musicbrainz-api 0.8.0 → 0.9.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.
Files changed (36) hide show
  1. package/.idea/$PRODUCT_WORKSPACE_FILE$ +1 -1
  2. package/.idea/misc.xml +6 -0
  3. package/.idea/modules.xml +7 -7
  4. package/.idea/vcs.xml +5 -5
  5. package/README.md +484 -311
  6. package/lib/digest-auth.d.ts +21 -21
  7. package/lib/digest-auth.js +82 -82
  8. package/lib/musicbrainz-api.d.ts +266 -174
  9. package/lib/musicbrainz-api.js +533 -418
  10. package/lib/musicbrainz.types.d.ts +584 -392
  11. package/lib/musicbrainz.types.js +16 -16
  12. package/lib/rate-limiter.d.ts +8 -8
  13. package/lib/rate-limiter.js +31 -31
  14. package/lib/xml/xml-isrc-list.d.ts +17 -17
  15. package/lib/xml/xml-isrc-list.js +22 -22
  16. package/lib/xml/xml-isrc.d.ts +10 -10
  17. package/lib/xml/xml-isrc.js +17 -17
  18. package/lib/xml/xml-metadata.d.ts +6 -6
  19. package/lib/xml/xml-metadata.js +29 -29
  20. package/lib/xml/xml-recording.d.ts +24 -24
  21. package/lib/xml/xml-recording.js +20 -20
  22. package/package.json +104 -106
  23. package/.idea/checkstyle-idea.xml +0 -16
  24. package/.idea/codeStyles/Project.xml +0 -38
  25. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  26. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  27. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_28-2-2022_22_59_[Default_Changelist]/shelved.patch +0 -453
  28. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_28-2-2022_22_59__Default_Changelist_.xml +0 -4
  29. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_3-3-2022_20_28_[Default_Changelist]/shelved.patch +0 -20
  30. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_3-3-2022_20_28__Default_Changelist_.xml +0 -4
  31. package/.idea/shelf/Uncommitted_changes_before_rebase_[Default_Changelist]/shelved.patch +0 -738
  32. package/.idea/shelf/Uncommitted_changes_before_rebase_[Default_Changelist]1/shelved.patch +0 -0
  33. package/.idea/shelf/Uncommitted_changes_before_rebase__Default_Changelist_.xml +0 -4
  34. package/.idea/workspace.xml +0 -732
  35. package/etc/config.js +0 -32
  36. package/yarn-error.log +0 -3608
