Skip to content
← Public packages

@kentcdodds/spotify

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

src/exports/set-shuffle.ts

18 lines · 761 B · TypeScript
import { setShuffle } from '../lib/spotify-api.ts'
import type { SetShuffleParams } from '../lib/export-types.ts'

/**
 * Enable or disable shuffle mode on the active or named Spotify device.
 * 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 setShuffle from 'kody:@kentcdodds/spotify/set-shuffle'
 * const result = await setShuffle({ state: true })
 * // => { ok: true, state: true, deviceId: null, status: 204 }
 */
async function spotifySetShuffle(params: SetShuffleParams = {}) {
	return await setShuffle(params)
}

export default spotifySetShuffle