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,451 lines (1,450 loc) 166 kB
{ "type": "File", "start": 0, "end": 1877, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 72, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1877, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 72, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 49, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 49 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 27, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 27 } }, "imported": { "type": "Identifier", "start": 9, "end": 15, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 15 }, "identifierName": "ALBUMS" }, "name": "ALBUMS" }, "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": 35, "end": 48, "loc": { "start": { "line": 1, "column": 35 }, "end": { "line": 1, "column": 48 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 50, "end": 82, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 57, "end": 64, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 57, "end": 64, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 70, "end": 81, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata and tracks of a album.\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums\n ", "start": 84, "end": 190, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 191, "end": 1876, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 71, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 206, "end": 1876, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 71, "column": 1 } }, "id": { "type": "Identifier", "start": 212, "end": 224, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 33 }, "identifierName": "AlbumFetcher" }, "name": "AlbumFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 233, "end": 240, "loc": { "start": { "line": 8, "column": 42 }, "end": { "line": 8, "column": 49 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 241, "end": 1876, "loc": { "start": { "line": 8, "column": 50 }, "end": { "line": 71, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 270, "end": 401, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 19, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 270, "end": 281, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 282, "end": 286, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 288, "end": 304, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 36 } }, "left": { "type": "Identifier", "start": 288, "end": 297, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 300, "end": 304, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 36 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 306, "end": 401, "loc": { "start": { "line": 12, "column": 38 }, "end": { "line": 19, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 312, "end": 335, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "CallExpression", "start": 312, "end": 334, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 26 } }, "callee": { "type": "Super", "start": 312, "end": 317, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 318, "end": 322, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 14 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 324, "end": 333, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 25 }, "identifierName": "territory" }, "name": "territory" } ] }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 341, "end": 367, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 372, "end": 397, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 372, "end": 396, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 372, "end": 384, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 16 } }, "object": { "type": "ThisExpression", "start": 372, "end": 376, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 377, "end": 384, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 16 }, "identifierName": "albumID" }, "name": "albumID" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 387, "end": 396, "loc": { "start": { "line": 18, "column": 19 }, "end": { "line": 18, "column": 28 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 341, "end": 367, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 245, "end": 267, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 11, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Set the album fetcher.\n *\n * @param {string} albumID - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums-album_id\n ", "start": 405, "end": 595, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 27, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 598, "end": 668, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 31, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 598, "end": 608, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 28, "column": 12 }, "identifierName": "setAlbumID" }, "name": "setAlbumID", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 609, "end": 616, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 28, "column": 20 }, "identifierName": "albumID" }, "name": "albumID" } ], "body": { "type": "BlockStatement", "start": 618, "end": 668, "loc": { "start": { "line": 28, "column": 22 }, "end": { "line": 31, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 624, "end": 647, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 624, "end": 646, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 624, "end": 636, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 16 } }, "object": { "type": "ThisExpression", "start": 624, "end": 628, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 8 } } }, "property": { "type": "Identifier", "start": 629, "end": 636, "loc": { "start": { "line": 29, "column": 9 }, "end": { "line": 29, "column": 16 }, "identifierName": "albumID" }, "name": "albumID" }, "computed": false }, "right": { "type": "Identifier", "start": 639, "end": 646, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 26 }, "identifierName": "albumID" }, "name": "albumID" } } }, { "type": "ReturnStatement", "start": 652, "end": 664, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 659, "end": 663, "loc": { "start": { "line": 30, "column": 11 }, "end": { "line": 30, "column": 15 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Set the album fetcher.\n *\n * @param {string} albumID - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums-album_id\n ", "start": 405, "end": 595, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 27, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums-album_id\n ", "start": 672, "end": 904, "loc": { "start": { "line": 33, "column": 2 }, "end": { "line": 39, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 907, "end": 1026, "loc": { "start": { "line": 40, "column": 2 }, "end": { "line": 44, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 907, "end": 920, "loc": { "start": { "line": 40, "column": 2 }, "end": { "line": 40, "column": 15 }, "identifierName": "fetchMetadata" }, "name": "fetchMetadata", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 923, "end": 1026, "loc": { "start": { "line": 40, "column": 18 }, "end": { "line": 44, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 929, "end": 1022, "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 43, "column": 7 } }, "argument": { "type": "CallExpression", "start": 936, "end": 1021, "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 43, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 936, "end": 949, "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 41, "column": 24 } }, "object": { "type": "MemberExpression", "start": 936, "end": 945, "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 41, "column": 20 } }, "object": { "type": "ThisExpression", "start": 936, "end": 940, "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 41, "column": 15 } } }, "property": { "type": "Identifier", "start": 941, "end": 945, "loc": { "start": { "line": 41, "column": 16 }, "end": { "line": 41, "column": 20 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 946, "end": 949, "loc": { "start": { "line": 41, "column": 21 }, "end": { "line": 41, "column": 24 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 950, "end": 979, "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 54 } }, "left": { "type": "BinaryExpression", "start": 950, "end": 964, "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 39 } }, "left": { "type": "Identifier", "start": 950, "end": 958, "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 33 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "StringLiteral", "start": 961, "end": 964, "loc": { "start": { "line": 41, "column": 36 }, "end": { "line": 41, "column": 39 } }, "extra": { "rawValue": "/", "raw": "'/'" }, "value": "/" } }, "operator": "+", "right": { "type": "MemberExpression", "start": 967, "end": 979, "loc": { "start": { "line": 41, "column": 42 }, "end": { "line": 41, "column": 54 } }, "object": { "type": "ThisExpression", "start": 967, "end": 971, "loc": { "start": { "line": 41, "column": 42 }, "end": { "line": 41, "column": 46 } } }, "property": { "type": "Identifier", "start": 972, "end": 979, "loc": { "start": { "line": 41, "column": 47 }, "end": { "line": 41, "column": 54 }, "identifierName": "albumID" }, "name": "albumID" }, "computed": false } }, { "type": "ObjectExpression", "start": 981, "end": 1020, "loc": { "start": { "line": 41, "column": 56 }, "end": { "line": 43, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 989, "end": 1014, "loc": { "start": { "line": 42, "column": 6 }, "end": { "line": 42, "column": 31 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 989, "end": 998, "loc": { "start": { "line": 42, "column": 6 }, "end": { "line": 42, "column": 15 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 1000, "end": 1014, "loc": { "start": { "line": 42, "column": 17 }, "end": { "line": 42, "column": 31 } }, "object": { "type": "ThisExpression", "start": 1000, "end": 1004, "loc": { "start": { "line": 42, "column": 17 }, "end": { "line": 42, "column": 21 } } }, "property": { "type": "Identifier", "start": 1005, "end": 1014, "loc": { "start": { "line": 42, "column": 22 }, "end": { "line": 42, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums-album_id\n ", "start": 672, "end": 904, "loc": { "start": { "line": 33, "column": 2 }, "end": { "line": 39, "column": 5 } } } ], "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": 1030, "end": 1181, "loc": { "start": { "line": 46, "column": 2 }, "end": { "line": 50, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1184, "end": 1277, "loc": { "start": { "line": 51, "column": 2 }, "end": { "line": 53, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1184, "end": 1196, "loc": { "start": { "line": 51, "column": 2 }, "end": { "line": 51, "column": 14 }, "identifierName": "getWidgetUri" }, "name": "getWidgetUri", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1199, "end": 1277, "loc": { "start": { "line": 51, "column": 17 }, "end": { "line": 53, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 1205, "end": 1273, "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 72 } }, "argument": { "type": "TemplateLiteral", "start": 1212, "end": 1272, "loc": { "start": { "line": 52, "column": 11 }, "end": { "line": 52, "column": 71 } }, "expressions": [ { "type": "MemberExpression", "start": 1247, "end": 1259, "loc": { "start": { "line": 52, "column": 46 }, "end": { "line": 52, "column": 58 } }, "object": { "type": "ThisExpression", "start": 1247, "end": 1251, "loc": { "start": { "line": 52, "column": 46 }, "end": { "line": 52, "column": 50 } } }, "property": { "type": "Identifier", "start": 1252, "end": 1259, "loc": { "start": { "line": 52, "column": 51