@@ -1,21 +1,21 @@
1
- export interface ICredentials {
2
- username: string;
3
- password: string;
4
- }
5
- export declare class DigestAuth {
6
- private credentials;
7
- /**
8
- * RFC 2617: handle both MD5 and MD5-sess algorithms.
9
- *
10
- * If the algorithm directive's value is "MD5" or unspecified, then HA1 is
11
- * HA1=MD5(username:realm:password)
12
- * If the algorithm directive's value is "MD5-sess", then HA1 is
13
- * HA1=MD5(MD5(username:realm:password):nonce:cnonce)
14
- */
15
- static ha1Compute(algorithm: any, user: any, realm: any, pass: any, nonce: any, cnonce: any): string;
16
- hasAuth: boolean;
17
- sentAuth: boolean;
18
- bearerToken: string;
19
- constructor(credentials: ICredentials);
20
- digest(method: string, path: string, authHeader: string): string;
21
- }
1
+ export interface ICredentials {
2
+ username: string;
3
+ password: string;
4
+ }
5
+ export declare class DigestAuth {
6
+ private credentials;
7
+ /**
8
+ * RFC 2617: handle both MD5 and MD5-sess algorithms.
9
+ *
10
+ * If the algorithm directive's value is "MD5" or unspecified, then HA1 is
11
+ * HA1=MD5(username:realm:password)
12
+ * If the algorithm directive's value is "MD5-sess", then HA1 is
13
+ * HA1=MD5(MD5(username:realm:password):nonce:cnonce)
14
+ */
15
+ static ha1Compute(algorithm: any, user: any, realm: any, pass: any, nonce: any, cnonce: any): string;
16
+ hasAuth: boolean;
17
+ sentAuth: boolean;
18
+ bearerToken: string;
19
+ constructor(credentials: ICredentials);
20
+ digest(method: string, path: string, authHeader: string): string;
21
+ }
@@ -1,83 +1,83 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DigestAuth = void 0;
4
- const uuid_1 = require("uuid");
5
- const crypto = require("crypto");
6
- function md5(str) {
7
- return crypto.createHash('md5').update(str).digest('hex'); // lgtm [js/insufficient-password-hash]
8
- }
9
- class DigestAuth {
10
- constructor(credentials) {
11
- this.credentials = credentials;
12
- this.hasAuth = false;
13
- this.sentAuth = false;
14
- this.bearerToken = null;
15
- }
16
- /**
17
- * RFC 2617: handle both MD5 and MD5-sess algorithms.
18
- *
19
- * If the algorithm directive's value is "MD5" or unspecified, then HA1 is
20
- * HA1=MD5(username:realm:password)
21
- * If the algorithm directive's value is "MD5-sess", then HA1 is
22
- * HA1=MD5(MD5(username:realm:password):nonce:cnonce)
23
- */
24
- static ha1Compute(algorithm, user, realm, pass, nonce, cnonce) {
25
- const ha1 = md5(user + ':' + realm + ':' + pass); // lgtm [js/insufficient-password-hash]
26
- return algorithm && algorithm.toLowerCase() === 'md5-sess' ? md5(ha1 + ':' + nonce + ':' + cnonce) : ha1;
27
- }
28
- digest(method, path, authHeader) {
29
- // TODO: More complete implementation of RFC 2617.
30
- // - support qop="auth-int" only
31
- // - handle Authentication-Info (not necessarily?)
32
- // - check challenge.stale (not necessarily?)
33
- // - increase nc (not necessarily?)
34
- // For reference:
35
- // http://tools.ietf.org/html/rfc2617#section-3
36
- // https://github.com/bagder/curl/blob/master/lib/http_digest.c
37
- const challenge = {};
38
- const re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;
39
- while (true) {
40
- const match = re.exec(authHeader);
41
- if (!match) {
42
- break;
43
- }
44
- challenge[match[1]] = match[2] || match[3];
45
- }
46
- const qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth';
47
- const nc = qop && '00000001';
48
- const cnonce = qop && (0, uuid_1.v4)().replace(/-/g, '');
49
- const ha1 = DigestAuth.ha1Compute(challenge.algorithm, this.credentials.username, challenge.realm, this.credentials.password, challenge.nonce, cnonce);
50
- const ha2 = md5(method + ':' + path); // lgtm [js/insufficient-password-hash]
51
- const digestResponse = qop
52
- ? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2) // lgtm [js/insufficient-password-hash]
53
- : md5(ha1 + ':' + challenge.nonce + ':' + ha2); // lgtm [js/insufficient-password-hash]
54
- const authValues = {
55
- username: this.credentials.username,
56
- realm: challenge.realm,
57
- nonce: challenge.nonce,
58
- uri: path,
59
- qop,
60
- response: digestResponse,
61
- nc,
62
- cnonce,
63
- algorithm: challenge.algorithm,
64
- opaque: challenge.opaque
65
- };
66
- const parts = [];
67
- for (const k in authValues) {
68
- if (authValues[k]) {
69
- if (k === 'qop' || k === 'nc' || k === 'algorithm') {
70
- parts.push(k + '=' + authValues[k]);
71
- }
72
- else {
73
- parts.push(k + '="' + authValues[k] + '"');
74
- }
75
- }
76
- }
77
- authHeader = 'Digest ' + parts.join(', ');
78
- this.sentAuth = true;
79
- return authHeader;
80
- }
81
- }
82
- exports.DigestAuth = DigestAuth;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DigestAuth = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const crypto = require("crypto");
6
+ function md5(str) {
7
+ return crypto.createHash('md5').update(str).digest('hex'); // lgtm [js/insufficient-password-hash]
8
+ }
9
+ class DigestAuth {
10
+ constructor(credentials) {
11
+ this.credentials = credentials;
12
+ this.hasAuth = false;
13
+ this.sentAuth = false;
14
+ this.bearerToken = null;
15
+ }
16
+ /**
17
+ * RFC 2617: handle both MD5 and MD5-sess algorithms.
18
+ *
19
+ * If the algorithm directive's value is "MD5" or unspecified, then HA1 is
20
+ * HA1=MD5(username:realm:password)
21
+ * If the algorithm directive's value is "MD5-sess", then HA1 is
22
+ * HA1=MD5(MD5(username:realm:password):nonce:cnonce)
23
+ */
24
+ static ha1Compute(algorithm, user, realm, pass, nonce, cnonce) {
25
+ const ha1 = md5(user + ':' + realm + ':' + pass); // lgtm [js/insufficient-password-hash]
26
+ return algorithm && algorithm.toLowerCase() === 'md5-sess' ? md5(ha1 + ':' + nonce + ':' + cnonce) : ha1;
27
+ }
28
+ digest(method, path, authHeader) {
29
+ // TODO: More complete implementation of RFC 2617.
30
+ // - support qop="auth-int" only
31
+ // - handle Authentication-Info (not necessarily?)
32
+ // - check challenge.stale (not necessarily?)
33
+ // - increase nc (not necessarily?)
34
+ // For reference:
35
+ // http://tools.ietf.org/html/rfc2617#section-3
36
+ // https://github.com/bagder/curl/blob/master/lib/http_digest.c
37
+ const challenge = {};
38
+ const re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;
39
+ while (true) {
40
+ const match = re.exec(authHeader);
41
+ if (!match) {
42
+ break;
43
+ }
44
+ challenge[match[1]] = match[2] || match[3];
45
+ }
46
+ const qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth';
47
+ const nc = qop && '00000001';
48
+ const cnonce = qop && (0, uuid_1.v4)().replace(/-/g, '');
49
+ const ha1 = DigestAuth.ha1Compute(challenge.algorithm, this.credentials.username, challenge.realm, this.credentials.password, challenge.nonce, cnonce);
50
+ const ha2 = md5(method + ':' + path); // lgtm [js/insufficient-password-hash]
51
+ const digestResponse = qop
52
+ ? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2) // lgtm [js/insufficient-password-hash]
53
+ : md5(ha1 + ':' + challenge.nonce + ':' + ha2); // lgtm [js/insufficient-password-hash]
54
+ const authValues = {
55
+ username: this.credentials.username,
56
+ realm: challenge.realm,
57
+ nonce: challenge.nonce,
58
+ uri: path,
59
+ qop,
60
+ response: digestResponse,
61
+ nc,
62
+ cnonce,
63
+ algorithm: challenge.algorithm,
64
+ opaque: challenge.opaque
65
+ };
66
+ const parts = [];
67
+ for (const k in authValues) {
68
+ if (authValues[k]) {
69
+ if (k === 'qop' || k === 'nc' || k === 'algorithm') {
70
+ parts.push(k + '=' + authValues[k]);
71
+ }
72
+ else {
73
+ parts.push(k + '="' + authValues[k] + '"');
74
+ }
75
+ }
76
+ }
77
+ authHeader = 'Digest ' + parts.join(', ');
78
+ this.sentAuth = true;
79
+ return authHeader;
80
+ }
81
+ }
82
+ exports.DigestAuth = DigestAuth;
83
83
  //# sourceMappingURL=digest-auth.js.map
