musicbrainz-api 0.12.0 → 0.14.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.
@@ -1,10 +1,10 @@
1
- export { XmlMetadata } from './xml/xml-metadata';
2
- export { XmlIsrc } from './xml/xml-isrc';
3
- export { XmlIsrcList } from './xml/xml-isrc-list';
4
- export { XmlRecording } from './xml/xml-recording';
5
- import { XmlMetadata } from './xml/xml-metadata';
6
- import * as mb from './musicbrainz.types';
7
- export * from './musicbrainz.types';
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
+ import { XmlMetadata } from './xml/xml-metadata.js';
6
+ import * as mb from './musicbrainz.types.js';
7
+ export * from './musicbrainz.types.js';
8
8
  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';
9
9
  export type SubQueryIncludes =
10
10
  /**
@@ -37,7 +37,7 @@ export type InstrumentIncludes = MiscIncludes | RelationsIncludes;
37
37
  export type LabelIncludes = MiscIncludes | RelationsIncludes | 'releases';
38
38
  export type PlaceIncludes = MiscIncludes | RelationsIncludes;
39
39
  export type RecordingIncludes = MiscIncludes | RelationsIncludes | SubQueryIncludes | 'artists' | 'releases' | 'isrcs';
40
- export type ReleasesIncludes = MiscIncludes | SubQueryIncludes | RelationsIncludes | 'artists' | 'collections' | 'labels' | 'recordings' | 'release-groups';
40
+ export type ReleaseIncludes = MiscIncludes | SubQueryIncludes | RelationsIncludes | 'artists' | 'collections' | 'labels' | 'recordings' | 'release-groups';
41
41
  export type ReleaseGroupIncludes = MiscIncludes | SubQueryIncludes | RelationsIncludes | 'artists' | 'releases';
42
42
  export type SeriesIncludes = MiscIncludes | RelationsIncludes;
43
43
  export type WorkIncludes = MiscIncludes | RelationsIncludes;
@@ -84,162 +84,58 @@ export declare class MusicBrainzApi {
84
84
  [key: string]: any;
85
85
  }, attempt?: number): Promise<T>;
86
86
  /**
87
- * Generic lookup function
88
- * @param entity
89
- * @param mbid
90
- * @param inc
91
- */
92
- lookupEntity<T, I extends string = never>(entity: mb.EntityType, mbid: string, inc?: I[]): Promise<T>;
93
- /**
94
- * Lookup area
95
- * @param areaId Area MBID
96
- * @param inc Sub-queries
97
- */
98
- lookupArea(areaId: string, inc?: AreaIncludes[]): Promise<mb.IArea>;
99
- /**
100
- * Lookup artist
101
- * @param artistId Artist MBID
102
- * @param inc Sub-queries
103
- */
104
- lookupArtist(artistId: string, inc?: ArtistIncludes[]): Promise<mb.IArtist>;
105
- /**
106
- * Lookup collection
107
- * @param collectionId Collection MBID
108
- * @param inc List of additional information to be included about the entity. Any of the entities directly linked to the entity can be included.
109
- */
110
- lookupCollection(collectionId: string, inc?: ArtistIncludes[]): Promise<mb.ICollection>;
111
- /**
112
- * Lookup instrument
113
- * @param artistId Instrument MBID
114
- * @param inc Sub-queries
115
- */
116
- lookupInstrument(instrumentId: string, inc?: InstrumentIncludes[]): Promise<mb.IInstrument>;
117
- /**
118
- * Lookup label
119
- * @param labelId Area MBID
120
- * @param inc Sub-queries
121
- */
122
- lookupLabel(labelId: string, inc?: LabelIncludes[]): Promise<mb.ILabel>;
123
- /**
124
- * Lookup place
125
- * @param placeId Area MBID
126
- * @param inc Sub-queries
127
- */
128
- lookupPlace(placeId: string, inc?: PlaceIncludes[]): Promise<mb.IPlace>;
129
- /**
130
- * Lookup release
131
- * @param releaseId Release MBID
132
- * @param inc Include: artist-credits, labels, recordings, release-groups, media, discids, isrcs (with recordings)
133
- * ToDo: ['recordings', 'artists', 'artist-credits', 'isrcs', 'url-rels', 'release-groups']
134
- */
135
- lookupRelease(releaseId: string, inc?: ReleasesIncludes[]): Promise<mb.IRelease>;
136
- /**
137
- * Lookup release-group
138
- * @param releaseGroupId Release-group MBID
139
- * @param inc Include: ToDo
140
- */
141
- lookupReleaseGroup(releaseGroupId: string, inc?: ReleaseGroupIncludes[]): Promise<mb.IReleaseGroup>;
142
- /**
143
- * Lookup recording
144
- * @param recordingId Label MBID
145
- * @param inc Include: artist-credits, isrcs
146
- */
147
- lookupRecording(recordingId: string, inc?: RecordingIncludes[]): Promise<mb.IRecording>;
148
- /**
149
- * Lookup series
150
- * @param seriesId Series MBID
151
- */
152
- lookupSeries(seriesId: string): Promise<mb.ISeries>;
153
- /**
154
- * Lookup work
155
- * @param workId Work MBID
156
- */
157
- lookupWork(workId: string, inc?: WorkIncludes[]): Promise<mb.IWork>;
158
- /**
159
- * Lookup URL
160
- * @param urlId URL MBID
161
- */
162
- lookupUrl(urlId: string, inc?: UrlIncludes[]): Promise<mb.IUrl>;
163
- /**
164
- * Lookup Event
165
- * @param eventId Event MBID
166
- * @param eventIncludes List of sub-queries to enable
167
- */
168
- lookupEvent(eventId: string, eventIncludes?: EventIncludes[]): Promise<mb.IEvent>;
169
- /**
170
- * Generic browse function
87
+ * Lookup entity
88
+ * @param entity 'area', 'artist', collection', 'instrument', 'label', 'place', 'release', 'release-group', 'recording', 'series', 'work', 'url' or 'event'
89
+ * @param mbid Entity MBID
90
+ * @param inc Query, like: {<entity>: <MBID:}
91
+ */
92
+ lookup(entity: 'area', mbid: string, inc?: AreaIncludes[]): Promise<mb.IArea>;
93
+ lookup(entity: 'artist', mbid: string, inc?: ArtistIncludes[]): Promise<mb.IArtist>;
94
+ lookup(entity: 'collection', mbid: string, inc?: CollectionIncludes[]): Promise<mb.ICollection>;
95
+ lookup(entity: 'instrument', mbid: string, inc?: InstrumentIncludes[]): Promise<mb.IInstrument>;
96
+ lookup(entity: 'label', mbid: string, inc?: LabelIncludes[]): Promise<mb.ILabel>;
97
+ lookup(entity: 'place', mbid: string, inc?: PlaceIncludes[]): Promise<mb.IPlace>;
98
+ lookup(entity: 'release', mbid: string, inc?: ReleaseIncludes[]): Promise<mb.IRelease>;
99
+ lookup(entity: 'release-group', mbid: string, inc?: ReleaseGroupIncludes[]): Promise<mb.IReleaseGroup>;
100
+ lookup(entity: 'recording', mbid: string, inc?: RecordingIncludes[]): Promise<mb.IRecording>;
101
+ lookup(entity: 'series', mbid: string, inc?: SeriesIncludes[]): Promise<mb.ISeries>;
102
+ lookup(entity: 'work', mbid: string, inc?: WorkIncludes[]): Promise<mb.IWork>;
103
+ lookup(entity: 'url', mbid: string, inc?: UrlIncludes[]): Promise<mb.IUrl>;
104
+ lookup(entity: 'event', mbid: string, inc?: EventIncludes[]): Promise<mb.IEvent>;
105
+ /**
106
+ * Browse entity
107
+ * https://wiki.musicbrainz.org/MusicBrainz_API#Browse
108
+ * https://wiki.musicbrainz.org/MusicBrainz_API#Linked_entities
171
109
  * https://wiki.musicbrainz.org/Development/JSON_Web_Service#Browse_Requests
110
+ * For example: http://musicbrainz.org/ws/2/release?label=47e718e1-7ee4-460c-b1cc-1192a841c6e5&offset=12&limit=2
172
111
  * @param entity MusicBrainz entity
173
112
  * @param query Query, like: {<entity>: <MBID:}
174
113
  */
