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,698 lines 42.9 kB
{ "type": "File", "start": 0, "end": 614, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 26, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 614, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 26, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 188, "end": 614, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 26, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 203, "end": 614, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 26, "column": 1 } }, "id": { "type": "Identifier", "start": 209, "end": 230, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 42 }, "identifierName": "ClientCredentialsFlow" }, "name": "ClientCredentialsFlow", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 231, "end": 614, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 26, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 268, "end": 364, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 15, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 268, "end": 279, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 280, "end": 285, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 21 }, "identifierName": "token" }, "name": "token" } ], "body": { "type": "BlockStatement", "start": 287, "end": 364, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 15, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 340, "end": 358, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 340, "end": 358, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 340, "end": 350, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 18 } }, "object": { "type": "ThisExpression", "start": 340, "end": 344, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 345, "end": 350, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 18 }, "identifierName": "token" }, "name": "token" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 353, "end": 358, "loc": { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 26 }, "identifierName": "token" }, "name": "token" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 297, "end": 331, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 13, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 237, "end": 263, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken()\n ", "start": 370, "end": 502, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 22, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 507, "end": 612, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 25, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 507, "end": 523, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 20 }, "identifierName": "fetchAccessToken" }, "name": "fetchAccessToken", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 526, "end": 612, "loc": { "start": { "line": 23, "column": 23 }, "end": { "line": 25, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 536, "end": 606, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 78 } }, "argument": { "type": "CallExpression", "start": 543, "end": 606, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 78 } }, "callee": { "type": "MemberExpression", "start": 543, "end": 570, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 42 } }, "object": { "type": "MemberExpression", "start": 543, "end": 553, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 25 } }, "object": { "type": "ThisExpression", "start": 543, "end": 547, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 19 } } }, "property": { "type": "Identifier", "start": 548, "end": 553, "loc": { "start": { "line": 24, "column": 20 }, "end": { "line": 24, "column": 25 }, "identifierName": "token" }, "name": "token" }, "computed": false }, "property": { "type": "Identifier", "start": 554, "end": 570, "loc": { "start": { "line": 24, "column": 26 }, "end": { "line": 24, "column": 42 }, "identifierName": "fetchAccessToken" }, "name": "fetchAccessToken" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 571, "end": 605, "loc": { "start": { "line": 24, "column": 43 }, "end": { "line": 24, "column": 77 } }, "properties": [ { "type": "ObjectProperty", "start": 572, "end": 604, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 76 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 572, "end": 582, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 54 }, "identifierName": "grant_type" }, "name": "grant_type" }, "value": { "type": "StringLiteral", "start": 584, "end": 604, "loc": { "start": { "line": 24, "column": 56 }, "end": { "line": 24, "column": 76 } }, "extra": { "rawValue": "client_credentials", "raw": "'client_credentials'" }, "value": "client_credentials" } } ] } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken()\n ", "start": 370, "end": 502, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 22, "column": 7 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 187, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 187, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 187, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 237, "end": 263, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 297, "end": 331, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 13, "column": 11 } } }, { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken()\n ", "start": 370, "end": 502, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 22, "column": 7 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 187, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 188, "end": 194, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 195, "end": 202, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 14 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 203, "end": 208, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 6, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ClientCredentialsFlow", "start": 209, "end": 230, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 42 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 231, "end": 232, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 6, "column": 44 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 237, "end": 263, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "constructor", "start": 268, "end": 279, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 15 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 279, "end": 280, "loc": { "start": { "line": 10, "column": 15 }, "end": { "line": 10, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 280, "end": 285, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 21 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 285, "end": 286, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 22 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 287, "end": 288, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 24 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 297, "end": 331, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 13, "column": 11 } } }, { "type": { "label": "this", "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "this", "start": 340, "end": 344, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 344, "end": 345, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 345, "end": 350, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 18 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 351, "end": 352, "loc": { "start": { "line": 14, "column": 19 }, "end": { "line": 14, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 353, "end": 358, "loc": { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 26 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 363, "end": 364, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 5 } } }, { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken()\n ", "start": 370, "end": 502, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 22, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "fetchAccessToken", "start": 507, "end": 523, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 20 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 523, "end": 524, "loc": { "start": { "line": 23, "column": 20 }, "end": { "line": 23, "column": 21 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 524, "end": 525, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 23, "column": 22 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 526, "end": 527, "loc": { "start": { "line": 23, "column": 23 }, "end": { "line": 23, "column": 24 } } }, { "type": { "label": "return", "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "return", "start": 536, "end": 542, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 14 } } }, { "type": { "label": "this", "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "this", "start": 543, "end": 547, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 19 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 547, "end": 548, "loc": { "start": { "line": 24, "column": 19 }, "end": { "line": 24, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 548, "end": 553, "loc": { "start": { "line": 24, "column": 20 }, "end": { "line": 24, "column": 25 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 553, "end": 554, "loc": { "start": { "line": 24, "column": 25 }, "end": { "line": 24, "column": 26 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "fetchAccessToken", "start": 554, "end": 570, "loc": { "start": { "line": 24, "column": 26 }, "end": { "line": 24, "column": 42 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 570, "end": 571, "loc": { "start": { "line": 24, "column": 42 }, "end": { "line": 24, "column": 43 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 571, "end": 572, "loc": { "start": { "line": 24, "column": 43 }, "end": { "line": 24, "column": 44 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "grant_type", "start": 572, "end": 582, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 54 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 582, "end": 583, "loc": { "start": { "line": 24, "column": 54 }, "end": { "line": 24, "column": 55 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "client_credentials", "start": 584, "end": 604, "loc": { "start": { "line": 24, "column": 56 }, "end": { "line": 24, "column": 76 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 604, "end": 605, "loc": { "start": { "line": 24, "column": 76 }, "end": { "line": 24, "column": 77 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 605, "end": 606, "loc": { "start": { "line": 24, "column": 77 }, "end": { "line": 24, "column": 78 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 611, "end": 612, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 5 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 613, "end": 614, "loc": { "start": { "line": 26, "column": 0 }, "end": { "line": 26, "column": 1 } } }, { "type": { "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 614, "end": 614, "loc": { "start": { "line": 26, "column": 1 }, "end": { "line": 26, "column": 1 } } } ] }