Skip to content
Client
Server

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

Function: clientOf() ​

ts
function clientOf(
   fn, 
   client, 
   methods
): tAppleMusicClient;

Defined in: packages/core/src/check.ts:70

A client from createClient, or anything with the methods the caller is about to use: a wrapped client, or a test's own. Naming the methods is what keeps the check to what is called.

Parameters ​

fn ​

string

The name of the function the client was handed to, for the error.

client ​

unknown

What the caller gave as a client.

methods ​

readonly (keyof tAppleMusicClient)[]

The client's methods the caller is about to call, such as ["request"].

Returns ​

tAppleMusicClient

client itself, as a client.

Throws ​

TypeError if client is not an object with a function under each of methods.

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