175
- browseEntity<T>(entity: mb.EntityType, query?: {
176
- [key: string]: any;
177
- }): Promise<T>;
178
- /**
179
- * Browse areas
180
- * @param query Query, like: {<entity>: <MBID:}
181
- */
182
- browseAreas(query?: mb.IBrowseAreasQuery): Promise<mb.IBrowseAreasResult>;
183
- /**
184
- * Browse artists
185
- * @param query Query, like: {<entity>: <MBID:}
186
- */
187
- browseArtists(query?: mb.IBrowseArtistsQuery): Promise<mb.IBrowseArtistsResult>;
188
- /**
189
- * Browse collections
190
- * @param query Query, like: {<entity>: <MBID:}
191
- */
192
- browseCollections(query?: mb.IBrowseCollectionsQuery): Promise<mb.IBrowseCollectionsResult>;
114
+ browse(entity: 'area', query?: mb.IBrowseAreasQuery): Promise<mb.IBrowseAreasResult>;
115
+ browse(entity: 'artist', query?: mb.IBrowseArtistsQuery): Promise<mb.IBrowseArtistsResult>;
116
+ browse(entity: 'collection', query?: mb.IBrowseCollectionsQuery): Promise<mb.IBrowseCollectionsResult>;
117
+ browse(entity: 'event', query?: mb.IBrowseEventsQuery): Promise<mb.IBrowseEventsResult>;
118
+ browse(entity: 'label', query?: mb.IBrowseLabelsQuery): Promise<mb.IBrowseLabelsResult>;
119
+ browse(entity: 'instrument', query?: mb.IBrowseInstrumentsQuery): Promise<mb.IBrowseInstrumentsResult>;
120
+ browse(entity: 'place', query?: mb.IBrowsePlacesQuery): Promise<mb.IBrowsePlacesResult>;
121
+ browse(entity: 'recording', query?: mb.IBrowseRecordingsQuery): Promise<mb.IBrowseRecordingsResult>;
122
+ browse(entity: 'release', query?: mb.IBrowseReleasesQuery): Promise<mb.IBrowseReleasesResult>;
123
+ browse(entity: 'release-group', query?: mb.IBrowseReleaseGroupsQuery): Promise<mb.IBrowseReleaseGroupsResult>;
124
+ browse(entity: 'series', query?: mb.IBrowseSeriesQuery): Promise<mb.IBrowseSeriesResult>;
125
+ browse(entity: 'url', query?: mb.IBrowseUrlsQuery): Promise<mb.IUrl>;
126
+ browse(entity: 'work', query?: mb.IBrowseWorksQuery): Promise<mb.IBrowseWorksResult>;
193
127
  /**
194
- * Browse events
195
- * @param query Query, like: {<entity>: <MBID:}
196
- */
197
- browseEvents(query?: mb.IBrowseEventsQuery): Promise<mb.IBrowseEventsResult>;
198
- /**
199
- * Browse instruments
200
- * @param query Query, like: {<entity>: <MBID:}
201
- */
202
- browseInstruments(query?: mb.IBrowseInstrumentsQuery): Promise<mb.IBrowseInstrumentsResult>;
203
- /**
204
- * Browse labels
205
- * @param query Query, like: {<entity>: <MBID:}
206
- */
207
- browseLabels(query?: mb.IBrowseLabelsQuery): Promise<mb.IBrowseLabelsResult>;
208
- /**
209
- * Browse places
210
- * @param query Query, like: {<entity>: <MBID:}
211
- */
212
- browsePlaces(query?: mb.IBrowsePlacesQuery): Promise<mb.IBrowsePlacesResult>;
213
- /**
214
- * Browse recordings
215
- * @param query Query, like: {<entity>: <MBID:}
216
- */
217
- browseRecordings(query?: mb.IBrowseRecordingsQuery): Promise<mb.IBrowseRecordingsResult>;
218
- /**
219
- * Browse releases
220
- * @param query Query, like: {<entity>: <MBID:}
221
- */
222
- browseReleases(query?: mb.IBrowseReleasesQuery): Promise<mb.IBrowseReleasesResult>;
223
- /**
224
- * Browse release-groups
225
- * @param query Query, like: {<entity>: <MBID:}
226
- */
227
- browseReleaseGroups(query?: mb.IReleaseGroupsQuery): Promise<mb.IBrowseReleaseGroupsResult>;
228
- /**
229
- * Browse series
230
- * @param query Query, like: {<entity>: <MBID:}
231
- */
232
- browseSeries(query?: mb.IBrowseSeriesQuery): Promise<mb.IBrowseSeriesResult>;
233
- /**
234
- * Browse works
235
- * @param query Query, like: {<entity>: <MBID:}
236
- */
237
- browseWorks(query?: mb.IBrowseWorksQuery): Promise<mb.IBrowseWorksResult>;
238
- /**
239
- * Browse URLs
240
- * @param query Query, like: {<entity>: <MBID:}
128
+ * Search an entity using a search query
129
+ * @param query e.g.: '" artist: Madonna, track: Like a virgin"' or object with search terms: {artist: Madonna}
130
+ * @param entity e.g. 'recording'
131
+ * @param query Arguments
241
132
  */
