UNPKG

@kkbox/kkbox-js-sdk

Version:

KKBOX Open API developer SDK for JavaScript. Use it to easily access KKBOX open API to get various metadata about KKBOX's tracks, albums, artists, playlists and stations.

1,456 lines 190 kB
{ "type": "File", "start": 0, "end": 2448, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2448, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 47, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 47 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 27, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 27 } }, "imported": { "type": "Identifier", "start": 8, "end": 15, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 15 }, "identifierName": "ARTISTS" }, "name": "ARTISTS" }, "local": { "type": "Identifier", "start": 19, "end": 27, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 27 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 34, "end": 47, "loc": { "start": { "line": 1, "column": 34 }, "end": { "line": 1, "column": 47 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 48, "end": 79, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 68, "end": 79, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher", "leadingComments": null, "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get artist metadata.\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists\n ", "start": 81, "end": 181, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 182, "end": 2448, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 77, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 197, "end": 2448, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 77, "column": 1 } }, "id": { "type": "Identifier", "start": 203, "end": 216, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 }, "identifierName": "ArtistFetcher" }, "name": "ArtistFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 225, "end": 232, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 50 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 233, "end": 2448, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 77, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 270, "end": 423, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 270, "end": 281, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 282, "end": 286, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 288, "end": 304, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 288, "end": 297, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 300, "end": 304, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 306, "end": 423, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 316, "end": 338, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 316, "end": 338, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 316, "end": 321, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 322, "end": 326, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 328, "end": 337, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 29 }, "identifierName": "territory" }, "name": "territory" } ], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 348, "end": 382, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 391, "end": 417, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 391, "end": 417, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 391, "end": 405, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 22 } }, "object": { "type": "ThisExpression", "start": 391, "end": 395, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 396, "end": 405, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 22 }, "identifierName": "artist_id" }, "name": "artist_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 408, "end": 417, "loc": { "start": { "line": 18, "column": 25 }, "end": { "line": 18, "column": 34 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 348, "end": 382, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 239, "end": 265, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the artist object.\n *\n * @param {string} artist_id - The ID of an artist.\n * @return {Artist}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id\n ", "start": 429, "end": 663, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 668, "end": 753, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 668, "end": 679, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 15 }, "identifierName": "setArtistID" }, "name": "setArtistID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 680, "end": 689, "loc": { "start": { "line": 28, "column": 16 }, "end": { "line": 28, "column": 25 }, "identifierName": "artist_id" }, "name": "artist_id" } ], "body": { "type": "BlockStatement", "start": 691, "end": 753, "loc": { "start": { "line": 28, "column": 27 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 701, "end": 727, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 701, "end": 727, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 701, "end": 715, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 22 } }, "object": { "type": "ThisExpression", "start": 701, "end": 705, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 706, "end": 715, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 22 }, "identifierName": "artist_id" }, "name": "artist_id" }, "computed": false }, "right": { "type": "Identifier", "start": 718, "end": 727, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 34 }, "identifierName": "artist_id" }, "name": "artist_id" } } }, { "type": "ReturnStatement", "start": 736, "end": 747, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 743, "end": 747, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the artist object.\n *\n * @param {string} artist_id - The ID of an artist.\n * @return {Artist}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id\n ", "start": 429, "end": 663, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the artist you find.\n *\n * @return {Promise}\n * @example api.Artist.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id\n ", "start": 759, "end": 1030, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 39, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1035, "end": 1143, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 42, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1035, "end": 1048, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 17 }, "identifierName": "fetchMetadata" }, "name": "fetchMetadata", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1051, "end": 1143, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 42, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1061, "end": 1137, "loc": { "start": { "line": 41, "column": 8 }, "end": { "line": 41, "column": 84 } }, "argument": { "type": "CallExpression", "start": 1068, "end": 1137, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 84 } }, "callee": { "type": "MemberExpression", "start": 1068, "end": 1081, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1068, "end": 1077, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1068, "end": 1072, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 19 } } }, "property": { "type": "Identifier", "start": 1073, "end": 1077, "loc": { "start": { "line": 41, "column": 20 }, "end": { "line": 41, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1078, "end": 1081, "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1082, "end": 1107, "loc": { "start": { "line": 41, "column": 29 }, "end": { "line": 41, "column": 54 } }, "left": { "type": "Identifier", "start": 1082, "end": 1090, "loc": { "start": { "line": 41, "column": 29 }, "end": { "line": 41, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1093, "end": 1107, "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 54 } }, "object": { "type": "ThisExpression", "start": 1093, "end": 1097, "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 44 } } }, "property": { "type": "Identifier", "start": 1098, "end": 1107, "loc": { "start": { "line": 41, "column": 45 }, "end": { "line": 41, "column": 54 }, "identifierName": "artist_id" }, "name": "artist_id" }, "computed": false } }, { "type": "ObjectExpression", "start": 1109, "end": 1136, "loc": { "start": { "line": 41, "column": 56 }, "end": { "line": 41, "column": 83 } }, "properties": [ { "type": "ObjectProperty", "start": 1110, "end": 1135, "loc": { "start": { "line": 41, "column": 57 }, "end": { "line": 41, "column": 82 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1110, "end": 1119, "loc": { "start": { "line": 41, "column": 57 }, "end": { "line": 41, "column": 66 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 1121, "end": 1135, "loc": { "start": { "line": 41, "column": 68 }, "end": { "line": 41, "column": 82 } }, "object": { "type": "ThisExpression", "start": 1121, "end": 1125, "loc": { "start": { "line": 41, "column": 68 }, "end": { "line": 41, "column": 72 } } }, "property": { "type": "Identifier", "start": 1126, "end": 1135, "loc": { "start": { "line": 41, "column": 73 }, "end": { "line": 41, "column": 82 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the artist you find.\n *\n * @return {Promise}\n * @example api.Artist.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id\n ", "start": 759, "end": 1030, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 39, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch albums belong to an artist.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchAlbums()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id-albums\n ", "start": 1149, "end": 1553, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 52, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1558, "end": 1789, "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 59, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1558, "end": 1569, "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 53, "column": 15 }, "identifierName": "fetchAlbums" }, "name": "fetchAlbums", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1570, "end": 1587, "loc": { "start": { "line": 53, "column": 16 }, "end": { "line": 53, "column": 33 } }, "left": { "type": "Identifier", "start": 1570, "end": 1575, "loc": { "start": { "line": 53, "column": 16 }, "end": { "line": 53, "column": 21 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 1578, "end": 1587, "loc": { "start": { "line": 53, "column": 24 }, "end": { "line": 53, "column": 33 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 1589, "end": 1607, "loc": { "start": { "line": 53, "column": 35 }, "end": { "line": 53, "column": 53 } }, "left": { "type": "Identifier", "start": 1589, "end": 1595, "loc": { "start": { "line": 53, "column": 35 }, "end": { "line": 53, "column": 41 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 1598, "end": 1607, "loc": { "start": { "line": 53, "column": 44 }, "end": { "line": 53, "column": 53 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 1609, "end": 1789, "loc": { "start": { "line": 53, "column": 55 }, "end": { "line": 59, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1619, "end": 1783, "loc": { "sta