javascript-ampache 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -7
- package/src/albums.js +106 -0
- package/src/artists.js +105 -0
- package/src/auth.js +142 -0
- package/src/base.js +145 -0
- package/src/bookmarks.js +106 -0
- package/src/catalogs.js +133 -0
- package/src/genres.js +57 -0
- package/src/index.js +30 -0
- package/src/labels.js +53 -0
- package/src/licenses.js +47 -0
- package/src/live-streams.js +97 -0
- package/src/playlists.js +241 -0
- package/src/podcasts.js +230 -0
- package/src/preferences.js +114 -0
- package/src/shares.js +99 -0
- package/src/shouts.js +24 -0
- package/src/songs.js +273 -0
- package/src/system.js +510 -0
- package/src/users.js +224 -0
- package/src/{utils.ts → utils.js} +16 -16
- package/src/videos.js +84 -0
- package/dist/albums/index.d.ts +0 -64
- package/dist/albums/types.d.ts +0 -37
- package/dist/artists/index.d.ts +0 -64
- package/dist/artists/types.d.ts +0 -35
- package/dist/auth/index.d.ts +0 -56
- package/dist/auth/types.d.ts +0 -32
- package/dist/base.d.ts +0 -47
- package/dist/bookmarks/index.d.ts +0 -91
- package/dist/bookmarks/types.d.ts +0 -13
- package/dist/catalogs/index.d.ts +0 -87
- package/dist/catalogs/types.d.ts +0 -19
- package/dist/genres/index.d.ts +0 -28
- package/dist/genres/types.d.ts +0 -22
- package/dist/index.d.ts +0 -24
- package/dist/labels/index.d.ts +0 -32
- package/dist/labels/types.d.ts +0 -18
- package/dist/licenses/index.d.ts +0 -32
- package/dist/licenses/types.d.ts +0 -12
- package/dist/live-streams/index.d.ts +0 -80
- package/dist/live-streams/types.d.ts +0 -14
- package/dist/playlists/index.d.ts +0 -208
- package/dist/playlists/types.d.ts +0 -26
- package/dist/podcasts/index.d.ts +0 -121
- package/dist/podcasts/types.d.ts +0 -79
- package/dist/preferences/index.d.ts +0 -80
- package/dist/preferences/types.d.ts +0 -18
- package/dist/shares/index.d.ts +0 -69
- package/dist/shares/types.d.ts +0 -23
- package/dist/shouts/index.d.ts +0 -17
- package/dist/shouts/types.d.ts +0 -10
- package/dist/songs/index.d.ts +0 -146
- package/dist/songs/types.d.ts +0 -73
- package/dist/system/index.d.ts +0 -419
- package/dist/system/types.d.ts +0 -31
- package/dist/users/index.d.ts +0 -190
- package/dist/users/types.d.ts +0 -34
- package/dist/utils.d.ts +0 -4
- package/dist/videos/index.d.ts +0 -33
- package/dist/videos/types.d.ts +0 -38
- package/src/albums/index.ts +0 -88
- package/src/albums/types.ts +0 -40
- package/src/artists/index.ts +0 -88
- package/src/artists/types.ts +0 -38
- package/src/auth/index.ts +0 -118
- package/src/auth/types.ts +0 -32
- package/src/base.ts +0 -133
- package/src/bookmarks/index.ts +0 -116
- package/src/bookmarks/types.ts +0 -15
- package/src/catalogs/index.ts +0 -130
- package/src/catalogs/types.ts +0 -27
- package/src/genres/index.ts +0 -39
- package/src/genres/types.ts +0 -25
- package/src/index.ts +0 -63
- package/src/labels/index.ts +0 -43
- package/src/labels/types.ts +0 -20
- package/src/licenses/index.ts +0 -43
- package/src/licenses/types.ts +0 -14
- package/src/live-streams/index.ts +0 -104
- package/src/live-streams/types.ts +0 -16
- package/src/playlists/index.ts +0 -284
- package/src/playlists/types.ts +0 -29
- package/src/podcasts/index.ts +0 -174
- package/src/podcasts/types.ts +0 -85
- package/src/preferences/index.ts +0 -114
- package/src/preferences/types.ts +0 -20
- package/src/shares/index.ts +0 -100
- package/src/shares/types.ts +0 -25
- package/src/shouts/index.ts +0 -18
- package/src/shouts/types.ts +0 -11
- package/src/songs/index.ts +0 -221
- package/src/songs/types.ts +0 -77
- package/src/system/index.ts +0 -860
- package/src/system/types.ts +0 -50
- package/src/users/index.ts +0 -227
- package/src/users/types.ts +0 -38
- package/src/videos/index.ts +0 -49
- package/src/videos/types.ts +0 -42
package/src/catalogs.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} CatalogResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {"local"|"remote"} type
|
|
6
|
+
* @property {"podcast"|"clip"|"tvshow"|"movie"|"personal_video"|"music"} gather_types
|
|
7
|
+
* @property {boolean} enabled
|
|
8
|
+
* @property {number} last_add
|
|
9
|
+
* @property {number} last_clean
|
|
10
|
+
* @property {number} last_update
|
|
11
|
+
* @property {string} path
|
|
12
|
+
* @property {string} rename_pattern
|
|
13
|
+
* @property {string} sort_pattern
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} CatalogsResponse
|
|
18
|
+
* @property {number} total_count
|
|
19
|
+
* @property {string} md5
|
|
20
|
+
* @property {CatalogResponse[]} catalog
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export const catalogsMethods = {
|
|
24
|
+
/**
|
|
25
|
+
* This searches the catalogs and returns... catalogs
|
|
26
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
27
|
+
* @param {Object} [params]
|
|
28
|
+
* @param {"music"|"clip"|"tvshow"|"movie"|"personal_video"|"podcast"} [params.filter] Catalog type
|
|
29
|
+
* @param {number} [params.offset]
|
|
30
|
+
* @param {number} [params.limit]
|
|
31
|
+
* @param {string} [params.cond]
|
|
32
|
+
* @param {string} [params.sort]
|
|
33
|
+
* @returns {Promise<CatalogsResponse>}
|
|
34
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalogs}
|
|
35
|
+
*/
|
|
36
|
+
catalogs(params) {
|
|
37
|
+
return this.call("catalogs", params);
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Return catalog by UID
|
|
42
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
43
|
+
* @param {Object} params
|
|
44
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
45
|
+
* @returns {Promise<CatalogResponse>}
|
|
46
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog}
|
|
47
|
+
*/
|
|
48
|
+
catalog(params) {
|
|
49
|
+
return this.call("catalog", params);
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Kick off a catalog update or clean for the selected catalog
|
|
54
|
+
* ACCESS REQUIRED: 75 (Catalog Manager)
|
|
55
|
+
* @remarks MINIMUM_API_VERSION=400001
|
|
56
|
+
* @param {Object} params
|
|
57
|
+
* @param {"add_to_catalog"|"clean_catalog"} params.task add_to_catalog, clean_catalog
|
|
58
|
+
* @param {import("./base.js").UID} params.catalog UID of catalog
|
|
59
|
+
* @param {import("./base.js").UID} [params.filter] Alias of catalog (Ampache 7.9.0+)
|
|
60
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
61
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_action}
|
|
62
|
+
*/
|
|
63
|
+
catalogAction(params) {
|
|
64
|
+
return this.call("catalog_action", params);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Perform actions on local catalog files. Single file versions of catalog add, clean, verify and remove (delete).
|
|
69
|
+
* Make sure you remember to urlencode those file names!
|
|
70
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
71
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
72
|
+
* @param {Object} params
|
|
73
|
+
* @param {string} params.file FULL path to local file
|
|
74
|
+
* @param {string} params.task add, clean, verify, remove, (can include comma-separated values)
|
|
75
|
+
* @param {import("./base.js").UID} params.catalog UID of catalog
|
|
76
|
+
* @param {import("./base.js").UID} [params.filter] Alias of catalog (Ampache 7.9.0+)
|
|
77
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
78
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_file}
|
|
79
|
+
*/
|
|
80
|
+
catalogFile(params) {
|
|
81
|
+
return this.call("catalog_file", params);
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Perform actions on local catalog folders. Single folder versions of catalog add, clean, verify and remove (delete).
|
|
86
|
+
* Make sure you remember to urlencode those folder names!
|
|
87
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
88
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
89
|
+
* @param {Object} params
|
|
90
|
+
* @param {string} params.folder FULL path to local folder
|
|
91
|
+
* @param {string} params.task add, clean, verify, remove, (can include comma-separated values)
|
|
92
|
+
* @param {import("./base.js").UID} params.catalog UID of catalog
|
|
93
|
+
* @param {import("./base.js").UID} [params.filter] Alias of catalog (Ampache 7.9.0+)
|
|
94
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
95
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_folder}
|
|
96
|
+
*/
|
|
97
|
+
catalogFolder(params) {
|
|
98
|
+
return this.call("catalog_folder", params);
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Create a new catalog.
|
|
103
|
+
* ACCESS REQUIRED: 75 (Catalog Manager)
|
|
104
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
105
|
+
* @param {Object} params
|
|
106
|
+
* @param {string} params.name Name for the catalog
|
|
107
|
+
* @param {string} params.path URL or folder path for your catalog
|
|
108
|
+
* @param {"local"|"beets"|"remote"|"subsonic"|"seafile"|"beetsremote"} [params.type] Default: 'local'
|
|
109
|
+
* @param {"music"|"podcast"|"clip"|"tvshow"|"movie"|"personal_video"} [params.media_type] Default: 'music'
|
|
110
|
+
* @param {string} [params.file_pattern] Pattern used identify tags from the file name. Default: '%T - %t'
|
|
111
|
+
* @param {string} [params.folder_pattern] Pattern used identify tags from the folder name. Default: '%a/%A'
|
|
112
|
+
* @param {string} [params.username] login to remote catalog
|
|
113
|
+
* @param {string} [params.password] password to remote catalog
|
|
114
|
+
* @returns {Promise<CatalogResponse>}
|
|
115
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_add}
|
|
116
|
+
*/
|
|
117
|
+
catalogAdd(params) {
|
|
118
|
+
return this.call("catalog_add", params);
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Delete an existing catalog. (if it exists)
|
|
123
|
+
* ACCESS REQUIRED: 75 (Catalog Manager)
|
|
124
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
125
|
+
* @param {Object} params
|
|
126
|
+
* @param {import("./base.js").UID} params.filter ID of the catalog
|
|
127
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
128
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_delete}
|
|
129
|
+
*/
|
|
130
|
+
catalogDelete(params) {
|
|
131
|
+
return this.call("catalog_delete", params);
|
|
132
|
+
},
|
|
133
|
+
};
|
package/src/genres.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} GenreSummary
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} GenreResponse
|
|
9
|
+
* @property {import("./base.js").UID} id
|
|
10
|
+
* @property {string} name
|
|
11
|
+
* @property {number} albums
|
|
12
|
+
* @property {number} artists
|
|
13
|
+
* @property {number} songs
|
|
14
|
+
* @property {number} videos
|
|
15
|
+
* @property {number} playlists
|
|
16
|
+
* @property {number} live_streams
|
|
17
|
+
* @property {boolean} is_hidden
|
|
18
|
+
* @property {GenreSummary[]} merge
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} GenresResponse
|
|
23
|
+
* @property {number} total_count
|
|
24
|
+
* @property {string} md5
|
|
25
|
+
* @property {GenreResponse[]} genre
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export const genresMethods = {
|
|
29
|
+
/**
|
|
30
|
+
* This returns the genres (Tags) based on the specified filter
|
|
31
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
32
|
+
* @param {Object} [params]
|
|
33
|
+
* @param {string} [params.filter] UID to find
|
|
34
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
35
|
+
* @param {number} [params.offset]
|
|
36
|
+
* @param {number} [params.limit]
|
|
37
|
+
* @param {string} [params.cond]
|
|
38
|
+
* @param {string} [params.sort]
|
|
39
|
+
* @returns {Promise<GenresResponse>}
|
|
40
|
+
* @see {@link https://ampache.org/api/api-json-methods#genres}
|
|
41
|
+
*/
|
|
42
|
+
genres(params) {
|
|
43
|
+
return this.call("genres", params);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* This returns a single genre based on UID
|
|
48
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
49
|
+
* @param {Object} params
|
|
50
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
51
|
+
* @returns {Promise<GenreResponse>}
|
|
52
|
+
* @see {@link https://ampache.org/api/api-json-methods#genre}
|
|
53
|
+
*/
|
|
54
|
+
genre(params) {
|
|
55
|
+
return this.call("genre", params);
|
|
56
|
+
},
|
|
57
|
+
};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { albumsMethods } from "./albums.js";
|
|
2
|
+
import { artistsMethods } from "./artists.js";
|
|
3
|
+
import { authMethods } from "./auth.js";
|
|
4
|
+
import { bookmarksMethods } from "./bookmarks.js";
|
|
5
|
+
import { catalogsMethods } from "./catalogs.js";
|
|
6
|
+
import { genresMethods } from "./genres.js";
|
|
7
|
+
import { labelsMethods } from "./labels.js";
|
|
8
|
+
import { licensesMethods } from "./licenses.js";
|
|
9
|
+
import { liveStreamsMethods } from "./live-streams.js";
|
|
10
|
+
import { playlistsMethods } from "./playlists.js";
|
|
11
|
+
import { podcastsMethods } from "./podcasts.js";
|
|
12
|
+
import { preferencesMethods } from "./preferences.js";
|
|
13
|
+
import { sharesMethods } from "./shares.js";
|
|
14
|
+
import { shoutsMethods } from "./shouts.js";
|
|
15
|
+
import { songsMethods } from "./songs.js";
|
|
16
|
+
import { systemMethods } from "./system.js";
|
|
17
|
+
import { usersMethods } from "./users.js";
|
|
18
|
+
import { videosMethods } from "./videos.js";
|
|
19
|
+
import { Base } from "./base.js";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Base} AmpacheAPI
|
|
23
|
+
* AmpacheAPI extends Base and has all domain methods (albums, artists, auth, etc.) on its prototype.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
class AmpacheAPI extends Base {}
|
|
27
|
+
|
|
28
|
+
Object.assign(AmpacheAPI.prototype, albumsMethods, artistsMethods, authMethods, bookmarksMethods, catalogsMethods, genresMethods, labelsMethods, licensesMethods, liveStreamsMethods, playlistsMethods, podcastsMethods, preferencesMethods, sharesMethods, shoutsMethods, songsMethods, systemMethods, usersMethods, videosMethods);
|
|
29
|
+
|
|
30
|
+
export default AmpacheAPI;
|
package/src/labels.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} LabelResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {number} artists
|
|
6
|
+
* @property {string|null} summary
|
|
7
|
+
* @property {string|null} external_link
|
|
8
|
+
* @property {string|null} address
|
|
9
|
+
* @property {string|null} category
|
|
10
|
+
* @property {string|null} email
|
|
11
|
+
* @property {string|null} website
|
|
12
|
+
* @property {import("./base.js").UID} user
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} LabelsResponse
|
|
17
|
+
* @property {number} total_count
|
|
18
|
+
* @property {string} md5
|
|
19
|
+
* @property {LabelResponse[]} label
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export const labelsMethods = {
|
|
23
|
+
/**
|
|
24
|
+
* This returns labels based on the specified filter
|
|
25
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
26
|
+
* @param {Object} [params]
|
|
27
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
28
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
29
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
30
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
31
|
+
* @param {number} [params.offset]
|
|
32
|
+
* @param {number} [params.limit]
|
|
33
|
+
* @param {string} [params.cond]
|
|
34
|
+
* @param {string} [params.sort]
|
|
35
|
+
* @returns {Promise<LabelsResponse>}
|
|
36
|
+
* @see {@link https://ampache.org/api/api-json-methods#labels}
|
|
37
|
+
*/
|
|
38
|
+
labels(params) {
|
|
39
|
+
return this.call("labels", params);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* This returns a single label
|
|
44
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
45
|
+
* @param {Object} params
|
|
46
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
47
|
+
* @returns {Promise<LabelResponse>}
|
|
48
|
+
* @see {@link https://ampache.org/api/api-json-methods#label}
|
|
49
|
+
*/
|
|
50
|
+
label(params) {
|
|
51
|
+
return this.call("label", params);
|
|
52
|
+
},
|
|
53
|
+
};
|
package/src/licenses.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} LicenseResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {string} description
|
|
6
|
+
* @property {string} external_link
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} LicensesResponse
|
|
11
|
+
* @property {number} total_count
|
|
12
|
+
* @property {string} md5
|
|
13
|
+
* @property {LicenseResponse[]} license
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const licensesMethods = {
|
|
17
|
+
/**
|
|
18
|
+
* This returns licenses based on the specified filter
|
|
19
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
20
|
+
* @param {Object} [params]
|
|
21
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
22
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
23
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
24
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
25
|
+
* @param {number} [params.offset]
|
|
26
|
+
* @param {number} [params.limit]
|
|
27
|
+
* @param {string} [params.cond]
|
|
28
|
+
* @param {string} [params.sort]
|
|
29
|
+
* @returns {Promise<LicensesResponse>}
|
|
30
|
+
* @see {@link https://ampache.org/api/api-json-methods#licenses}
|
|
31
|
+
*/
|
|
32
|
+
licenses(params) {
|
|
33
|
+
return this.call("licenses", params);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* This returns a single license
|
|
38
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
39
|
+
* @param {Object} params
|
|
40
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
41
|
+
* @returns {Promise<LicenseResponse>}
|
|
42
|
+
* @see {@link https://ampache.org/api/api-json-methods#license}
|
|
43
|
+
*/
|
|
44
|
+
license(params) {
|
|
45
|
+
return this.call("license", params);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} LiveStreamResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {string} url
|
|
6
|
+
* @property {string} codec
|
|
7
|
+
* @property {import("./base.js").UID} catalog
|
|
8
|
+
* @property {string} site_url
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} LiveStreamsResponse
|
|
13
|
+
* @property {number} total_count
|
|
14
|
+
* @property {string} md5
|
|
15
|
+
* @property {LiveStreamResponse[]} live_stream
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const liveStreamsMethods = {
|
|
19
|
+
/**
|
|
20
|
+
* This returns live_streams based on the specified filter
|
|
21
|
+
* @remarks MINIMUM_API_VERSION=5.1.0
|
|
22
|
+
* @param {Object} [params]
|
|
23
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
24
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
25
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
26
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
27
|
+
* @param {number} [params.offset]
|
|
28
|
+
* @param {number} [params.limit]
|
|
29
|
+
* @param {string} [params.cond]
|
|
30
|
+
* @param {string} [params.sort]
|
|
31
|
+
* @returns {Promise<LiveStreamsResponse>}
|
|
32
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_streams}
|
|
33
|
+
*/
|
|
34
|
+
liveStreams(params) {
|
|
35
|
+
return this.call("live_streams", params);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This returns a single live_stream
|
|
40
|
+
* @remarks MINIMUM_API_VERSION=5.1.0
|
|
41
|
+
* @param {Object} params
|
|
42
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
43
|
+
* @returns {Promise<LiveStreamResponse>}
|
|
44
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream}
|
|
45
|
+
*/
|
|
46
|
+
liveStream(params) {
|
|
47
|
+
return this.call("live_stream", params);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create a live_stream (radio station) object.
|
|
52
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
53
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
54
|
+
* @param {Object} params
|
|
55
|
+
* @param {string} params.name Stream title
|
|
56
|
+
* @param {string} params.url URL of the http/s stream
|
|
57
|
+
* @param {"mp3"|"flac"|"ogg"|"vorbis"|"opus"|"aac"|"alac"} params.codec Stream codec
|
|
58
|
+
* @param {string} params.catalog Catalog ID to associate with this stream
|
|
59
|
+
* @param {string} [params.site_url] Homepage URL of the stream
|
|
60
|
+
* @returns {Promise<LiveStreamResponse>}
|
|
61
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_create}
|
|
62
|
+
*/
|
|
63
|
+
liveStreamCreate(params) {
|
|
64
|
+
return this.call("live_stream_create", params);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Edit a live_stream (radio station) object.
|
|
69
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
70
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
71
|
+
* @param {Object} params
|
|
72
|
+
* @param {string} params.filter Object to find
|
|
73
|
+
* @param {string} [params.name] Stream title
|
|
74
|
+
* @param {string} [params.url] URL of the http/s stream
|
|
75
|
+
* @param {"mp3"|"flac"|"ogg"|"vorbis"|"opus"|"aac"|"alac"} [params.codec] Stream codec
|
|
76
|
+
* @param {string} [params.catalog] Catalog ID to associate with this stream
|
|
77
|
+
* @param {string} [params.site_url] Homepage URL of the stream
|
|
78
|
+
* @returns {Promise<LiveStreamResponse>}
|
|
79
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_edit}
|
|
80
|
+
*/
|
|
81
|
+
liveStreamEdit(params) {
|
|
82
|
+
return this.call("live_stream_edit", params);
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Delete a live_stream (radio station) object (if it exists)
|
|
87
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
88
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
89
|
+
* @param {Object} params
|
|
90
|
+
* @param {string} params.filter Object to find
|
|
91
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
92
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_delete}
|
|
93
|
+
*/
|
|
94
|
+
liveStreamDelete(params) {
|
|
95
|
+
return this.call("live_stream_delete", params);
|
|
96
|
+
},
|
|
97
|
+
};
|
package/src/playlists.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} PlaylistResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {string} owner
|
|
6
|
+
* @property {number} items
|
|
7
|
+
* @property {"public"|"private"} type
|
|
8
|
+
* @property {string} art
|
|
9
|
+
* @property {boolean} has_art
|
|
10
|
+
* @property {boolean} flag
|
|
11
|
+
* @property {number|null} rating
|
|
12
|
+
* @property {number|null} averagerating
|
|
13
|
+
* @property {import("./users.js").UserSummary} user
|
|
14
|
+
* @property {boolean} has_access
|
|
15
|
+
* @property {boolean} has_collaborate
|
|
16
|
+
* @property {number} last_update
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} PlaylistsResponse
|
|
21
|
+
* @property {number} total_count
|
|
22
|
+
* @property {string} md5
|
|
23
|
+
* @property {PlaylistResponse[]} playlist
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} HashResponse
|
|
28
|
+
* @property {string} md5
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export const playlistsMethods = {
|
|
32
|
+
/**
|
|
33
|
+
* This returns playlists based on the specified filter
|
|
34
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
35
|
+
* @param {Object} [params]
|
|
36
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
37
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
38
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
39
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
40
|
+
* @param {import("./base.js").BinaryBoolean} [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
|
|
41
|
+
* @param {import("./base.js").BinaryBoolean} [params.show_dupes] 0, 1 (if true ignore 'api_hide_dupe_searches' setting)
|
|
42
|
+
* @param {import("./base.js").BinaryBoolean} [params.include] 0, 1 (if true include the objects in the playlist)
|
|
43
|
+
* @param {number} [params.offset]
|
|
44
|
+
* @param {number} [params.limit]
|
|
45
|
+
* @param {string} [params.cond]
|
|
46
|
+
* @param {string} [params.sort]
|
|
47
|
+
* @returns {Promise<PlaylistsResponse>}
|
|
48
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlists}
|
|
49
|
+
*/
|
|
50
|
+
playlists(params) {
|
|
51
|
+
return this.call("playlists", params);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* This returns smartlists based on the specified filter
|
|
56
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
57
|
+
* @param {Object} [params]
|
|
58
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
59
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
60
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
61
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
62
|
+
* @param {number} [params.offset]
|
|
63
|
+
* @param {number} [params.limit]
|
|
64
|
+
* @param {string} [params.cond]
|
|
65
|
+
* @param {string} [params.sort]
|
|
66
|
+
* @returns {Promise<PlaylistsResponse>}
|
|
67
|
+
* @see {@link https://ampache.org/api/api-json-methods#smartlists}
|
|
68
|
+
*/
|
|
69
|
+
smartlists(params) {
|
|
70
|
+
return this.call("smartlists", params);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* This returns a single playlist
|
|
75
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
76
|
+
* @param {Object} params
|
|
77
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
78
|
+
* @returns {Promise<PlaylistResponse>}
|
|
79
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist}
|
|
80
|
+
*/
|
|
81
|
+
playlist(params) {
|
|
82
|
+
return this.call("playlist", params);
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* This returns a user's playlists based on the specified filter
|
|
87
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
88
|
+
* @param {Object} [params]
|
|
89
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
90
|
+
* @param {import("./base.js").BinaryBoolean} [params.include] 0, 1 (include playlist items)
|
|
91
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
92
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
93
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
94
|
+
* @param {number} [params.offset]
|
|
95
|
+
* @param {number} [params.limit]
|
|
96
|
+
* @param {string} [params.cond]
|
|
97
|
+
* @param {string} [params.sort]
|
|
98
|
+
* @returns {Promise<PlaylistsResponse>}
|
|
99
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_playlists}
|
|
100
|
+
*/
|
|
101
|
+
userPlaylists(params) {
|
|
102
|
+
return this.call("user_playlists", params);
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* This returns a user's smartlists based on the specified filter
|
|
107
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
108
|
+
* @param {Object} [params]
|
|
109
|
+
* @param {string} [params.filter] Filter results to match this string
|
|
110
|
+
* @param {import("./base.js").BinaryBoolean} [params.include] 0, 1 (include playlist items)
|
|
111
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
112
|
+
* @param {Date} [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
113
|
+
* @param {Date} [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
114
|
+
* @param {number} [params.offset]
|
|
115
|
+
* @param {number} [params.limit]
|
|
116
|
+
* @param {string} [params.cond]
|
|
117
|
+
* @param {string} [params.sort]
|
|
118
|
+
* @returns {Promise<PlaylistsResponse>}
|
|
119
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_smartlists}
|
|
120
|
+
*/
|
|
121
|
+
userSmartlists(params) {
|
|
122
|
+
return this.call("user_smartlists", params);
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* This creates a new playlist and returns it
|
|
127
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
128
|
+
* @param {Object} params
|
|
129
|
+
* @param {string} params.name Playlist name
|
|
130
|
+
* @param {"public"|"private"} [params.type] public, private (Playlist type)
|
|
131
|
+
* @returns {Promise<PlaylistResponse>}
|
|
132
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_create}
|
|
133
|
+
*/
|
|
134
|
+
playlistCreate(params) {
|
|
135
|
+
return this.call("playlist_create", params);
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* This adds an item to a playlist
|
|
140
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
141
|
+
* @param {Object} params
|
|
142
|
+
* @param {import("./base.js").UID} params.filter UID of Playlist
|
|
143
|
+
* @param {import("./base.js").UID} params.id UID of the object to add to playlist
|
|
144
|
+
* @param {"song"|"album"|"artist"|"playlist"} params.type 'song', 'album', 'artist', 'playlist'
|
|
145
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
146
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_add}
|
|
147
|
+
*/
|
|
148
|
+
playlistAdd(params) {
|
|
149
|
+
return this.call("playlist_add", params);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* This modifies name and type of the playlist.
|
|
154
|
+
* NOTE items and tracks must be sent together and be of equal length.
|
|
155
|
+
* @remarks MINIMUM_API_VERSION=400001
|
|
156
|
+
* @param {Object} params
|
|
157
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
158
|
+
* @param {string} [params.name] Playlist name
|
|
159
|
+
* @param {"public"|"private"} [params.type] public, private (Playlist type)
|
|
160
|
+
* @param {string} [params.owner] Change playlist owner to the user id (-1 = System playlist)
|
|
161
|
+
* @param {string} [params.items] comma-separated song_id's (replaces existing items with a new id)
|
|
162
|
+
* @param {string} [params.tracks] comma-separated playlisttrack numbers matched to 'items' in order
|
|
163
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
164
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_edit}
|
|
165
|
+
*/
|
|
166
|
+
playlistEdit(params) {
|
|
167
|
+
return this.call("playlist_edit", params);
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* This deletes a playlist
|
|
172
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
173
|
+
* @param {Object} params
|
|
174
|
+
* @param {import("./base.js").UID} params.filter UID of playlist to delete
|
|
175
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
176
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_delete}
|
|
177
|
+
*/
|
|
178
|
+
playlistDelete(params) {
|
|
179
|
+
return this.call("playlist_delete", params);
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* This adds a song to a playlist
|
|
184
|
+
* @remarks MINIMUM_API_VERSION=380001; CHANGED_IN_API_VERSION=400003
|
|
185
|
+
* @param {Object} params
|
|
186
|
+
* @param {import("./base.js").UID} params.filter UID of Playlist
|
|
187
|
+
* @param {import("./base.js").UID} params.song UID of song to add to playlist
|
|
188
|
+
* @param {import("./base.js").BinaryBoolean} [params.check] 0, 1 Whether to check and ignore duplicates (default = 0)
|
|
189
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
190
|
+
* @deprecated Being removed in 7.0.0. Use `playlist_add` instead.
|
|
191
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_add_song}
|
|
192
|
+
*/
|
|
193
|
+
playlistAddSong(params) {
|
|
194
|
+
return this.call("playlist_add_song", params);
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* This remove a song from a playlist
|
|
199
|
+
* @remarks MINIMUM_API_VERSION=380001; CHANGED_IN_API_VERSION=400001
|
|
200
|
+
* @param {Object} params
|
|
201
|
+
* @param {import("./base.js").UID} params.filter UID of Playlist
|
|
202
|
+
* @param {import("./base.js").UID} [params.song] UID of song to remove from playlist
|
|
203
|
+
* @param {number} [params.track] Track number to remove from playlist
|
|
204
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
205
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_remove_song}
|
|
206
|
+
*/
|
|
207
|
+
playlistRemoveSong(params) {
|
|
208
|
+
return this.call("playlist_remove_song", params);
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get a list of song JSON, indexes or id's based on some simple search criteria
|
|
213
|
+
* @remarks MINIMUM_API_VERSION=400001; CHANGED_IN_API_VERSION=400002; 'recent' will search for tracks played after 'Popular Threshold' days; 'forgotten' will search for tracks played before 'Popular Threshold' days; 'unplayed' added in 400002 for searching unplayed tracks
|
|
214
|
+
* @param {Object} [params]
|
|
215
|
+
* @param {"recent"|"forgotten"|"unplayed"|"random"} [params.mode] (default = 'random')
|
|
216
|
+
* @param {string} [params.filter] string LIKE matched to song title
|
|
217
|
+
* @param {number} [params.album] UID of album
|
|
218
|
+
* @param {number} [params.artist] UID of artist
|
|
219
|
+
* @param {import("./base.js").BinaryBoolean} [params.flag] 0, 1 (get flagged songs only. default = 0)
|
|
220
|
+
* @param {"song"|"index"|"id"} [params.format] song, index, id (default = 'song')
|
|
221
|
+
* @param {number} [params.offset]
|
|
222
|
+
* @param {number} [params.limit]
|
|
223
|
+
* @returns {Promise<import("./songs.js").SongsResponse>}
|
|
224
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_generate}
|
|
225
|
+
*/
|
|
226
|
+
playlistGenerate(params) {
|
|
227
|
+
return this.call("playlist_generate", params);
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* This returns the md5 hash for the songs in a playlist
|
|
232
|
+
* @remarks MINIMUM_API_VERSION=6.6.0
|
|
233
|
+
* @param {Object} params
|
|
234
|
+
* @param {import("./base.js").UID} params.filter string UID of Playlist
|
|
235
|
+
* @returns {Promise<HashResponse>}
|
|
236
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_hash}
|
|
237
|
+
*/
|
|
238
|
+
playlistHash(params) {
|
|
239
|
+
return this.call("playlist_hash", params);
|
|
240
|
+
},
|
|
241
|
+
};
|