Reference / @open-music-sdk/core / resourcesGetter
Function: resourcesGetter()
function resourcesGetter<R, C, E>(
fn,
collection,
...also
): tEndpoint<[ids: readonly string[], options?: tEndpointOptions<R, C, E>], R, Promise<tItem<R>[]>, "resources">;Defined in: packages/core/src/endpoint.ts:462
A function for the resources with the ids given: GET {collection}?ids=.
The function it gives takes ids and options, checks the ids 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.
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<[ids: 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, 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.