Class: MusicVideosEndpoint
Defined in: endpoints/MusicVideos/index.ts:23
Strongly-typed helper for the Apple Music music video endpoint.
Methods
get()
get(params: MusicVideoParams): Promise<MusicVideosResponse>;
Defined in: endpoints/MusicVideos/index.ts:54
Fetch a catalog music video by identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | MusicVideoParams | MusicVideoParams containing the music video identifier and optional query filters. |
Returns
Promise<MusicVideosResponse>
Complete music video resource payload returned by Apple Music.
Throws
Error When the endpoint has not been initialized.
Throws
Error When Apple Music returns an unexpected response.
Example
const video = await appleMusic.MusicVideos.get({ id: "1440936011" });
getView()
getView(params: MusicVideoViewParams): Promise<MusicVideoViewResponse>;
Defined in: endpoints/MusicVideos/index.ts:108
Fetch a curated relationship view on a music video.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | MusicVideoViewParams | MusicVideoViewParams describing the music video identifier, view name, and optional query options. |
Returns
Promise<MusicVideoViewResponse>
A collection representing the requested view.
Remarks
Wraps GET /v1/catalog/{storefront}/music-videos/{id}/view/{view}.
Throws
Error When the endpoint has not been initialized.
Throws
Error When Apple Music returns an unexpected response.
Example
const similar = await appleMusic.MusicVideos.getView({
id: "1440936011",
view: MusicVideosEndpointTypes.MusicVideoViewName.MoreByArtist,
});
getRelationship()
getRelationship<T>(params: MusicVideoRelationshipParams): Promise<MusicVideoRelationshipResponse<T>>;
Defined in: endpoints/MusicVideos/index.ts:168
Fetch a direct relationship collection for a music video.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends keyof MusicVideoRelationshipResourceMap | keyof MusicVideoRelationshipResourceMap |
Parameters
| Parameter | Type | Description |
|---|---|---|
params | MusicVideoRelationshipParams | MusicVideoRelationshipParams describing the music video identifier, relationship name, and optional query options. |
Returns
Promise<MusicVideoRelationshipResponse<T>>
The requested relationship data.
Remarks
Wraps GET /v1/catalog/{storefront}/music-videos/{id}/{relationship}.
Throws
Error When the endpoint has not been initialized.
Throws
Error When Apple Music returns an unexpected response.
Example
const artists = await appleMusic.MusicVideos.getRelationship({
id: "1440936011",
relationship: MusicVideosEndpointTypes.IncludeOption.Artists,
});