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,698 lines 42.9 kB
{ "type": "File", "start": 0, "end": 617, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 26, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 617, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 26, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 191, "end": 617, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 26, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 206, "end": 617, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 26, "column": 1 } }, "id": { "type": "Identifier", "start": 212, "end": 233, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 42 }, "identifierName": "ClientCredentialsFlow" }, "name": "ClientCredentialsFlow", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 234, "end": 617, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 26, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 271, "end": 367, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 15, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 271, "end": 282, "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": 283, "end": 288, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 21 }, "identifierName": "token" }, "name": "token" } ], "body": { "type": "BlockStatement", "start": 290, "end": 367, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 15, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 343, "end": 361, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 343, "end": 361, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 343, "end": 353, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 18 } }, "object": { "type": "ThisExpression", "start": 343, "end": 347, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 348, "end": 353, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 18 }, "identifierName": "token" }, "name": "token" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 356, "end": 361, "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": 300, "end": 334, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 13, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 240, "end": 266, "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": 373, "end": 505, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 22, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 510, "end": 615, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 25, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 510, "end": 526, "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": 529, "end": 615, "loc": { "start": { "line": 23, "column": 23 }, "end": { "line": 25, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 539, "end": 609, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 78 } }, "argument": { "type": "CallExpression", "start": 546, "end": 609, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 78 } }, "callee": { "type": "MemberExpression", "start": 546, "end": 573, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 42 } }, "object": { "type": "MemberExpression", "start": 546, "end": 556, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 25 } }, "object": { "type": "ThisExpression", "start": 546, "end": 550, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 19 } } }, "property": { "type": "Identifier", "start": 551, "end": 556, "loc": { "start": { "line": 24, "column": 20 }, "end": { "line": 24, "column": 25 }, "identifierName": "token" }, "name": "token" }, "computed": false }, "property": { "type": "Identifier", "start": 557, "end": 573, "loc": { "start": { "line": 24, "column": 26 }, "end": { "line": 24, "column": 42 }, "identifierName": "fetchAccessToken" }, "name": "fetchAccessToken" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 574, "end": 608, "loc": { "start": { "line": 24, "column": 43 }, "end": { "line": 24, "column": 77 } }, "properties": [ { "type": "ObjectProperty", "start": 575, "end": 607, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 76 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 575, "end": 585, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 54 }, "identifierName": "grant_type" }, "name": "grant_type" }, "value": { "type": "StringLiteral", "start": 587, "end": 607, "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": 373, "end": 505, "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://kkbox.gelato.io/docs/versions/1.1/authentication\n ", "start": 0, "end": 190, "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://kkbox.gelato.io/docs/versions/1.1/authentication\n ", "start": 0, "end": 190, "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://kkbox.gelato.io/docs/versions/1.1/authentication\n ", "start": 0, "end": 190, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 240, "end": 266, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 300, "end": 334, "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": 373, "end": 505, "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://kkbox.gelato.io/docs/versions/1.1/authentication\n ", "start": 0, "end": 190, "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": 191, "end": 197, "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": 198, "end": 205, "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": 206, "end": 211, "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": 212, "end": 233, "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": 234, "end": 235, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 6, "column": 44 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 240, "end": 266, "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": 271, "end": 282, "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": 282, "end": 283, "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": 283, "end": 288, "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": 288, "end": 289, "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": 290, "end": 291, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 24 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 300, "end": 334, "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": 343, "end": 347, "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": 347, "end": 348, "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": 348, "end": 353, "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": 354, "end": 355, "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": 356, "end": 361, "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": 366, "end": 367, "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": 373, "end": 505, "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": 510, "end": 526, "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": 526, "end": 527, "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": 527, "end": 528, "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": 529, "end": 530, "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": 539, "end": 545, "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": 546, "end": 550, "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": 550, "end": 551, "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": 551, "end": 556, "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": 556, "end": 557, "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": 557, "end": 573, "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": 573, "end": 574, "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": 574, "end": 575, "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": 575, "end": 585, "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": 585, "end": 586, "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": 587, "end": 607, "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": 607, "end": 608, "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": 608, "end": 609, "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": 614, "end": 615, "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": 616, "end": 617, "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": 617, "end": 617, "loc": { "start": { "line": 26, "column": 1 }, "end": { "line": 26, "column": 1 } } } ] }