Skip to content
← Public packages

@kentcdodds/spotify

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

src/exports/follow-playlist.ts

17 lines · 727 B · TypeScript
import { followPlaylist } from '../lib/spotify-api.ts'
import type { PlaylistIdParams } from '../lib/export-types.ts'

/**
 * Save (follow) a Spotify playlist to the user's library.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @returns Confirmation with ok, playlistId, uri, and status.
 * @example
 * import followPlaylist from 'kody:@kentcdodds/spotify/follow-playlist'
const result = await followPlaylist({ playlistId: '37i9dQZF1DX0XUsuxWHRQd' })
// => { ok: true, playlistId: '...', uri: 'spotify:playlist:...', status: 200 }
 */
async function spotifyFollowPlaylist(params: PlaylistIdParams = {}) {
	return await followPlaylist(params)
}

export default spotifyFollowPlaylist