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,447 lines (1,446 loc) 157 kB
{ "type": "File", "start": 0, "end": 2105, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2105, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 46, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 46 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 26, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 26 } }, "imported": { "type": "Identifier", "start": 8, "end": 14, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 14 }, "identifierName": "ALBUMS" }, "name": "ALBUMS" }, "local": { "type": "Identifier", "start": 18, "end": 26, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 26 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 33, "end": 46, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 46 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 47, "end": 78, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 54, "end": 61, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 54, "end": 61, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 67, "end": 78, "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 * Fetch metadata and tracks of a album.\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums\n ", "start": 80, "end": 196, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 197, "end": 2105, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 69, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 212, "end": 2105, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 69, "column": 1 } }, "id": { "type": "Identifier", "start": 218, "end": 230, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 33 }, "identifierName": "AlbumFetcher" }, "name": "AlbumFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 239, "end": 246, "loc": { "start": { "line": 8, "column": 42 }, "end": { "line": 8, "column": 49 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 247, "end": 2105, "loc": { "start": { "line": 8, "column": 50 }, "end": { "line": 69, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 288, "end": 440, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 288, "end": 299, "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": 300, "end": 304, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 306, "end": 322, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 306, "end": 315, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 318, "end": 322, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 324, "end": 440, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 334, "end": 356, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 334, "end": 356, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 334, "end": 339, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 340, "end": 344, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 346, "end": 355, "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": 366, "end": 400, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 409, "end": 434, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 409, "end": 434, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 409, "end": 422, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 21 } }, "object": { "type": "ThisExpression", "start": 409, "end": 413, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 414, "end": 422, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 21 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 425, "end": 434, "loc": { "start": { "line": 18, "column": 24 }, "end": { "line": 18, "column": 33 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 366, "end": 400, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 257, "end": 283, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Set the album fetcher.\n *\n * @param {string} album_id - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id\n ", "start": 446, "end": 680, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 685, "end": 774, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 685, "end": 695, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 14 }, "identifierName": "setAlbumID" }, "name": "setAlbumID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 696, "end": 704, "loc": { "start": { "line": 28, "column": 15 }, "end": { "line": 28, "column": 23 }, "identifierName": "album_id" }, "name": "album_id" } ], "body": { "type": "BlockStatement", "start": 706, "end": 774, "loc": { "start": { "line": 28, "column": 25 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 716, "end": 740, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 716, "end": 740, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 716, "end": 729, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 21 } }, "object": { "type": "ThisExpression", "start": 716, "end": 720, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 721, "end": 729, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 21 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false }, "right": { "type": "Identifier", "start": 732, "end": 740, "loc": { "start": { "line": 29, "column": 24 }, "end": { "line": 29, "column": 32 }, "identifierName": "album_id" }, "name": "album_id" } } }, { "type": "ReturnStatement", "start": 757, "end": 768, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 764, "end": 768, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Set the album fetcher.\n *\n * @param {string} album_id - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id\n ", "start": 446, "end": 680, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetcy metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id\n ", "start": 780, "end": 1054, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 39, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1059, "end": 1166, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 42, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1059, "end": 1072, "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": 1075, "end": 1166, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 42, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1085, "end": 1160, "loc": { "start": { "line": 41, "column": 8 }, "end": { "line": 41, "column": 83 } }, "argument": { "type": "CallExpression", "start": 1092, "end": 1160, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 83 } }, "callee": { "type": "MemberExpression", "start": 1092, "end": 1105, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1092, "end": 1101, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1092, "end": 1096, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 19 } } }, "property": { "type": "Identifier", "start": 1097, "end": 1101, "loc": { "start": { "line": 41, "column": 20 }, "end": { "line": 41, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1102, "end": 1105, "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1106, "end": 1130, "loc": { "start": { "line": 41, "column": 29 }, "end": { "line": 41, "column": 53 } }, "left": { "type": "Identifier", "start": 1106, "end": 1114, "loc": { "start": { "line": 41, "column": 29 }, "end": { "line": 41, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1117, "end": 1130, "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 53 } }, "object": { "type": "ThisExpression", "start": 1117, "end": 1121, "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 44 } } }, "property": { "type": "Identifier", "start": 1122, "end": 1130, "loc": { "start": { "line": 41, "column": 45 }, "end": { "line": 41, "column": 53 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false } }, { "type": "ObjectExpression", "start": 1132, "end": 1159, "loc": { "start": { "line": 41, "column": 55 }, "end": { "line": 41, "column": 82 } }, "properties": [ { "type": "ObjectProperty", "start": 1133, "end": 1158, "loc": { "start": { "line": 41, "column": 56 }, "end": { "line": 41, "column": 81 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1133, "end": 1142, "loc": { "start": { "line": 41, "column": 56 }, "end": { "line": 41, "column": 65 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 1144, "end": 1158, "loc": { "start": { "line": 41, "column": 67 }, "end": { "line": 41, "column": 81 } }, "object": { "type": "ThisExpression", "start": 1144, "end": 1148, "loc": { "start": { "line": 41, "column": 67 }, "end": { "line": 41, "column": 71 } } }, "property": { "type": "Identifier", "start": 1149, "end": 1158, "loc": { "start": { "line": 41, "column": 72 }, "end": { "line": 41, "column": 81 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetcy metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id\n ", "start": 780, "end": 1054, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 39, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get KKBOX web widget uri of the album.\n * @example https://widget.kkbox.com/v1/?id=4qtXcj31wYJTRZbb23&type=album\n * @return {string}\n ", "start": 1172, "end": 1331, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 48, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1336, "end": 1434, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 51, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1336, "end": 1348, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 16 }, "identifierName": "getWidgetUri" }, "name": "getWidgetUri", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1350, "end": 1434, "loc": { "start": { "line": 49, "column": 18 }, "end": { "line": 51, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1360, "end": 1428, "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 76 } }, "argument": { "type": "TemplateLiteral", "start": 1367, "end": 1428, "loc": { "start": { "line": 50, "column": 15 }, "end": { "line": 50, "column": 76 } }, "expressions": [ { "type": "MemberExpression", "start": 1402, "end": 1415, "loc": { "start": { "line": 50, "column": 50 }, "end": { "line": 50, "column": 63 } }, "object": { "type": "ThisExpression", "start": 1402, "end": 1406, "loc": { "start": { "line": 50, "column": 50 }, "end": { "line": 50, "column": 54 } } }, "property": { "type": "Identifier", "start": 1407, "end": 1415, "loc": { "start": { "line": 50, "column": 55 }, "end": { "line": 50, "column": 63 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false } ], "quasis": [ { "type": "TemplateElement", "start": 1368, "end": 1400, "loc": { "start": { "line": 50, "column": 16 }, "end": { "line": 50, "column": 48 } }, "value": { "raw": "https://widget.kkbox.com/v1/?id=",