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,450 lines (1,449 loc) 190 kB
{ "type": "File", "start": 0, "end": 2065, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 72, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2065, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 72, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 25, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 25 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 } }, "local": { "type": "Identifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 }, "identifierName": "axios" }, "name": "axios" } } ], "source": { "type": "StringLiteral", "start": 18, "end": 25, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 25 } }, "extra": { "rawValue": "axios", "raw": "'axios'" }, "value": "axios" } }, { "type": "ImportDeclaration", "start": 26, "end": 65, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 39 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 34, "end": 43, "loc": { "start": { "line": 2, "column": 8 }, "end": { "line": 2, "column": 17 } }, "imported": { "type": "Identifier", "start": 34, "end": 43, "loc": { "start": { "line": 2, "column": 8 }, "end": { "line": 2, "column": 17 }, "identifierName": "authError" }, "name": "authError" }, "local": { "type": "Identifier", "start": 34, "end": 43, "loc": { "start": { "line": 2, "column": 8 }, "end": { "line": 2, "column": 17 }, "identifierName": "authError" }, "name": "authError" } } ], "source": { "type": "StringLiteral", "start": 50, "end": 65, "loc": { "start": { "line": 2, "column": 24 }, "end": { "line": 2, "column": 39 } }, "extra": { "rawValue": "../catchError", "raw": "'../catchError'" }, "value": "../catchError" } }, { "type": "ImportDeclaration", "start": 66, "end": 103, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 37 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 73, "end": 84, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 18 } }, "local": { "type": "Identifier", "start": 73, "end": 84, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 18 }, "identifierName": "querystring" }, "name": "querystring" } } ], "source": { "type": "StringLiteral", "start": 90, "end": 103, "loc": { "start": { "line": 3, "column": 24 }, "end": { "line": 3, "column": 37 } }, "extra": { "rawValue": "querystring", "raw": "'querystring'" }, "value": "querystring" } }, { "type": "ImportDeclaration", "start": 104, "end": 155, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 51 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 112, "end": 135, "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 31 } }, "imported": { "type": "Identifier", "start": 112, "end": 117, "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 13 }, "identifierName": "Token" }, "name": "Token" }, "local": { "type": "Identifier", "start": 121, "end": 135, "loc": { "start": { "line": 4, "column": 17 }, "end": { "line": 4, "column": 31 }, "identifierName": "ENDPOINT_TOKEN" }, "name": "ENDPOINT_TOKEN" } } ], "source": { "type": "StringLiteral", "start": 142, "end": 155, "loc": { "start": { "line": 4, "column": 38 }, "end": { "line": 4, "column": 51 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 156, "end": 216, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 60 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 164, "end": 196, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 40 } }, "imported": { "type": "Identifier", "start": 164, "end": 173, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 17 }, "identifierName": "TokenInfo" }, "name": "TokenInfo" }, "local": { "type": "Identifier", "start": 177, "end": 196, "loc": { "start": { "line": 5, "column": 21 }, "end": { "line": 5, "column": 40 }, "identifierName": "ENDPOINT_TOKEN_INFO" }, "name": "ENDPOINT_TOKEN_INFO" } } ], "source": { "type": "StringLiteral", "start": 203, "end": 216, "loc": { "start": { "line": 5, "column": 47 }, "end": { "line": 5, "column": 60 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint", "leadingComments": null, "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Retrieve information about a access token.\n * @see https://docs.kkbox.codes/docs/token-introspection-api\n ", "start": 218, "end": 333, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 10, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 334, "end": 2065, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 72, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 349, "end": 2065, "loc": { "start": { "line": 11, "column": 15 }, "end": { "line": 72, "column": 1 } }, "id": { "type": "Identifier", "start": 355, "end": 360, "loc": { "start": { "line": 11, "column": 21 }, "end": { "line": 11, "column": 26 }, "identifierName": "Token" }, "name": "Token", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 361, "end": 2065, "loc": { "start": { "line": 11, "column": 27 }, "end": { "line": 72, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 398, "end": 608, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 25, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 398, "end": 409, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 410, "end": 419, "loc": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 25 }, "identifierName": "client_id" }, "name": "client_id" }, { "type": "Identifier", "start": 421, "end": 434, "loc": { "start": { "line": 15, "column": 27 }, "end": { "line": 15, "column": 40 }, "identifierName": "client_secret" }, "name": "client_secret" } ], "body": { "type": "BlockStatement", "start": 436, "end": 608, "loc": { "start": { "line": 15, "column": 42 }, "end": { "line": 25, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 489, "end": 515, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 489, "end": 515, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 489, "end": 503, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 22 } }, "object": { "type": "ThisExpression", "start": 489, "end": 493, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 494, "end": 503, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 22 }, "identifierName": "client_id" }, "name": "client_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 506, "end": 515, "loc": { "start": { "line": 19, "column": 25 }, "end": { "line": 19, "column": 34 }, "identifierName": "client_id" }, "name": "client_id", "leadingComments": null, "trailingComments": null }, "leadingComments": null, "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 446, "end": 480, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 18, "column": 11 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 525, "end": 559, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 23, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 568, "end": 602, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 568, "end": 602, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 42 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 568, "end": 586, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 26 } }, "object": { "type": "ThisExpression", "start": 568, "end": 572, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 573, "end": 586, "loc": { "start": { "line": 24, "column": 13 }, "end": { "line": 24, "column": 26 }, "identifierName": "client_secret" }, "name": "client_secret" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 589, "end": 602, "loc": { "start": { "line": 24, "column": 29 }, "end": { "line": 24, "column": 42 }, "identifierName": "client_secret" }, "name": "client_secret" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 525, "end": 559, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 23, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 367, "end": 393, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 14, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Retrieve information about a access token.\n *\n * @param {string} access_token - Access token authorized by a user, need to be URL encoded before using.\n * @return {Promise}\n * @example auth.token.info('1DOOqXertxd9nUs0MOHQSA==')\n * @see Retrieve information about a access token.\n ", "start": 614, "end": 932, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 34, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 937, "end": 1149, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 40, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 937, "end": 941, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 8 }, "identifierName": "info" }, "name": "info", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 942, "end": 954, "loc": { "start": { "line": 35, "column": 9 }, "end": { "line": 35, "column": 21 }, "identifierName": "access_token" }, "name": "access_token" } ], "body": { "type": "BlockStatement", "start": 956, "end": 1149, "loc": { "start": { "line": 35, "column": 23 }, "end": { "line": 40, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 966, "end": 1143, "loc": { "start": { "line": 36, "column": 8 }, "end": { "line": 39, "column": 27 } }, "argument": { "type": "CallExpression", "start": 973, "end": 1143, "loc": { "start": { "line": 36, "column": 15 }, "end": { "line": 39, "column": 27 } }, "callee": { "type": "MemberExpression", "start": 973, "end": 1132, "loc": { "start": { "line": 36, "column": 15 }, "end": { "line": 39, "column": 16 } }, "object": { "type": "CallExpression", "start": 973, "end": 1126, "loc": { "start": { "line": 36, "column": 15 }, "end": { "line": 39, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 973, "end": 982, "loc": { "start": { "line": 36, "column": 15 }, "end": { "line": 36, "column": 24 } }, "object": { "type": "Identifier", "start": 973, "end": 978, "loc": { "start": { "line": 36, "column": 15 }, "end": { "line": 36, "column": 20 }, "identifierName": "axios" }, "name": "axios" }, "property": { "type": "Identifier", "start": 979, "end": 982, "loc": { "start": { "line": 36, "column": 21 }, "end": { "line": 36, "column": 24 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 983, "end": 1002, "loc": { "start": { "line": 36, "column": 25 }, "end": { "line": 36, "column": 44 }, "identifierName": "ENDPOINT_TOKEN_INFO" }, "name": "ENDPOINT_TOKEN_INFO" }, { "type": "ObjectExpression", "start": 1004, "end": 1125, "loc": { "start": { "line": 36, "column": 46 }, "end": { "line": 39, "column": 9 } }, "properties": [ { "type": "ObjectProperty", "start": 1018, "end": 1054, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 48 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1018, "end": 1024, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 18 }, "identifierName": "params" }, "name": "params" }, "value": { "type": "ObjectExpression", "start": 1026, "end": 1054, "loc": { "start": { "line": 37, "column": 20 }, "end": { "line": 37, "column": 48 } }, "properties": [ { "type": "ObjectProperty", "start": 1027, "end": 1053, "loc": { "start": { "line": 37, "column": 21 }, "end": { "line": 37, "column": 47 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1027, "end": 1039, "loc": { "start": { "line": 37, "column": 21 }, "end": { "line": 37, "column": 33 }, "identifierName": "access_token" }, "name": "access_token" }, "value": { "type": "Identifier", "start": 1041, "end": 1053, "loc": { "start": { "line": 37, "column": 35 }, "end": { "line": 37, "column": 47 }, "identifierName": "access_token" }, "name": "access_token" } } ] } }, { "type": "ObjectProperty", "start": 1068, "end": 1115, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 59 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1068, "end": 1075, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 19 }, "identifierName": "headers" }, "name": "headers" }, "value": { "type": "ObjectExpression", "start": 1077, "end": 1115, "loc": { "start": { "line": 38, "column": 21 }, "end": { "line": 38, "column": 59 } }, "properties": [ { "type": "ObjectProperty", "start": 1078, "end": 1114, "loc": { "start": { "line": 38, "column": 22 }, "end": { "line": 38, "column": 58 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "StringLiteral", "start": 1078, "end": 1090, "loc": { "start": { "line": 38, "column": 22 }, "end": { "line": 38, "column": 34 } }, "extra": { "rawValue": "User-Agent", "raw": "'User-Agent'" }, "value": "User-Agent" }, "value": { "type": "StringLiteral", "start": 1092, "end": 1114, "loc": { "start": { "line": 38, "column": 36 }, "end": { "line": 38, "column": 58 } }, "extra": { "rawValue": "KKBOX JavaScript SDK", "raw": "'KKBOX JavaScript SDK'" }, "value": "KKBOX JavaScript SDK" } } ] } } ] } ] }, "property": { "type": "Identifier", "start": 1127, "end": 1132, "loc": { "start": { "line": 39, "column": 11 }, "end": { "line": 39, "column": 16 }, "identifierName": "catch" }, "name": "catch" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 1133, "end": 1142, "loc": { "start": { "line": 39, "column": 17 }, "end": { "line": 39, "column": 26 }, "identifierName": "authError" }, "name": "authError" } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Retrieve information about a access token.\n *\n * @param {string} access_token - Access token authorized by a user, need to be URL encoded before using.\n * @return {Promise}\n * @example auth.token.info('1DOOqXertxd9nUs0MOHQSA==')\n * @see Retrieve information about a access token.\n ", "start": 614, "end": 932, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 34, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get access token.\n *\n * @param {object} params - Form data.\n * @return {Promise}\n ", "start": 1155, "end": 1266, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 47, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1271, "end": 1579, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 56, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1271, "end": 1278, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 11 }, "identifierName": "request" }, "name": "request", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1279, "end": 1285,