@kkboxorg/kkbox-javascript-developer-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,447 lines (1,446 loc) • 191 kB
JSON
{
"type": "File",
"start": 0,
"end": 2146,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 72,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2146,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 72,
"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"
}
},
{
"type": "ImportDeclaration",
"start": 156,
"end": 216,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 60
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 164,
"end": 196,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 40
}
},
"imported": {
"type": "Identifier",
"start": 164,
"end": 173,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 17
},
"identifierName": "TokenInfo"
},
"name": "TokenInfo"
},
"local": {
"type": "Identifier",
"start": 177,
"end": 196,
"loc": {
"start": {
"line": 5,
"column": 21
},
"end": {
"line": 5,
"column": 40
},
"identifierName": "ENDPOINT_TOKEN_INFO"
},
"name": "ENDPOINT_TOKEN_INFO"
}
}
],
"source": {
"type": "StringLiteral",
"start": 203,
"end": 216,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 60
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint",
"leadingComments": null,
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches access token and also fetches information about a access token.\n * @see https://docs.kkbox.codes/docs/token-introspection-api\n ",
"start": 218,
"end": 362,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 10,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 363,
"end": 2146,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 72,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 378,
"end": 2146,
"loc": {
"start": {
"line": 11,
"column": 15
},
"end": {
"line": 72,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 384,
"end": 396,
"loc": {
"start": {
"line": 11,
"column": 21
},
"end": {
"line": 11,
"column": 33
},
"identifierName": "TokenFetcher"
},
"name": "TokenFetcher",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 397,
"end": 2146,
"loc": {
"start": {
"line": 11,
"column": 34
},
"end": {
"line": 72,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 434,
"end": 644,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 25,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 434,
"end": 445,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 446,
"end": 455,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 25
},
"identifierName": "client_id"
},
"name": "client_id"
},
{
"type": "Identifier",
"start": 457,
"end": 470,
"loc": {
"start": {
"line": 15,
"column": 27
},
"end": {
"line": 15,
"column": 40
},
"identifierName": "client_secret"
},
"name": "client_secret"
}
],
"body": {
"type": "BlockStatement",
"start": 472,
"end": 644,
"loc": {
"start": {
"line": 15,
"column": 42
},
"end": {
"line": 25,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 525,
"end": 551,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 525,
"end": 551,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 525,
"end": 539,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 525,
"end": 529,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 530,
"end": 539,
"loc": {
"start": {
"line": 19,
"column": 13
},
"end": {
"line": 19,
"column": 22
},
"identifierName": "client_id"
},
"name": "client_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 542,
"end": 551,
"loc": {
"start": {
"line": 19,
"column": 25
},
"end": {
"line": 19,
"column": 34
},
"identifierName": "client_id"
},
"name": "client_id",
"leadingComments": null,
"trailingComments": null
},
"leadingComments": null,
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 482,
"end": 516,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 18,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 561,
"end": 595,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 23,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 604,
"end": 638,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 42
}
},
"expression": {
"type": "AssignmentExpression",
"start": 604,
"end": 638,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 42
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 604,
"end": 622,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 26
}
},
"object": {
"type": "ThisExpression",
"start": 604,
"end": 608,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 609,
"end": 622,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 26
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 625,
"end": 638,
"loc": {
"start": {
"line": 24,
"column": 29
},
"end": {
"line": 24,
"column": 42
},
"identifierName": "client_secret"
},
"name": "client_secret"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 561,
"end": 595,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 23,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 403,
"end": 429,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 14,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches information about a access token.\n *\n * @param {string} access_token - Access token authorized by a user, need to be URL encoded before using.\n * @return {Promise}\n * @example auth.tokenFetcher.fetchInfo('1DOOqXertxd9nUs0MOHQSA==')\n * @see Retrieve information about a access token.\n ",
"start": 650,
"end": 979,
"loc": {
"start": {
"line": 27,
"column": 4
},
"end": {
"line": 34,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 984,
"end": 1201,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 40,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 984,
"end": 993,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 13
},
"identifierName": "fetchInfo"
},
"name": "fetchInfo",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 994,
"end": 1006,
"loc": {
"start": {
"line": 35,
"column": 14
},
"end": {
"line": 35,
"column": 26
},
"identifierName": "access_token"
},
"name": "access_token"
}
],
"body": {
"type": "BlockStatement",
"start": 1008,
"end": 1201,
"loc": {
"start": {
"line": 35,
"column": 28
},
"end": {
"line": 40,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1018,
"end": 1195,
"loc": {
"start": {
"line": 36,
"column": 8
},
"end": {
"line": 39,
"column": 27
}
},
"argument": {
"type": "CallExpression",
"start": 1025,
"end": 1195,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 39,
"column": 27
}
},
"callee": {
"type": "MemberExpression",
"start": 1025,
"end": 1184,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 39,
"column": 16
}
},
"object": {
"type": "CallExpression",
"start": 1025,
"end": 1178,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 39,
"column": 10
}
},
"callee": {
"type": "MemberExpression",
"start": 1025,
"end": 1034,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 36,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 1025,
"end": 1030,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 36,
"column": 20
},
"identifierName": "axios"
},
"name": "axios"
},
"property": {
"type": "Identifier",
"start": 1031,
"end": 1034,
"loc": {
"start": {
"line": 36,
"column": 21
},
"end": {
"line": 36,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 1035,
"end": 1054,
"loc": {
"start": {
"line": 36,
"column": 25
},
"end": {
"line": 36,
"column": 44
},
"identifierName": "ENDPOINT_TOKEN_INFO"
},
"name": "ENDPOINT_TOKEN_INFO"
},
{
"type": "ObjectExpression",
"start": 1056,
"end": 1177,
"loc": {
"start": {
"line": 36,
"column": 46
},
"end": {
"line": 39,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1070,
"end": 1106,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 48
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1070,
"end": 1076,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 18
},
"identifierName": "params"
},
"name": "params"
},
"value": {
"type": "ObjectExpression",
"start": 1078,
"end": 1106,
"loc": {
"start": {
"line": 37,
"column": 20
},
"end": {
"line": 37,
"column": 48
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1079,
"end": 1105,
"loc": {
"start": {
"line": 37,
"column": 21
},
"end": {
"line": 37,
"column": 47
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1079,
"end": 1091,
"loc": {
"start": {
"line": 37,
"column": 21
},
"end": {
"line": 37,
"column": 33
},
"identifierName": "access_token"
},
"name": "access_token"
},
"value": {
"type": "Identifier",
"start": 1093,
"end": 1105,
"loc": {
"start": {
"line": 37,
"column": 35
},
"end": {
"line": 37,
"column": 47
},
"identifierName": "access_token"
},
"name": "access_token"
}
}
]
}
},
{
"type": "ObjectProperty",
"start": 1120,
"end": 1167,
"loc": {
"start": {
"line": 38,
"column": 12
},
"end": {
"line": 38,
"column": 59
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1120,
"end": 1127,
"loc": {
"start": {
"line": 38,
"column": 12
},
"end": {
"line": 38,
"column": 19
},
"identifierName": "headers"
},
"name": "headers"
},
"value": {
"type": "ObjectExpression",
"start": 1129,
"end": 1167,
"loc": {
"start": {
"line": 38,
"column": 21
},
"end": {
"line": 38,
"column": 59
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1130,
"end": 1166,
"loc": {
"start": {
"line": 38,
"column": 22
},
"end": {
"line": 38,
"column": 58
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "StringLiteral",
"start": 1130,
"end": 1142,
"loc": {
"start": {
"line": 38,
"column": 22
},
"end": {
"line": 38,
"column": 34
}
},
"extra": {
"rawValue": "User-Agent",
"raw": "'User-Agent'"
},
"value": "User-Agent"
},
"value": {
"type": "StringLiteral",
"start": 1144,
"end": 1166,
"loc": {
"start": {
"line": 38,
"column": 36
},
"end": {
"line": 38,
"column": 58
}
},
"extra": {
"rawValue": "KKBOX JavaScript SDK",
"raw": "'KKBOX JavaScript SDK'"
},
"value": "KKBOX JavaScript SDK"
}
}
]
}
}
]
}
]
},
"property": {
"type": "Identifier",
"start": 1179,
"end": 1184,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 39,
"column": 16
},
"identifierName": "catch"
},
"name": "catch"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 1185,
"end": 1194,
"loc": {
"start": {
"line": 39,
"column": 17
},
"end": {
"line": 39,
"column": 26
},
"identifierName": "authError"
},
"name": "authError"
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches information about a access token.\n *\n * @param {string} access_token - Access token authorized by a user, need to be URL encoded before using.\n * @return {Promise}\n * @example auth.tokenFetcher.fetchInfo('1DOOqXertxd9nUs0MOHQSA==')\n * @see Retrieve information about a access token.\n ",
"start": 650,
"end": 979,
"loc": {
"start": {
"line": 27,
"column": 4
},
"end": {
"line": 34,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches access token.\n *\n * @param {object} params - Form data.\n * @return {Promise}\n ",
"start": 1207,
"end": 1322,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 47,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1327,
"end": 1644,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 56,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1327,
"end": 1343,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 20
},
"identifierName": "fetchAccessToken"
},
"name": "fetchAccessToken",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{