Skip to content
← Public packages

@kentcdodds/spotify

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

src/exports/skip.ts

22 lines · 813 B · TypeScript
import { skip } from '../lib/spotify-api.ts'
import type { SkipParams } from '../lib/export-types.ts'

/**
 * Skip to the next or previous Spotify track by direction.
 * Prefer `deviceName` when targeting a device; omit selectors for the active device.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @param params.direction - 'next' (default) or 'previous'.
 * @returns Confirmation with ok, action ('next' or 'previous'), and status.
 * @example
 * import skip from 'kody:@kentcdodds/spotify/skip'
 * const result = await skip({ direction: 'next' })
 * // => { ok: true, action: 'next', status: 204 }
 */
async function spotifySkip(params: SkipParams = {}) {
	return await skip({
		...params,
		direction: params.direction ?? 'next',
	})
}

export default spotifySkip