Skip to content
← Public packages

@kentcdodds/spotify

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

FollowFork

Files

delete-playlist.ts

21 lines · 969 B · TypeScript
import { unfollowPlaylist } from '../lib/spotify-api.ts'
import type { PlaylistIdParams } from '../lib/export-types.ts'

/**
 * Delete/remove a Spotify playlist from the user's library.
 * Thin alias of `./unfollow-playlist`: calls Spotify's DELETE
 * /playlists/{playlist_id}/followers (unfollow). That is how Spotify removes a
 * playlist from the library; there is no separate public delete-owned-playlist
 * endpoint.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @returns Confirmation with ok, playlistId, uri, and status.
 * @example
 * import deletePlaylist from 'kody:@kentcdodds/spotify/delete-playlist'
const result = await deletePlaylist({ playlistId: '37i9dQZF1DX0XUsuxWHRQd' })
// => { ok: true, playlistId: '...', uri: 'spotify:playlist:...', status: 200 }
 */
async function spotifyDeletePlaylist(params: PlaylistIdParams = {}) {
	return await unfollowPlaylist(params)
}

export default spotifyDeletePlaylist