@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,275 lines (1,274 loc) • 137 kB
JSON
{
"type": "File",
"start": 0,
"end": 1776,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 62,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1776,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 62,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 29,
"end": 1776,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 62,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 44,
"end": 1776,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 62,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 50,
"end": 57,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 28
},
"identifierName": "Fetcher"
},
"name": "Fetcher",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 58,
"end": 1776,
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 62,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 219,
"end": 409,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 219,
"end": 230,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 231,
"end": 235,
"loc": {
"start": {
"line": 9,
"column": 16
},
"end": {
"line": 9,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 237,
"end": 253,
"loc": {
"start": {
"line": 9,
"column": 22
},
"end": {
"line": 9,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 237,
"end": 246,
"loc": {
"start": {
"line": 9,
"column": 22
},
"end": {
"line": 9,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 249,
"end": 253,
"loc": {
"start": {
"line": 9,
"column": 34
},
"end": {
"line": 9,
"column": 38
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 255,
"end": 409,
"loc": {
"start": {
"line": 9,
"column": 40
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 308,
"end": 324,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 308,
"end": 324,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 24
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 308,
"end": 317,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 308,
"end": 312,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 313,
"end": 317,
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 17
},
"identifierName": "http"
},
"name": "http"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 320,
"end": 324,
"loc": {
"start": {
"line": 13,
"column": 20
},
"end": {
"line": 13,
"column": 24
},
"identifierName": "http"
},
"name": "http",
"leadingComments": null,
"trailingComments": null
},
"leadingComments": null,
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 265,
"end": 299,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 12,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 334,
"end": 368,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 377,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 377,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 377,
"end": 391,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 377,
"end": 381,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 382,
"end": 391,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 22
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 394,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 25
},
"end": {
"line": 18,
"column": 34
},
"identifierName": "territory"
},
"name": "territory"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 334,
"end": 368,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* \n * @param {Http} http \n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory for the fetcher.\n ",
"start": 64,
"end": 214,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 8,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches next page of various paged API.\n * @param {fulfillment} fulfillment - The fulfillment get from Promose's onFulfillment function \n * @return {Promise}\n * @example \n * api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchTracks().then(response => {\n * api.albumFetcher.fetchNextPage(response))\n * })\n ",
"start": 415,
"end": 770,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 29,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 775,
"end": 1123,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 40,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 775,
"end": 788,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 17
},
"identifierName": "fetchNextPage"
},
"name": "fetchNextPage",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 789,
"end": 800,
"loc": {
"start": {
"line": 30,
"column": 18
},
"end": {
"line": 30,
"column": 29
},
"identifierName": "fulfillment"
},
"name": "fulfillment"
}
],
"body": {
"type": "BlockStatement",
"start": 802,
"end": 1123,
"loc": {
"start": {
"line": 30,
"column": 31
},
"end": {
"line": 40,
"column": 5
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 812,
"end": 854,
"loc": {
"start": {
"line": 31,
"column": 8
},
"end": {
"line": 31,
"column": 50
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 816,
"end": 854,
"loc": {
"start": {
"line": 31,
"column": 12
},
"end": {
"line": 31,
"column": 50
}
},
"id": {
"type": "Identifier",
"start": 816,
"end": 823,
"loc": {
"start": {
"line": 31,
"column": 12
},
"end": {
"line": 31,
"column": 19
},
"identifierName": "nextUri"
},
"name": "nextUri"
},
"init": {
"type": "MemberExpression",
"start": 826,
"end": 854,
"loc": {
"start": {
"line": 31,
"column": 22
},
"end": {
"line": 31,
"column": 50
}
},
"object": {
"type": "MemberExpression",
"start": 826,
"end": 849,
"loc": {
"start": {
"line": 31,
"column": 22
},
"end": {
"line": 31,
"column": 45
}
},
"object": {
"type": "MemberExpression",
"start": 826,
"end": 842,
"loc": {
"start": {
"line": 31,
"column": 22
},
"end": {
"line": 31,
"column": 38
}
},
"object": {
"type": "Identifier",
"start": 826,
"end": 837,
"loc": {
"start": {
"line": 31,
"column": 22
},
"end": {
"line": 31,
"column": 33
},
"identifierName": "fulfillment"
},
"name": "fulfillment"
},
"property": {
"type": "Identifier",
"start": 838,
"end": 842,
"loc": {
"start": {
"line": 31,
"column": 34
},
"end": {
"line": 31,
"column": 38
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 843,
"end": 849,
"loc": {
"start": {
"line": 31,
"column": 39
},
"end": {
"line": 31,
"column": 45
},
"identifierName": "paging"
},
"name": "paging"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 850,
"end": 854,
"loc": {
"start": {
"line": 31,
"column": 46
},
"end": {
"line": 31,
"column": 50
},
"identifierName": "next"
},
"name": "next"
},
"computed": false
}
}
],
"kind": "var"
},
{
"type": "IfStatement",
"start": 863,
"end": 1117,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 39,
"column": 9
}
},
"test": {
"type": "LogicalExpression",
"start": 867,
"end": 907,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 52
}
},
"left": {
"type": "BinaryExpression",
"start": 867,
"end": 882,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 27
}
},
"left": {
"type": "Identifier",
"start": 867,
"end": 874,
"loc": {
"start": {
"line": 32,
"column": 12
},
"end": {
"line": 32,
"column": 19
},
"identifierName": "nextUri"
},
"name": "nextUri"
},
"operator": "!=",
"right": {
"type": "NullLiteral",
"start": 878,
"end": 882,
"loc": {
"start": {
"line": 32,
"column": 23
},
"end": {
"line": 32,
"column": 27
}
}
}
},
"operator": "&&",
"right": {
"type": "BinaryExpression",
"start": 886,
"end": 907,
"loc": {
"start": {
"line": 32,
"column": 31
},
"end": {
"line": 32,
"column": 52
}
},
"left": {
"type": "Identifier",
"start": 886,
"end": 893,
"loc": {
"start": {
"line": 32,
"column": 31
},
"end": {
"line": 32,
"column": 38
},
"identifierName": "nextUri"
},
"name": "nextUri"
},
"operator": "!==",
"right": {
"type": "Identifier",
"start": 898,
"end": 907,
"loc": {
"start": {
"line": 32,
"column": 43
},
"end": {
"line": 32,
"column": 52
},
"identifierName": "undefined"
},
"name": "undefined"
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 909,
"end": 962,
"loc": {
"start": {
"line": 32,
"column": 54
},
"end": {
"line": 34,
"column": 9
}
},
"body": [
{
"type": "ReturnStatement",
"start": 923,
"end": 952,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 41
}
},
"argument": {
"type": "CallExpression",
"start": 930,
"end": 952,
"loc": {
"start": {
"line": 33,
"column": 19
},
"end": {
"line": 33,
"column": 41
}
},
"callee": {
"type": "MemberExpression",
"start": 930,
"end": 943,
"loc": {
"start": {
"line": 33,
"column": 19
},
"end": {
"line": 33,
"column": 32
}
},
"object": {
"type": "MemberExpression",
"start": 930,
"end": 939,
"loc": {
"start": {
"line": 33,
"column": 19
},
"end": {
"line": 33,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 930,
"end": 934,
"loc": {
"start": {
"line": 33,
"column": 19
},
"end": {
"line": 33,
"column": 23
}
}
},
"property": {
"type": "Identifier",
"start": 935,
"end": 939,
"loc": {
"start": {
"line": 33,
"column": 24
},
"end": {
"line": 33,
"column": 28
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 940,
"end": 943,
"loc": {
"start": {
"line": 33,
"column": 29
},
"end": {
"line": 33,
"column": 32
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 944,
"end": 951,
"loc": {
"start": {
"line": 33,
"column": 33
},
"end": {
"line": 33,
"column": 40
},
"identifierName": "nextUri"
},
"name": "nextUri"
}
]
}
}
],
"directives": []
},
"alternate": {
"type": "BlockStatement",
"start": 976,
"end": 1117,
"loc": {
"start": {
"line": 35,
"column": 13
},
"end": {
"line": 39,
"column": 9
}
},
"body": [
{
"type": "ReturnStatement",
"start": 990,
"end": 1095,
"loc": {
"start": {
"line": 36,
"column": 12
},
"end": {
"line": 38,
"column": 14
}
},
"argument": {
"type": "NewExpression",
"start": 997,
"end": 1095,
"loc": {
"start": {
"line": 36,
"column": 19
},
"end": {
"line": 38,
"column": 14
}
},
"callee": {
"type": "Identifier",
"start": 1001,
"end": 1008,
"loc": {
"start": {
"line": 36,
"column": 23
},
"end": {
"line": 36,
"column": 30
},
"identifierName": "Promise"
},
"name": "Promise"
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 1009,
"end": 1094,
"loc": {
"start": {
"line": 36,
"column": 31
},
"end": {
"line": 38,
"column": 13
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1010,
"end": 1017,
"loc": {
"start": {
"line": 36,
"column": 32
},
"end": {
"line": 36,
"column": 39
},
"identifierName": "resolve"
},
"name": "resolve"
},
{
"type": "Identifier",
"start": 1019,
"end": 1025,
"loc": {
"start": {
"line": 36,
"column": 41
},
"end": {
"line": 36,
"column": 47
},
"identifierName": "reject"
},
"name": "reject"
}
],
"body": {
"type": "BlockStatement",
"start": 1030,
"end": 1094,
"loc": {
"start": {
"line": 36,
"column": 52
},
"end": {
"line": 38,
"column": 13
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1048,
"end": 1080,
"loc": {
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 48
}
},
"expression": {
"type": "CallExpression",
"start": 1048,
"end": 1080,
"loc": {
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 48
}
},
"callee": {
"type": "Identifier",
"start": 1048,
"end": 1054,
"loc": {
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 22
},
"identifierName": "reject"
},
"name": "reject"
},
"arguments": [
{
"type": "StringLiteral",
"start": 1055,
"end": 1079,
"loc": {
"start": {
"line": 37,
"column": 23
},
"end": {
"line": 37,
"column": 47
}
},
"extra": {
"rawValue": "Cannot fetch next page",
"raw": "'Cannot fetch next page'"
},
"value": "Cannot fetch next page"
}
]
}
}
],
"directives": []
}
}
]
}
}
],
"directives": []
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetches next page of various paged API.\n * @param {fulfillment} fulfillment - The fulfillment get from Promose's onFulfillment function \n * @return {Promise}\n * @example \n * api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchTracks().then(response => {\n * api.albumFetcher.fetchNextPage(response))\n * })\n ",
"start": 415,
"end": 770,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 29,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Is next page available for various paged API.\n * @param {fulfillment} fulfillment - The fulfillment get from Promose's onFulfillment function \n * @return {Boolean}\n * @example\n * api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchTracks().then(response => {\n * if (api.albumFetcher.hasNextPage(response)) {\n * // more data available\n * }\n * })\n ",
"start": 1129,
"end": 1546,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 52,
"column": 7