Skip to content
Client
Server

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

Function: relationshipGetter() ​

ts
function relationshipGetter<Rels, C>(fn, collection): tRelationshipEndpoint<Rels, C>;

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

A function for a resource's relationships, each a collection of its own: GET {collection}/{id}/{name}. The names are held to Rels by the types alone: at runtime a name is any one segment of a path, and Apple says whether there is such a relationship. The function it gives is a tRelationshipEndpoint, and throws and resolves as that says.

Type Parameters ​

Rels ​

Rels = never

C ​

C extends object = object

Parameters ​

fn ​

string

The function's name, as its errors say it.

collection ​

tCollectionGiven<Rels, C>

Where the resources are: the path with nothing after it, or how to ask the client for it.

Returns ​

tRelationshipEndpoint<Rels, C>

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, or its user is given and is no boolean.

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