Reference / @open-music-sdk/server / tServerClientOptions
Interface: tServerClientOptions
Defined in: integrations/server/src/client.ts:14
The key and its two ids, as developerTokenMinter takes them, and every option of createClient but the developer token, which the minter provides. origin is not among them: the server's own token never meets a browser, and the one that does is tokenEndpoint's. Invalid values throw a TypeError when the client is made.
Extends
Omit<tClientOptions,"developerToken">Omit<tMinterOptions,"origin">
Properties
fetch?
optional fetch?: {
(input, init?): Promise<Response>;
(input, init?): Promise<Response>;
};Defined in: packages/core/src/client.ts:107
What sends each request. Default: the global fetch.
Call Signature
(input, init?): Promise<Response>;Parameters
input
URL | RequestInfo
init?
RequestInit
Returns
Promise<Response>
Call Signature
(input, init?): Promise<Response>;Parameters
input
string | Request | URL
init?
RequestInit
Returns
Promise<Response>
Inherited from
Omit.fetchkeyId
readonly keyId: string;Defined in: packages/developer-token/src/mint.ts:19
The ID of the MusicKit key, the ten capital letters and digits in the file's name; becomes kid.
Inherited from
Omit.keyIdonRequest?
optional onRequest?: (req) => void;Defined in: packages/core/src/client.ts:116
Called just before each attempt is sent, with the final Request. Its headers hold the developer token and, where it is sent, the Music User Token, so a hook that logs requests logs both tokens.
Parameters
req
Request
Returns
void
Inherited from
Omit.onRequestonResponse?
optional onResponse?: (res, req, outcome) => void;Defined in: packages/core/src/client.ts:123
Called once per response, after the client is done with it: the body has been read and the outcome decided. outcome.error is what the request will throw unless a retry succeeds. The body has been read, so take it from outcome.body, not from res.json(). req is the Request onRequest is handed, token headers and all, so a hook that logs it logs the tokens.
Parameters
res
Response
req
Request
outcome
Returns
void
Inherited from
Omit.onResponsepem
readonly pem: string;Defined in: packages/developer-token/src/mint.ts:15
The contents of AuthKey_XXXXXXXXXX.p8: a PKCS8 PEM. Line breaks escaped as \n, as an environment variable usually holds them, are accepted, and so are Windows line endings, a byte order mark and whitespace around it.
Inherited from
Omit.pemrateLimit?
optional rateLimit?: tRateLimiter;Defined in: packages/core/src/client.ts:111
Opt-in token bucket. Share one instance across every client using the same developer token.
Inherited from
Omit.rateLimitrefreshAheadSeconds?
readonly optional refreshAheadSeconds?: number;Defined in: packages/developer-token/src/mint.ts:33
Mint a replacement this long before exp. Default, and at most, half the lifetime.
Inherited from
Omit.refreshAheadSecondsretry?
optional retry?: false | tRetryPolicy;Defined in: packages/core/src/client.ts:109
false disables retries; a plain object sets the policy field by field. Default: 2 attempts, 250 ms base, 4 s cap, full jitter, Retry-After honoured.
Inherited from
Omit.retrystorefront?
optional storefront?: string;Defined in: packages/core/src/client.ts:105
Catalog storefront, by its id, such as "us": one segment of a path. Without it, storefront() resolves the listener's from /v1/me/storefront.
Inherited from
Omit.storefrontteamId
readonly teamId: string;Defined in: packages/developer-token/src/mint.ts:17
Your Apple Developer Team ID, ten capital letters and digits as Apple issues it; becomes iss.
Inherited from
Omit.teamIdttlSeconds?
readonly optional ttlSeconds?: number;Defined in: packages/developer-token/src/mint.ts:21
Lifetime in whole seconds, from 60 to 15 777 000 (Apple's six months). Default one hour.
Inherited from
Omit.ttlSecondsuserToken?
optional userToken?: string | tTokenProvider;Defined in: packages/core/src/client.ts:101
Binds the client to one listener. Alternatively set userTokenStore and use forUser().
Inherited from
Omit.userTokenuserTokenStore?
optional userTokenStore?: tUserTokenStore;Defined in: packages/core/src/client.ts:103
Where forUser() finds a listener's token. Needs get, set and delete; the client itself calls only get.
Inherited from
Omit.userTokenStore