@@ -1,174 +1,266 @@
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';
8
- /**
9
- * https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#Subqueries
10
- */
11
- export declare type Includes = 'artists' | 'releases' | 'recordings' | 'artist-credits' | 'isrcs' | 'url-rels' | 'release-groups' | 'aliases' | 'discids' | 'annotation' | 'media' | 'area-rels' | 'artist-rels' | 'event-rels' | 'instrument-rels' | 'label-rels' | 'place-rels' | 'recording-rels' | 'release-rels' | 'release-group-rels' | 'series-rels' | 'work-rels';
12
- export interface IFormData {
13
- [key: string]: string | number;
14
- }
15
- export interface IMusicBrainzConfig {
16
- botAccount?: {
17
- username: string;
18
- password: string;
19
- };
20
- baseUrl?: string;
21
- appName?: string;
22
- appVersion?: string;
23
- /**
24
- * HTTP Proxy
25
- */
26
- proxy?: string;
27
- /**
28
- * User e-mail address or application URL
29
- */
30
- appContactInfo?: string;
31
- }
32
- export interface ISessionInformation {
33
- csrf: {
34
- sessionKey: string;
35
- token: string;
36
- };
37
- loggedIn?: boolean;
38
- }
39
- export declare class MusicBrainzApi {
40
- private static escapeText;
41
- readonly config: IMusicBrainzConfig;
42
- private rateLimiter;
43
- private options;
44
- private session;
45
- static fetchCsrf(html: string): {
46
- sessionKey: string;
47
- token: string;
48
- };
49
- private static fetchValue;
50
- private getCookies;
51
- constructor(_config?: IMusicBrainzConfig);
52
- restGet<T>(relUrl: string, query?: {
53
- [key: string]: any;
54
- }, attempt?: number): Promise<T>;
55
- /**
56
- * Generic lookup function
57
- * @param entity
58
- * @param mbid
59
- * @param inc
60
- */
61
- lookupEntity<T>(entity: mb.EntityType, mbid: string, inc?: Includes[]): Promise<T>;
62
- /**
63
- * Lookup area
64
- * @param areaId Area MBID
65
- * @param inc Sub-queries
66
- */
67
- lookupArea(areaId: string, inc?: Includes[]): Promise<mb.IArea>;
68
- /**
69
- * Lookup artist
70
- * @param artistId Artist MBID
71
- * @param inc Sub-queries
72
- */
73
- lookupArtist(artistId: string, inc?: Includes[]): Promise<mb.IArtist>;
74
- /**
75
- * Lookup instrument
76
- * @param artistId Instrument MBID
77
- * @param inc Sub-queries
78
- */
79
- lookupInstrument(instrumentId: string, inc?: Includes[]): Promise<mb.IInstrument>;
80
- /**
81
- * Lookup label
82
- * @param labelId Area MBID
83
- * @param inc Sub-queries
84
- */
85
- lookupLabel(labelId: string, inc?: Includes[]): Promise<mb.ILabel>;
86
- /**
87
- * Lookup place
88
- * @param placeId Area MBID
89
- * @param inc Sub-queries
90
- */
91
- lookupPlace(placeId: string, inc?: Includes[]): Promise<mb.IPlace>;
92
- /**
93
- * Lookup release
94
- * @param releaseId Release MBID
95
- * @param inc Include: artist-credits, labels, recordings, release-groups, media, discids, isrcs (with recordings)
96
- * ToDo: ['recordings', 'artists', 'artist-credits', 'isrcs', 'url-rels', 'release-groups']
97
- */
98
- lookupRelease(releaseId: string, inc?: Includes[]): Promise<mb.IRelease>;
99
- /**
100
- * Lookup release-group
101
- * @param releaseGroupId Release-group MBID
102
- * @param inc Include: ToDo
103
- */
104
- lookupReleaseGroup(releaseGroupId: string, inc?: Includes[]): Promise<mb.IReleaseGroup>;
105
- /**
106
- * Lookup recording
107
- * @param recordingId Label MBID
108
- * @param inc Include: artist-credits, isrcs
109
- */
110
- lookupRecording(recordingId: string, inc?: Includes[]): Promise<mb.IRecording>;
111
- /**
112
- * Lookup work
113
- * @param workId Work MBID
114
- */
115
- lookupWork(workId: string): Promise<mb.IWork>;
116
- /**
117
- * Lookup URL
118
- * @param urlId URL MBID
119
- */
120
- lookupUrl(urlId: string): Promise<mb.IUrl>;
121
- postRecording(xmlMetadata: XmlMetadata): Promise<void>;
122
- post(entity: mb.EntityType, xmlMetadata: XmlMetadata): Promise<void>;
123
- login(): Promise<boolean>;
124
- /**
125
- * Logout
126
- */
127
- logout(): Promise<boolean>;
128
- /**
129
- * Submit entity
130
- * @param entity Entity type e.g. 'recording'
131
- * @param mbid
132
- * @param formData
133
- */
134
- editEntity(entity: mb.EntityType, mbid: string, formData: Record<string, any>): Promise<void>;
135
- /**
136
- * Set URL to recording
137
- * @param recording Recording to update
138
- * @param url2add URL to add to the recording
139
- * @param editNote Edit note
140
- */
141
- addUrlToRecording(recording: mb.IRecording, url2add: {
142
- linkTypeId: mb.LinkType;
143
- text: string;
144
- }, editNote?: string): Promise<void>;
145
- /**
146
- * Add ISRC to recording
147
- * @param recording Recording to update
148
- * @param isrc ISRC code to add
149
- * @param editNote Edit note
150
- */
151
- addIsrc(recording: mb.IRecording, isrc: string, editNote?: string): Promise<void>;
152
- /**
153
- * Search an entity using a search query
154
- * @param query e.g.: '" artist: Madonna, track: Like a virgin"' or object with search terms: {artist: Madonna}
155
- * @param entity e.g. 'recording'
156
- * @param query Arguments
157
- */
158
- search<T extends mb.ISearchResult>(entity: mb.EntityType, query: mb.ISearchQuery): Promise<T>;
159
- /**
160
- * Add Spotify-ID to MusicBrainz recording.
161
- * This function will automatically lookup the recording title, which is required to submit the recording URL
162
- * @param recording MBID of the recording
163
- * @param spotifyId Spotify ID
164
- * @param editNote Comment to add.
165
- */
166
- addSpotifyIdToRecording(recording: mb.IRecording, spotifyId: string, editNote: string): Promise<void>;
167
- searchArea(query: mb.ISearchQuery & mb.ILinkedEntitiesArea): Promise<mb.IAreaList>;
168
- searchArtist(query: mb.ISearchQuery & mb.ILinkedEntitiesArtist): Promise<mb.IArtistList>;
169
- searchRelease(query: mb.ISearchQuery & mb.ILinkedEntitiesRelease): Promise<mb.IReleaseList>;
170
- searchReleaseGroup(query: mb.ISearchQuery & mb.ILinkedEntitiesReleaseGroup): Promise<mb.IReleaseGroupList>;
171
- searchUrl(query: mb.ISearchQuery & mb.ILinkedEntitiesUrl): Promise<mb.IUrlList>;
172
- private getSession;
173
- }
174
- export declare function makeAndQueryString(keyValuePairs: IFormData): string;
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';
8
+ export declare 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
+ export declare type MiscIncludes = 'aliases' | 'annotation' | 'tags' | 'genres' | 'ratings' | 'media';
10
+ export declare type AreaIncludes = MiscIncludes | RelationsIncludes;
11
+ export declare type ArtistIncludes = MiscIncludes | RelationsIncludes | 'recordings' | 'releases' | 'release-groups' | 'works';
12
+ export declare type CollectionIncludes = MiscIncludes | RelationsIncludes | 'user-collections';
13
+ export declare type EventIncludes = MiscIncludes | RelationsIncludes;
14
+ export declare type GenreIncludes = MiscIncludes;
15
+ export declare type InstrumentIncludes = MiscIncludes | RelationsIncludes;
16
+ export declare type LabelIncludes = MiscIncludes | RelationsIncludes | 'releases';
17
+ export declare type PlaceIncludes = MiscIncludes | RelationsIncludes;
18
+ export declare type RecordingIncludes = MiscIncludes | RelationsIncludes | 'artists' | 'releases' | 'isrcs';
19
+ export declare type ReleasesIncludes = MiscIncludes | RelationsIncludes | 'artists' | 'collections' | 'labels' | 'recordings' | 'release-groups';
20
+ export declare type ReleaseGroupIncludes = MiscIncludes | RelationsIncludes | 'artists' | 'releases';
21
+ export declare type SeriesIncludes = MiscIncludes | RelationsIncludes;
22
+ export declare type WorkIncludes = MiscIncludes | RelationsIncludes;
23
+ export declare type UrlIncludes = RelationsIncludes;
24
+ export interface IFormData {
25
+ [key: string]: string | number;
26
+ }
27
+ export interface IMusicBrainzConfig {
28
+ botAccount?: {
29
+ username: string;
30
+ password: string;
31
+ };
32
+ baseUrl?: string;
33
+ appName?: string;
34
+ appVersion?: string;
35
+ /**
36
+ * HTTP Proxy
37
+ */
38
+ proxy?: string;
39
+ /**
40
+ * User e-mail address or application URL
41
+ */
42
+ appContactInfo?: string;
43
+ }
44
+ export interface ISessionInformation {
45
+ csrf: {
46
+ sessionKey: string;
47
+ token: string;
48
+ };
49
+ loggedIn?: boolean;
50
+ }
51
+ export declare class MusicBrainzApi {
52
+ private static escapeText;
53
+ readonly config: IMusicBrainzConfig;
54
+ private rateLimiter;
55
+ private options;
56
+ private session;
57
+ static fetchCsrf(html: string): {
58
+ sessionKey: string;
59
+ token: string;
60
+ };
61
+ private static fetchValue;
62
+ private getCookies;
63
+ constructor(_config?: IMusicBrainzConfig);
64
+ restGet<T>(relUrl: string, query?: {
65
+ [key: string]: any;
66
+ }, attempt?: number): Promise<T>;
67
+ /**
68
+ * Generic lookup function
69
+ * @param entity
70
+ * @param mbid
71
+ * @param inc
72
+ */
73
+ lookupEntity<T, I extends string = never>(entity: mb.EntityType, mbid: string, inc?: I[]): Promise<T>;
74
+ /**
75
+ * Lookup area
76
+ * @param areaId Area MBID
77
+ * @param inc Sub-queries
78
+ */
79
+ lookupArea(areaId: string, inc?: AreaIncludes[]): Promise<mb.IArea>;
80
+ /**
81
+ * Lookup artist
82
+ * @param artistId Artist MBID
83
+ * @param inc Sub-queries
84
+ */
85
+ lookupArtist(artistId: string, inc?: ArtistIncludes[]): Promise<mb.IArtist>;
86
+ /**
87
+ * Lookup instrument
88
+ * @param artistId Instrument MBID
89
+ * @param inc Sub-queries
90
+ */
91
+ lookupInstrument(instrumentId: string, inc?: InstrumentIncludes[]): Promise<mb.IInstrument>;
92
+ /**
93
+ * Lookup label
94
+ * @param labelId Area MBID
95
+ * @param inc Sub-queries
96
+ */
97
+ lookupLabel(labelId: string, inc?: LabelIncludes[]): Promise<mb.ILabel>;
98
+ /**
99
+ * Lookup place
100
+ * @param placeId Area MBID
101
+ * @param inc Sub-queries
102
+ */
103
+ lookupPlace(placeId: string, inc?: PlaceIncludes[]): Promise<mb.IPlace>;
104
+ /**
105
+ * Lookup release
106
+ * @param releaseId Release MBID
107
+ * @param inc Include: artist-credits, labels, recordings, release-groups, media, discids, isrcs (with recordings)
108
+ * ToDo: ['recordings', 'artists', 'artist-credits', 'isrcs', 'url-rels', 'release-groups']
109
+ */
110
+ lookupRelease(releaseId: string, inc?: ReleasesIncludes[]): Promise<mb.IRelease>;
111
+ /**
112
+ * Lookup release-group
113
+ * @param releaseGroupId Release-group MBID
114
+ * @param inc Include: ToDo
115
+ */
116
+ lookupReleaseGroup(releaseGroupId: string, inc?: ReleaseGroupIncludes[]): Promise<mb.IReleaseGroup>;
117
+ /**
118
+ * Lookup recording
119
+ * @param recordingId Label MBID
120
+ * @param inc Include: artist-credits, isrcs
121
+ */
122
+ lookupRecording(recordingId: string, inc?: RecordingIncludes[]): Promise<mb.IRecording>;
123
+ /**
124
+ * Lookup work
125
+ * @param workId Work MBID
126
+ */
127
+ lookupWork(workId: string, inc?: WorkIncludes[]): Promise<mb.IWork>;
128
+ /**
129
+ * Lookup URL
130
+ * @param urlId URL MBID
131
+ */
132
+ lookupUrl(urlId: string, inc?: UrlIncludes[]): Promise<mb.IUrl>;
133
+ /**
134
+ * Lookup Event
135
+ * @param eventId Event MBID
136
+ * @param eventIncludes List of sub-queries to enable
137
+ */
138
+ lookupEvent(eventId: string, eventIncludes?: EventIncludes[]): Promise<mb.IEvent>;
139
+ /**
140
+ * Generic browse function
141
+ * https://wiki.musicbrainz.org/Development/JSON_Web_Service#Browse_Requests
142
+ * @param entity MusicBrainz entity
143
+ * @param query Query, like: {<entity>: <MBID:}
144
+ */
145
+ browseEntity<T>(entity: mb.EntityType, query?: {
146
+ [key: string]: any;
147
+ }): Promise<T>;
148
+ /**
149
+ * Browse areas
150
+ * @param query Query, like: {<entity>: <MBID:}
151
+ */
152
+ browseAreas(query?: mb.IBrowseAreasQuery): Promise<mb.IBrowseAreasResult>;
153
+ /**
154
+ * Browse artists
155
+ * @param query Query, like: {<entity>: <MBID:}
156
+ */
157
+ browseArtists(query?: mb.IBrowseArtistsQuery): Promise<mb.IBrowseArtistsResult>;
158
+ /**
159
+ * Browse collections
160
+ * @param query Query, like: {<entity>: <MBID:}
161
+ */
162
+ browseCollections(query?: mb.IBrowseCollectionsQuery): Promise<mb.IBrowseCollectionsResult>;
163
+ /**
164
+ * Browse events
165
+ * @param query Query, like: {<entity>: <MBID:}
166
+ */
167
+ browseEvents(query?: mb.IBrowseEventsQuery): Promise<mb.IBrowseEventsResult>;
168
+ /**
169
+ * Browse instruments
170
+ * @param query Query, like: {<entity>: <MBID:}
171
+ */
172
+ browseInstruments(query?: mb.IBrowseInstrumentsQuery): Promise<mb.IBrowseInstrumentsResult>;
173
+ /**
174
+ * Browse labels
175
+ * @param query Query, like: {<entity>: <MBID:}
176
+ */
177
+ browseLabels(query?: mb.IBrowseLabelsQuery): Promise<mb.IBrowseLabelsResult>;
178
+ /**
179
+ * Browse places
180
+ * @param query Query, like: {<entity>: <MBID:}
181
+ */
182
+ browsePlaces(query?: mb.IBrowsePlacesQuery): Promise<mb.IBrowsePlacesResult>;
183
+ /**
184
+ * Browse recordings
185
+ * @param query Query, like: {<entity>: <MBID:}
186
+ */
187
+ browseRecordings(query?: mb.IBrowseRecordingsQuery): Promise<mb.IBrowseRecordingsResult>;
188
+ /**
189
+ * Browse releases
190
+ * @param query Query, like: {<entity>: <MBID:}
191
+ */
192
+ browseReleases(query?: mb.IBrowseReleasesQuery): Promise<mb.IBrowseReleasesResult>;
193
+ /**
194
+ * Browse release-groups
195
+ * @param query Query, like: {<entity>: <MBID:}
196
+ */
197
+ browseReleaseGroups(query?: mb.IReleaseGroupsQuery): Promise<mb.IBrowseReleaseGroupsResult>;
198
+ /**
199
+ * Browse series
200
+ * @param query Query, like: {<entity>: <MBID:}
201
+ */
202
+ browseSeries(query?: mb.IBrowseSeriesQuery): Promise<mb.IBrowseSeriesResult>;
203
+ /**
204
+ * Browse works
205
+ * @param query Query, like: {<entity>: <MBID:}
206
+ */
207
+ browseWorks(query?: mb.IBrowseWorksQuery): Promise<mb.IBrowseWorksResult>;
208
+ /**
209
+ * Browse URLs
210
+ * @param query Query, like: {<entity>: <MBID:}
211
+ */
212
+ browseUrls(query?: mb.IBrowseUrlsQuery): Promise<mb.IUrl>;
213
+ postRecording(xmlMetadata: XmlMetadata): Promise<void>;
214
+ post(entity: mb.EntityType, xmlMetadata: XmlMetadata): Promise<void>;
215
+ login(): Promise<boolean>;
216
+ /**
217
+ * Logout
218
+ */
219
+ logout(): Promise<boolean>;
220
+ /**
221
+ * Submit entity
222
+ * @param entity Entity type e.g. 'recording'
223
+ * @param mbid
224
+ * @param formData
225
+ */
226
+ editEntity(entity: mb.EntityType, mbid: string, formData: Record<string, any>): Promise<void>;
227
+ /**
228
+ * Set URL to recording
229
+ * @param recording Recording to update
230
+ * @param url2add URL to add to the recording
231
+ * @param editNote Edit note
232
+ */
233
+ addUrlToRecording(recording: mb.IRecording, url2add: {
234
+ linkTypeId: mb.LinkType;
235
+ text: string;
236
+ }, editNote?: string): Promise<void>;
237
+ /**
238
+ * Add ISRC to recording
239
+ * @param recording Recording to update
240
+ * @param isrc ISRC code to add
241
+ * @param editNote Edit note
242
+ */
243
+ addIsrc(recording: mb.IRecording, isrc: string, editNote?: string): Promise<void>;
244
+ /**
245
+ * Search an entity using a search query
246
+ * @param query e.g.: '" artist: Madonna, track: Like a virgin"' or object with search terms: {artist: Madonna}
247
+ * @param entity e.g. 'recording'
248
+ * @param query Arguments
249
+ */
250
+ search<T extends mb.ISearchResult, I extends string = never>(entity: mb.EntityType, query: mb.ISearchQuery<I>): Promise<T>;
251
+ /**
252
+ * Add Spotify-ID to MusicBrainz recording.
253
+ * This function will automatically lookup the recording title, which is required to submit the recording URL
254
+ * @param recording MBID of the recording
255
+ * @param spotifyId Spotify ID
256
+ * @param editNote Comment to add.
257
+ */
258
+ addSpotifyIdToRecording(recording: mb.IRecording, spotifyId: string, editNote: string): Promise<void>;
259
+ searchArea(query: mb.ISearchQuery<AreaIncludes> & mb.ILinkedEntitiesArea): Promise<mb.IAreaList>;
260
+ searchArtist(query: mb.ISearchQuery<ArtistIncludes> & mb.ILinkedEntitiesArtist): Promise<mb.IArtistList>;
261
+ searchRelease(query: mb.ISearchQuery<ReleasesIncludes> & mb.ILinkedEntitiesRelease): Promise<mb.IReleaseList>;
262
+ searchReleaseGroup(query: mb.ISearchQuery<ReleaseGroupIncludes> & mb.ILinkedEntitiesReleaseGroup): Promise<mb.IReleaseGroupList>;
263
+ searchUrl(query: mb.ISearchQuery<UrlIncludes> & mb.ILinkedEntitiesUrl): Promise<mb.IUrlList>;
264
+ private getSession;
265
+ }
266
+ export declare function makeAndQueryString(keyValuePairs: IFormData): string;