Skip to content
Client
Server

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

Interface: tReadOptions<T> ​

Defined in: packages/core/src/options.ts:11

What a function that asks Apple for something takes. Every field is optional and an explicit undefined means it was not given. Invalid values throw a TypeError, and no error quotes a value.

Extended by ​

Type Parameters ​

T ​

T = unknown

Properties ​

extend? ​

ts
readonly optional extend?: readonly string[];

Defined in: packages/core/src/options.ts:26

The attributes to add to those sent by default, such as ["artistUrl"]: at most 300 names, each of 1 to 64 characters with no comma in it. An empty list is none, and is not sent.


include? ​

ts
readonly optional include?: readonly string[];

Defined in: packages/core/src/options.ts:21

The relationships to send in full with each resource, such as ["albums", "artists"]: at most 300 names, each of 1 to 64 characters with no comma in it. An empty list is none, and is not sent.


language? ​

ts
readonly optional language?: string;

Defined in: packages/core/src/options.ts:16

The language to answer in, as a tag the storefront supports, such as "en-GB": a string of 1 to 64 characters, sent as l. Default: the storefront's own.


limit? ​

ts
readonly optional limit?: number;

Defined in: packages/core/src/options.ts:28

How many to send in one answer: a whole number above zero. Apple sets the default and the most.


offset? ​

ts
readonly optional offset?: string | number;

Defined in: packages/core/src/options.ts:30

Where in the collection to start: a whole number from zero, or a cursor as Apple gave it, of 1 to 256 characters.


params? ​

ts
readonly optional params?: Readonly<Record<string, 
  | string
  | number
  | boolean
  | readonly (string | number)[]
  | null
| undefined>>;

Defined in: packages/core/src/options.ts:42

Any other query parameter, sent as given: what Apple takes and no option here names. An option that is given, or an argument of the function, wins over the same key here.

It is a plain object of at most 100 parameters; a Map or a URLSearchParams is a TypeError, where it would otherwise be read as no parameters at all. A name is one as Apple writes them, such as ids[albums] or limit[songs:tracks]: a letter, then letters, digits, -, _, . and :, with any part in brackets after, in at most 64 characters. A name that does not fit is described in the error, not repeated. A value is a string of at most 256 characters, a number, true or false, or a list of at most 300 numbers and strings, each string of 1 to 64 characters with no comma in it. null, undefined and an empty list are not sent.


schema? ​

ts
readonly optional schema?: tSchemaLike<T>;

Defined in: packages/core/src/options.ts:47

Validates the answer; a failure throws ValidationError. Any Standard Schema, such as a validator from @open-music-sdk/validate: an object or a function with a validate function under ~standard.


signal? ​

ts
readonly optional signal?: AbortSignal;

Defined in: packages/core/src/options.ts:49

Aborts the request. An abort is rethrown as it is.

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