Skip to content
← Public packages

@kentcdodds/spotify

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

src/exports/get-playlist.ts

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

/**
 * Read a Spotify playlist summary and up to 100 track previews.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @returns Playlist metadata with id, name, trackCount, owner, url, and tracks.
 * @example
 * import getPlaylist from 'kody:@kentcdodds/spotify/get-playlist'
const playlist = await getPlaylist({ playlistId: '37i9dQZF1DXcBWIGoYBM5M' })
// => { id: '...', name: '...', trackCount: 50, tracks: [...] }
 */
async function spotifyGetPlaylist(params: PlaylistIdParams = {}) {
	return await getPlaylist(params)
}

export default spotifyGetPlaylist