Skip to content

spotify-cli


spotify-cli / resolve

resolve ​

Enrichment resolver — resolves Spotify IDs/queries to human-readable summaries.

Interfaces ​

ResolveDeps ​

Defined in: src/resolve.ts:20

Properties ​

cacheGet() ​

cacheGet: (id) => ItemSummary | undefined

Defined in: src/resolve.ts:25

Parameters ​
id ​

string

Returns ​

ItemSummary | undefined

cachePut() ​

cachePut: (summary) => void

Defined in: src/resolve.ts:26

Parameters ​
summary ​

ItemSummary

Returns ​

void

flushCache() ​

flushCache: () => void

Defined in: src/resolve.ts:27

Returns ​

void

getAlbums() ​

getAlbums: (ids, fetch) => Promise<object[]>

Defined in: src/resolve.ts:22

Fetches multiple albums by ID, one at a time.

Parameters ​
ids ​

string[]

fetch? ​

<T>(path, options) => Promise<T>

Returns ​

Promise<object[]>

getArtists() ​

getArtists: (ids, fetch) => Promise<object[]>

Defined in: src/resolve.ts:23

Fetches multiple artists by ID, one at a time.

Parameters ​
ids ​

string[]

fetch? ​

<T>(path, options) => Promise<T>

Returns ​

Promise<object[]>

getTracks() ​

getTracks: (ids, fetch) => Promise<object[]>

Defined in: src/resolve.ts:21

Fetches multiple tracks by ID, one at a time.

Parameters ​
ids ​

string[]

fetch? ​

<T>(path, options) => Promise<T>

Returns ​

Promise<object[]>

search: (options, fetch) => Promise<unknown>

Defined in: src/resolve.ts:24

Searches the Spotify catalog for tracks, albums, artists, and/or playlists.

Parameters ​
options ​

Search parameters.

limit? ​

number

Maximum number of results per type.

offset? ​

number

Index of the first result to return.

q ​

string

The search query string.

type ​

string

Comma-separated list of item types (e.g. "track,album").

fetch? ​

<T>(path, options) => Promise<T>

Returns ​

Promise<unknown>

See ​

GET /search

Type Aliases ​

AlbumSummary ​

AlbumSummary = object

Defined in: src/resolve.ts:14

Properties ​

artist ​

artist: string

Defined in: src/resolve.ts:14

id ​

id: string

Defined in: src/resolve.ts:14

name ​

name: string

Defined in: src/resolve.ts:14

type ​

type: "album"

Defined in: src/resolve.ts:14


ArtistSummary ​

ArtistSummary = object

Defined in: src/resolve.ts:15

Properties ​

id ​

id: string

Defined in: src/resolve.ts:15

name ​

name: string

Defined in: src/resolve.ts:15

type ​

type: "artist"

Defined in: src/resolve.ts:15


ItemSummary ​

ItemSummary = TrackSummary | AlbumSummary | ArtistSummary

Defined in: src/resolve.ts:16


TrackSummary ​

TrackSummary = object

Defined in: src/resolve.ts:13

Properties ​

album ​

album: string

Defined in: src/resolve.ts:13

artist ​

artist: string

Defined in: src/resolve.ts:13

id ​

id: string

Defined in: src/resolve.ts:13

name ​

name: string

Defined in: src/resolve.ts:13

type ​

type: "track"

Defined in: src/resolve.ts:13

Functions ​

resolveInput() ​

resolveInput(input, type, deps?): Promise<{ id: string; searched?: SearchedEntry; }>

Defined in: src/resolve.ts:99

Resolves a single user input (ID, URI, or search query) to a Spotify ID. Returns the resolved ID and, if a search was performed, what was matched.

Parameters ​

input ​

string

type ​

"artist" | "track" | "album"

deps? ​

Partial<ResolveDeps>

Returns ​

Promise<{ id: string; searched?: SearchedEntry; }>


resolveInputs() ​

resolveInputs(inputs, type, deps?): Promise<{ ids: string[]; searched: SearchedEntry[]; }>

Defined in: src/resolve.ts:136

Resolves multiple user inputs to Spotify IDs. Returns the resolved IDs and any search matches.

Parameters ​

inputs ​

string[]

type ​

"artist" | "track" | "album"

deps? ​

Partial<ResolveDeps>

Returns ​

Promise<{ ids: string[]; searched: SearchedEntry[]; }>


resolveItems() ​

resolveItems(type, ids, deps?): Promise<ItemSummary[]>

Defined in: src/resolve.ts:48

Resolves a list of IDs to enriched summaries. Checks cache first, batch-fetches uncached, caches results.

Parameters ​

type ​

"artist" | "track" | "album"

ids ​

string[]

deps? ​

Partial<ResolveDeps>

Returns ​

Promise<ItemSummary[]>


tryResolveItems() ​

tryResolveItems(type, ids, deps?): Promise<ItemSummary[] | undefined>

Defined in: src/resolve.ts:83

Best-effort enrichment — returns items on success, undefined on failure. Never throws. Use this when enrichment should not interfere with core behavior.

Parameters ​

type ​

"artist" | "track" | "album"

ids ​

string[]

deps? ​

Partial<ResolveDeps>

Returns ​

Promise<ItemSummary[] | undefined>

MIT Licensed. Not affiliated with or endorsed by Spotify AB.