UNPKG

javascript-ampache

Version:
1 lines 156 kB
{"version":3,"file":"index.modern.mjs","sources":["../src/albums.js","../src/artists.js","../node_modules/querystringify/index.js","../node_modules/unfetch/dist/unfetch.module.js","../node_modules/isomorphic-unfetch/browser.js","../node_modules/jssha/dist/sha256.mjs","../src/utils.js","../src/auth.js","../src/bookmarks.js","../src/catalogs.js","../src/genres.js","../src/labels.js","../src/licenses.js","../src/live-streams.js","../src/playlists.js","../src/podcasts.js","../src/preferences.js","../src/shares.js","../src/shouts.js","../src/songs.js","../src/system.js","../src/users.js","../src/videos.js","../src/base.js","../src/index.js"],"sourcesContent":["/**\r\n * @typedef {Object} AlbumSummary\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {string|null} prefix\r\n * @property {string} basename\r\n */\r\n\r\n/**\r\n * @typedef {Object} AlbumResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {string|null} prefix\r\n * @property {string} basename\r\n * @property {import(\"./artists.js\").ArtistSummary} artist\r\n * @property {import(\"./artists.js\").ArtistSummary[]} artists\r\n * @property {import(\"./artists.js\").ArtistSummary[]} songartists\r\n * @property {number} time\r\n * @property {number|string} year\r\n * @property {import(\"./songs.js\").SongResponse[]} [tracks]\r\n * @property {number} songcount\r\n * @property {number} disccount\r\n * @property {string|null} type\r\n * @property {import(\"./genres.js\").GenreSummary[]} genre\r\n * @property {string} art\r\n * @property {boolean} has_art\r\n * @property {boolean} flag\r\n * @property {number|null} rating\r\n * @property {number|null} averagerating\r\n * @property {string|null} mbid\r\n */\r\n\r\n/**\r\n * @typedef {Object} AlbumsResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {AlbumResponse[]} album\r\n */\r\n\r\nexport const albumsMethods = {\r\n /**\r\n * This returns albums based on the provided search filters\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} [params]\r\n * @param {string} [params.filter] Filter results to match this string\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)\r\n * @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date\r\n * @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date\r\n * @param {\"albums\"|\"songs\"} [params.include] albums, songs (include child objects in the response)\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<AlbumsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#albums}\r\n */\r\n albums(params) {\r\n return this.call(\"albums\", params);\r\n },\r\n\r\n /**\r\n * This returns a single album based on the UID provided\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {\"songs\"} [params.include] songs (include child objects in the response)\r\n * @returns {Promise<AlbumResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#album}\r\n */\r\n album(params) {\r\n return this.call(\"album\", params);\r\n },\r\n\r\n /**\r\n * This returns the albums of an artist\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.album_artist] 0, 1 (if true filter for album artists only)\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<AlbumsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#artist_albums}\r\n */\r\n artistAlbums(params) {\r\n return this.call(\"artist_albums\", params);\r\n },\r\n\r\n /**\r\n * This returns the albums associated with the genre in question\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} [params]\r\n * @param {import(\"./base.js\").UID} [params.filter] UID to find\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<AlbumsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#genre_albums}\r\n */\r\n genreAlbums(params) {\r\n return this.call(\"genre_albums\", params);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} ArtistSummary\r\n * @property {string} id\r\n * @property {string} name\r\n * @property {string|null} prefix\r\n * @property {string} basename\r\n */\r\n\r\n/**\r\n * @typedef {Object} ArtistResponse\r\n * @property {string} id\r\n * @property {string} name\r\n * @property {string|null} prefix\r\n * @property {string} basename\r\n * @property {import(\"./albums.js\").AlbumResponse[]} albums\r\n * @property {number} albumcount\r\n * @property {import(\"./songs.js\").SongsResponse[]} songs\r\n * @property {number} songcount\r\n * @property {import(\"./genres.js\").GenreResponse[]} genre\r\n * @property {string} art\r\n * @property {boolean} has_art\r\n * @property {boolean} flag\r\n * @property {number|null} rating\r\n * @property {number|null} averagerating\r\n * @property {string|null} mbid\r\n * @property {string} summary\r\n * @property {number} time\r\n * @property {number} yearformed\r\n * @property {string} placeformed\r\n */\r\n\r\n/**\r\n * @typedef {Object} ArtistsResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {ArtistResponse[]} artist\r\n */\r\n\r\nexport const artistsMethods = {\r\n /**\r\n * This takes a collection of inputs and returns artist objects\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} [params]\r\n * @param {string} [params.filter] Filter results to match this string\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)\r\n * @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date\r\n * @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date\r\n * @param {\"albums\"|\"songs\"} [params.include] (albums | songs) include child objects in the response\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.album_artist] 0, 1 (if true filter for album artists only)\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<ArtistsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#artists}\r\n */\r\n artists(params) {\r\n return this.call(\"artists\", params);\r\n },\r\n\r\n /**\r\n * This returns a single artist based on the UID of said artist\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {\"albums\"|\"songs\"} [params.include] (albums | songs) include child objects in the response\r\n * @returns {Promise<ArtistResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#artist}\r\n */\r\n artist(params) {\r\n return this.call(\"artist\", params);\r\n },\r\n\r\n /**\r\n * This returns the artists associated with the genre in question as defined by the UID\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<ArtistsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#genre_artists}\r\n */\r\n genreArtists(params) {\r\n return this.call(\"genre_artists\", params);\r\n },\r\n\r\n /**\r\n * This returns the artists associated with the label in question as defined by the UID\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID of find\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<ArtistsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#label_artists}\r\n */\r\n labelArtists(params) {\r\n return this.call(\"label_artists\", params);\r\n },\r\n};\r\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , undef;\n\n/**\n * Decode a URI encoded string.\n *\n * @param {String} input The URI encoded string.\n * @returns {String|Null} The decoded string.\n * @api private\n */\nfunction decode(input) {\n try {\n return decodeURIComponent(input.replace(/\\+/g, ' '));\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Attempts to encode a given input.\n *\n * @param {String} input The string that needs to be encoded.\n * @returns {String|Null} The encoded string.\n * @api private\n */\nfunction encode(input) {\n try {\n return encodeURIComponent(input);\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Simple query string parser.\n *\n * @param {String} query The query string that needs to be parsed.\n * @returns {Object}\n * @api public\n */\nfunction querystring(query) {\n var parser = /([^=?#&]+)=?([^&]*)/g\n , result = {}\n , part;\n\n while (part = parser.exec(query)) {\n var key = decode(part[1])\n , value = decode(part[2]);\n\n //\n // Prevent overriding of existing properties. This ensures that build-in\n // methods like `toString` or __proto__ are not overriden by malicious\n // querystrings.\n //\n // In the case if failed decoding, we want to omit the key/value pairs\n // from the result.\n //\n if (key === null || value === null || key in result) continue;\n result[key] = value;\n }\n\n return result;\n}\n\n/**\n * Transform a query string to an object.\n *\n * @param {Object} obj Object that should be transformed.\n * @param {String} prefix Optional prefix.\n * @returns {String}\n * @api public\n */\nfunction querystringify(obj, prefix) {\n prefix = prefix || '';\n\n var pairs = []\n , value\n , key;\n\n //\n // Optionally prefix with a '?' if needed\n //\n if ('string' !== typeof prefix) prefix = '?';\n\n for (key in obj) {\n if (has.call(obj, key)) {\n value = obj[key];\n\n //\n // Edge cases where we actually want to encode the value to an empty\n // string instead of the stringified value.\n //\n if (!value && (value === null || value === undef || isNaN(value))) {\n value = '';\n }\n\n key = encode(key);\n value = encode(value);\n\n //\n // If we failed to encode the strings, we should bail out as we don't\n // want to add invalid strings to the query.\n //\n if (key === null || value === null) continue;\n pairs.push(key +'='+ value);\n }\n }\n\n return pairs.length ? prefix + pairs.join('&') : '';\n}\n\n//\n// Expose the module.\n//\nexports.stringify = querystringify;\nexports.parse = querystring;\n","export default function(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t}),t(a())},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null)})}\n//# sourceMappingURL=unfetch.module.js.map\n","module.exports = self.fetch || (self.fetch = require('unfetch').default || require('unfetch'));\n","/**\n * A JavaScript implementation of the SHA family of hashes - defined in FIPS PUB 180-4, FIPS PUB 202,\n * and SP 800-185 - as well as the corresponding HMAC implementation as defined in FIPS PUB 198-1.\n *\n * Copyright 2008-2023 Brian Turek, 1998-2009 Paul Johnston & Contributors\n * Distributed under the BSD License\n * See http://caligatio.github.com/jsSHA/ for more information\n */\nconst t=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",r=\"ARRAYBUFFER not supported by this environment\",n=\"UINT8ARRAY not supported by this environment\";function i(t,r,n,i){let e,s,o;const h=r||[0],u=(n=n||0)>>>3,f=-1===i?3:0;for(e=0;e<t.length;e+=1)o=e+u,s=o>>>2,h.length<=s&&h.push(0),h[s]|=t[e]<<8*(f+i*(o%4));return{value:h,binLen:8*t.length+n}}function e(e,s,o){switch(s){case\"UTF8\":case\"UTF16BE\":case\"UTF16LE\":break;default:throw new Error(\"encoding must be UTF8, UTF16BE, or UTF16LE\")}switch(e){case\"HEX\":return function(t,r,n){return function(t,r,n,i){let e,s,o,h;if(0!=t.length%2)throw new Error(\"String of HEX type must be in byte increments\");const u=r||[0],f=(n=n||0)>>>3,c=-1===i?3:0;for(e=0;e<t.length;e+=2){if(s=parseInt(t.substr(e,2),16),isNaN(s))throw new Error(\"String of HEX type contains invalid characters\");for(h=(e>>>1)+f,o=h>>>2;u.length<=o;)u.push(0);u[o]|=s<<8*(c+i*(h%4))}return{value:u,binLen:4*t.length+n}}(t,r,n,o)};case\"TEXT\":return function(t,r,n){return function(t,r,n,i,e){let s,o,h,u,f,c,a,w,E=0;const l=n||[0],A=(i=i||0)>>>3;if(\"UTF8\"===r)for(a=-1===e?3:0,h=0;h<t.length;h+=1)for(s=t.charCodeAt(h),o=[],128>s?o.push(s):2048>s?(o.push(192|s>>>6),o.push(128|63&s)):55296>s||57344<=s?o.push(224|s>>>12,128|s>>>6&63,128|63&s):(h+=1,s=65536+((1023&s)<<10|1023&t.charCodeAt(h)),o.push(240|s>>>18,128|s>>>12&63,128|s>>>6&63,128|63&s)),u=0;u<o.length;u+=1){for(c=E+A,f=c>>>2;l.length<=f;)l.push(0);l[f]|=o[u]<<8*(a+e*(c%4)),E+=1}else for(a=-1===e?2:0,w=\"UTF16LE\"===r&&1!==e||\"UTF16LE\"!==r&&1===e,h=0;h<t.length;h+=1){for(s=t.charCodeAt(h),!0===w&&(u=255&s,s=u<<8|s>>>8),c=E+A,f=c>>>2;l.length<=f;)l.push(0);l[f]|=s<<8*(a+e*(c%4)),E+=2}return{value:l,binLen:8*E+i}}(t,s,r,n,o)};case\"B64\":return function(r,n,i){return function(r,n,i,e){let s,o,h,u,f,c,a,w=0;const E=n||[0],l=(i=i||0)>>>3,A=-1===e?3:0,p=r.indexOf(\"=\");if(-1===r.search(/^[a-zA-Z0-9=+/]+$/))throw new Error(\"Invalid character in base-64 string\");if(r=r.replace(/=/g,\"\"),-1!==p&&p<r.length)throw new Error(\"Invalid '=' found in base-64 string\");for(o=0;o<r.length;o+=4){for(f=r.substr(o,4),u=0,h=0;h<f.length;h+=1)s=t.indexOf(f.charAt(h)),u|=s<<18-6*h;for(h=0;h<f.length-1;h+=1){for(a=w+l,c=a>>>2;E.length<=c;)E.push(0);E[c]|=(u>>>16-8*h&255)<<8*(A+e*(a%4)),w+=1}}return{value:E,binLen:8*w+i}}(r,n,i,o)};case\"BYTES\":return function(t,r,n){return function(t,r,n,i){let e,s,o,h;const u=r||[0],f=(n=n||0)>>>3,c=-1===i?3:0;for(s=0;s<t.length;s+=1)e=t.charCodeAt(s),h=s+f,o=h>>>2,u.length<=o&&u.push(0),u[o]|=e<<8*(c+i*(h%4));return{value:u,binLen:8*t.length+n}}(t,r,n,o)};case\"ARRAYBUFFER\":try{new ArrayBuffer(0)}catch(t){throw new Error(r)}return function(t,r,n){return function(t,r,n,e){return i(new Uint8Array(t),r,n,e)}(t,r,n,o)};case\"UINT8ARRAY\":try{new Uint8Array(0)}catch(t){throw new Error(n)}return function(t,r,n){return i(t,r,n,o)};default:throw new Error(\"format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY\")}}function s(i,e,s,o){switch(i){case\"HEX\":return function(t){return function(t,r,n,i){const e=\"0123456789abcdef\";let s,o,h=\"\";const u=r/8,f=-1===n?3:0;for(s=0;s<u;s+=1)o=t[s>>>2]>>>8*(f+n*(s%4)),h+=e.charAt(o>>>4&15)+e.charAt(15&o);return i.outputUpper?h.toUpperCase():h}(t,e,s,o)};case\"B64\":return function(r){return function(r,n,i,e){let s,o,h,u,f,c=\"\";const a=n/8,w=-1===i?3:0;for(s=0;s<a;s+=3)for(u=s+1<a?r[s+1>>>2]:0,f=s+2<a?r[s+2>>>2]:0,h=(r[s>>>2]>>>8*(w+i*(s%4))&255)<<16|(u>>>8*(w+i*((s+1)%4))&255)<<8|f>>>8*(w+i*((s+2)%4))&255,o=0;o<4;o+=1)c+=8*s+6*o<=n?t.charAt(h>>>6*(3-o)&63):e.b64Pad;return c}(r,e,s,o)};case\"BYTES\":return function(t){return function(t,r,n){let i,e,s=\"\";const o=r/8,h=-1===n?3:0;for(i=0;i<o;i+=1)e=t[i>>>2]>>>8*(h+n*(i%4))&255,s+=String.fromCharCode(e);return s}(t,e,s)};case\"ARRAYBUFFER\":try{new ArrayBuffer(0)}catch(t){throw new Error(r)}return function(t){return function(t,r,n){let i;const e=r/8,s=new ArrayBuffer(e),o=new Uint8Array(s),h=-1===n?3:0;for(i=0;i<e;i+=1)o[i]=t[i>>>2]>>>8*(h+n*(i%4))&255;return s}(t,e,s)};case\"UINT8ARRAY\":try{new Uint8Array(0)}catch(t){throw new Error(n)}return function(t){return function(t,r,n){let i;const e=r/8,s=-1===n?3:0,o=new Uint8Array(e);for(i=0;i<e;i+=1)o[i]=t[i>>>2]>>>8*(s+n*(i%4))&255;return o}(t,e,s)};default:throw new Error(\"format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY\")}}const o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],u=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function f(t){const r={outputUpper:!1,b64Pad:\"=\",outputLen:-1},n=t||{},i=\"Output length must be a multiple of 8\";if(r.outputUpper=n.outputUpper||!1,n.b64Pad&&(r.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw new Error(i);r.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw new Error(i);r.outputLen=n.shakeLen}if(\"boolean\"!=typeof r.outputUpper)throw new Error(\"Invalid outputUpper formatting option\");if(\"string\"!=typeof r.b64Pad)throw new Error(\"Invalid b64Pad formatting option\");return r}class c{constructor(t,r,n){const i=n||{};if(this.t=r,this.i=i.encoding||\"UTF8\",this.numRounds=i.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw new Error(\"numRounds must a integer >= 1\");this.o=t,this.h=[],this.u=0,this.l=!1,this.A=0,this.p=!1,this.U=[],this.R=[]}update(t){let r,n=0;const i=this.T>>>5,e=this.F(t,this.h,this.u),s=e.binLen,o=e.value,h=s>>>5;for(r=0;r<h;r+=i)n+this.T<=s&&(this.m=this.g(o.slice(r,r+i),this.m),n+=this.T);return this.A+=n,this.h=o.slice(n>>>5),this.u=s%this.T,this.l=!0,this}getHash(t,r){let n,i,e=this.H;const o=f(r);if(this.B){if(-1===o.outputLen)throw new Error(\"Output length must be specified in options\");e=o.outputLen}const h=s(t,e,this.v,o);if(this.p&&this.C)return h(this.C(o));for(i=this.Y(this.h.slice(),this.u,this.A,this.S(this.m),e),n=1;n<this.numRounds;n+=1)this.B&&e%32!=0&&(i[i.length-1]&=16777215>>>24-e%32),i=this.Y(i,e,0,this.I(this.o),e);return h(i)}setHMACKey(t,r,n){if(!this.L)throw new Error(\"Variant does not support HMAC\");if(this.l)throw new Error(\"Cannot set MAC key after calling update\");const i=e(r,(n||{}).encoding||\"UTF8\",this.v);this.M(i(t))}M(t){const r=this.T>>>3,n=r/4-1;let i;if(1!==this.numRounds)throw new Error(\"Cannot set numRounds with MAC\");if(this.p)throw new Error(\"MAC key already set\");for(r<t.binLen/8&&(t.value=this.Y(t.value,t.binLen,0,this.I(this.o),this.H));t.value.length<=n;)t.value.push(0);for(i=0;i<=n;i+=1)this.U[i]=909522486^t.value[i],this.R[i]=1549556828^t.value[i];this.m=this.g(this.U,this.m),this.A=this.T,this.p=!0}getHMAC(t,r){const n=f(r);return s(t,this.H,this.v,n)(this.N())}N(){let t;if(!this.p)throw new Error(\"Cannot call getHMAC without first setting MAC key\");const r=this.Y(this.h.slice(),this.u,this.A,this.S(this.m),this.H);return t=this.g(this.R,this.I(this.o)),t=this.Y(r,this.H,this.T,t,this.H),t}}function a(t,r){return t>>>r|t<<32-r}function w(t,r){return t>>>r}function E(t,r,n){return t&r^~t&n}function l(t,r,n){return t&r^t&n^r&n}function A(t){return a(t,2)^a(t,13)^a(t,22)}function p(t,r){const n=(65535&t)+(65535&r);return(65535&(t>>>16)+(r>>>16)+(n>>>16))<<16|65535&n}function U(t,r,n,i){const e=(65535&t)+(65535&r)+(65535&n)+(65535&i);return(65535&(t>>>16)+(r>>>16)+(n>>>16)+(i>>>16)+(e>>>16))<<16|65535&e}function d(t,r,n,i,e){const s=(65535&t)+(65535&r)+(65535&n)+(65535&i)+(65535&e);return(65535&(t>>>16)+(r>>>16)+(n>>>16)+(i>>>16)+(e>>>16)+(s>>>16))<<16|65535&s}function R(t){return a(t,7)^a(t,18)^w(t,3)}function y(t){return a(t,6)^a(t,11)^a(t,25)}function T(t){let r;return r=\"SHA-224\"==t?h.slice():u.slice(),r}function F(t,r){let n,i,e,s,h,u,f,c,T,F,b;const m=[];for(n=r[0],i=r[1],e=r[2],s=r[3],h=r[4],u=r[5],f=r[6],c=r[7],b=0;b<64;b+=1)m[b]=b<16?t[b]:U(a(g=m[b-2],17)^a(g,19)^w(g,10),m[b-7],R(m[b-15]),m[b-16]),T=d(c,y(h),E(h,u,f),o[b],m[b]),F=p(A(n),l(n,i,e)),c=f,f=u,u=h,h=p(s,T),s=e,e=i,i=n,n=p(T,F);var g;return r[0]=p(n,r[0]),r[1]=p(i,r[1]),r[2]=p(e,r[2]),r[3]=p(s,r[3]),r[4]=p(h,r[4]),r[5]=p(u,r[5]),r[6]=p(f,r[6]),r[7]=p(c,r[7]),r}class b extends c{constructor(t,r,n){if(\"SHA-224\"!==t&&\"SHA-256\"!==t)throw new Error(\"Chosen SHA variant is not supported\");super(t,r,n);const i=n||{};this.C=this.N,this.L=!0,this.v=-1,this.F=e(this.t,this.i,this.v),this.g=F,this.S=function(t){return t.slice()},this.I=T,this.Y=function(r,n,i,e){return function(t,r,n,i,e){let s,o;const h=15+(r+65>>>9<<4),u=r+n;for(;t.length<=h;)t.push(0);for(t[r>>>5]|=128<<24-r%32,t[h]=4294967295&u,t[h-1]=u/4294967296|0,s=0;s<t.length;s+=16)i=F(t.slice(s,s+16),i);return o=\"SHA-224\"===e?[i[0],i[1],i[2],i[3],i[4],i[5],i[6]]:i,o}(r,n,i,e,t)},this.m=T(t),this.T=512,this.H=\"SHA-224\"===t?224:256,this.B=!1,i.hmacKey&&this.M(function(t,r,n,i){const s=t+\" must include a value and format\";if(!r){if(!i)throw new Error(s);return i}if(void 0===r.value||!r.format)throw new Error(s);return e(r.format,r.encoding||\"UTF8\",n)(r.value)}(\"hmacKey\",i.hmacKey,this.v))}}export{b as default};\n","import JsSHA from \"jssha/dist/sha256\";\r\n\r\n/**\r\n * @param {string} password\r\n * @param {number} time\r\n * @returns {string}\r\n */\r\nexport function encryptPassword(password, time) {\r\n let key = getSHA256(password);\r\n return getSHA256(time + key);\r\n\r\n /**\r\n * @param {string} text\r\n * @returns {string}\r\n */\r\n function getSHA256(text) {\r\n let shaObj = new JsSHA(\"SHA-256\", \"TEXT\", { encoding: \"UTF8\" });\r\n shaObj.update(text);\r\n\r\n return shaObj.getHash(\"HEX\");\r\n }\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n * @param {{ useBearerToken?: boolean, sessionKey?: string|null }} config\r\n */\r\nexport function outputDebugURL(url, config) {\r\n let label = \"javascript-ampache query URL\";\r\n\r\n if (config.useBearerToken) {\r\n label = \"(Using Bearer token, auth added for debugging) - \" + label;\r\n url += \"&auth=\" + config.sessionKey;\r\n }\r\n\r\n console.debug(\r\n label + \" %c\" + url,\r\n \"color: black; font-style: italic; background-color: orange;padding: 2px\",\r\n );\r\n}\r\n","/**\r\n * @typedef {Object} AuthResponse\r\n * @property {string} add\r\n * @property {number} albums\r\n * @property {string} api\r\n * @property {number} artists\r\n * @property {string} auth\r\n * @property {number} catalogs\r\n * @property {string} compatible\r\n * @property {string} clean\r\n * @property {number} genres\r\n * @property {number} labels\r\n * @property {number} licenses\r\n * @property {number} live_streams\r\n * @property {number} playlists\r\n * @property {number} podcasts\r\n * @property {number} podcast_episodes\r\n * @property {string} server\r\n * @property {string} session_expire\r\n * @property {string|null} [streamtoken]\r\n * @property {number} shares\r\n * @property {number} songs\r\n * @property {string} update\r\n * @property {number} user\r\n * @property {string} username\r\n * @property {string} version\r\n * @property {number} videos\r\n * @property {number} max_song\r\n * @property {number} max_album\r\n * @property {number} max_artist\r\n * @property {number} max_video\r\n * @property {number} max_podcast\r\n * @property {number} max_podcast_episode\r\n */\r\n\r\nimport qs from \"querystringify\";\r\nimport fetch from \"isomorphic-unfetch\";\r\nimport { outputDebugURL, encryptPassword as encryptPasswordUtil } from \"./utils.js\";\r\n\r\nexport const authMethods = {\r\n /**\r\n * Handles verifying a new handshake\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} params\r\n * @param {string} params.auth encrypted apikey OR password if using password auth\r\n * @param {string} [params.user] username\r\n * @param {number} [params.timestamp] UNIXTIME()\r\n * @param {string} [params.version] version of Ampache API to establish connection with\r\n * @returns {Promise<AuthResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#handshake}\r\n */\r\n handshake(params) {\r\n let token = params.auth;\r\n\r\n // generate a timestamp if one wasn't provided\r\n if (!params.timestamp) {\r\n params.timestamp = Math.floor(new Date().getTime() / 1000);\r\n }\r\n\r\n // override the fallback API version with specified\r\n if (params.version) {\r\n this.version = params.version;\r\n }\r\n\r\n // drop timestamp if no user provided (i.e. logging in with API key)\r\n if (!params.user) {\r\n delete params.timestamp;\r\n }\r\n\r\n // not needed if using Bearer token\r\n if (this.useBearerToken) {\r\n delete params.auth;\r\n }\r\n\r\n let query = this.url + \"/server/json.server.php?action=handshake\";\r\n query += qs.stringify(params, \"&\");\r\n\r\n if (this.debug) {\r\n outputDebugURL(query, this);\r\n }\r\n\r\n return fetch(query, {\r\n method: \"GET\",\r\n headers: this.useBearerToken ? { Authorization: \"Bearer \" + token } : {},\r\n })\r\n .then((response) => response.json())\r\n .then((data) => {\r\n if (data.auth) {\r\n this.sessionKey = data.auth;\r\n }\r\n return /** @type {AuthResponse} */ (data);\r\n });\r\n },\r\n\r\n /**\r\n * This can be called without being authenticated, it is useful for determining if what the status\r\n * of the server is, and what version it is running/compatible with\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} [params]\r\n * @param {string} [params.auth] (Session ID) returns version information and extends the session if passed\r\n * @param {string} [params.version] API Version that the application understands\r\n * @returns {Promise<AuthResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#ping}\r\n */\r\n ping(params) {\r\n return this.call(\"ping\", params);\r\n },\r\n\r\n /**\r\n * Destroy a session using the session auth parameter\r\n * @remarks MINIMUM_API_VERSION=400001\r\n * @param {Object} params\r\n * @param {string} params.auth Session ID to destroy\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#goodbye}\r\n */\r\n goodbye(params) {\r\n return this.call(\"goodbye\", params);\r\n },\r\n\r\n /**\r\n * Email a new password to the user (if allowed) using a reset token.\r\n * @remarks MINIMUM_API_VERSION=6.1.0\r\n * @param {Object} params\r\n * @param {string} params.auth Password reset token\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#lost_password}\r\n */\r\n lostPassword(params) {\r\n return this.call(\"lost_password\", params);\r\n },\r\n\r\n /**\r\n * Encrypt your password into the accepted format.\r\n * @param {Object} params\r\n * @param {string} params.password\r\n * @param {number} params.time\r\n * @returns {string}\r\n */\r\n encryptPassword(params) {\r\n return encryptPasswordUtil(params.password, params.time);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} BookmarkResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {\"song\"|\"video\"|\"podcast_episode\"} type\r\n * @property {number} position\r\n * @property {string} [client]\r\n * @property {number} [date]\r\n */\r\n\r\n/**\r\n * @typedef {Object} BookmarksResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {BookmarkResponse[]} bookmark\r\n */\r\n\r\nexport const bookmarksMethods = {\r\n /**\r\n * Get a single bookmark by bookmark_id\r\n * @remarks MINIMUM_API_VERSION=6.1.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.include] 0,1, if true include the object in the bookmark\r\n * @returns {Promise<BookmarkResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#bookmark}\r\n */\r\n bookmark(params) {\r\n return this.call(\"bookmark\", params);\r\n },\r\n\r\n /**\r\n * Get information about bookmarked media this user is allowed to manage\r\n * @remarks MINIMUM_API_VERSION=5.0.0\r\n * @param {Object} [params]\r\n * @param {string} [params.client] filter by the agent/client name\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.include] 0,1, if true include the object in the bookmark\r\n * @returns {Promise<BookmarksResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#bookmarks}\r\n */\r\n bookmarks(params) {\r\n return this.call(\"bookmarks\", params);\r\n },\r\n\r\n /**\r\n * Get the bookmark/s from its object_id and object_type.\r\n * @remarks MINIMUM_API_VERSION=5.0.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {\"song\"|\"video\"|\"podcast_episode\"} params.type Object type\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.include] 0,1, if true include the object in the bookmark\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.all]\r\n * @returns {Promise<BookmarkResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#get_bookmark}\r\n */\r\n getBookmark(params) {\r\n return this.call(\"get_bookmark\", params);\r\n },\r\n\r\n /**\r\n * Create a placeholder for the current media that you can return to later.\r\n * @remarks MINIMUM_API_VERSION=5.0.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {\"song\"|\"video\"|\"podcast_episode\"} params.type Object type\r\n * @param {number} params.position current track time in seconds\r\n * @param {string} [params.client] Agent string. (Default: 'AmpacheAPI')\r\n * @param {number} [params.date] update time (Default: UNIXTIME())\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.include] 0,1, if true include the object in the bookmark\r\n * @returns {Promise<BookmarkResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#bookmark_create}\r\n */\r\n bookmarkCreate(params) {\r\n return this.call(\"bookmark_create\", params);\r\n },\r\n\r\n /**\r\n * Edit a placeholder for the current media that you can return to later.\r\n * @remarks MINIMUM_API_VERSION=5.0.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {\"bookmark\"|\"song\"|\"video\"|\"podcast_episode\"} params.type Object type\r\n * @param {number} params.position current track time in seconds\r\n * @param {string} [params.client] Agent string. (Default: 'AmpacheAPI')\r\n * @param {number} [params.date] update time (Default: UNIXTIME())\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.include] 0,1, if true include the object in the bookmark\r\n * @returns {Promise<BookmarkResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#bookmark_edit}\r\n */\r\n bookmarkEdit(params) {\r\n return this.call(\"bookmark_edit\", params);\r\n },\r\n\r\n /**\r\n * Delete an existing bookmark. (if it exists)\r\n * @remarks MINIMUM_API_VERSION=5.0.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @param {\"song\"|\"video\"|\"podcast_episode\"} params.type Object type\r\n * @param {string} [params.client] Agent string. (Default: 'AmpacheAPI')\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#bookmark_delete}\r\n */\r\n bookmarkDelete(params) {\r\n return this.call(\"bookmark_delete\", params);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} CatalogResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {\"local\"|\"remote\"} type\r\n * @property {\"podcast\"|\"clip\"|\"tvshow\"|\"movie\"|\"personal_video\"|\"music\"} gather_types\r\n * @property {boolean} enabled\r\n * @property {number} last_add\r\n * @property {number} last_clean\r\n * @property {number} last_update\r\n * @property {string} path\r\n * @property {string} rename_pattern\r\n * @property {string} sort_pattern\r\n */\r\n\r\n/**\r\n * @typedef {Object} CatalogsResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {CatalogResponse[]} catalog\r\n */\r\n\r\nexport const catalogsMethods = {\r\n /**\r\n * This searches the catalogs and returns... catalogs\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} [params]\r\n * @param {\"music\"|\"clip\"|\"tvshow\"|\"movie\"|\"personal_video\"|\"podcast\"} [params.filter] Catalog type\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<CatalogsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalogs}\r\n */\r\n catalogs(params) {\r\n return this.call(\"catalogs\", params);\r\n },\r\n\r\n /**\r\n * Return catalog by UID\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @returns {Promise<CatalogResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalog}\r\n */\r\n catalog(params) {\r\n return this.call(\"catalog\", params);\r\n },\r\n\r\n /**\r\n * Kick off a catalog update or clean for the selected catalog\r\n * ACCESS REQUIRED: 75 (Catalog Manager)\r\n * @remarks MINIMUM_API_VERSION=400001\r\n * @param {Object} params\r\n * @param {\"add_to_catalog\"|\"clean_catalog\"} params.task add_to_catalog, clean_catalog\r\n * @param {import(\"./base.js\").UID} params.catalog UID of catalog\r\n * @param {import(\"./base.js\").UID} [params.filter] Alias of catalog (Ampache 7.9.0+)\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalog_action}\r\n */\r\n catalogAction(params) {\r\n return this.call(\"catalog_action\", params);\r\n },\r\n\r\n /**\r\n * Perform actions on local catalog files. Single file versions of catalog add, clean, verify and remove (delete).\r\n * Make sure you remember to urlencode those file names!\r\n * ACCESS REQUIRED: 50 (Content Manager)\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} params\r\n * @param {string} params.file FULL path to local file\r\n * @param {string} params.task add, clean, verify, remove, (can include comma-separated values)\r\n * @param {import(\"./base.js\").UID} params.catalog UID of catalog\r\n * @param {import(\"./base.js\").UID} [params.filter] Alias of catalog (Ampache 7.9.0+)\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalog_file}\r\n */\r\n catalogFile(params) {\r\n return this.call(\"catalog_file\", params);\r\n },\r\n\r\n /**\r\n * Perform actions on local catalog folders. Single folder versions of catalog add, clean, verify and remove (delete).\r\n * Make sure you remember to urlencode those folder names!\r\n * ACCESS REQUIRED: 50 (Content Manager)\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} params\r\n * @param {string} params.folder FULL path to local folder\r\n * @param {string} params.task add, clean, verify, remove, (can include comma-separated values)\r\n * @param {import(\"./base.js\").UID} params.catalog UID of catalog\r\n * @param {import(\"./base.js\").UID} [params.filter] Alias of catalog (Ampache 7.9.0+)\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalog_folder}\r\n */\r\n catalogFolder(params) {\r\n return this.call(\"catalog_folder\", params);\r\n },\r\n\r\n /**\r\n * Create a new catalog.\r\n * ACCESS REQUIRED: 75 (Catalog Manager)\r\n * @remarks MINIMUM_API_VERSION=6.0.0\r\n * @param {Object} params\r\n * @param {string} params.name Name for the catalog\r\n * @param {string} params.path URL or folder path for your catalog\r\n * @param {\"local\"|\"beets\"|\"remote\"|\"subsonic\"|\"seafile\"|\"beetsremote\"} [params.type] Default: 'local'\r\n * @param {\"music\"|\"podcast\"|\"clip\"|\"tvshow\"|\"movie\"|\"personal_video\"} [params.media_type] Default: 'music'\r\n * @param {string} [params.file_pattern] Pattern used identify tags from the file name. Default: '%T - %t'\r\n * @param {string} [params.folder_pattern] Pattern used identify tags from the folder name. Default: '%a/%A'\r\n * @param {string} [params.username] login to remote catalog\r\n * @param {string} [params.password] password to remote catalog\r\n * @returns {Promise<CatalogResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalog_add}\r\n */\r\n catalogAdd(params) {\r\n return this.call(\"catalog_add\", params);\r\n },\r\n\r\n /**\r\n * Delete an existing catalog. (if it exists)\r\n * ACCESS REQUIRED: 75 (Catalog Manager)\r\n * @remarks MINIMUM_API_VERSION=6.0.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter ID of the catalog\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#catalog_delete}\r\n */\r\n catalogDelete(params) {\r\n return this.call(\"catalog_delete\", params);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} GenreSummary\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n */\r\n\r\n/**\r\n * @typedef {Object} GenreResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {number} albums\r\n * @property {number} artists\r\n * @property {number} songs\r\n * @property {number} videos\r\n * @property {number} playlists\r\n * @property {number} live_streams\r\n * @property {boolean} is_hidden\r\n * @property {GenreSummary[]} merge\r\n */\r\n\r\n/**\r\n * @typedef {Object} GenresResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {GenreResponse[]} genre\r\n */\r\n\r\nexport const genresMethods = {\r\n /**\r\n * This returns the genres (Tags) based on the specified filter\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} [params]\r\n * @param {string} [params.filter] UID to find\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<GenresResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#genres}\r\n */\r\n genres(params) {\r\n return this.call(\"genres\", params);\r\n },\r\n\r\n /**\r\n * This returns a single genre based on UID\r\n * @remarks MINIMUM_API_VERSION=380001\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @returns {Promise<GenreResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#genre}\r\n */\r\n genre(params) {\r\n return this.call(\"genre\", params);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} LabelResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {number} artists\r\n * @property {string|null} summary\r\n * @property {string|null} external_link\r\n * @property {string|null} address\r\n * @property {string|null} category\r\n * @property {string|null} email\r\n * @property {string|null} website\r\n * @property {import(\"./base.js\").UID} user\r\n */\r\n\r\n/**\r\n * @typedef {Object} LabelsResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {LabelResponse[]} label\r\n */\r\n\r\nexport const labelsMethods = {\r\n /**\r\n * This returns labels based on the specified filter\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} [params]\r\n * @param {string} [params.filter] Filter results to match this string\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)\r\n * @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date\r\n * @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<LabelsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#labels}\r\n */\r\n labels(params) {\r\n return this.call(\"labels\", params);\r\n },\r\n\r\n /**\r\n * This returns a single label\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @returns {Promise<LabelResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#label}\r\n */\r\n label(params) {\r\n return this.call(\"label\", params);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} LicenseResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {string} description\r\n * @property {string} external_link\r\n */\r\n\r\n/**\r\n * @typedef {Object} LicensesResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {LicenseResponse[]} license\r\n */\r\n\r\nexport const licensesMethods = {\r\n /**\r\n * This returns licenses based on the specified filter\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} [params]\r\n * @param {string} [params.filter] Filter results to match this string\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)\r\n * @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date\r\n * @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<LicensesResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#licenses}\r\n */\r\n licenses(params) {\r\n return this.call(\"licenses\", params);\r\n },\r\n\r\n /**\r\n * This returns a single license\r\n * @remarks MINIMUM_API_VERSION=420000\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @returns {Promise<LicenseResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#license}\r\n */\r\n license(params) {\r\n return this.call(\"license\", params);\r\n },\r\n};\r\n","/**\r\n * @typedef {Object} LiveStreamResponse\r\n * @property {import(\"./base.js\").UID} id\r\n * @property {string} name\r\n * @property {string} url\r\n * @property {string} codec\r\n * @property {import(\"./base.js\").UID} catalog\r\n * @property {string} site_url\r\n */\r\n\r\n/**\r\n * @typedef {Object} LiveStreamsResponse\r\n * @property {number} total_count\r\n * @property {string} md5\r\n * @property {LiveStreamResponse[]} live_stream\r\n */\r\n\r\nexport const liveStreamsMethods = {\r\n /**\r\n * This returns live_streams based on the specified filter\r\n * @remarks MINIMUM_API_VERSION=5.1.0\r\n * @param {Object} [params]\r\n * @param {string} [params.filter] Filter results to match this string\r\n * @param {import(\"./base.js\").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)\r\n * @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date\r\n * @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date\r\n * @param {number} [params.offset]\r\n * @param {number} [params.limit]\r\n * @param {string} [params.cond]\r\n * @param {string} [params.sort]\r\n * @returns {Promise<LiveStreamsResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#live_streams}\r\n */\r\n liveStreams(params) {\r\n return this.call(\"live_streams\", params);\r\n },\r\n\r\n /**\r\n * This returns a single live_stream\r\n * @remarks MINIMUM_API_VERSION=5.1.0\r\n * @param {Object} params\r\n * @param {import(\"./base.js\").UID} params.filter UID to find\r\n * @returns {Promise<LiveStreamResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#live_stream}\r\n */\r\n liveStream(params) {\r\n return this.call(\"live_stream\", params);\r\n },\r\n\r\n /**\r\n * Create a live_stream (radio station) object.\r\n * ACCESS REQUIRED: 50 (Content Manager)\r\n * @remarks MINIMUM_API_VERSION=6.0.0\r\n * @param {Object} params\r\n * @param {string} params.name Stream title\r\n * @param {string} params.url URL of the http/s stream\r\n * @param {\"mp3\"|\"flac\"|\"ogg\"|\"vorbis\"|\"opus\"|\"aac\"|\"alac\"} params.codec Stream codec\r\n * @param {string} params.catalog Catalog ID to associate with this stream\r\n * @param {string} [params.site_url] Homepage URL of the stream\r\n * @returns {Promise<LiveStreamResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#live_stream_create}\r\n */\r\n liveStreamCreate(params) {\r\n return this.call(\"live_stream_create\", params);\r\n },\r\n\r\n /**\r\n * Edit a live_stream (radio station) object.\r\n * ACCESS REQUIRED: 50 (Content Manager)\r\n * @remarks MINIMUM_API_VERSION=6.0.0\r\n * @param {Object} params\r\n * @param {string} params.filter Object to find\r\n * @param {string} [params.name] Stream title\r\n * @param {string} [params.url] URL of the http/s stream\r\n * @param {\"mp3\"|\"flac\"|\"ogg\"|\"vorbis\"|\"opus\"|\"aac\"|\"alac\"} [params.codec] Stream codec\r\n * @param {string} [params.catalog] Catalog ID to associate with this stream\r\n * @param {string} [params.site_url] Homepage URL of the stream\r\n * @returns {Promise<LiveStreamResponse>}\r\n * @see {@link https://ampache.org/api/api-json-methods#live_stream_edit}\r\n */\r\n liveStreamEdit(params) {\r\n return this.call(\"live_stream_edit\", params);\r\n },\r\n\r\n /**\r\n * Delete a live_stream (radio station) object (if it exists)\r\n * ACCESS REQUIRED: 50 (Content Manager)\r\n * @remarks MINIMUM_API_VERSION=6.0.0\r\n * @param {Object} params\r\n * @param {string} params.filter Object to find\r\n * @returns {Promise<import(\"./base.js\").Success>}\r\n * @see {@link https://ampache.org/api/api-json-methods#live_stream_delete}\r\n */\r\n liveStreamDelete(params) {\r\n return this.call(\"live_stream_delete\", params);\r\n },\r\n};\r\n","/**\n * @typedef {Object} PlaylistResponse\n * @property {import(\"./base.js\").UID} id\n * @property {string} name\n * @property {string} owner\n * @property {number} items\n * @property {\"public\"|\"private\"} type\n * @property {string} art\n * @property {boolean} has_art\n * @property {boolean} flag\n * @property {number|null} rating\n * @property {number|null} averagerating\n * @property {import(\"./users.js\").UserSummary} user\n * @property {boolean} has_access\n * @property {boolean} has_collaborate\n * @property {number} last_update\n */\n\n/**\n * @typedef {Object} PlaylistsResponse\n * @property {number} total_count\n * @property {string} md5\n * @property {PlaylistResponse[]} playlist\n */\n\n/**\n * @typedef {Object} HashResponse\n * @property {string} md5\n */\n\nexport const playlistsMethods = {\n /**\n * This returns playlists based on the specified filter\n * @remarks MINIMUM_API_VERSION=380001\n * @param {Obje