@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,227 lines (1,226 loc) • 1.6 MB
JSON
{
"type": "File",
"start": 0,
"end": 5414,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 154,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 5414,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 154,
"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": 61,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 32
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 38,
"end": 42,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
}
},
"imported": {
"type": "Identifier",
"start": 38,
"end": 42,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "Auth"
},
"name": "Auth"
},
"local": {
"type": "Identifier",
"start": 38,
"end": 42,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "Auth"
},
"name": "Auth"
}
},
{
"type": "ImportSpecifier",
"start": 44,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 44,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 18
},
"identifierName": "Api"
},
"name": "Api"
},
"local": {
"type": "Identifier",
"start": 44,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 18
},
"identifierName": "Api"
},
"name": "Api"
}
}
],
"source": {
"type": "StringLiteral",
"start": 55,
"end": 60,
"loc": {
"start": {
"line": 2,
"column": 26
},
"end": {
"line": 2,
"column": 31
}
},
"extra": {
"rawValue": "../",
"raw": "'../'"
},
"value": "../"
}
},
{
"type": "ImportDeclaration",
"start": 62,
"end": 116,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 54
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 71,
"end": 80,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 71,
"end": 80,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 18
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
},
"local": {
"type": "Identifier",
"start": 71,
"end": 80,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 18
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
}
}
],
"source": {
"type": "StringLiteral",
"start": 88,
"end": 115,
"loc": {
"start": {
"line": 3,
"column": 26
},
"end": {
"line": 3,
"column": 53
}
},
"extra": {
"rawValue": "../../client_secrets.json",
"raw": "'../../client_secrets.json'"
},
"value": "../../client_secrets.json"
}
},
{
"type": "VariableDeclaration",
"start": 118,
"end": 156,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 38
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 124,
"end": 155,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 37
}
},
"id": {
"type": "Identifier",
"start": 124,
"end": 133,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 15
},
"identifierName": "CLIENT_ID"
},
"name": "CLIENT_ID"
},
"init": {
"type": "MemberExpression",
"start": 136,
"end": 155,
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 37
}
},
"object": {
"type": "Identifier",
"start": 136,
"end": 145,
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 27
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
},
"property": {
"type": "Identifier",
"start": 146,
"end": 155,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 5,
"column": 37
},
"identifierName": "client_id"
},
"name": "client_id"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 157,
"end": 203,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 46
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 163,
"end": 202,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 45
}
},
"id": {
"type": "Identifier",
"start": 163,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 19
},
"identifierName": "CLIENT_SECRET"
},
"name": "CLIENT_SECRET"
},
"init": {
"type": "MemberExpression",
"start": 179,
"end": 202,
"loc": {
"start": {
"line": 6,
"column": 22
},
"end": {
"line": 6,
"column": 45
}
},
"object": {
"type": "Identifier",
"start": 179,
"end": 188,
"loc": {
"start": {
"line": 6,
"column": 22
},
"end": {
"line": 6,
"column": 31
},
"identifierName": "kkbox_sdk"
},
"name": "kkbox_sdk"
},
"property": {
"type": "Identifier",
"start": 189,
"end": 202,
"loc": {
"start": {
"line": 6,
"column": 32
},
"end": {
"line": 6,
"column": 45
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 205,
"end": 5413,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 153,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 205,
"end": 5412,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 153,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 205,
"end": 213,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 8
},
"identifierName": "describe"
},
"name": "describe"
},
"arguments": [
{
"type": "StringLiteral",
"start": 214,
"end": 233,
"loc": {
"start": {
"line": 8,
"column": 9
},
"end": {
"line": 8,
"column": 28
}
},
"extra": {
"rawValue": "SDK Begin to Test",
"raw": "'SDK Begin to Test'"
},
"value": "SDK Begin to Test"
},
{
"type": "ArrowFunctionExpression",
"start": 235,
"end": 5411,
"loc": {
"start": {
"line": 8,
"column": 30
},
"end": {
"line": 153,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 241,
"end": 5411,
"loc": {
"start": {
"line": 8,
"column": 36
},
"end": {
"line": 153,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 245,
"end": 5409,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 152,
"column": 5
}
},
"expression": {
"type": "CallExpression",
"start": 245,
"end": 5408,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 152,
"column": 4
}
},
"callee": {
"type": "Identifier",
"start": 245,
"end": 253,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 10
},
"identifierName": "describe"
},
"name": "describe"
},
"arguments": [
{
"type": "StringLiteral",
"start": 254,
"end": 260,
"loc": {
"start": {
"line": 9,
"column": 11
},
"end": {
"line": 9,
"column": 17
}
},
"extra": {
"rawValue": "Auth",
"raw": "'Auth'"
},
"value": "Auth"
},
{
"type": "ArrowFunctionExpression",
"start": 262,
"end": 5407,
"loc": {
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 152,
"column": 3
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 268,
"end": 5407,
"loc": {
"start": {
"line": 9,
"column": 25
},
"end": {
"line": 152,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 274,
"end": 5403,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 151,
"column": 7
}
},
"expression": {
"type": "CallExpression",
"start": 274,
"end": 5402,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 151,
"column": 6
}
},
"callee": {
"type": "Identifier",
"start": 274,
"end": 276,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 6
},
"identifierName": "it"
},
"name": "it"
},
"arguments": [
{
"type": "StringLiteral",
"start": 277,
"end": 302,
"loc": {
"start": {
"line": 10,
"column": 7
},
"end": {
"line": 10,
"column": 32
}
},
"extra": {
"rawValue": "should get access token",
"raw": "'should get access token'"
},
"value": "should get access token"
},
{
"type": "ArrowFunctionExpression",
"start": 304,
"end": 5401,
"loc": {
"start": {
"line": 10,
"column": 34
},
"end": {
"line": 151,
"column": 5
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 310,
"end": 5401,
"loc": {
"start": {
"line": 10,
"column": 40
},
"end": {
"line": 151,
"column": 5
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 318,
"end": 366,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 54
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 324,
"end": 365,
"loc": {
"start": {
"line": 11,
"column": 12
},
"end": {
"line": 11,
"column": 53
}
},
"id": {
"type": "Identifier",
"start": 324,
"end": 328,
"loc": {
"start": {
"line": 11,
"column": 12
},
"end": {
"line": 11,
"column": 16
},
"identifierName": "auth"
},
"name": "auth"
},
"init": {
"type": "NewExpression",
"start": 331,
"end": 365,
"loc": {
"start": {
"line": 11,
"column": 19
},
"end": {
"line": 11,
"column": 53
}
},
"callee": {
"type": "Identifier",
"start": 335,
"end": 339,
"loc": {
"start": {
"line": 11,
"column": 23
},
"end": {
"line": 11,
"column": 27
},
"identifierName": "Auth"
},
"name": "Auth"
},
"arguments": [
{
"type": "Identifier",
"start": 340,
"end": 349,
"loc": {
"start": {
"line": 11,
"column": 28
},
"end": {
"line": 11,
"column": 37
},
"identifierName": "CLIENT_ID"
},
"name": "CLIENT_ID"
},
{
"type": "Identifier",
"start": 351,
"end": 364,
"loc": {
"start": {
"line": 11,
"column": 39
},
"end": {
"line": 11,
"column": 52
},
"identifierName": "CLIENT_SECRET"
},
"name": "CLIENT_SECRET"
}
]
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 373,
"end": 5395,
"loc": {
"start": {
"line": 12,
"column": 6
},
"end": {
"line": 150,
"column": 9
}
},
"argument": {
"type": "CallExpression",
"start": 380,
"end": 5394,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 150,
"column": 8
}
},
"callee": {
"type": "MemberExpression",
"start": 380,
"end": 430,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 63
}
},
"object": {
"type": "CallExpression",
"start": 380,
"end": 425,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 58
}
},
"callee": {
"type": "MemberExpression",
"start": 380,
"end": 423,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 56
}
},
"object": {
"type": "MemberExpression",
"start": 380,
"end": 406,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 380,
"end": 384,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 17
},
"identifierName": "auth"
},
"name": "auth"
},
"property": {
"type": "Identifier",
"start": 385,
"end": 406,
"loc": {
"start": {
"line": 12,
"column": 18
},
"end": {
"line": 12,
"column": 39
},
"identifierName": "clientCredentialsFlow"
},
"name": "clientCredentialsFlow"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 407,
"end": 423,
"loc": {
"start": {
"line": 12,
"column": 40
},
"end": {
"line": 12,
"column": 56
},
"identifierName": "fetchAccessToken"
},
"name": "fetchAccessToken"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 426,
"end": 430,
"loc": {
"start": {
"line": 12,
"column": 59
},
"end": {
"line": 12,
"column": 63
},
"identifierName": "then"
},
"name": "then"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 431,
"end": 5393,
"loc": {
"start": {
"line": 12,
"column": 64
},
"end": {
"line": 150,
"column": 7
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 431,
"end": 439,
"loc": {
"start": {
"line": 12,
"column": 64
},
"end": {
"line": 12,
"column": 72
},
"identifierName": "response"
},
"name": "response"
}
],
"body": {
"type": "BlockStatement",
"start": 443,
"end": 5393,
"loc": {
"start": {
"line": 12,
"column": 76
},
"end": {
"line": 150,
"column": 7
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 453,
"end": 1202,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 35,
"column": 11
}
},
"expression": {
"type": "CallExpression",
"start": 453,
"end": 1201,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 35,
"column": 10
}
},
"callee": {
"type": "Identifier",
"start": 453,
"end": 461,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 16
},
"identifierName": "describe"
},
"name": "describe"
},
"arguments": [
{
"type": "StringLiteral",
"start": 462,
"end": 483,
"loc": {
"start": {
"line": 13,
"column": 17
},
"end": {
"line": 13,
"column": 38
}
},
"extra": {
"rawValue": "Api With Fake Token",
"raw": "'Api With Fake Token'"
},
"value": "Api With Fake Token"
},
{
"type": "ArrowFunctionExpression",
"start": 485,
"end": 1200,
"loc": {
"start": {
"line": 13,
"column": 40
},