@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,375 lines (1,374 loc) • 109 kB
JSON
{
"type": "File",
"start": 0,
"end": 810,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 43,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 810,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 43,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"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": 27,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 42
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 36,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 36,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 18
},
"identifierName": "authError"
},
"name": "authError"
},
"local": {
"type": "Identifier",
"start": 36,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 18
},
"identifierName": "authError"
},
"name": "authError"
}
}
],
"source": {
"type": "StringLiteral",
"start": 53,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 26
},
"end": {
"line": 2,
"column": 41
}
},
"extra": {
"rawValue": "../catchError",
"raw": "'../catchError'"
},
"value": "../catchError"
}
},
{
"type": "ImportDeclaration",
"start": 70,
"end": 108,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 38
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 77,
"end": 88,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 18
}
},
"local": {
"type": "Identifier",
"start": 77,
"end": 88,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 18
},
"identifierName": "querystring"
},
"name": "querystring"
}
}
],
"source": {
"type": "StringLiteral",
"start": 94,
"end": 107,
"loc": {
"start": {
"line": 3,
"column": 24
},
"end": {
"line": 3,
"column": 37
}
},
"extra": {
"rawValue": "querystring",
"raw": "'querystring'"
},
"value": "querystring"
}
},
{
"type": "ImportDeclaration",
"start": 109,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 54
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 118,
"end": 141,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 32
}
},
"imported": {
"type": "Identifier",
"start": 118,
"end": 123,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 14
},
"identifierName": "Token"
},
"name": "Token"
},
"local": {
"type": "Identifier",
"start": 127,
"end": 141,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 32
},
"identifierName": "ENDPOINT_TOKEN"
},
"name": "ENDPOINT_TOKEN"
}
}
],
"source": {
"type": "StringLiteral",
"start": 149,
"end": 162,
"loc": {
"start": {
"line": 4,
"column": 40
},
"end": {
"line": 4,
"column": 53
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches access token.\n ",
"start": 165,
"end": 197,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 198,
"end": 809,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 42,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 213,
"end": 809,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 42,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 219,
"end": 231,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 33
},
"identifierName": "TokenFetcher"
},
"name": "TokenFetcher",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 232,
"end": 809,
"loc": {
"start": {
"line": 9,
"column": 34
},
"end": {
"line": 42,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 261,
"end": 433,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 261,
"end": 272,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 273,
"end": 281,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 22
},
"identifierName": "clientID"
},
"name": "clientID"
},
{
"type": "Identifier",
"start": 283,
"end": 295,
"loc": {
"start": {
"line": 13,
"column": 24
},
"end": {
"line": 13,
"column": 36
},
"identifierName": "clientSecret"
},
"name": "clientSecret"
}
],
"body": {
"type": "BlockStatement",
"start": 297,
"end": 433,
"loc": {
"start": {
"line": 13,
"column": 38
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 334,
"end": 359,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 334,
"end": 358,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 334,
"end": 347,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 334,
"end": 338,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 339,
"end": 347,
"loc": {
"start": {
"line": 17,
"column": 9
},
"end": {
"line": 17,
"column": 17
},
"identifierName": "clientID"
},
"name": "clientID"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 350,
"end": 358,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 28
},
"identifierName": "clientID"
},
"name": "clientID"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 303,
"end": 329,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 16,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 365,
"end": 391,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 21,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 396,
"end": 429,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 37
}
},
"expression": {
"type": "AssignmentExpression",
"start": 396,
"end": 428,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 36
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 396,
"end": 413,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 396,
"end": 400,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 401,
"end": 413,
"loc": {
"start": {
"line": 22,
"column": 9
},
"end": {
"line": 22,
"column": 21
},
"identifierName": "clientSecret"
},
"name": "clientSecret"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 416,
"end": 428,
"loc": {
"start": {
"line": 22,
"column": 24
},
"end": {
"line": 22,
"column": 36
},
"identifierName": "clientSecret"
},
"name": "clientSecret"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 365,
"end": 391,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 21,
"column": 7
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 236,
"end": 258,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 12,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches access token.\n *\n * @param {object} params - Form data.\n * @return {Promise}\n ",
"start": 437,
"end": 542,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 30,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 545,
"end": 807,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 41,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 545,
"end": 561,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 31,
"column": 18
},
"identifierName": "fetchAccessToken"
},
"name": "fetchAccessToken",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 562,
"end": 568,
"loc": {
"start": {
"line": 31,
"column": 19
},
"end": {
"line": 31,
"column": 25
},
"identifierName": "params"
},
"name": "params"
}
],
"body": {
"type": "BlockStatement",
"start": 570,
"end": 807,
"loc": {
"start": {
"line": 31,
"column": 27
},
"end": {
"line": 41,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 576,
"end": 803,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 40,
"column": 24
}
},
"argument": {
"type": "CallExpression",
"start": 583,
"end": 802,
"loc": {
"start": {
"line": 32,
"column": 11
},
"end": {
"line": 40,
"column": 23
}
},
"callee": {
"type": "MemberExpression",
"start": 583,
"end": 791,
"loc": {
"start": {
"line": 32,
"column": 11
},
"end": {
"line": 40,
"column": 12
}
},
"object": {
"type": "CallExpression",
"start": 583,
"end": 778,
"loc": {
"start": {
"line": 32,
"column": 11
},
"end": {
"line": 39,
"column": 8
}
},
"callee": {
"type": "MemberExpression",
"start": 583,
"end": 600,
"loc": {
"start": {
"line": 32,
"column": 11
},
"end": {
"line": 33,
"column": 11
}
},
"object": {
"type": "Identifier",
"start": 583,
"end": 588,
"loc": {
"start": {
"line": 32,
"column": 11
},
"end": {
"line": 32,
"column": 16
},
"identifierName": "axios"
},
"name": "axios"
},
"property": {
"type": "Identifier",
"start": 596,
"end": 600,
"loc": {
"start": {
"line": 33,
"column": 7
},
"end": {
"line": 33,
"column": 11
},
"identifierName": "post"
},
"name": "post"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 601,
"end": 615,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 26
},
"identifierName": "ENDPOINT_TOKEN"
},
"name": "ENDPOINT_TOKEN"
},
{
"type": "CallExpression",
"start": 617,
"end": 646,
"loc": {
"start": {
"line": 33,
"column": 28
},
"end": {
"line": 33,
"column": 57
}
},
"callee": {
"type": "MemberExpression",
"start": 617,
"end": 638,
"loc": {
"start": {
"line": 33,
"column": 28
},
"end": {
"line": 33,
"column": 49
}
},
"object": {
"type": "Identifier",
"start": 617,
"end": 628,
"loc": {
"start": {
"line": 33,
"column": 28
},
"end": {
"line": 33,
"column": 39
},
"identifierName": "querystring"
},
"name": "querystring"
},
"property": {
"type": "Identifier",
"start": 629,
"end": 638,
"loc": {
"start": {
"line": 33,
"column": 40
},
"end": {
"line": 33,
"column": 49
},
"identifierName": "stringify"
},
"name": "stringify"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 639,
"end": 645,
"loc": {
"start": {
"line": 33,
"column": 50
},
"end": {
"line": 33,
"column": 56
},
"identifierName": "params"
},
"name": "params"
}
]
},
{
"type": "ObjectExpression",
"start": 648,
"end": 777,
"loc": {
"start": {
"line": 33,
"column": 59
},
"end": {
"line": 39,
"column": 7
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 658,
"end": 748,
"loc": {
"start": {
"line": 34,
"column": 8
},
"end": {
"line": 37,
"column": 9
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 658,
"end": 662,
"loc": {
"start": {
"line": 34,
"column": 8
},
"end": {
"line": 34,
"column": 12
},
"identifierName": "auth"
},
"name": "auth"
},
"value": {
"type": "ObjectExpression",
"start": 664,
"end": 748,
"loc": {
"start": {
"line": 34,
"column": 14
},
"end": {
"line": 37,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 676,
"end": 699,
"loc": {
"start": {
"line": 35,
"column": 10
},
"end": {
"line": 35,
"column": 33
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 676,
"end": 684,
"loc": {
"start": {
"line": 35,
"column": 10
},
"end": {
"line": 35,
"column": 18
},
"identifierName": "username"
},
"name": "username"
},
"value": {
"type": "MemberExpression",
"start": 686,
"end": 699,
"loc": {
"start": {
"line": 35,
"column": 20
},
"end": {
"line": 35,
"column": 33
}
},
"object": {
"type": "ThisExpression",
"start": 686,
"end": 690,
"loc": {
"start": {
"line": 35,
"column": 20
},
"end": {
"line": 35,
"column": 24
}
}
},
"property": {
"type": "Identifier",
"start": 691,
"end": 699,
"loc": {
"start": {
"line": 35,
"column": 25
},
"end": {
"line": 35,
"column": 33
},
"identifierName": "clientID"
},
"name": "clientID"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 711,
"end": 738,
"loc": {
"start": {
"line": 36,
"column": 10
},
"end": {
"line": 36,
"column": 37
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 711,
"end": 719,
"loc": {
"start": {
"line": 36,
"column": 10
},
"end": {
"line": 36,
"column": 18
},
"identifierName": "password"
},
"name": "password"
},
"value": {
"type": "MemberExpression",
"start": 721,
"end": 738,
"loc": {
"start": {
"line": 36,
"column": 20
},
"end": {
"line": 36,
"column": 37
}
},
"object": {
"type": "ThisExpression",
"start": 721,
"end": 725,
"loc": {
"start": {
"line": 36,
"column": 20
},
"end": {
"line": 36,
"column": 24
}
}
},
"property": {
"type": "Identifier",
"start": 726,
"end": 738,
"loc": {
"start": {
"line": 36,
"column": 25
},
"end": {
"line": 36,
"column": 37
},
"identifierName": "clientSecret"
},
"name": "clientSecret"
},
"computed": false
}
}
]
}
},
{
"type": "ObjectProperty",
"start": 758,
"end": 769,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 19
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 758,
"end": 765,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 15
},
"identifierName": "headers"
},
"name": "headers"
},
"value": {
"type": "ObjectExpression",
"start": 767,
"end": 769,
"loc": {
"start": {
"line": 38,
"column": 17
},
"end": {
"line": 38,
"column": 19
}
},
"properties": []
}
}
]
}
]
},
"property": {
"type": "Identifier",