242
- browseUrls(query?: mb.IBrowseUrlsQuery): Promise<mb.IUrl>;
133
+ search(entity: 'area', query: mb.ISearchQuery<AreaIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IAreaList>;
134
+ search(artist: 'artist', query: mb.ISearchQuery<ArtistIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IArtistList>;
135
+ search(artist: 'recording', query: mb.ISearchQuery<AreaIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IRecordingList>;
136
+ search(artist: 'release', query: mb.ISearchQuery<ReleaseIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IReleaseList>;
137
+ search(artist: 'release-group', query: mb.ISearchQuery<ReleaseGroupIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IReleaseGroupList>;
138
+ search(artist: 'url', query: mb.ISearchQuery<UrlIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IUrlList>;
243
139
  postRecording(xmlMetadata: XmlMetadata): Promise<void>;
244
140
  post(entity: mb.EntityType, xmlMetadata: XmlMetadata): Promise<void>;
245
141
  login(): Promise<boolean>;
@@ -271,13 +167,6 @@ export declare class MusicBrainzApi {
271
167
  * @param editNote Edit note
272
168
  */
273
169
  addIsrc(recording: mb.IRecording, isrc: string, editNote?: string): Promise<void>;
274
- /**
275
- * Search an entity using a search query
276
- * @param query e.g.: '" artist: Madonna, track: Like a virgin"' or object with search terms: {artist: Madonna}
277
- * @param entity e.g. 'recording'
278
- * @param query Arguments
279
- */
280
- search<T extends mb.ISearchResult, I extends string = never>(entity: mb.EntityType, query: mb.ISearchQuery<I>): Promise<T>;
281
170
  /**
282
171
  * Add Spotify-ID to MusicBrainz recording.
283
172
  * This function will automatically lookup the recording title, which is required to submit the recording URL
@@ -286,11 +175,6 @@ export declare class MusicBrainzApi {
286
175
  * @param editNote Comment to add.
287
176
  */
288
177
  addSpotifyIdToRecording(recording: mb.IRecording, spotifyId: string, editNote: string): Promise<void>;
289
- searchArea(query: mb.ISearchQuery<AreaIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IAreaList>;
290
- searchArtist(query: mb.ISearchQuery<ArtistIncludes> & mb.ILinkedEntitiesArtist): Promise<mb.IArtistList>;
291
- searchRelease(query: mb.ISearchQuery<ReleasesIncludes> & mb.ILinkedEntitiesRelease): Promise<mb.IReleaseList>;
292
- searchReleaseGroup(query: mb.ISearchQuery<ReleaseGroupIncludes> & mb.ILinkedEntitiesReleaseGroup): Promise<mb.IReleaseGroupList>;
293
- searchUrl(query: mb.ISearchQuery<UrlIncludes> & mb.ILinkedEntitiesUrl): Promise<mb.IUrlList>;
294
178
  private getSession;
295
179
  }
296
180
  export declare function makeAndQueryString(keyValuePairs: IFormData): string;