@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,252 lines (1,251 loc) • 148 kB
JSON
{
"type": "File",
"start": 0,
"end": 816,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 23,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 816,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 23,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 28
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "should"
},
"name": "should"
}
}
],
"source": {
"type": "StringLiteral",
"start": 19,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 27
}
},
"extra": {
"rawValue": "should",
"raw": "'should'"
},
"value": "should"
}
},
{
"type": "ImportDeclaration",
"start": 29,
"end": 77,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 48
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 36,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 19
}
},
"local": {
"type": "Identifier",
"start": 36,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 19
},
"identifierName": "TokenFetcher"
},
"name": "TokenFetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 54,
"end": 76,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 47
}
},
"extra": {
"rawValue": "../auth/TokenFetcher",
"raw": "'../auth/TokenFetcher'"
},
"value": "../auth/TokenFetcher"
}
},
{
"type": "ImportDeclaration",
"start": 78,
"end": 144,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 66
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 85,
"end": 106,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 28
}
},
"local": {
"type": "Identifier",
"start": 85,
"end": 106,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 28
},
"identifierName": "ClientCredentialsFlow"
},
"name": "ClientCredentialsFlow"
}
}
],
"source": {
"type": "StringLiteral",
"start": 112,
"end": 143,
"loc": {
"start": {
"line": 3,
"column": 34
},
"end": {
"line": 3,
"column": 65
}
},
"extra": {
"rawValue": "../auth/ClientCredentialsFlow",
"raw": "'../auth/ClientCredentialsFlow'"
},
"value": "../auth/ClientCredentialsFlow"
}
},
{
"type": "ImportDeclaration",
"start": 145,
"end": 199,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 54
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 154,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 154,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 18
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
},
"local": {
"type": "Identifier",
"start": 154,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 18
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
}
}
],
"source": {
"type": "StringLiteral",
"start": 171,
"end": 198,
"loc": {
"start": {
"line": 4,
"column": 26
},
"end": {
"line": 4,
"column": 53
}
},
"extra": {
"rawValue": "../../client_secrets.json",
"raw": "'../../client_secrets.json'"
},
"value": "../../client_secrets.json"
}
},
{
"type": "VariableDeclaration",
"start": 201,
"end": 239,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 38
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 207,
"end": 238,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 37
}
},
"id": {
"type": "Identifier",
"start": 207,
"end": 216,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 15
},
"identifierName": "CLIENT_ID"
},
"name": "CLIENT_ID"
},
"init": {
"type": "MemberExpression",
"start": 219,
"end": 238,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 37
}
},
"object": {
"type": "Identifier",
"start": 219,
"end": 228,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 27
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
},
"property": {
"type": "Identifier",
"start": 229,
"end": 238,
"loc": {
"start": {
"line": 6,
"column": 28
},
"end": {
"line": 6,
"column": 37
},
"identifierName": "client_id"
},
"name": "client_id"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 240,
"end": 286,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 46
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 246,
"end": 285,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 45
}
},
"id": {
"type": "Identifier",
"start": 246,
"end": 259,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 19
},
"identifierName": "CLIENT_SECRET"
},
"name": "CLIENT_SECRET"
},
"init": {
"type": "MemberExpression",
"start": 262,
"end": 285,
"loc": {
"start": {
"line": 7,
"column": 22
},
"end": {
"line": 7,
"column": 45
}
},
"object": {
"type": "Identifier",
"start": 262,
"end": 271,
"loc": {
"start": {
"line": 7,
"column": 22
},
"end": {
"line": 7,
"column": 31
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
},
"property": {
"type": "Identifier",
"start": 272,
"end": 285,
"loc": {
"start": {
"line": 7,
"column": 32
},
"end": {
"line": 7,
"column": 45
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 288,
"end": 815,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 22,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 288,
"end": 814,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 22,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 288,
"end": 296,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 8
},
"identifierName": "describe"
},
"name": "describe"
},
"arguments": [
{
"type": "StringLiteral",
"start": 297,
"end": 317,
"loc": {
"start": {
"line": 9,
"column": 9
},
"end": {
"line": 9,
"column": 29
}
},
"extra": {
"rawValue": "Auth Begin to Test",
"raw": "'Auth Begin to Test'"
},
"value": "Auth Begin to Test"
},
{
"type": "ArrowFunctionExpression",
"start": 319,
"end": 813,
"loc": {
"start": {
"line": 9,
"column": 31
},
"end": {
"line": 22,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 325,
"end": 813,
"loc": {
"start": {
"line": 9,
"column": 37
},
"end": {
"line": 22,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 329,
"end": 393,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 66
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 335,
"end": 392,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 65
}
},
"id": {
"type": "Identifier",
"start": 335,
"end": 347,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 20
},
"identifierName": "tokenFetcher"
},
"name": "tokenFetcher"
},
"init": {
"type": "NewExpression",
"start": 350,
"end": 392,
"loc": {
"start": {
"line": 10,
"column": 23
},
"end": {
"line": 10,
"column": 65
}
},
"callee": {
"type": "Identifier",
"start": 354,
"end": 366,
"loc": {
"start": {
"line": 10,
"column": 27
},
"end": {
"line": 10,
"column": 39
},
"identifierName": "TokenFetcher"
},
"name": "TokenFetcher"
},
"arguments": [
{
"type": "Identifier",
"start": 367,
"end": 376,
"loc": {
"start": {
"line": 10,
"column": 40
},
"end": {
"line": 10,
"column": 49
},
"identifierName": "CLIENT_ID"
},
"name": "CLIENT_ID"
},
{
"type": "Identifier",
"start": 378,
"end": 391,
"loc": {
"start": {
"line": 10,
"column": 51
},
"end": {
"line": 10,
"column": 64
},
"identifierName": "CLIENT_SECRET"
},
"name": "CLIENT_SECRET"
}
]
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 396,
"end": 811,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 21,
"column": 5
}
},
"expression": {
"type": "CallExpression",
"start": 396,
"end": 810,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 21,
"column": 4
}
},
"callee": {
"type": "Identifier",
"start": 396,
"end": 404,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 10
},
"identifierName": "describe"
},
"name": "describe"
},
"arguments": [
{
"type": "StringLiteral",
"start": 405,
"end": 428,
"loc": {
"start": {
"line": 11,
"column": 11
},
"end": {
"line": 11,
"column": 34
}
},
"extra": {
"rawValue": "clientCredentialsFlow",
"raw": "'clientCredentialsFlow'"
},
"value": "clientCredentialsFlow"
},
{
"type": "ArrowFunctionExpression",
"start": 430,
"end": 809,
"loc": {
"start": {
"line": 11,
"column": 36
},
"end": {
"line": 21,
"column": 3
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 436,
"end": 809,
"loc": {
"start": {
"line": 11,
"column": 42
},
"end": {
"line": 21,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 442,
"end": 805,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 20,
"column": 7
}
},
"expression": {
"type": "CallExpression",
"start": 442,
"end": 804,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 20,
"column": 6
}
},
"callee": {
"type": "Identifier",
"start": 442,
"end": 450,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 12
},
"identifierName": "describe"
},
"name": "describe"
},
"arguments": [
{
"type": "StringLiteral",
"start": 451,
"end": 472,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 34
}
},
"extra": {
"rawValue": "#fetchAccessToken()",
"raw": "'#fetchAccessToken()'"
},
"value": "#fetchAccessToken()"
},
{
"type": "ArrowFunctionExpression",
"start": 474,
"end": 803,
"loc": {
"start": {
"line": 12,
"column": 36
},
"end": {
"line": 20,
"column": 5
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 480,
"end": 803,
"loc": {
"start": {
"line": 12,
"column": 42
},
"end": {
"line": 20,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 488,
"end": 797,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 19,
"column": 9
}
},
"expression": {
"type": "CallExpression",
"start": 488,
"end": 796,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 19,
"column": 8
}
},
"callee": {
"type": "Identifier",
"start": 488,
"end": 490,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 8
},
"identifierName": "it"
},
"name": "it"
},
"arguments": [
{
"type": "StringLiteral",
"start": 491,
"end": 516,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 34
}
},
"extra": {
"rawValue": "should get access token",
"raw": "'should get access token'"
},
"value": "should get access token"
},
{
"type": "ArrowFunctionExpression",
"start": 518,
"end": 795,
"loc": {
"start": {
"line": 13,
"column": 36
},
"end": {
"line": 19,
"column": 7
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 524,
"end": 795,
"loc": {
"start": {
"line": 13,
"column": 42
},
"end": {
"line": 19,
"column": 7
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 534,
"end": 604,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 78
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 540,
"end": 603,
"loc": {
"start": {
"line": 14,
"column": 14
},
"end": {
"line": 14,
"column": 77
}
},
"id": {
"type": "Identifier",
"start": 540,
"end": 561,
"loc": {
"start": {
"line": 14,
"column": 14
},
"end": {
"line": 14,
"column": 35
},
"identifierName": "clientCredentialsFlow"
},
"name": "clientCredentialsFlow"
},
"init": {
"type": "NewExpression",
"start": 564,
"end": 603,
"loc": {
"start": {
"line": 14,
"column": 38
},
"end": {
"line": 14,
"column": 77
}
},
"callee": {
"type": "Identifier",
"start": 568,
"end": 589,
"loc": {
"start": {
"line": 14,
"column": 42
},
"end": {
"line": 14,
"column": 63
},
"identifierName": "ClientCredentialsFlow"
},
"name": "ClientCredentialsFlow"
},
"arguments": [
{
"type": "Identifier",
"start": 590,
"end": 602,
"loc": {
"start": {
"line": 14,
"column": 64
},
"end": {
"line": 14,
"column": 76
},
"identifierName": "tokenFetcher"
},
"name": "tokenFetcher"
}
]
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 613,
"end": 787,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 18,
"column": 11
}
},
"argument": {
"type": "CallExpression",
"start": 620,
"end": 786,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 18,
"column": 10
}
},
"callee": {
"type": "MemberExpression",
"start": 620,
"end": 665,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 60
}
},
"object": {
"type": "CallExpression",
"start": 620,
"end": 660,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 55
}
},
"callee": {
"type": "MemberExpression",
"start": 620,
"end": 658,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 53
}
},
"object": {
"type": "Identifier",
"start": 620,
"end": 641,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 36
},
"identifierName": "clientCredentialsFlow"
},
"name": "clientCredentialsFlow"
},
"property": {
"type": "Identifier",
"start": 642,
"end": 658,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 15,
"column": 53
},
"identifierName": "fetchAccessToken"
},
"name": "fetchAccessToken"
},
"computed": false
},
"arguments": []
},
"property": {