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,467 lines (1,466 loc) 217 kB
{ "type": "File", "start": 0, "end": 2719, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 92, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2719, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 92, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 45, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 45 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 25, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 25 } }, "imported": { "type": "Identifier", "start": 8, "end": 13, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 13 }, "identifierName": "USERS" }, "name": "USERS" }, "local": { "type": "Identifier", "start": 17, "end": 25, "loc": { "start": { "line": 1, "column": 17 }, "end": { "line": 1, "column": 25 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 32, "end": 45, "loc": { "start": { "line": 1, "column": 32 }, "end": { "line": 1, "column": 45 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 46, "end": 77, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 53, "end": 60, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 53, "end": 60, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 66, "end": 77, "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 profile for a user.\n * @see https://docs.kkbox.codes/docs/user-profile\n ", "start": 79, "end": 166, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 167, "end": 2719, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 92, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 182, "end": 2719, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 92, "column": 1 } }, "id": { "type": "Identifier", "start": 188, "end": 199, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 32 }, "identifierName": "UserFetcher" }, "name": "UserFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 208, "end": 215, "loc": { "start": { "line": 8, "column": 41 }, "end": { "line": 8, "column": 48 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 216, "end": 2719, "loc": { "start": { "line": 8, "column": 49 }, "end": { "line": 92, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 253, "end": 375, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 253, "end": 264, "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": 265, "end": 269, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" } ], "body": { "type": "BlockStatement", "start": 271, "end": 375, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 281, "end": 292, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 19 } }, "expression": { "type": "CallExpression", "start": 281, "end": 292, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 19 } }, "callee": { "type": "Super", "start": 281, "end": 286, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 287, "end": 291, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" } ], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 302, "end": 336, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 345, "end": 369, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 345, "end": 369, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 345, "end": 357, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 20 } }, "object": { "type": "ThisExpression", "start": 345, "end": 349, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 350, "end": 357, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 20 }, "identifierName": "user_id" }, "name": "user_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 360, "end": 369, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 32 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 302, "end": 336, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 222, "end": 248, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the user fetcher.\n *\n * @param {string} user_id - The ID of a user.\n * @return {User}\n * @see https://docs.kkbox.codes/docs/user-profile\n ", "start": 381, "end": 557, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 562, "end": 639, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 562, "end": 571, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 13 }, "identifierName": "setUserID" }, "name": "setUserID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 572, "end": 579, "loc": { "start": { "line": 28, "column": 14 }, "end": { "line": 28, "column": 21 }, "identifierName": "user_id" }, "name": "user_id" } ], "body": { "type": "BlockStatement", "start": 581, "end": 639, "loc": { "start": { "line": 28, "column": 23 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 591, "end": 613, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 30 } }, "expression": { "type": "AssignmentExpression", "start": 591, "end": 613, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 591, "end": 603, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 20 } }, "object": { "type": "ThisExpression", "start": 591, "end": 595, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 596, "end": 603, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 20 }, "identifierName": "user_id" }, "name": "user_id" }, "computed": false }, "right": { "type": "Identifier", "start": 606, "end": 613, "loc": { "start": { "line": 29, "column": 23 }, "end": { "line": 29, "column": 30 }, "identifierName": "user_id" }, "name": "user_id" } } }, { "type": "ReturnStatement", "start": 622, "end": 633, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 629, "end": 633, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the user fetcher.\n *\n * @param {string} user_id - The ID of a user.\n * @return {User}\n * @see https://docs.kkbox.codes/docs/user-profile\n ", "start": 381, "end": 557, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch the profile of the user you find.\n *\n * @return {Promise}\n * @example api.userFetcher.setUserID('KlLwTKHUeWVZEMl3CQ').fetchProfile()\n ", "start": 645, "end": 814, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 819, "end": 895, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 819, "end": 831, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 39, "column": 16 }, "identifierName": "fetchProfile" }, "name": "fetchProfile", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 834, "end": 895, "loc": { "start": { "line": 39, "column": 19 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 844, "end": 889, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 53 } }, "argument": { "type": "CallExpression", "start": 851, "end": 889, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 53 } }, "callee": { "type": "MemberExpression", "start": 851, "end": 864, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 28 } }, "object": { "type": "MemberExpression", "start": 851, "end": 860, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 851, "end": 855, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 19 } } }, "property": { "type": "Identifier", "start": 856, "end": 860, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 40, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 861, "end": 864, "loc": { "start": { "line": 40, "column": 25 }, "end": { "line": 40, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 865, "end": 888, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 52 } }, "left": { "type": "Identifier", "start": 865, "end": 873, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 876, "end": 888, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 52 } }, "object": { "type": "ThisExpression", "start": 876, "end": 880, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 44 } } }, "property": { "type": "Identifier", "start": 881, "end": 888, "loc": { "start": { "line": 40, "column": 45 }, "end": { "line": 40, "column": 52 }, "identifierName": "user_id" }, "name": "user_id" }, "computed": false } } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch the profile of the user you find.\n *\n * @return {Promise}\n * @example api.userFetcher.setUserID('KlLwTKHUeWVZEMl3CQ').fetchProfile()\n ", "start": 645, "end": 814, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * User's shared playlists.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @see https://docs.kkbox.codes/docs/user-shared-playlist\n * @example api.userFetcher.setUserID('KlLwTKHUeWVZEMl3CQ').fetchSharedPlaylists()\n ", "start": 901, "end": 1251, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 51, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1256, "end": 1465, "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 57, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1256, "end": 1276, "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 24 }, "identifierName": "fetchSharedPlaylists" }, "name": "fetchSharedPlaylists", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1277, "end": 1294, "loc": { "start": { "line": 52, "column": 25 }, "end": { "line": 52, "column": 42 } }, "left": { "type": "Identifier", "start": 1277, "end": 1282, "loc": { "start": { "line": 52, "column": 25 }, "end": { "line": 52, "column": 30 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 1285, "end": 1294, "loc": { "start": { "line": 52, "column": 33 }, "end": { "line": 52, "column": 42 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 1296, "end": 1314, "loc": { "start": { "line": 52, "column": 44 }, "end": { "line": 52, "column": 62 } }, "left": { "type": "Identifier", "start": 1296, "end": 1302, "loc": { "start": { "line": 52, "column": 44 }, "end": { "line": 52, "column": 50 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 1305, "end": 1314, "loc": { "start": { "line": 52, "column": 53 }, "end": { "line": 52, "column": 62 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 1316, "end": 1465, "loc": { "start": { "line": 52, "column": 64 }, "end": { "line": 57, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1326, "end": 1459, "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 56, "column": 10 } }, "argument": { "type": "CallExpression", "start": 1333, "end": 1459, "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 56, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 1333, "end": 1346, "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1333, "end": 1342, "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1333, "end": 1337, "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 19 } } }, "property": { "type": "Identifier", "start": 1338, "end": 1342, "loc": { "start": { "line": 53, "column": 20 }, "end": { "line": 53, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1343, "end": 1346, "loc": { "start": { "line": 53, "column": 25 }, "end": { "line": 53, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1347, "end": 1392, "loc": { "start": { "line": 53, "column": 29 }, "end": { "line": 53, "column": 74 } }, "left": { "type": "BinaryExpression", "start": 1347, "end": 1370, "loc": { "start": { "line": 53, "column": 29 }, "end": { "line": 53, "column": 52 } }, "left": { "type": "Identifier", "start": 1347, "end": 1355, "loc": { "start": { "line": 53, "column": 29 }, "end": { "line": 53, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1358, "end": 1370, "loc": { "start": { "line": 53, "column": 40 }, "end": { "line": 53, "column": 52 } }, "object": { "type": "ThisExpression", "start": 1358, "end": 1362, "loc": { "start": { "line": 53, "column": 40 }, "end": { "line": 53, "column": 44 } } },