UNPKG

@kkboxorg/kkbox-javascript-developer-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,469 lines (1,468 loc) 189 kB
{ "type": "File", "start": 0, "end": 2155, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 76, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2155, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 76, "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://docs.kkbox.codes/docs/artists\n ", "start": 81, "end": 158, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 159, "end": 2155, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 76, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 174, "end": 2155, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 76, "column": 1 } }, "id": { "type": "Identifier", "start": 180, "end": 193, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 }, "identifierName": "ArtistFetcher" }, "name": "ArtistFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 202, "end": 209, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 50 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 210, "end": 2155, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 76, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 247, "end": 400, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 247, "end": 258, "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": 259, "end": 263, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 265, "end": 281, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 265, "end": 274, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 277, "end": 281, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 283, "end": 400, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 293, "end": 315, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 293, "end": 315, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 293, "end": 298, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 299, "end": 303, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 305, "end": 314, "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": 325, "end": 359, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 368, "end": 394, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 368, "end": 394, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 368, "end": 382, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 22 } }, "object": { "type": "ThisExpression", "start": 368, "end": 372, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 373, "end": 382, "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": 385, "end": 394, "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": 325, "end": 359, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 216, "end": 242, "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://docs.kkbox.codes/docs/artists\n ", "start": 406, "end": 585, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 590, "end": 675, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 590, "end": 601, "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": 602, "end": 611, "loc": { "start": { "line": 28, "column": 16 }, "end": { "line": 28, "column": 25 }, "identifierName": "artist_id" }, "name": "artist_id" } ], "body": { "type": "BlockStatement", "start": 613, "end": 675, "loc": { "start": { "line": 28, "column": 27 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 623, "end": 649, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 623, "end": 649, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 623, "end": 637, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 22 } }, "object": { "type": "ThisExpression", "start": 623, "end": 627, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 628, "end": 637, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 22 }, "identifierName": "artist_id" }, "name": "artist_id" }, "computed": false }, "right": { "type": "Identifier", "start": 640, "end": 649, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 34 }, "identifierName": "artist_id" }, "name": "artist_id" } } }, { "type": "ReturnStatement", "start": 658, "end": 669, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 665, "end": 669, "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://docs.kkbox.codes/docs/artists\n ", "start": 406, "end": 585, "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 ", "start": 681, "end": 847, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 852, "end": 960, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 852, "end": 865, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 39, "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": 868, "end": 960, "loc": { "start": { "line": 39, "column": 20 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 878, "end": 954, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 84 } }, "argument": { "type": "CallExpression", "start": 885, "end": 954, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 84 } }, "callee": { "type": "MemberExpression", "start": 885, "end": 898, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 28 } }, "object": { "type": "MemberExpression", "start": 885, "end": 894, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 885, "end": 889, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 19 } } }, "property": { "type": "Identifier", "start": 890, "end": 894, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 40, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 895, "end": 898, "loc": { "start": { "line": 40, "column": 25 }, "end": { "line": 40, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 899, "end": 924, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 54 } }, "left": { "type": "Identifier", "start": 899, "end": 907, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 910, "end": 924, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 54 } }, "object": { "type": "ThisExpression", "start": 910, "end": 914, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 44 } } }, "property": { "type": "Identifier", "start": 915, "end": 924, "loc": { "start": { "line": 40, "column": 45 }, "end": { "line": 40, "column": 54 }, "identifierName": "artist_id" }, "name": "artist_id" }, "computed": false } }, { "type": "ObjectExpression", "start": 926, "end": 953, "loc": { "start": { "line": 40, "column": 56 }, "end": { "line": 40, "column": 83 } }, "properties": [ { "type": "ObjectProperty", "start": 927, "end": 952, "loc": { "start": { "line": 40, "column": 57 }, "end": { "line": 40, "column": 82 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 927, "end": 936, "loc": { "start": { "line": 40, "column": 57 }, "end": { "line": 40, "column": 66 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 938, "end": 952, "loc": { "start": { "line": 40, "column": 68 }, "end": { "line": 40, "column": 82 } }, "object": { "type": "ThisExpression", "start": 938, "end": 942, "loc": { "start": { "line": 40, "column": 68 }, "end": { "line": 40, "column": 72 } } }, "property": { "type": "Identifier", "start": 943, "end": 952, "loc": { "start": { "line": 40, "column": 73 }, "end": { "line": 40, "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 ", "start": 681, "end": 847, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "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://docs.kkbox.codes/docs/artists-albums\n ", "start": 966, "end": 1315, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 51, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1320, "end": 1551, "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 58, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1320, "end": 1331, "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 15 }, "identifierName": "fetchAlbums" }, "name": "fetchAlbums", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1332, "end": 1349, "loc": { "start": { "line": 52, "column": 16 }, "end": { "line": 52, "column": 33 } }, "left": { "type": "Identifier", "start": 1332, "end": 1337, "loc": { "start": { "line": 52, "column": 16 }, "end": { "line": 52, "column": 21 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 1340, "end": 1349, "loc": { "start": { "line": 52, "column": 24 }, "end": { "line": 52, "column": 33 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 1351, "end": 1369, "loc": { "start": { "line": 52, "column": 35 }, "end": { "line": 52, "column": 53 } }, "left": { "type": "Identifier", "start": 1351, "end": 1357, "loc": { "start": { "line": 52, "column": 35 }, "end": { "line": 52, "column": 41 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 1360, "end": 1369, "loc": { "start": { "line": 52, "column": 44 }, "end": { "line": 52, "column": 53 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 1371, "end": 1551, "loc": { "start": { "line": 52, "column": 55 }, "end": { "line": 58, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1381, "end": 1545, "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 57, "column": 10 } }, "argument": { "type": "CallExpression", "start": 1388, "end": 1545,