Reference / @open-music-sdk/client-catalog / tViewEndpoint
Interface: tViewEndpoint()<Views>
Defined in: clients/client-catalog/src/resources.ts:98
A function for a resource's views: GET {collection}/{id}/view/{name}. Views is the resource's views as the generated types have them, such as tAlbumViews: its keys are the names that may be asked for, and the name asked for decides what comes back.
Type Parameters
Views
Views
tViewEndpoint<K>(
client,
id,
name,
options?
): Promise<tViewPage<Views, K>>;Defined in: clients/client-catalog/src/resources.ts:115
Asks for one view of the resource with an id.
Type Parameters
K
K extends string
Parameters
client
The client to ask with.
id
string
The resource's id.
name
K
The view's name, one of Views as the type has them; Apple says whether there is such a one.
options?
tViewOptions<Views, K>
The storefront to ask in, whether to send the view's own attributes, how many to send in one page, where to start, what to send beside them, and the signal and schema of the request.
Returns
Promise<tViewPage<Views, K>>
What Apple answered: the first page, with its own attributes where they were asked for and next where there is more; maxPages plays no part.
Throws
TypeError if client is no client or an argument is not what it should be, before Apple is asked.
Throws
AppleMusicError if Apple, the network, or a token provider fails, if the client has no storefront to ask in, or a schema finds issues; _tag says which.
Throws
The reason options.signal aborted with, when it does.
Throws
Whatever a token provider, store, schema, hook or rate limiter throws, as client.request passes it on.
Properties
bound
readonly bound: (client) => <K>(id, name, options?) => AsyncIterable<tRelated<Views, K>>;Defined in: clients/client-catalog/src/resources.ts:120
The same call with the client fixed and the pages walked: every item of the view, asked for as a loop reaches them. It is what catalog(client) holds under the function's name.
Parameters
client
Returns
<K>(id, name, options?) => AsyncIterable<tRelated<Views, K>>
unwrap
readonly unwrap: "pages";Defined in: clients/client-catalog/src/resources.ts:122
How the bound form hands the answer over: every item of all its pages.