musicbrainz-api 0.23.1 → 0.24.0

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.
package/README.md CHANGED
@@ -111,7 +111,8 @@ The MusicBrainz API allows you to look up various entities. Here’s how to use
111
111
 
112
112
  ## Lookup MusicBrainz Entities
113
113
 
114
- MusicBrainz API documentation: [XML Web Service/Version 2 Lookups](https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2#Lookups)
114
+ You can use the lookup function, to look up an entity, when you have the MBID for that entity.
115
+ MusicBrainz API documentation: [MusicBrainz API - Lookups](https://wiki.musicbrainz.org/MusicBrainz_API#Lookups)
115
116
 
116
117
  ### Lookup Function
117
118
 
@@ -127,7 +128,7 @@ Arguments:
127
128
  #### Lookup URLs
128
129
 
129
130
  There is special method to lookup URL entity / entities by one, or an array of URLs
130
- ([MusicBrainz documentation](https://musicbrainz.org/doc/MusicBrainz_API#url_(by_text))):
131
+ ([MusicBrainz API documentation: url (by text)](https://musicbrainz.org/doc/MusicBrainz_API#url_(by_text))):
131
132
 
132
133
  ```js
133
134
  const urls = await mbApi.lookupUrl(['https://open.spotify.com/track/2AMysGXOe0zzZJMtH3Nizb', 'https://open.spotify.com/track/78Teboqh9lPIxWlIW5RMQL']);
@@ -136,7 +137,7 @@ const urls = await mbApi.lookupUrl(['https://open.spotify.com/track/2AMysGXOe0zz
136
137
  or
137
138
 
138
139
  ```js
139
- const url = await mbApi.lookupUrl('https://open.spotify.com/track/2AMysGXOe0zzZJMtH3Nizb']);
140
+ const url = await mbApi.lookupUrl('https://open.spotify.com/track/2AMysGXOe0zzZJMtH3Nizb');
140
141
  ```
141
142
 
142
143
  Arguments:
@@ -145,11 +146,29 @@ Arguments:
145
146
 
146
147
  Note that the return type is different, depending on if a single URL or an array of URLs is provided.
147
148
 
149
+ ## Browse requests
150
+ Browse requests are a direct lookup of all the entities directly linked to another entity ("directly linked" here meaning it does not include entities linked by a relationship).
151
+
152
+ For example, browse _releases_:
153
+ ```js
154
+
155
+ const artist_mbid = 'ab2528d9-719f-4261-8098-21849222a0f2';
156
+
157
+ const releases = await mbApi.browse('release', {
158
+ track_artist: artist_mbid,
159
+ limit: 0,
160
+ offset: 0,
161
+ }, ['url-rels', 'isrcs', 'recordings']);
162
+ ```
163
+
164
+ For the optional include arguments (`string[]`), see [Include arguments](#include-arguments).
165
+
148
166
  ### Browse artist
149
167
 
150
168
  ```js
151
169
  const artists = await mbApi.browse('artist', query);
152
- ````
170
+ const artists = await mbApi.browse('artist', query, ['area', 'collection']);
171
+ ```
153
172
 
154
173
  | Query argument | Query value |
155
174
  |-----------------------|--------------------|
@@ -163,7 +182,8 @@ const artists = await mbApi.browse('artist', query);
163
182
  ### Browse collection
164
183
  ```js
165
184
  const collections = await mbApi.browse('collection', query);
166
- ````
185
+ const collections = await mbApi.browse('collection', query, ['area', 'artist']);
186
+ ```
167
187
 
168
188
  | Query argument | Query value |
169
189
  |-----------------------|--------------------|
@@ -181,7 +201,8 @@ const collections = await mbApi.browse('collection', query);
181
201
  ### Browse events
182
202
  ```js
183
203
  const events = await mbApi.browse('event', query);
184
- ````
204
+ const events = await mbApi.browse('instrument', query, ['area', 'artist']);
205
+ ```
185
206
 
186
207
  | Query argument | Query value |
187
208
  |-----------------------|-----------------|
@@ -192,8 +213,9 @@ const events = await mbApi.browse('event', query);
192
213
 
193
214
  ### Browse instruments
194
215
  ```js
195
- const instruments = await mbApi.browse('event', query);
196
- ````
216
+ const instruments = await mbApi.browse('instrument', query);
217
+ const instruments = await mbApi.browse('instrument', query, ['collection']);
218
+ ```
197
219
 
198
220
  | Query argument | Query value |
199
221
  |-----------------------|--------------------|
@@ -202,7 +224,8 @@ const instruments = await mbApi.browse('event', query);
202
224
  ### Browse labels
203
225
  ```js
204
226
  const labels = await mbApi.browse('label', query);
205
- ````
227
+ const places = await mbApi.browse('place', query, ['area', 'collection']);
228
+ ```
206
229
 
207
230
  | Query argument | Query value |
208
231
  |--------------------|-----------------|
@@ -213,7 +236,8 @@ const labels = await mbApi.browse('label', query);
213
236
  ### Browse places
214
237
  ```js
215
238
  const places = await mbApi.browse('place', query);
216
- ````
239
+ const places = await mbApi.browse('place', query, ['area', 'collection']);
240
+ ```
217
241
 
218
242
  | Query argument | Query value |
219
243
  |--------------------|-----------------|
@@ -222,8 +246,8 @@ const places = await mbApi.browse('place', query);
222
246
 
223
247
  ### Browse recordings
224
248
  ```js
225
- const recordings = await mbApi.browse('recording', query);
226
- ````
249
+ const recordings = await mbApi.browse('recording', query, ['artist']);
250
+ ```
227
251
 
228
252
  | Query argument | Query value |
229
253
  |--------------------|-----------------|
@@ -235,7 +259,8 @@ const recordings = await mbApi.browse('recording', query);
235
259
  ### Browse releases
236
260
  ```js
237
261
  const releases = await mbApi.browse('release', query);
238
- ````
262
+ const releases = await mbApi.browse('release', query, ['artist', 'track']);
263
+ ```
239
264
 
240
265
  | Query argument | Query value |
241
266
  |-----------------------|--------------------|
@@ -252,7 +277,8 @@ const releases = await mbApi.browse('release', query);
252
277
 
253
278
  ### Browse release-groups
254
279
  ```js
255
- const releaseGroups = await mbApi.browse('release-group',query);
280
+ const releaseGroups = await mbApi.browse('release-group', query);
281
+ const releaseGroups = await mbApi.browse('release-group', query, ['artist', 'release']);
256
282
  ```
257
283
 
258
284
  | Query argument | Query value |
@@ -264,7 +290,8 @@ const releaseGroups = await mbApi.browse('release-group',query);
264
290
  ### Browse series
265
291
  ```js
266
292
  const series = await mbApi.browse('series');
267
- ````
293
+ const series = await mbApi.browse('series', ['collection']);
294
+ ```
268
295
 
269
296
  | Query argument | Query value |
270
297
  |-----------------------|--------------------|
@@ -282,7 +309,8 @@ const series = await mbApi.browse('series');
282
309
  ### Browse works
283
310
  ```js
284
311
  const works = await mbApi.browse('work');
285
- ````
312
+ const series = await mbApi.browse('series', ['artist', 'collection']);
313
+ ```
286
314
 
287
315
  | Query argument | Query value |
288
316
  |--------------------|-----------------|
@@ -292,7 +320,8 @@ const works = await mbApi.browse('work');
292
320
  ### Browse urls
293
321
  ```js
294
322
  const urls = await mbApi.browse('url');
295
- ````
323
+ const series = await mbApi.browse('series', ['artist', 'collection', 'artist-rels']);
324
+ ```
296
325
 
297
326
  | Query argument | Query value |
298
327
  |--------------------|-----------------|
@@ -301,7 +330,7 @@ const urls = await mbApi.browse('url');
301
330
 
302
331
  ## Search (query)
303
332
 
304
- Implements [XML Web Service/Version 2/Search](https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2/Search).
333
+ Implements [MusicBrainz API: Search](https://wiki.musicbrainz.org/MusicBrainz_API/Search).
305
334
 
306
335
  There are different search fields depending on the entity.
307
336
 
@@ -334,21 +363,21 @@ const result = await mbApi.search('release-group', {query});
334
363
 
335
364
  ```js
336
365
  mbApi.search('area', 'Île-de-France');
337
- ````
366
+ ```
338
367
 
339
368
  ##### Example: search release by barcode
340
369
 
341
370
  Search a release with the barcode 602537479870:
342
371
  ```js
343
372
  mbApi.search('release', {query: {barcode: 602537479870}});
344
- ````
373
+ ```
345
374
 
346
375
  ##### Example: search by object
347
376
 
348
377
  Same as previous example, but automatically serialize parameters to search query
349
378
  ```js
350
379
  mbApi.search('release', 'barcode: 602537479870');
351
- ````
380
+ ```
352
381
 
353
382
  ##### Example: search artist by artist name
354
383
 
@@ -443,9 +472,9 @@ As such, keep in mind requesting "artist-rels" for an artist, "release-rels" for
443
472
  In a release request, you might also be interested on relationships for the recordings linked to the release, or the release group linked to the release, or even for the works linked to those recordings that are linked to the release (for example, to find out who played guitar on a specific track, who wrote the lyrics for the song being performed, or whether the release group is part of a series). Similarly, for a recording request, you might want to get the relationships for any linked works.
444
473
  There are three additional includes for this:
445
474
 
446
- - recording-level-rels
447
- - release-group-level-rels (for releases only)
448
- - work-level-rels
475
+ - `recording-level-rels`
476
+ - `release-group-level-rels` (for releases only)
477
+ - `work-level-rels`
449
478
 
450
479
  # Submitting data via XML POST
451
480
 
@@ -1,11 +1,11 @@
1
- export { XmlMetadata } from './xml/xml-metadata.js';
2
- export { XmlIsrc } from './xml/xml-isrc.js';
3
- export { XmlIsrcList } from './xml/xml-isrc-list.js';
4
- export { XmlRecording } from './xml/xml-recording.js';
5
1
  import type { XmlMetadata } from './xml/xml-metadata.js';
6
2
  import { RateLimitThreshold } from 'rate-limit-threshold';
7
3
  import * as mb from './musicbrainz.types.js';
8
4
  import { HttpClient, type MultiQueryFormData } from "./http-client.js";
5
+ export { XmlMetadata } from './xml/xml-metadata.js';
6
+ export { XmlIsrc } from './xml/xml-isrc.js';
7
+ export { XmlIsrcList } from './xml/xml-isrc-list.js';
8
+ export { XmlRecording } from './xml/xml-recording.js';
9
9
  export * from './musicbrainz.types.js';
10
10
  export type RelationsIncludes = 'area-rels' | 'artist-rels' | 'event-rels' | 'instrument-rels' | 'label-rels' | 'place-rels' | 'recording-rels' | 'release-rels' | 'release-group-rels' | 'series-rels' | 'url-rels' | 'work-rels';
11
11
  export type SubQueryIncludes =
@@ -90,7 +90,7 @@ export declare class MusicBrainzApi {
90
90
  * Lookup entity
91
91
  * @param entity 'area', 'artist', collection', 'instrument', 'label', 'place', 'release', 'release-group', 'recording', 'series', 'work', 'url' or 'event'
92
92
  * @param mbid Entity MBID
93
- * @param inc Query, like: {<entity>: <MBID:}
93
+ * @param inc Includes, which allows you to request more information to be included about the entity
94
94
  */
95
95
  lookup(entity: 'area', mbid: string, inc?: AreaIncludes[]): Promise<mb.IArea>;
96
96
  lookup(entity: 'artist', mbid: string, inc?: ArtistIncludes[]): Promise<mb.IArtist>;
@@ -115,20 +115,21 @@ export declare class MusicBrainzApi {
115
115
  * For example: http://musicbrainz.org/ws/2/release?label=47e718e1-7ee4-460c-b1cc-1192a841c6e5&offset=12&limit=2
116
116
  * @param entity MusicBrainz entity
117
117
  * @param query Query, like: {<entity>: <MBID:}
118
+ * @param inc Includes, which allows you to request more information to be included about the entity
118
119
  */
119
- browse(entity: 'area', query?: mb.IBrowseAreasQuery): Promise<mb.IBrowseAreasResult>;
120
- browse(entity: 'artist', query?: mb.IBrowseArtistsQuery): Promise<mb.IBrowseArtistsResult>;
121
- browse(entity: 'collection', query?: mb.IBrowseCollectionsQuery): Promise<mb.IBrowseCollectionsResult>;
122
- browse(entity: 'event', query?: mb.IBrowseEventsQuery): Promise<mb.IBrowseEventsResult>;
123
- browse(entity: 'label', query?: mb.IBrowseLabelsQuery): Promise<mb.IBrowseLabelsResult>;
124
- browse(entity: 'instrument', query?: mb.IBrowseInstrumentsQuery): Promise<mb.IBrowseInstrumentsResult>;
125
- browse(entity: 'place', query?: mb.IBrowsePlacesQuery): Promise<mb.IBrowsePlacesResult>;
126
- browse(entity: 'recording', query?: mb.IBrowseRecordingsQuery): Promise<mb.IBrowseRecordingsResult>;
127
- browse(entity: 'release', query?: mb.IBrowseReleasesQuery): Promise<mb.IBrowseReleasesResult>;
128
- browse(entity: 'release-group', query?: mb.IBrowseReleaseGroupsQuery): Promise<mb.IBrowseReleaseGroupsResult>;
129
- browse(entity: 'series', query?: mb.IBrowseSeriesQuery): Promise<mb.IBrowseSeriesResult>;
130
- browse(entity: 'url', query?: mb.IBrowseUrlsQuery): Promise<mb.IUrl>;
131
- browse(entity: 'work', query?: mb.IBrowseWorksQuery): Promise<mb.IBrowseWorksResult>;
120
+ browse(entity: 'area', query?: mb.IBrowseAreasQuery, inc?: AreaIncludes[]): Promise<mb.IBrowseAreasResult>;
121
+ browse(entity: 'artist', query?: mb.IBrowseArtistsQuery, inc?: ArtistIncludes[]): Promise<mb.IBrowseArtistsResult>;
122
+ browse(entity: 'collection', query?: mb.IBrowseCollectionsQuery, inc?: CollectionIncludes[]): Promise<mb.IBrowseCollectionsResult>;
123
+ browse(entity: 'event', query?: mb.IBrowseEventsQuery, inc?: EventIncludes[]): Promise<mb.IBrowseEventsResult>;
124
+ browse(entity: 'label', query?: mb.IBrowseLabelsQuery, inc?: LabelIncludes[]): Promise<mb.IBrowseLabelsResult>;
125
+ browse(entity: 'instrument', query?: mb.IBrowseInstrumentsQuery, inc?: InstrumentIncludes[]): Promise<mb.IBrowseInstrumentsResult>;
126
+ browse(entity: 'place', query?: mb.IBrowsePlacesQuery, inc?: PlaceIncludes[]): Promise<mb.IBrowsePlacesResult>;
127
+ browse(entity: 'recording', query?: mb.IBrowseRecordingsQuery, inc?: RecordingIncludes[]): Promise<mb.IBrowseRecordingsResult>;
128
+ browse(entity: 'release', query?: mb.IBrowseReleasesQuery, inc?: ReleaseIncludes[]): Promise<mb.IBrowseReleasesResult>;
129
+ browse(entity: 'release-group', query?: mb.IBrowseReleaseGroupsQuery, inc?: ReleaseGroupIncludes[]): Promise<mb.IBrowseReleaseGroupsResult>;
130
+ browse(entity: 'series', query?: mb.IBrowseSeriesQuery, inc?: SeriesIncludes[]): Promise<mb.IBrowseSeriesResult>;
131
+ browse(entity: 'url', query?: mb.IBrowseUrlsQuery, inc?: UrlIncludes[]): Promise<mb.IUrl>;
132
+ browse(entity: 'work', query?: mb.IBrowseWorksQuery, inc?: WorkIncludes[]): Promise<mb.IBrowseWorksResult>;
132
133
  /**
133
134
  * Search an entity using a search query
134
135
  * @param query e.g.: '" artist: Madonna, track: Like a virgin"' or object with search terms: {artist: Madonna}
@@ -1,13 +1,13 @@
1
1
  import { StatusCodes as HttpStatus } from 'http-status-codes';
2
2
  import Debug from 'debug';
3
- export { XmlMetadata } from './xml/xml-metadata.js';
4
- export { XmlIsrc } from './xml/xml-isrc.js';
5
- export { XmlIsrcList } from './xml/xml-isrc-list.js';
6
- export { XmlRecording } from './xml/xml-recording.js';
7
3
  import { DigestAuth } from './digest-auth.js';
8
4
  import { RateLimitThreshold } from 'rate-limit-threshold';
9
5
  import * as mb from './musicbrainz.types.js';
10
6
  import { HttpClient } from "./http-client.js";
7
+ export { XmlMetadata } from './xml/xml-metadata.js';
8
+ export { XmlIsrc } from './xml/xml-isrc.js';
9
+ export { XmlIsrcList } from './xml/xml-isrc-list.js';
10
+ export { XmlRecording } from './xml/xml-recording.js';
11
11
  export * from './musicbrainz.types.js';
12
12
  const debug = Debug('musicbrainz-api');
13
13
  export class MusicBrainzApi {
@@ -60,16 +60,20 @@ export class MusicBrainzApi {
60
60
  async lookupUrl(url, inc = []) {
61
61
  const result = await this.restGet('/url', { resource: url, inc: inc.join(' ') });
62
62
  if (Array.isArray(url) && url.length <= 1) {
63
- const searchResult = {
63
+ return {
64
64
  'url-count': 1,
65
65
  'url-offset': 0,
66
66
  urls: [result],
67
67
  };
68
- return searchResult;
69
68
  }
70
69
  return result;
71
70
  }
72
- browse(entity, query) {
71
+ browse(entity, query, inc) {
72
+ query = query ? query : {};
73
+ if (inc) {
74
+ // Serialize include parameter
75
+ query.inc = inc.join(' ');
76
+ }
73
77
  return this.restGet(`/${entity}`, query);
74
78
  }
75
79
  search(entity, query) {
@@ -438,131 +438,147 @@ export interface ILinkedEntitiesWork {
438
438
  export interface ILinkedEntitiesUrl {
439
439
  resource?: string;
440
440
  }
441
+ export type OneOf<T> = {
442
+ [K in keyof T]: {
443
+ [P in K]: T[K];
444
+ } & Partial<Record<Exclude<keyof T, K>, never>>;
445
+ }[keyof T];
441
446
  /**
442
- * Browse artist query <entity>: <MBID>
443
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
447
+ * List of entity names allowed for browsing releases by a single MBID.
448
+ * Used as a key set for constructing exclusive query types.
444
449
  */
445
- export interface IBrowseAreasQuery extends IPagination {
446
- collection?: string;
447
- }
450
+ interface BrowseReleasesEntityParams {
451
+ area: string;
452
+ artist: string;
453
+ editor: string;
454
+ event: string;
455
+ label: string;
456
+ place: string;
457
+ recording: string;
458
+ release: string;
459
+ 'release-group': string;
460
+ track_artist: string;
461
+ work: string;
462
+ }
463
+ export type IBrowseReleasesQuery = IPagination & OneOf<BrowseReleasesEntityParams>;
448
464
  /**
449
- * Browse artist query <entity>: <MBID>
450
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
465
+ * List of entity names allowed for browsing artists by a single MBID.
466
+ * Used as a key set for constructing exclusive query types.
451
467
  */
452
- export interface IBrowseArtistsQuery extends IPagination {
453
- area?: string;
454
- collection?: string;
455
- recording?: string;
456
- release?: string;
457
- 'release-group'?: string;
458
- work?: string;
459
- }
468
+ interface BrowseArtistsEntityParams {
469
+ area: string;
470
+ collection: string;
471
+ recording: string;
472
+ release: string;
473
+ 'release-group': string;
474
+ work: string;
475
+ }
476
+ export type IBrowseArtistsQuery = IPagination & OneOf<BrowseArtistsEntityParams>;
460
477
  /**
461
- * Browse collection query <entity>: <MBID>
462
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
478
+ * List of entity names allowed for browsing collections by a single MBID.
479
+ * Used as a key set for constructing exclusive query types.
463
480
  */
464
- export interface IBrowseCollectionsQuery extends IPagination {
465
- area?: string;
466
- artist?: string;
467
- editor?: string;
468
- event?: string;
469
- label?: string;
470
- place?: string;
471
- recording?: string;
472
- release?: string;
473
- 'release-group'?: string;
474
- work?: string;
481
+ interface BrowseCollectionsEntityParams {
482
+ area: string;
483
+ artist: string;
484
+ editor: string;
485
+ event: string;
486
+ label: string;
487
+ place: string;
488
+ recording: string;
489
+ release: string;
490
+ 'release-group': string;
491
+ work: string;
492
+ }
493
+ export type IBrowseCollectionsQuery = IPagination & OneOf<BrowseCollectionsEntityParams>;
494
+ /**
495
+ * List of entity names allowed for browsing events by a single MBID.
496
+ * Used as a key set for constructing exclusive query types.
497
+ */
498
+ interface BrowseEventsEntityParams {
499
+ area: string;
500
+ artist: string;
501
+ collection: string;
502
+ place: string;
475
503
  }
504
+ export type IBrowseEventsQuery = IPagination & OneOf<BrowseEventsEntityParams>;
476
505
  /**
477
- * Browse events query <entity>: <MBID>
478
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
506
+ * List of entity names allowed for browsing labels by a single MBID.
507
+ * Used as a key set for constructing exclusive query types.
479
508
  */
480
- export interface IBrowseEventsQuery extends IPagination {
481
- area?: string;
482
- artist?: string;
483
- collection?: string;
484
- place?: string;
509
+ interface BrowseLabelsEntityParams {
510
+ area: string;
511
+ collection: string;
512
+ release: string;
485
513
  }
514
+ export type IBrowseLabelsQuery = IPagination & OneOf<BrowseLabelsEntityParams>;
486
515
  /**
487
- * Browse instruments query <entity>: <MBID>
488
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
516
+ * List of entity names allowed for browsing places by a single MBID.
517
+ * Used as a key set for constructing exclusive query types.
489
518
  */
490
- export interface IBrowseInstrumentsQuery extends IPagination {
491
- collection?: string;
519
+ interface BrowsePlacesEntityParams {
520
+ area: string;
521
+ collection: string;
492
522
  }
523
+ export type IBrowsePlacesQuery = IPagination & OneOf<BrowsePlacesEntityParams>;
493
524
  /**
494
- * Browse labels query <entity>: <MBID>
495
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
525
+ * List of entity names allowed for browsing recordings by a single MBID.
526
+ * Used as a key set for constructing exclusive query types.
496
527
  */
497
- export interface IBrowseLabelsQuery extends IPagination {
498
- area?: string;
499
- collection?: string;
500
- release?: string;
528
+ interface BrowseRecordingsEntityParams {
529
+ artist: string;
530
+ collection: string;
531
+ release: string;
532
+ work: string;
501
533
  }
534
+ export type IBrowseRecordingsQuery = IPagination & OneOf<BrowseRecordingsEntityParams>;
502
535
  /**
503
- * Browse places query <entity>: <MBID>
504
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
536
+ * List of entity names allowed for browsing release-groups by a single MBID.
537
+ * Used as a key set for constructing exclusive query types.
505
538
  */
506
- export interface IBrowsePlacesQuery extends IPagination {
507
- area?: string;
508
- collection?: string;
539
+ interface BrowseReleaseGroupsEntityParams {
540
+ artist: string;
541
+ collection: string;
542
+ release: string;
509
543
  }
544
+ export type IBrowseReleaseGroupsQuery = IPagination & OneOf<BrowseReleaseGroupsEntityParams>;
510
545
  /**
511
- * Browse recordings query <entity>: <MBID>
512
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
546
+ * List of entity names allowed for browsing works by a single MBID.
547
+ * Used as a key set for constructing exclusive query types.
513
548
  */
514
- export interface IBrowseRecordingsQuery extends IPagination {
515
- artist?: string;
516
- collection?: string;
517
- release?: string;
518
- work?: string;
549
+ interface BrowseWorksEntityParams {
550
+ artist: string;
551
+ collection: string;
519
552
  }
553
+ export type IBrowseWorksQuery = IPagination & OneOf<BrowseWorksEntityParams>;
520
554
  /**
521
- * Browse releases query <entity>: <MBID>
555
+ * Query for browsing areas by collection MBID.
522
556
  * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
523
557
  */
524
- export interface IBrowseReleasesQuery extends IPagination {
525
- area?: string;
526
- artist?: string;
527
- editor?: string;
528
- event?: string;
529
- label?: string;
530
- place?: string;
531
- recording?: string;
532
- release?: string;
533
- 'release-group'?: string;
534
- work?: string;
558
+ export interface IBrowseAreasQuery extends IPagination {
559
+ collection?: string;
535
560
  }
536
561
  /**
537
- * Browse release-groups query <entity>: <MBID>
562
+ * Query for browsing instruments by collection MBID.
563
+ * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
538
564
  */
539
- export interface IBrowseReleaseGroupsQuery extends IPagination {
540
- artist?: string;
565
+ export interface IBrowseInstrumentsQuery extends IPagination {
541
566
  collection?: string;
542
- release?: string;
543
567
  }
544
568
  /**
545
- * Browse release query <entity>: <MBID>
569
+ * Query for browsing series by collection MBID.
546
570
  * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
547
571
  */
548
572
  export interface IBrowseSeriesQuery extends IPagination {
549
573
  collection?: string;
550
574
  }
551
575
  /**
552
- * Browse urls query <entity>: <MBID>
576
+ * Query for browsing URLs by resource URI.
553
577
  * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
554
578
  */
555
579
  export interface IBrowseUrlsQuery extends IPagination {
556
580
  resource?: string;
557
581
  }
558
- /**
559
- * Browse works query <entity>: <MBID>
560
- * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
561
- */
562
- export interface IBrowseWorksQuery extends IPagination {
563
- artist?: string;
564
- collection?: string;
565
- }
566
582
  export interface IBrowseAreasResult {
567
583
  area: IArea;
568
584
  'area-count': number;
@@ -628,3 +644,4 @@ export interface IUrlLookupResult {
628
644
  'url-count': number;
629
645
  urls: IUrl[];
630
646
  }
647
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musicbrainz-api",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "MusicBrainz API client for reading and submitting metadata",
5
5
  "exports": {
6
6
  "node": {
@@ -77,7 +77,7 @@
77
77
  "mocha": "^11.0.1",
78
78
  "remark-cli": "^12.0.0",
79
79
  "remark-preset-lint-recommended": "^7.0.0",
80
- "sinon": "^19.0.2",
80
+ "sinon": "^20.0.0",
81
81
  "source-map-support": "^0.5.21",
82
82
  "ts-node": "^10.9.2",
83
83
  "typescript": "^5.5.4"