@opfelmusig/lib 0.0.0-ci.0.sha-3e76884

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/README.md +8 -0
  2. package/dist/clients/catalog/album.d.ts +12 -0
  3. package/dist/clients/catalog/album.js +14 -0
  4. package/dist/clients/catalog/genre.d.ts +13 -0
  5. package/dist/clients/catalog/genre.js +17 -0
  6. package/dist/clients/catalog/index.d.ts +71 -0
  7. package/dist/clients/catalog/index.js +99 -0
  8. package/dist/clients/catalog/musicVideo.d.ts +12 -0
  9. package/dist/clients/catalog/musicVideo.js +14 -0
  10. package/dist/clients/catalog/playlist.d.ts +12 -0
  11. package/dist/clients/catalog/playlist.js +16 -0
  12. package/dist/clients/catalog/song.d.ts +12 -0
  13. package/dist/clients/catalog/song.js +14 -0
  14. package/dist/clients/catalog/station.d.ts +14 -0
  15. package/dist/clients/catalog/station.js +34 -0
  16. package/dist/clients/catalog/stationGenre.d.ts +12 -0
  17. package/dist/clients/catalog/stationGenre.js +14 -0
  18. package/dist/clients/library/index.d.ts +39 -0
  19. package/dist/clients/library/index.js +68 -0
  20. package/dist/clients/library/playlistFolder.d.ts +12 -0
  21. package/dist/clients/library/playlistFolder.js +16 -0
  22. package/dist/clients/me/index.d.ts +25 -0
  23. package/dist/clients/me/index.js +49 -0
  24. package/dist/clients/me/musicSummary.d.ts +12 -0
  25. package/dist/clients/me/musicSummary.js +14 -0
  26. package/dist/clients/me/ratings.d.ts +15 -0
  27. package/dist/clients/me/ratings.js +34 -0
  28. package/dist/clients/me/recent.d.ts +17 -0
  29. package/dist/clients/me/recent.js +37 -0
  30. package/dist/clients/me/recommendation.d.ts +12 -0
  31. package/dist/clients/me/recommendation.js +14 -0
  32. package/dist/clients/me/station.d.ts +10 -0
  33. package/dist/clients/me/station.js +13 -0
  34. package/dist/clients/playback.d.ts +9 -0
  35. package/dist/clients/playback.js +68 -0
  36. package/dist/clients/resource.d.ts +34 -0
  37. package/dist/clients/resource.js +105 -0
  38. package/dist/clients/shared/equivalent.d.ts +10 -0
  39. package/dist/clients/shared/equivalent.js +15 -0
  40. package/dist/clients/social/index.d.ts +7 -0
  41. package/dist/clients/social/index.js +9 -0
  42. package/dist/clients/social/profile.d.ts +12 -0
  43. package/dist/clients/social/profile.js +14 -0
  44. package/dist/clients/storefront.d.ts +12 -0
  45. package/dist/clients/storefront.js +14 -0
  46. package/dist/core/client.d.ts +40 -0
  47. package/dist/core/client.js +82 -0
  48. package/dist/core/error.d.ts +23 -0
  49. package/dist/core/error.js +24 -0
  50. package/dist/core/http.d.ts +22 -0
  51. package/dist/core/http.js +232 -0
  52. package/dist/helpers/language.d.ts +1 -0
  53. package/dist/helpers/language.js +48 -0
  54. package/dist/helpers/public.d.ts +19 -0
  55. package/dist/helpers/public.js +35 -0
  56. package/dist/helpers/requestQuery.d.ts +17 -0
  57. package/dist/helpers/requestQuery.js +153 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.js +4 -0
  60. package/dist/schemas/error.d.ts +29 -0
  61. package/dist/schemas/error.js +16 -0
  62. package/dist/schemas/request.d.ts +42 -0
  63. package/dist/schemas/request.js +28 -0
  64. package/dist/types/combined.d.ts +15 -0
  65. package/dist/types/combined.js +0 -0
  66. package/dist/types/config.d.ts +63 -0
  67. package/dist/types/config.js +0 -0
  68. package/dist/types/params.d.ts +22 -0
  69. package/dist/types/params.js +0 -0
  70. package/dist/types/playback.d.ts +199 -0
  71. package/dist/types/playback.js +103 -0
  72. package/dist/types/public.d.ts +56 -0
  73. package/dist/types/public.js +1 -0
  74. package/dist/types/query/helpers.d.ts +27 -0
  75. package/dist/types/query/helpers.js +0 -0
  76. package/dist/types/query/registry.d.ts +74 -0
  77. package/dist/types/query/registry.js +0 -0
  78. package/dist/types/query/resource.d.ts +29 -0
  79. package/dist/types/query/resource.js +0 -0
  80. package/dist/types/query/response.d.ts +3 -0
  81. package/dist/types/query/response.js +0 -0
  82. package/dist/types/query/results.d.ts +45 -0
  83. package/dist/types/query/results.js +0 -0
  84. package/dist/types/query/scopes.d.ts +77 -0
  85. package/dist/types/query/scopes.js +0 -0
  86. package/dist/types/request.d.ts +14 -0
  87. package/dist/types/request.js +0 -0
  88. package/dist/types/resources/catalog/activity.d.ts +15 -0
  89. package/dist/types/resources/catalog/activity.js +0 -0
  90. package/dist/types/resources/catalog/album.d.ts +47 -0
  91. package/dist/types/resources/catalog/album.js +0 -0
  92. package/dist/types/resources/catalog/artist.d.ts +57 -0
  93. package/dist/types/resources/catalog/artist.js +0 -0
  94. package/dist/types/resources/catalog/concert.d.ts +32 -0
  95. package/dist/types/resources/catalog/concert.js +0 -0
  96. package/dist/types/resources/catalog/creditArtist.d.ts +11 -0
  97. package/dist/types/resources/catalog/creditArtist.js +0 -0
  98. package/dist/types/resources/catalog/curator.d.ts +27 -0
  99. package/dist/types/resources/catalog/curator.js +0 -0
  100. package/dist/types/resources/catalog/genre.d.ts +11 -0
  101. package/dist/types/resources/catalog/genre.js +0 -0
  102. package/dist/types/resources/catalog/lyrics.d.ts +8 -0
  103. package/dist/types/resources/catalog/lyrics.js +0 -0
  104. package/dist/types/resources/catalog/musicVideo.d.ts +34 -0
  105. package/dist/types/resources/catalog/musicVideo.js +0 -0
  106. package/dist/types/resources/catalog/playlist.d.ts +35 -0
  107. package/dist/types/resources/catalog/playlist.js +0 -0
  108. package/dist/types/resources/catalog/recordLabel.d.ts +16 -0
  109. package/dist/types/resources/catalog/recordLabel.js +0 -0
  110. package/dist/types/resources/catalog/roleCategory.d.ts +12 -0
  111. package/dist/types/resources/catalog/roleCategory.js +0 -0
  112. package/dist/types/resources/catalog/song.d.ts +50 -0
  113. package/dist/types/resources/catalog/song.js +0 -0
  114. package/dist/types/resources/catalog/station.d.ts +21 -0
  115. package/dist/types/resources/catalog/station.js +0 -0
  116. package/dist/types/resources/catalog/stationGenre.d.ts +11 -0
  117. package/dist/types/resources/catalog/stationGenre.js +0 -0
  118. package/dist/types/resources/catalog/syllableLyrics.d.ts +9 -0
  119. package/dist/types/resources/catalog/syllableLyrics.js +0 -0
  120. package/dist/types/resources/catalog/venue.d.ts +20 -0
  121. package/dist/types/resources/catalog/venue.js +0 -0
  122. package/dist/types/resources/library/album.d.ts +17 -0
  123. package/dist/types/resources/library/album.js +0 -0
  124. package/dist/types/resources/library/artist.d.ts +13 -0
  125. package/dist/types/resources/library/artist.js +0 -0
  126. package/dist/types/resources/library/musicVideo.d.ts +15 -0
  127. package/dist/types/resources/library/musicVideo.js +0 -0
  128. package/dist/types/resources/library/playlist.d.ts +24 -0
  129. package/dist/types/resources/library/playlist.js +0 -0
  130. package/dist/types/resources/library/playlistFolder.d.ts +13 -0
  131. package/dist/types/resources/library/playlistFolder.js +0 -0
  132. package/dist/types/resources/library/song.d.ts +15 -0
  133. package/dist/types/resources/library/song.js +0 -0
  134. package/dist/types/resources/me/musicSummary.d.ts +37 -0
  135. package/dist/types/resources/me/musicSummary.js +0 -0
  136. package/dist/types/resources/me/profile.d.ts +32 -0
  137. package/dist/types/resources/me/profile.js +0 -0
  138. package/dist/types/resources/me/rating.d.ts +11 -0
  139. package/dist/types/resources/me/rating.js +0 -0
  140. package/dist/types/resources/me/recommendation.d.ts +27 -0
  141. package/dist/types/resources/me/recommendation.js +0 -0
  142. package/dist/types/resources/me/summaries/albumPeriodSummary.d.ts +15 -0
  143. package/dist/types/resources/me/summaries/albumPeriodSummary.js +0 -0
  144. package/dist/types/resources/me/summaries/artistPeriodSummary.d.ts +15 -0
  145. package/dist/types/resources/me/summaries/artistPeriodSummary.js +0 -0
  146. package/dist/types/resources/me/summaries/genrePeriodSummary.d.ts +12 -0
  147. package/dist/types/resources/me/summaries/genrePeriodSummary.js +0 -0
  148. package/dist/types/resources/me/summaries/monthlySongPeriodSummary.d.ts +13 -0
  149. package/dist/types/resources/me/summaries/monthlySongPeriodSummary.js +0 -0
  150. package/dist/types/resources/me/summaries/playlistPeriodSummary.d.ts +14 -0
  151. package/dist/types/resources/me/summaries/playlistPeriodSummary.js +0 -0
  152. package/dist/types/resources/me/summaries/songPeriodSummary.d.ts +15 -0
  153. package/dist/types/resources/me/summaries/songPeriodSummary.js +0 -0
  154. package/dist/types/resources/me/summaries/stationPeriodSummary.d.ts +14 -0
  155. package/dist/types/resources/me/summaries/stationPeriodSummary.js +0 -0
  156. package/dist/types/resources/other/storefront.d.ts +8 -0
  157. package/dist/types/resources/other/storefront.js +0 -0
  158. package/dist/types/resources/shared/album.d.ts +11 -0
  159. package/dist/types/resources/shared/album.js +0 -0
  160. package/dist/types/resources/shared/artist.d.ts +3 -0
  161. package/dist/types/resources/shared/artist.js +0 -0
  162. package/dist/types/resources/shared/lyrics.d.ts +5 -0
  163. package/dist/types/resources/shared/lyrics.js +0 -0
  164. package/dist/types/resources/shared/musicVideo.d.ts +13 -0
  165. package/dist/types/resources/shared/musicVideo.js +0 -0
  166. package/dist/types/resources/shared/playlist.d.ts +7 -0
  167. package/dist/types/resources/shared/playlist.js +0 -0
  168. package/dist/types/resources/shared/song.d.ts +15 -0
  169. package/dist/types/resources/shared/song.js +0 -0
  170. package/dist/types/results/chart.d.ts +8 -0
  171. package/dist/types/results/chart.js +0 -0
  172. package/dist/types/results/search.d.ts +30 -0
  173. package/dist/types/results/search.js +0 -0
  174. package/dist/types/shared.d.ts +81 -0
  175. package/dist/types/shared.js +0 -0
  176. package/package.json +64 -0
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Öpfelmusig
2
+
3
+ Öpfelmusig is the literal Swiss German translation of "Apple Music"
4
+
5
+ - Öpfel = Swiss German for German "Apfel" ("Apple")
6
+ - Musig = Swiss German for German "Musik" ("Music")
7
+
8
+ It will primarily be used privately for my own use cases, so I do not intend to make it production-ready (but it probably will be).
@@ -0,0 +1,12 @@
1
+ import { EquivalentClient } from "../../clients/shared/equivalent.js";
2
+ import type { DefaultParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "albums";
7
+ type TResource = Registry[typeof type];
8
+ export declare class AlbumClient extends EquivalentClient<typeof type, TResource> {
9
+ protected readonly type: "albums";
10
+ getByUpc<const TScopes extends ResourceScopes = {}>(upc: string | string[], opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogAlbum, TScopes>>;
11
+ }
12
+ export {};
@@ -0,0 +1,14 @@
1
+ import { EquivalentClient } from "../../clients/shared/equivalent.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "albums";
4
+ export class AlbumClient extends EquivalentClient {
5
+ type = type;
6
+ async getByUpc(upc, opts = {}) {
7
+ const query = new RequestQueryBuilder().params(opts).setStringArray("filter[upc]", upc);
8
+ const result = await this.http.request(`${this.path}/${this.type}`, {
9
+ config: opts.config,
10
+ query,
11
+ });
12
+ return this.prepare(result);
13
+ }
14
+ }
@@ -0,0 +1,13 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import type { DefaultParams, LimitParam, PaginationParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes, ScopedResourceIterator } from "../../types/query/scopes.js";
6
+ declare const type: "genres";
7
+ type TResource = Registry[typeof type];
8
+ export declare class GenreClient extends ResourceClient<typeof type, TResource> {
9
+ protected readonly type: "genres";
10
+ getFromTopCharts<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & PaginationParams): Promise<ResourceResponse<import("../../types/public.js").CatalogGenre, TScopes>>;
11
+ iterateFromTopCharts<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & LimitParam): ScopedResourceIterator<TResource, TScopes>;
12
+ }
13
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "genres";
4
+ export class GenreClient extends ResourceClient {
5
+ type = type;
6
+ async getFromTopCharts(opts = {}) {
7
+ const query = new RequestQueryBuilder().params(opts);
8
+ const result = await this.http.request(`${this.path}/${this.type}`, {
9
+ config: opts.config,
10
+ query,
11
+ });
12
+ return this.prepare(result);
13
+ }
14
+ iterateFromTopCharts(opts = {}) {
15
+ return this.iterate((offset) => this.getFromTopCharts({ ...opts, offset }));
16
+ }
17
+ }
@@ -0,0 +1,71 @@
1
+ import { AlbumClient } from "../../clients/catalog/album.js";
2
+ import { GenreClient } from "../../clients/catalog/genre.js";
3
+ import { MusicVideoClient } from "../../clients/catalog/musicVideo.js";
4
+ import { PlaylistClient } from "../../clients/catalog/playlist.js";
5
+ import { SongClient } from "../../clients/catalog/song.js";
6
+ import { StationClient } from "../../clients/catalog/station.js";
7
+ import { StationGenreClient } from "../../clients/catalog/stationGenre.js";
8
+ import { BaseResourceClient } from "../../clients/resource.js";
9
+ import type { HttpClient } from "../../core/http.js";
10
+ import type { CatalogResources, CatalogResourceTypes } from "../../types/combined.js";
11
+ import type { ResultParams, PaginationParams, ConfigParm, DefaultParams } from "../../types/params.js";
12
+ import type { ResourceResponse } from "../../types/query/response.js";
13
+ import type { ResultShape, ShapedResult } from "../../types/query/results.js";
14
+ import type { ResourceScopes } from "../../types/query/scopes.js";
15
+ import type { SearchCatalogResult } from "../../types/results/search.js";
16
+ declare const ActivityClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"activities", import("../../types/public.js").CatalogActivity>;
17
+ declare class ActivityClient extends ActivityClient_base {
18
+ }
19
+ declare const AppleCuratorClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"apple-curators", import("../../types/public.js").CatalogAppleCurator>;
20
+ declare class AppleCuratorClient extends AppleCuratorClient_base {
21
+ }
22
+ declare const ArtistClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"artists", import("../../types/public.js").CatalogArtist>;
23
+ declare class ArtistClient extends ArtistClient_base {
24
+ }
25
+ declare const ConcertClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"concerts", import("../../types/public.js").CatalogConcert>;
26
+ declare class ConcertClient extends ConcertClient_base {
27
+ }
28
+ declare const CreditArtistClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"credit-artists", import("../../types/public.js").CatalogCreditArtist>;
29
+ declare class CreditArtistClient extends CreditArtistClient_base {
30
+ }
31
+ declare const CuratorClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"curators", import("../../types/public.js").CatalogCurator>;
32
+ declare class CuratorClient extends CuratorClient_base {
33
+ }
34
+ declare const LyricsClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"lyrics", import("../../types/public.js").CatalogLyrics>;
35
+ declare class LyricsClient extends LyricsClient_base {
36
+ }
37
+ declare const RecordLabelClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"record-labels", import("../../types/public.js").CatalogRecordLabel>;
38
+ declare class RecordLabelClient extends RecordLabelClient_base {
39
+ }
40
+ declare const RoleCategoryClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"role-categories", import("../../types/public.js").CatalogRoleCategory>;
41
+ declare class RoleCategoryClient extends RoleCategoryClient_base {
42
+ }
43
+ declare const SyllableLyricsClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").ResourceClient<"syllable-lyrics", import("../../types/public.js").CatalogSyllableLyrics>;
44
+ declare class SyllableLyricsClient extends SyllableLyricsClient_base {
45
+ }
46
+ export declare class CatalogClient extends BaseResourceClient {
47
+ protected http: HttpClient;
48
+ protected path: string;
49
+ activities: ActivityClient;
50
+ albums: AlbumClient;
51
+ appleCurators: AppleCuratorClient;
52
+ playlists: PlaylistClient;
53
+ artists: ArtistClient;
54
+ concerts: ConcertClient;
55
+ creditArtists: CreditArtistClient;
56
+ curators: CuratorClient;
57
+ genres: GenreClient;
58
+ lyrics: LyricsClient;
59
+ musicVideos: MusicVideoClient;
60
+ recordLabels: RecordLabelClient;
61
+ roleCategories: RoleCategoryClient;
62
+ songs: SongClient;
63
+ stations: StationClient;
64
+ stationGenres: StationGenreClient;
65
+ syllableLyrics: SyllableLyricsClient;
66
+ constructor(http: HttpClient, path: string);
67
+ search<const TTypes extends ResultShape<SearchCatalogResult>, const TScopes extends ResourceScopes = {}>(term: string, opts: ResultParams<SearchCatalogResult, TTypes, TScopes> & PaginationParams): Promise<ShapedResult<SearchCatalogResult, TTypes, TScopes>>;
68
+ searchHints(term: string, opts?: ConfigParm): Promise<string[]>;
69
+ getMany<const TScopes extends ResourceScopes = {}>(ids: Partial<Record<CatalogResourceTypes, string[]>>, opts?: DefaultParams<TScopes>): Promise<ResourceResponse<CatalogResources, TScopes>>;
70
+ }
71
+ export {};
@@ -0,0 +1,99 @@
1
+ import { AlbumClient } from "../../clients/catalog/album.js";
2
+ import { GenreClient } from "../../clients/catalog/genre.js";
3
+ import { MusicVideoClient } from "../../clients/catalog/musicVideo.js";
4
+ import { PlaylistClient } from "../../clients/catalog/playlist.js";
5
+ import { SongClient } from "../../clients/catalog/song.js";
6
+ import { StationClient } from "../../clients/catalog/station.js";
7
+ import { StationGenreClient } from "../../clients/catalog/stationGenre.js";
8
+ import { BaseResourceClient, createResourceClient } from "../../clients/resource.js";
9
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
10
+ class ActivityClient extends createResourceClient("activities") {
11
+ }
12
+ class AppleCuratorClient extends createResourceClient("apple-curators") {
13
+ }
14
+ class ArtistClient extends createResourceClient("artists") {
15
+ }
16
+ class ConcertClient extends createResourceClient("concerts") {
17
+ }
18
+ class CreditArtistClient extends createResourceClient("credit-artists") {
19
+ }
20
+ class CuratorClient extends createResourceClient("curators") {
21
+ }
22
+ class LyricsClient extends createResourceClient("lyrics") {
23
+ }
24
+ class RecordLabelClient extends createResourceClient("record-labels") {
25
+ }
26
+ class RoleCategoryClient extends createResourceClient("role-categories") {
27
+ }
28
+ class SyllableLyricsClient extends createResourceClient("syllable-lyrics") {
29
+ }
30
+ export class CatalogClient extends BaseResourceClient {
31
+ http;
32
+ path;
33
+ activities;
34
+ albums;
35
+ appleCurators;
36
+ playlists;
37
+ artists;
38
+ concerts;
39
+ creditArtists;
40
+ curators;
41
+ genres;
42
+ lyrics;
43
+ musicVideos;
44
+ recordLabels;
45
+ roleCategories;
46
+ songs;
47
+ stations;
48
+ stationGenres;
49
+ syllableLyrics;
50
+ constructor(http, path) {
51
+ super(http, path);
52
+ this.http = http;
53
+ this.path = path;
54
+ this.activities = new ActivityClient(http, path);
55
+ this.albums = new AlbumClient(http, path);
56
+ this.appleCurators = new AppleCuratorClient(http, path);
57
+ this.playlists = new PlaylistClient(http, path);
58
+ this.artists = new ArtistClient(http, path);
59
+ this.concerts = new ConcertClient(http, path);
60
+ this.creditArtists = new CreditArtistClient(http, path);
61
+ this.curators = new CuratorClient(http, path);
62
+ this.genres = new GenreClient(http, path);
63
+ this.lyrics = new LyricsClient(http, path);
64
+ this.musicVideos = new MusicVideoClient(http, path);
65
+ this.recordLabels = new RecordLabelClient(http, path);
66
+ this.roleCategories = new RoleCategoryClient(http, path);
67
+ this.songs = new SongClient(http, path);
68
+ this.stations = new StationClient(http, path);
69
+ this.stationGenres = new StationGenreClient(http, path);
70
+ this.syllableLyrics = new SyllableLyricsClient(http, path);
71
+ }
72
+ async search(term, opts) {
73
+ const query = new RequestQueryBuilder().params(opts).setString("term", term);
74
+ const result = await this.http.request(`${this.path}/search`, {
75
+ config: opts.config,
76
+ query,
77
+ });
78
+ return this.prepareResults(result);
79
+ }
80
+ async searchHints(term, opts = {}) {
81
+ const query = new RequestQueryBuilder().params(opts).setString("term", term);
82
+ const result = await this.http.request(`${this.path}/search/hints`, {
83
+ config: opts.config,
84
+ query,
85
+ });
86
+ return result.results.terms;
87
+ }
88
+ async getMany(ids, opts = {}) {
89
+ const query = new RequestQueryBuilder().params(opts);
90
+ for (const [key, value] of Object.entries(ids)) {
91
+ query.setStringArray("ids", value, key);
92
+ }
93
+ const result = await this.http.request(this.path, {
94
+ config: opts.config,
95
+ query,
96
+ });
97
+ return this.prepare(result);
98
+ }
99
+ }
@@ -0,0 +1,12 @@
1
+ import { EquivalentClient } from "../../clients/shared/equivalent.js";
2
+ import type { DefaultParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "music-videos";
7
+ type TResource = Registry[typeof type];
8
+ export declare class MusicVideoClient extends EquivalentClient<typeof type, TResource> {
9
+ protected readonly type: "music-videos";
10
+ getByIsrc<const TScopes extends ResourceScopes = {}>(isrc: string | string[], opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogMusicVideo, TScopes>>;
11
+ }
12
+ export {};
@@ -0,0 +1,14 @@
1
+ import { EquivalentClient } from "../../clients/shared/equivalent.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "music-videos";
4
+ export class MusicVideoClient extends EquivalentClient {
5
+ type = type;
6
+ async getByIsrc(isrc, opts = {}) {
7
+ const query = new RequestQueryBuilder().params(opts).setStringArray("filter[isrc]", isrc);
8
+ const result = await this.http.request(`${this.path}/${this.type}`, {
9
+ config: opts.config,
10
+ query,
11
+ });
12
+ return this.prepare(result);
13
+ }
14
+ }
@@ -0,0 +1,12 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import type { DefaultParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "playlists";
7
+ type TResource = Registry[typeof type];
8
+ export declare class PlaylistClient extends ResourceClient<typeof type, TResource> {
9
+ protected readonly type: "playlists";
10
+ getByStorefrontChart<const TScopes extends ResourceScopes = {}>(chart: string | string[], opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogPlaylist, TScopes>>;
11
+ }
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "playlists";
4
+ export class PlaylistClient extends ResourceClient {
5
+ type = type;
6
+ async getByStorefrontChart(chart, opts = {}) {
7
+ const query = new RequestQueryBuilder()
8
+ .params(opts)
9
+ .setStringArray("filter[storefront-chart]", chart);
10
+ const result = await this.http.request(`${this.path}/${this.type}`, {
11
+ config: opts.config,
12
+ query,
13
+ });
14
+ return this.prepare(result);
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ import { EquivalentClient } from "../../clients/shared/equivalent.js";
2
+ import type { DefaultParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "songs";
7
+ type TResource = Registry[typeof type];
8
+ export declare class SongClient extends EquivalentClient<typeof type, TResource> {
9
+ protected readonly type: "songs";
10
+ getByIsrc<const TScopes extends ResourceScopes = {}>(isrc: string | string[], opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogSong, TScopes>>;
11
+ }
12
+ export {};
@@ -0,0 +1,14 @@
1
+ import { EquivalentClient } from "../../clients/shared/equivalent.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "songs";
4
+ export class SongClient extends EquivalentClient {
5
+ type = type;
6
+ async getByIsrc(isrc, opts = {}) {
7
+ const query = new RequestQueryBuilder().params(opts).setStringArray("filter[isrc]", isrc);
8
+ const result = await this.http.request(`${this.path}/${this.type}`, {
9
+ config: opts.config,
10
+ query,
11
+ });
12
+ return this.prepare(result);
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import type { DefaultParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "stations";
7
+ type TResource = Registry[typeof type];
8
+ export declare class StationClient extends ResourceClient<typeof type, TResource> {
9
+ protected readonly type: "stations";
10
+ getFeaturedOnStorefront<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogStation, TScopes>>;
11
+ getPersonal<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogStation, TScopes>>;
12
+ getResourceStation<const TScopes extends ResourceScopes = {}>(resourceId: string, opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").CatalogStation, TScopes>>;
13
+ }
14
+ export {};
@@ -0,0 +1,34 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "stations";
4
+ export class StationClient extends ResourceClient {
5
+ type = type;
6
+ async getFeaturedOnStorefront(opts = {}) {
7
+ const query = new RequestQueryBuilder()
8
+ .params(opts)
9
+ .setStringArray("filter[featured]", "apple-music-live-radio");
10
+ const result = await this.http.request(`${this.path}/${this.type}`, {
11
+ config: opts.config,
12
+ query,
13
+ });
14
+ return this.prepare(result);
15
+ }
16
+ async getPersonal(opts = {}) {
17
+ const query = new RequestQueryBuilder()
18
+ .params(opts)
19
+ .setStringArray("filter[identity]", "personal");
20
+ const result = await this.http.request(`${this.path}/${this.type}`, {
21
+ config: opts.config,
22
+ query,
23
+ });
24
+ return this.prepare(result);
25
+ }
26
+ async getResourceStation(resourceId, opts = {}) {
27
+ const query = new RequestQueryBuilder().params(opts);
28
+ const result = await this.http.request(`${this.path}/${this.type}/ra.${resourceId}`, {
29
+ config: opts.config,
30
+ query,
31
+ });
32
+ return this.prepare(result);
33
+ }
34
+ }
@@ -0,0 +1,12 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import type { DefaultParams, PaginationParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "station-genres";
7
+ type TResource = Registry[typeof type];
8
+ export declare class StationGenreClient extends ResourceClient<typeof type, TResource> {
9
+ protected readonly type: "station-genres";
10
+ getAll<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & PaginationParams): Promise<ResourceResponse<import("../../types/public.js").CatalogStationGenre, TScopes>>;
11
+ }
12
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "station-genres";
4
+ export class StationGenreClient extends ResourceClient {
5
+ type = type;
6
+ async getAll(opts = {}) {
7
+ const query = new RequestQueryBuilder().params(opts);
8
+ const result = await this.http.request(`${this.path}/${this.type}`, {
9
+ config: opts.config,
10
+ query,
11
+ });
12
+ return this.prepare(result);
13
+ }
14
+ }
@@ -0,0 +1,39 @@
1
+ import { LibraryPlaylistFolderClient } from "../../clients/library/playlistFolder.js";
2
+ import { BaseResourceClient } from "../../clients/resource.js";
3
+ import type { HttpClient } from "../../core/http.js";
4
+ import type { LibraryResources, LibraryResourceTypes, PinnableResources, RecentlyAddedResources } from "../../types/combined.js";
5
+ import type { DefaultParams, LimitParam, PaginationParams, ResultParams } from "../../types/params.js";
6
+ import type { ResourceResponse } from "../../types/query/response.js";
7
+ import type { ResultShape, ShapedResult } from "../../types/query/results.js";
8
+ import type { ResourceScopes, ScopedResourceIterator } from "../../types/query/scopes.js";
9
+ import type { SearchLibraryResult } from "../../types/results/search.js";
10
+ declare const LibraryAlbumClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").LibraryResourceClient<"library-albums", import("../../types/public.js").LibraryAlbum>;
11
+ declare class LibraryAlbumClient extends LibraryAlbumClient_base {
12
+ }
13
+ declare const LibraryArtistClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").LibraryResourceClient<"library-artists", import("../../types/public.js").LibraryArtist>;
14
+ declare class LibraryArtistClient extends LibraryArtistClient_base {
15
+ }
16
+ declare const LibraryMusicVideoClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").LibraryResourceClient<"library-music-videos", import("../../types/public.js").LibraryMusicVideo>;
17
+ declare class LibraryMusicVideoClient extends LibraryMusicVideoClient_base {
18
+ }
19
+ declare const LibraryPlaylistClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").LibraryResourceClient<"library-playlists", import("../../types/public.js").LibraryPlaylist>;
20
+ declare class LibraryPlaylistClient extends LibraryPlaylistClient_base {
21
+ }
22
+ declare const LibrarySongClient_base: new (http: HttpClient, path: string) => import("../../clients/resource.js").LibraryResourceClient<"library-songs", import("../../types/public.js").LibrarySong>;
23
+ declare class LibrarySongClient extends LibrarySongClient_base {
24
+ }
25
+ export declare class LibraryClient extends BaseResourceClient {
26
+ songs: LibrarySongClient;
27
+ albums: LibraryAlbumClient;
28
+ artists: LibraryArtistClient;
29
+ musicVideos: LibraryMusicVideoClient;
30
+ playlists: LibraryPlaylistClient;
31
+ playlistFolders: LibraryPlaylistFolderClient;
32
+ constructor(http: HttpClient, path: string);
33
+ getPins<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & LimitParam): Promise<ResourceResponse<PinnableResources, TScopes>>;
34
+ getRecentlyAdded<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & PaginationParams): Promise<ResourceResponse<RecentlyAddedResources, TScopes>>;
35
+ search<const TTypes extends ResultShape<SearchLibraryResult>, const TScopes extends ResourceScopes = {}>(term: string, opts: ResultParams<SearchLibraryResult, TTypes, TScopes> & PaginationParams): Promise<ShapedResult<SearchLibraryResult, TTypes, TScopes>>;
36
+ getMany<const TScopes extends ResourceScopes = {}>(ids: Partial<Record<LibraryResourceTypes, string[]>>, opts?: DefaultParams<TScopes>): Promise<ResourceResponse<LibraryResources, TScopes>>;
37
+ iterateRecentlyAdded<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & LimitParam): ScopedResourceIterator<RecentlyAddedResources, TScopes>;
38
+ }
39
+ export {};
@@ -0,0 +1,68 @@
1
+ import { LibraryPlaylistFolderClient } from "../../clients/library/playlistFolder.js";
2
+ import { BaseResourceClient, createLibraryResourceClient } from "../../clients/resource.js";
3
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
4
+ class LibraryAlbumClient extends createLibraryResourceClient("albums") {
5
+ }
6
+ class LibraryArtistClient extends createLibraryResourceClient("artists") {
7
+ }
8
+ class LibraryMusicVideoClient extends createLibraryResourceClient("music-videos") {
9
+ }
10
+ class LibraryPlaylistClient extends createLibraryResourceClient("playlists") {
11
+ }
12
+ class LibrarySongClient extends createLibraryResourceClient("songs") {
13
+ }
14
+ export class LibraryClient extends BaseResourceClient {
15
+ songs;
16
+ albums;
17
+ artists;
18
+ musicVideos;
19
+ playlists;
20
+ playlistFolders;
21
+ constructor(http, path) {
22
+ super(http, path);
23
+ this.songs = new LibrarySongClient(http, path);
24
+ this.albums = new LibraryAlbumClient(http, path);
25
+ this.artists = new LibraryArtistClient(http, path);
26
+ this.musicVideos = new LibraryMusicVideoClient(http, path);
27
+ this.playlists = new LibraryPlaylistClient(http, path);
28
+ this.playlistFolders = new LibraryPlaylistFolderClient(http, path);
29
+ }
30
+ async getPins(opts = {}) {
31
+ const query = new RequestQueryBuilder().params(opts);
32
+ const result = await this.http.request(`${this.path}/pins`, {
33
+ config: opts.config,
34
+ query,
35
+ });
36
+ return this.prepare(result);
37
+ }
38
+ async getRecentlyAdded(opts = {}) {
39
+ const query = new RequestQueryBuilder().params(opts);
40
+ const result = await this.http.request(`${this.path}/recently-added`, {
41
+ config: opts.config,
42
+ query,
43
+ });
44
+ return this.prepare(result);
45
+ }
46
+ async search(term, opts) {
47
+ const query = new RequestQueryBuilder().params(opts).setString("term", term);
48
+ const result = await this.http.request(`${this.path}/search`, {
49
+ config: opts.config,
50
+ query,
51
+ });
52
+ return this.prepareResults(result);
53
+ }
54
+ async getMany(ids, opts = {}) {
55
+ const query = new RequestQueryBuilder().params(opts);
56
+ for (const [key, value] of Object.entries(ids)) {
57
+ query.setStringArray("ids", value, key);
58
+ }
59
+ const result = await this.http.request(this.path, {
60
+ config: opts.config,
61
+ query,
62
+ });
63
+ return this.prepare(result);
64
+ }
65
+ iterateRecentlyAdded(opts = {}) {
66
+ return this.iterate((offset) => this.getRecentlyAdded({ ...opts, offset }));
67
+ }
68
+ }
@@ -0,0 +1,12 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import type { DefaultParams } from "../../types/params.js";
3
+ import type { Registry } from "../../types/query/registry.js";
4
+ import type { ResourceResponse } from "../../types/query/response.js";
5
+ import type { ResourceScopes } from "../../types/query/scopes.js";
6
+ declare const type: "library-playlist-folders";
7
+ type TResource = Registry[typeof type];
8
+ export declare class LibraryPlaylistFolderClient extends ResourceClient<typeof type, TResource> {
9
+ protected readonly type = "playlist-folders";
10
+ getRoot<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes>): Promise<ResourceResponse<import("../../types/public.js").LibraryPlaylistFolder, TScopes>>;
11
+ }
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ResourceClient } from "../../clients/resource.js";
2
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
3
+ const type = "library-playlist-folders";
4
+ export class LibraryPlaylistFolderClient extends ResourceClient {
5
+ type = "playlist-folders";
6
+ async getRoot(opts = {}) {
7
+ const query = new RequestQueryBuilder()
8
+ .params(opts)
9
+ .setStringArray("filter[identity]", "playlistsroot");
10
+ const result = await this.http.request(`${this.path}/${this.type}`, {
11
+ config: opts.config,
12
+ query,
13
+ });
14
+ return this.prepare(result);
15
+ }
16
+ }
@@ -0,0 +1,25 @@
1
+ import { MusicSummaryClient } from "../../clients/me/musicSummary.js";
2
+ import { RatingsClient } from "../../clients/me/ratings.js";
3
+ import { RecentClient } from "../../clients/me/recent.js";
4
+ import { RecommendationClient } from "../../clients/me/recommendation.js";
5
+ import { StationClient } from "../../clients/me/station.js";
6
+ import { BaseResourceClient } from "../../clients/resource.js";
7
+ import type { HttpClient } from "../../core/http.js";
8
+ import type { DefaultParams, LimitParam, PaginationParams } from "../../types/params.js";
9
+ import type { ResourceResponse } from "../../types/query/response.js";
10
+ import type { ResourceScopes, ScopedResourceIterator } from "../../types/query/scopes.js";
11
+ import type { LibraryPlaylist } from "../../types/resources/library/playlist.js";
12
+ import type { PersonalSocialProfile } from "../../types/resources/me/profile.js";
13
+ import type { Storefront } from "../../types/resources/other/storefront.js";
14
+ export declare class MeClient extends BaseResourceClient {
15
+ recommendations: RecommendationClient;
16
+ musicSummaries: MusicSummaryClient;
17
+ recent: RecentClient;
18
+ ratings: RatingsClient;
19
+ stations: StationClient;
20
+ constructor(http: HttpClient, path: string);
21
+ getStorefront<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes>): Promise<ResourceResponse<Storefront, TScopes>>;
22
+ getProfile<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes>): Promise<ResourceResponse<PersonalSocialProfile, TScopes>>;
23
+ getHeavyRotation<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & PaginationParams): Promise<ResourceResponse<LibraryPlaylist, TScopes>>;
24
+ iterateHeavyRotation<const TScopes extends ResourceScopes = {}>(opts?: DefaultParams<TScopes> & LimitParam): ScopedResourceIterator<LibraryPlaylist, TScopes>;
25
+ }
@@ -0,0 +1,49 @@
1
+ import { MusicSummaryClient } from "../../clients/me/musicSummary.js";
2
+ import { RatingsClient } from "../../clients/me/ratings.js";
3
+ import { RecentClient } from "../../clients/me/recent.js";
4
+ import { RecommendationClient } from "../../clients/me/recommendation.js";
5
+ import { StationClient } from "../../clients/me/station.js";
6
+ import { BaseResourceClient } from "../../clients/resource.js";
7
+ import { RequestQueryBuilder } from "../../helpers/requestQuery.js";
8
+ export class MeClient extends BaseResourceClient {
9
+ recommendations;
10
+ musicSummaries;
11
+ recent;
12
+ ratings;
13
+ stations;
14
+ constructor(http, path) {
15
+ super(http, path);
16
+ this.recommendations = new RecommendationClient(http, path);
17
+ this.musicSummaries = new MusicSummaryClient(http, path);
18
+ this.recent = new RecentClient(http, path);
19
+ this.ratings = new RatingsClient(http, path);
20
+ this.stations = new StationClient(http, path);
21
+ }
22
+ async getStorefront(opts = {}) {
23
+ const query = new RequestQueryBuilder().params(opts);
24
+ const result = await this.http.request(`${this.path}/storefront`, {
25
+ config: opts.config,
26
+ query,
27
+ });
28
+ return this.prepare(result);
29
+ }
30
+ async getProfile(opts = {}) {
31
+ const query = new RequestQueryBuilder().params(opts);
32
+ const result = await this.http.request(`${this.path}/social/profile`, {
33
+ config: opts.config,
34
+ query,
35
+ });
36
+ return this.prepare(result);
37
+ }
38
+ async getHeavyRotation(opts = {}) {
39
+ const query = new RequestQueryBuilder().params(opts);
40
+ const result = await this.http.request(`${this.path}/history/heavy-rotation`, {
41
+ config: opts.config,
42
+ query,
43
+ });
44
+ return this.prepare(result);
45
+ }
46
+ iterateHeavyRotation(opts = {}) {
47
+ return this.iterate((offset) => this.getHeavyRotation({ ...opts, offset }));
48
+ }
49
+ }