Skip to content
Client
Server

Reference / @open-music-sdk/core / inStorefront

Function: inStorefront() ​

ts
function inStorefront<T>(
   fn, 
   client, 
   storefront, 
   finish
): T | tLater<T>;

Defined in: packages/core/src/endpoint.ts:391

What finish makes of the storefront a call is for. When the call named it, that is there and then. When it did not, the client has to say which it is, and may have to ask Apple for the listener's: that is left for when the request is about to be made, so a walk nobody loops over asks for nothing. Either way the storefront is handed over as one segment of a path, checked and encoded, so one from outside cannot move the request to another path.

Type Parameters ​

T ​

T

Parameters ​

fn ​

string

The name of the function the call was made to, for the error.

client ​

tAppleMusicClient

The client the call is made with, asked for its storefront when the call named none.

storefront ​

unknown

The storefront the call named, or undefined for the client's.

finish ​

(storefront) => T

What to make of the storefront as one encoded segment, such as the collection's path.

Returns ​

T | tLater<T>

What finish gave, when the call named a storefront; otherwise a function that asks the client, checks its answer and gives what finish makes of it, for when the request is about to be made. That function rejects with what client.storefront() rejects with, and with a TypeError when the client's answer is no segment.

Throws ​

TypeError if storefront is given and is not one segment of a path, as segmentOf holds it to be.

MIT licensed. Not affiliated with, endorsed by, or sponsored by Apple Inc. Apple Music and MusicKit are trademarks of Apple Inc.