@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,464 lines (1,463 loc) • 134 kB
JSON
{
"type": "File",
"start": 0,
"end": 1570,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 61,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1570,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 61,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 56
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "MOOD_STATIONS"
},
"name": "MOOD_STATIONS"
},
"local": {
"type": "Identifier",
"start": 26,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 34
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 42,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 55
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 57,
"end": 89,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 64,
"end": 71,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 64,
"end": 71,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 77,
"end": 88,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 31
}
},
"extra": {
"rawValue": "./Fetcher",
"raw": "'./Fetcher'"
},
"value": "./Fetcher"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get mood stations.\n * @see https://docs-en.kkbox.codes/v1.1/reference#mood-stations\n ",
"start": 91,
"end": 185,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 186,
"end": 1569,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 60,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 201,
"end": 1569,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 60,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 207,
"end": 225,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 39
},
"identifierName": "MoodStationFetcher"
},
"name": "MoodStationFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 234,
"end": 241,
"loc": {
"start": {
"line": 8,
"column": 48
},
"end": {
"line": 8,
"column": 55
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 242,
"end": 1569,
"loc": {
"start": {
"line": 8,
"column": 56
},
"end": {
"line": 60,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 271,
"end": 408,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 271,
"end": 282,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 283,
"end": 287,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 289,
"end": 305,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 36
}
},
"left": {
"type": "Identifier",
"start": 289,
"end": 298,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 301,
"end": 305,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 36
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 307,
"end": 408,
"loc": {
"start": {
"line": 12,
"column": 38
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 313,
"end": 336,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 27
}
},
"expression": {
"type": "CallExpression",
"start": 313,
"end": 335,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 26
}
},
"callee": {
"type": "Super",
"start": 313,
"end": 318,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 319,
"end": 323,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 14
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 325,
"end": 334,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 25
},
"identifierName": "territory"
},
"name": "territory"
}
]
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 342,
"end": 368,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 373,
"end": 404,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 35
}
},
"expression": {
"type": "AssignmentExpression",
"start": 373,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 373,
"end": 391,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 373,
"end": 377,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 378,
"end": 391,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 22
},
"identifierName": "moodStationID"
},
"name": "moodStationID"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 394,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 25
},
"end": {
"line": 18,
"column": 34
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 342,
"end": 368,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 246,
"end": 268,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all mood stations.\n *\n * @return {Promise}\n * @example api.moodStationFetcher.fetchAllMoodStations();\n * @see https://docs-en.kkbox.codes/v1.1/reference#moodstations\n ",
"start": 412,
"end": 606,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 609,
"end": 714,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 32,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 609,
"end": 629,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 22
},
"identifierName": "fetchAllMoodStations"
},
"name": "fetchAllMoodStations",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 632,
"end": 714,
"loc": {
"start": {
"line": 28,
"column": 25
},
"end": {
"line": 32,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 638,
"end": 710,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 31,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 645,
"end": 709,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 31,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 645,
"end": 658,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 645,
"end": 654,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 645,
"end": 649,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 650,
"end": 654,
"loc": {
"start": {
"line": 29,
"column": 16
},
"end": {
"line": 29,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 655,
"end": 658,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 29,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 659,
"end": 667,
"loc": {
"start": {
"line": 29,
"column": 25
},
"end": {
"line": 29,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
{
"type": "ObjectExpression",
"start": 669,
"end": 708,
"loc": {
"start": {
"line": 29,
"column": 35
},
"end": {
"line": 31,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 677,
"end": 702,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 677,
"end": 686,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 15
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 688,
"end": 702,
"loc": {
"start": {
"line": 30,
"column": 17
},
"end": {
"line": 30,
"column": 31
}
},
"object": {
"type": "ThisExpression",
"start": 688,
"end": 692,
"loc": {
"start": {
"line": 30,
"column": 17
},
"end": {
"line": 30,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"start": 693,
"end": 702,
"loc": {
"start": {
"line": 30,
"column": 22
},
"end": {
"line": 30,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all mood stations.\n *\n * @return {Promise}\n * @example api.moodStationFetcher.fetchAllMoodStations();\n * @see https://docs-en.kkbox.codes/v1.1/reference#moodstations\n ",
"start": 412,
"end": 606,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the mood station fetcher.\n *\n * @param {string} moodStationID - The ID of a mood station.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory of a mood station.\n * @return {MoodStation}\n * @see https://docs-en.kkbox.codes/v1.1/reference#moodstations-station_id\n ",
"start": 718,
"end": 1041,
"loc": {
"start": {
"line": 34,
"column": 2
},
"end": {
"line": 41,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1044,
"end": 1188,
"loc": {
"start": {
"line": 42,
"column": 2
},
"end": {
"line": 46,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1044,
"end": 1060,
"loc": {
"start": {
"line": 42,
"column": 2
},
"end": {
"line": 42,
"column": 18
},
"identifierName": "setMoodStationID"
},
"name": "setMoodStationID",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1061,
"end": 1074,
"loc": {
"start": {
"line": 42,
"column": 19
},
"end": {
"line": 42,
"column": 32
},
"identifierName": "moodStationID"
},
"name": "moodStationID"
},
{
"type": "AssignmentPattern",
"start": 1076,
"end": 1092,
"loc": {
"start": {
"line": 42,
"column": 34
},
"end": {
"line": 42,
"column": 50
}
},
"left": {
"type": "Identifier",
"start": 1076,
"end": 1085,
"loc": {
"start": {
"line": 42,
"column": 34
},
"end": {
"line": 42,
"column": 43
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 1088,
"end": 1092,
"loc": {
"start": {
"line": 42,
"column": 46
},
"end": {
"line": 42,
"column": 50
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 1094,
"end": 1188,
"loc": {
"start": {
"line": 42,
"column": 52
},
"end": {
"line": 46,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1100,
"end": 1135,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 39
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1100,
"end": 1134,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 38
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1100,
"end": 1118,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 1100,
"end": 1104,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 1105,
"end": 1118,
"loc": {
"start": {
"line": 43,
"column": 9
},
"end": {
"line": 43,
"column": 22
},
"identifierName": "moodStationID"
},
"name": "moodStationID"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1121,
"end": 1134,
"loc": {
"start": {
"line": 43,
"column": 25
},
"end": {
"line": 43,
"column": 38
},
"identifierName": "moodStationID"
},
"name": "moodStationID"
}
}
},
{
"type": "ExpressionStatement",
"start": 1140,
"end": 1167,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1140,
"end": 1166,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1140,
"end": 1154,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 1140,
"end": 1144,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 1145,
"end": 1154,
"loc": {
"start": {
"line": 44,
"column": 9
},
"end": {
"line": 44,
"column": 18
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1157,
"end": 1166,
"loc": {
"start": {
"line": 44,
"column": 21
},
"end": {
"line": 44,
"column": 30
},
"identifierName": "territory"
},
"name": "territory"
}
}
},
{
"type": "ReturnStatement",
"start": 1172,
"end": 1184,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 16
}
},
"argument": {
"type": "ThisExpression",
"start": 1179,
"end": 1183,
"loc": {
"start": {
"line": 45,
"column": 11
},
"end": {
"line": 45,
"column": 15
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the mood station fetcher.\n *\n * @param {string} moodStationID - The ID of a mood station.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory of a mood station.\n * @return {MoodStation}\n * @see https://docs-en.kkbox.codes/v1.1/reference#moodstations-station_id\n ",
"start": 718,
"end": 1041,
"loc": {
"start": {
"line": 34,
"column": 2
},
"end": {
"line": 41,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch the mood station's metadata.\n *\n * @return {Promise}\n * @example api.moodStationFetcher.setMoodStationID('StGZp2ToWq92diPHS7').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#moodstations-station_id\n ",
"start": 1192,
"end": 1439,
"loc": {
"start": {
"line": 48,
"column": 2
},
"end": {
"line": 54,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1442,
"end": 1567,
"loc": {
"start": {
"line": 55,
"column": 2
},
"end": {
"line": 59,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1442,
"end": 1455,
"loc": {
"start": {
"line": 55,
"column": 2
},
"end": {
"line": 55,
"column": 15
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1458,
"end": 1567,
"loc": {
"start": {
"line": 55,
"column": 18
},
"end": {
"line": 59,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1464,
"end": 1563,
"loc": {
"start": {
"line": 56,
"column": 4
},
"end": {
"line": 58,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 1471,
"end": 1562,
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 58,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 1471,