Reference / @open-music-sdk/core / resourcesFinder
Function: resourcesFinder()
function resourcesFinder<R, C, E>(
fn,
filter,
collection,
...also
): tEndpoint<[values: readonly string[], options?: tEndpointOptions<R, C, E>], R, Promise<tItem<R>[]>, "resources">;Defined in: packages/core/src/endpoint.ts:488
A function for the resources a filter picks out of a collection: GET {collection}?filter[{filter}]=. filter is the filter's name as Apple writes it, such as isrc, and the function takes the values to look for, which a mistake in them calls values, as the function's own signature does.
The function it gives takes values and options, checks the values as a list of 1 to 300 strings, as listOf does, and the options as tEndpointOptions, and throws and resolves as tEndpoint says. Bound, it hands over the list of resources.
Type Parameters
R
R extends tResources = never
C
C extends object = object
E
E extends object = object
Parameters
fn
string
The function's name, as its errors say it.
filter
string
The filter's name as Apple writes it, lowercase words with hyphens between, such as isrc.
collection
tCollectionGiven<R, C>
Where the resources are: the path with nothing after it, or how to ask the client for it.
also
...tAlsoGiven<E>
What each option of E is, a "list" or a "name"; left out when E names none.
Returns
tEndpoint<[values: readonly string[], options?: tEndpointOptions<R, C, E>], R, Promise<tItem<R>[]>, "resources">
The function, frozen, with bound and unwrap on it.
Throws
TypeError if fn is not a string with something in it, filter is not lowercase words with hyphens between of at most 64 characters, collection is no function, its user is given and is no boolean, or also is not an object that says "list" or "name" for each option.