Skip to content
← Public packages

@kentcdodds/spotify

Spotify playback, playlist, search, library, and device helpers.

src/exports/set-repeat.ts

18 lines · 743 B · TypeScript
import { setRepeat } from '../lib/spotify-api.ts'
import type { SetRepeatParams } from '../lib/export-types.ts'

/**
 * Set Spotify repeat mode to off, track, or context.
 * Prefer `deviceName` when targeting a device; omit selectors for the active device.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @returns Confirmation with ok, state, deviceId, and status.
 * @example
 * import setRepeat from 'kody:@kentcdodds/spotify/set-repeat'
 * const result = await setRepeat({ state: 'context' })
 * // => { ok: true, state: 'context', deviceId: null, status: 204 }
 */
async function spotifySetRepeat(params: SetRepeatParams = {}) {
	return await setRepeat(params)
}

export default spotifySetRepeat