Skip to content
← Public packages

@kentcdodds/spotify

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

src/exports/get-recently-played.ts

17 lines · 752 B · TypeScript
import { getRecentlyPlayed } from '../lib/spotify-api.ts'
import type { GetRecentlyPlayedParams } from '../lib/export-types.ts'

/**
 * Read recently played Spotify tracks for the authenticated user.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @returns Array of tracks with name, uri, playedAt, and artists.
 * @example
 * import getRecentlyPlayed from 'kody:@kentcdodds/spotify/get-recently-played'
const items = await getRecentlyPlayed({ limit: 10 })
// => [{ name: '...', uri: 'spotify:track:...', playedAt: '...', artists: ['...'] }]
 */
async function spotifyGetRecentlyPlayed(params: GetRecentlyPlayedParams = {}) {
	return await getRecentlyPlayed(params)
}

export default spotifyGetRecentlyPlayed