@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,372 lines (1,371 loc) • 111 kB
JSON
{
"type": "File",
"start": 0,
"end": 916,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 40,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 916,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 40,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 25
}
},
"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": 26,
"end": 65,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 39
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 34,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 17
}
},
"imported": {
"type": "Identifier",
"start": 34,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 17
},
"identifierName": "authError"
},
"name": "authError"
},
"local": {
"type": "Identifier",
"start": 34,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 17
},
"identifierName": "authError"
},
"name": "authError"
}
}
],
"source": {
"type": "StringLiteral",
"start": 50,
"end": 65,
"loc": {
"start": {
"line": 2,
"column": 24
},
"end": {
"line": 2,
"column": 39
}
},
"extra": {
"rawValue": "../catchError",
"raw": "'../catchError'"
},
"value": "../catchError"
}
},
{
"type": "ImportDeclaration",
"start": 66,
"end": 103,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 37
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 73,
"end": 84,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 18
}
},
"local": {
"type": "Identifier",
"start": 73,
"end": 84,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 18
},
"identifierName": "querystring"
},
"name": "querystring"
}
}
],
"source": {
"type": "StringLiteral",
"start": 90,
"end": 103,
"loc": {
"start": {
"line": 3,
"column": 24
},
"end": {
"line": 3,
"column": 37
}
},
"extra": {
"rawValue": "querystring",
"raw": "'querystring'"
},
"value": "querystring"
}
},
{
"type": "ImportDeclaration",
"start": 104,
"end": 155,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 51
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 112,
"end": 135,
"loc": {
"start": {
"line": 4,
"column": 8
},
"end": {
"line": 4,
"column": 31
}
},
"imported": {
"type": "Identifier",
"start": 112,
"end": 117,
"loc": {
"start": {
"line": 4,
"column": 8
},
"end": {
"line": 4,
"column": 13
},
"identifierName": "Token"
},
"name": "Token"
},
"local": {
"type": "Identifier",
"start": 121,
"end": 135,
"loc": {
"start": {
"line": 4,
"column": 17
},
"end": {
"line": 4,
"column": 31
},
"identifierName": "ENDPOINT_TOKEN"
},
"name": "ENDPOINT_TOKEN"
}
}
],
"source": {
"type": "StringLiteral",
"start": 142,
"end": 155,
"loc": {
"start": {
"line": 4,
"column": 38
},
"end": {
"line": 4,
"column": 51
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint",
"leadingComments": null,
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches access token.\n ",
"start": 157,
"end": 189,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 190,
"end": 916,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 40,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 205,
"end": 916,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 40,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 211,
"end": 223,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 33
},
"identifierName": "TokenFetcher"
},
"name": "TokenFetcher",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 224,
"end": 916,
"loc": {
"start": {
"line": 9,
"column": 34
},
"end": {
"line": 40,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 261,
"end": 471,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 23,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 261,
"end": 272,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 273,
"end": 282,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 25
},
"identifierName": "client_id"
},
"name": "client_id"
},
{
"type": "Identifier",
"start": 284,
"end": 297,
"loc": {
"start": {
"line": 13,
"column": 27
},
"end": {
"line": 13,
"column": 40
},
"identifierName": "client_secret"
},
"name": "client_secret"
}
],
"body": {
"type": "BlockStatement",
"start": 299,
"end": 471,
"loc": {
"start": {
"line": 13,
"column": 42
},
"end": {
"line": 23,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 352,
"end": 378,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 352,
"end": 378,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 352,
"end": 366,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 352,
"end": 356,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 357,
"end": 366,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 22
},
"identifierName": "client_id"
},
"name": "client_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 369,
"end": 378,
"loc": {
"start": {
"line": 17,
"column": 25
},
"end": {
"line": 17,
"column": 34
},
"identifierName": "client_id"
},
"name": "client_id",
"leadingComments": null,
"trailingComments": null
},
"leadingComments": null,
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 309,
"end": 343,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 16,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 388,
"end": 422,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 21,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 431,
"end": 465,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 42
}
},
"expression": {
"type": "AssignmentExpression",
"start": 431,
"end": 465,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 42
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 431,
"end": 449,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 26
}
},
"object": {
"type": "ThisExpression",
"start": 431,
"end": 435,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 436,
"end": 449,
"loc": {
"start": {
"line": 22,
"column": 13
},
"end": {
"line": 22,
"column": 26
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 452,
"end": 465,
"loc": {
"start": {
"line": 22,
"column": 29
},
"end": {
"line": 22,
"column": 42
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 388,
"end": 422,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 21,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 230,
"end": 256,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 12,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches access token.\n *\n * @param {object} params - Form data.\n * @return {Promise}\n ",
"start": 477,
"end": 592,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 30,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 597,
"end": 914,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 39,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 597,
"end": 613,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 20
},
"identifierName": "fetchAccessToken"
},
"name": "fetchAccessToken",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 614,
"end": 620,
"loc": {
"start": {
"line": 31,
"column": 21
},
"end": {
"line": 31,
"column": 27
},
"identifierName": "params"
},
"name": "params"
}
],
"body": {
"type": "BlockStatement",
"start": 622,
"end": 914,
"loc": {
"start": {
"line": 31,
"column": 29
},
"end": {
"line": 39,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 632,
"end": 908,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 38,
"column": 27
}
},
"argument": {
"type": "CallExpression",
"start": 639,
"end": 908,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 38,
"column": 27
}
},
"callee": {
"type": "MemberExpression",
"start": 639,
"end": 897,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 38,
"column": 16
}
},
"object": {
"type": "CallExpression",
"start": 639,
"end": 891,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 38,
"column": 10
}
},
"callee": {
"type": "MemberExpression",
"start": 639,
"end": 649,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 32,
"column": 25
}
},
"object": {
"type": "Identifier",
"start": 639,
"end": 644,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 32,
"column": 20
},
"identifierName": "axios"
},
"name": "axios"
},
"property": {
"type": "Identifier",
"start": 645,
"end": 649,
"loc": {
"start": {
"line": 32,
"column": 21
},
"end": {
"line": 32,
"column": 25
},
"identifierName": "post"
},
"name": "post"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 650,
"end": 664,
"loc": {
"start": {
"line": 32,
"column": 26
},
"end": {
"line": 32,
"column": 40
},
"identifierName": "ENDPOINT_TOKEN"
},
"name": "ENDPOINT_TOKEN"
},
{
"type": "CallExpression",
"start": 666,
"end": 695,
"loc": {
"start": {
"line": 32,
"column": 42
},
"end": {
"line": 32,
"column": 71
}
},
"callee": {
"type": "MemberExpression",
"start": 666,
"end": 687,
"loc": {
"start": {
"line": 32,
"column": 42
},
"end": {
"line": 32,
"column": 63
}
},
"object": {
"type": "Identifier",
"start": 666,
"end": 677,
"loc": {
"start": {
"line": 32,
"column": 42
},
"end": {
"line": 32,
"column": 53
},
"identifierName": "querystring"
},
"name": "querystring"
},
"property": {
"type": "Identifier",
"start": 678,
"end": 687,
"loc": {
"start": {
"line": 32,
"column": 54
},
"end": {
"line": 32,
"column": 63
},
"identifierName": "stringify"
},
"name": "stringify"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 688,
"end": 694,
"loc": {
"start": {
"line": 32,
"column": 64
},
"end": {
"line": 32,
"column": 70
},
"identifierName": "params"
},
"name": "params"
}
]
},
{
"type": "ObjectExpression",
"start": 697,
"end": 890,
"loc": {
"start": {
"line": 32,
"column": 73
},
"end": {
"line": 38,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 711,
"end": 819,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 36,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 711,
"end": 715,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 16
},
"identifierName": "auth"
},
"name": "auth"
},
"value": {
"type": "ObjectExpression",
"start": 717,
"end": 819,
"loc": {
"start": {
"line": 33,
"column": 18
},
"end": {
"line": 36,
"column": 13
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 735,
"end": 759,
"loc": {
"start": {
"line": 34,
"column": 16
},
"end": {
"line": 34,
"column": 40
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 735,
"end": 743,
"loc": {
"start": {
"line": 34,
"column": 16
},
"end": {
"line": 34,
"column": 24
},
"identifierName": "username"
},
"name": "username"
},
"value": {
"type": "MemberExpression",
"start": 745,
"end": 759,
"loc": {
"start": {
"line": 34,
"column": 26
},
"end": {
"line": 34,
"column": 40
}
},
"object": {
"type": "ThisExpression",
"start": 745,
"end": 749,
"loc": {
"start": {
"line": 34,
"column": 26
},
"end": {
"line": 34,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"start": 750,
"end": 759,
"loc": {
"start": {
"line": 34,
"column": 31
},
"end": {
"line": 34,
"column": 40
},
"identifierName": "client_id"
},
"name": "client_id"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 777,
"end": 805,
"loc": {
"start": {
"line": 35,
"column": 16
},
"end": {
"line": 35,
"column": 44
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 777,
"end": 785,
"loc": {
"start": {
"line": 35,
"column": 16
},
"end": {
"line": 35,
"column": 24
},
"identifierName": "password"
},
"name": "password"
},
"value": {
"type": "MemberExpression",
"start": 787,
"end": 805,
"loc": {
"start": {
"line": 35,
"column": 26
},
"end": {
"line": 35,
"column": 44
}
},
"object": {
"type": "ThisExpression",
"start": 787,
"end": 791,
"loc": {
"start": {
"line": 35,
"column": 26
},
"end": {
"line": 35,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"start": 792,
"end": 805,
"loc": {
"start": {
"line": 35,
"column": 31
},
"end": {
"line": 35,
"column": 44
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"computed": false
}
}
]
}
},
{
"type": "ObjectProperty",
"start": 833,
"end": 880,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 59
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 833,
"end": 840,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 19
},
"identifierName": "headers"
},
"name": "headers"
},
"value": {
"type": "ObjectExpression",
"start": 842,
"end": 880,
"loc": {
"start": {
"line": 37,
"column": 21
},
"end": {
"line": 37,
"column": 59
}
},
"properties": [