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/podcasts.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} PodcastEpisodeResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} title
|
|
5
|
+
* @property {string} name
|
|
6
|
+
* @property {string} description
|
|
7
|
+
* @property {string} category
|
|
8
|
+
* @property {string} author
|
|
9
|
+
* @property {string} author_full
|
|
10
|
+
* @property {string} website
|
|
11
|
+
* @property {string} pubdate
|
|
12
|
+
* @property {"completed"|"pending"} state
|
|
13
|
+
* @property {string} filelength
|
|
14
|
+
* @property {string} filesize
|
|
15
|
+
* @property {string} filename
|
|
16
|
+
* @property {string} mime
|
|
17
|
+
* @property {number} time
|
|
18
|
+
* @property {number} size
|
|
19
|
+
* @property {number} bitrate
|
|
20
|
+
* @property {number} stream_bitrate
|
|
21
|
+
* @property {number} rate
|
|
22
|
+
* @property {number|null} mode
|
|
23
|
+
* @property {number|null} channels
|
|
24
|
+
* @property {string} public_url
|
|
25
|
+
* @property {string} url
|
|
26
|
+
* @property {import("./base.js").UID} catalog
|
|
27
|
+
* @property {string} art
|
|
28
|
+
* @property {boolean} has_art
|
|
29
|
+
* @property {boolean} flag
|
|
30
|
+
* @property {number|null} rating
|
|
31
|
+
* @property {number|null} averagerating
|
|
32
|
+
* @property {number} playcount
|
|
33
|
+
* @property {number} played
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {Object} PodcastResponse
|
|
38
|
+
* @property {import("./base.js").UID} id
|
|
39
|
+
* @property {string} name
|
|
40
|
+
* @property {string} description
|
|
41
|
+
* @property {string} language
|
|
42
|
+
* @property {string} copyright
|
|
43
|
+
* @property {string} feed_url
|
|
44
|
+
* @property {string} generator
|
|
45
|
+
* @property {string} website
|
|
46
|
+
* @property {string} build_date
|
|
47
|
+
* @property {string} sync_date
|
|
48
|
+
* @property {string} public_url
|
|
49
|
+
* @property {string} art
|
|
50
|
+
* @property {boolean} has_art
|
|
51
|
+
* @property {boolean} flag
|
|
52
|
+
* @property {number|null} rating
|
|
53
|
+
* @property {number|null} averaterating
|
|
54
|
+
* @property {PodcastEpisodeResponse[]} podcast_episode
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @typedef {Object} PodcastsResponse
|
|
59
|
+
* @property {number} total_count
|
|
60
|
+
* @property {string} md5
|
|
61
|
+
* @property {PodcastResponse[]} podcast
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {Object} PodcastEpisodesResponse
|
|
66
|
+
* @property {number} total_count
|
|
67
|
+
* @property {string} md5
|
|
68
|
+
* @property {PodcastEpisodeResponse[]} podcast_episode
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @typedef {Object} DeletedPodcastEpisodeResponse
|
|
73
|
+
* @property {import("./base.js").UID} id
|
|
74
|
+
* @property {number} addition_time
|
|
75
|
+
* @property {number} delete_time
|
|
76
|
+
* @property {string} title
|
|
77
|
+
* @property {string} file
|
|
78
|
+
* @property {import("./base.js").UID} catalog
|
|
79
|
+
* @property {number} total_count
|
|
80
|
+
* @property {number} total_skip
|
|
81
|
+
* @property {import("./base.js").UID} podcast
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @typedef {Object} DeletedPodcastEpisodesResponse
|
|
86
|
+
* @property {number} total_count
|
|
87
|
+
* @property {string} md5
|
|
88
|
+
* @property {DeletedPodcastEpisodeResponse[]} deleted_podcast_episode
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
export const podcastsMethods = {
|
|
92
|
+
/**
|
|
93
|
+
* Get information about podcasts
|
|
94
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
95
|
+
* @param {Object} [params]
|
|
96
|
+
* @param {string} [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
|
|
97
|
+
* @param {"episodes"} [params.include] episodes (include podcast_episodes in the response)
|
|
98
|
+
* @param {number} [params.offset]
|
|
99
|
+
* @param {number} [params.limit]
|
|
100
|
+
* @param {string} [params.cond]
|
|
101
|
+
* @param {string} [params.sort]
|
|
102
|
+
* @returns {Promise<PodcastsResponse>}
|
|
103
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcasts}
|
|
104
|
+
*/
|
|
105
|
+
podcasts(params) {
|
|
106
|
+
return this.call("podcasts", params);
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get the podcast from its id
|
|
111
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
112
|
+
* @param {Object} params
|
|
113
|
+
* @param {import("./base.js").UID} params.filter UID of podcast, returns podcast JSON
|
|
114
|
+
* @param {"episodes"} [params.include] episodes (include podcast_episodes in the response)
|
|
115
|
+
* @returns {Promise<PodcastResponse>}
|
|
116
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast}
|
|
117
|
+
*/
|
|
118
|
+
podcast(params) {
|
|
119
|
+
return this.call("podcast", params);
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Create a podcast that can be used by anyone to stream media.
|
|
124
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
125
|
+
* @param {Object} params
|
|
126
|
+
* @param {string} params.url RSS url for podcast
|
|
127
|
+
* @param {import("./base.js").UID} params.catalog UID of podcast catalog
|
|
128
|
+
* @returns {Promise<PodcastResponse>}
|
|
129
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast_create}
|
|
130
|
+
*/
|
|
131
|
+
podcastCreate(params) {
|
|
132
|
+
return this.call("podcast_create", params);
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Update the description and/or expiration date for an existing podcast.
|
|
137
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
138
|
+
* @param {Object} params
|
|
139
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
140
|
+
* @param {string} [params.feed] RSS url for podcast
|
|
141
|
+
* @param {string} [params.title] Podcast title
|
|
142
|
+
* @param {string} [params.website] Source website URL
|
|
143
|
+
* @param {string} [params.description] Podcast description
|
|
144
|
+
* @param {string} [params.generator] Podcast generator
|
|
145
|
+
* @param {string} [params.copyright] Podcast copyright
|
|
146
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
147
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast_edit}
|
|
148
|
+
*/
|
|
149
|
+
podcastEdit(params) {
|
|
150
|
+
return this.call("podcast_edit", params);
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Delete an existing podcast
|
|
155
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
156
|
+
* @param {Object} params
|
|
157
|
+
* @param {import("./base.js").UID} params.filter UID of podcast to delete
|
|
158
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
159
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast_delete}
|
|
160
|
+
*/
|
|
161
|
+
podcastDelete(params) {
|
|
162
|
+
return this.call("podcast_delete", params);
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* This returns the episodes for a podcast
|
|
167
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
168
|
+
* @param {Object} params
|
|
169
|
+
* @param {import("./base.js").UID} params.filter UID of podcast
|
|
170
|
+
* @param {number} [params.offset]
|
|
171
|
+
* @param {number} [params.limit]
|
|
172
|
+
* @param {string} [params.cond]
|
|
173
|
+
* @param {string} [params.sort]
|
|
174
|
+
* @returns {Promise<PodcastEpisodesResponse>}
|
|
175
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast_episodes}
|
|
176
|
+
*/
|
|
177
|
+
podcastEpisodes(params) {
|
|
178
|
+
return this.call("podcast_episodes", params);
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get the podcast_episode from a UID
|
|
183
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
184
|
+
* @param {Object} params
|
|
185
|
+
* @param {import("./base.js").UID} params.filter UID of podcast
|
|
186
|
+
* @returns {Promise<PodcastEpisodeResponse>}
|
|
187
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast_episode}
|
|
188
|
+
*/
|
|
189
|
+
podcastEpisode(params) {
|
|
190
|
+
return this.call("podcast_episode", params);
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Delete an existing podcast_episode
|
|
195
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
196
|
+
* @param {Object} params
|
|
197
|
+
* @param {import("./base.js").UID} params.filter UID of podcast episode to delete
|
|
198
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
199
|
+
* @see {@link https://ampache.org/api/api-json-methods#podcast_episode_delete}
|
|
200
|
+
*/
|
|
201
|
+
podcastEpisodeDelete(params) {
|
|
202
|
+
return this.call("podcast_episode_delete", params);
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Sync and download new podcast episodes
|
|
207
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
208
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
209
|
+
* @param {Object} params
|
|
210
|
+
* @param {import("./base.js").UID} params.filter UID of podcast (required)
|
|
211
|
+
* @param {import("./base.js").UID} [params.id] Alias of filter (Ampache 7.9.0+)
|
|
212
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
213
|
+
* @see {@link https://ampache.org/api/api-json-methods#update_podcast}
|
|
214
|
+
*/
|
|
215
|
+
updatePodcast(params) {
|
|
216
|
+
return this.call("update_podcast", params);
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* This returns the episodes for a podcast that have been deleted
|
|
221
|
+
* @param {Object} [params]
|
|
222
|
+
* @param {number} [params.offset]
|
|
223
|
+
* @param {number} [params.limit]
|
|
224
|
+
* @returns {Promise<DeletedPodcastEpisodesResponse>}
|
|
225
|
+
* @see {@link https://ampache.org/api/api-json-methods#deleted_podcast_episodes}
|
|
226
|
+
*/
|
|
227
|
+
deletedPodcastEpisodes(params) {
|
|
228
|
+
return this.call("deleted_podcast_episodes", params);
|
|
229
|
+
},
|
|
230
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} PreferenceResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {string} level
|
|
6
|
+
* @property {string} description
|
|
7
|
+
* @property {string} value
|
|
8
|
+
* @property {string} type
|
|
9
|
+
* @property {string} category
|
|
10
|
+
* @property {string|null} subcategory
|
|
11
|
+
* @property {boolean} has_access
|
|
12
|
+
* @property {string} [values]
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} PreferencesResponse
|
|
17
|
+
* @property {number} total_count
|
|
18
|
+
* @property {string} md5
|
|
19
|
+
* @property {PreferenceResponse[]} preference
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export const preferencesMethods = {
|
|
23
|
+
/**
|
|
24
|
+
* Get your server preferences
|
|
25
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
26
|
+
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
27
|
+
* @returns {Promise<PreferencesResponse>}
|
|
28
|
+
* @see {@link https://ampache.org/api/api-json-methods#system_preferences}
|
|
29
|
+
*/
|
|
30
|
+
systemPreferences() {
|
|
31
|
+
return this.call("system_preferences");
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get your system preference by name
|
|
36
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
37
|
+
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
38
|
+
* @param {Object} params
|
|
39
|
+
* @param {string} params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
40
|
+
* @returns {Promise<PreferenceResponse>}
|
|
41
|
+
* @see {@link https://ampache.org/api/api-json-methods#system_preference}
|
|
42
|
+
*/
|
|
43
|
+
systemPreference(params) {
|
|
44
|
+
return this.call("system_preference", params);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get your user preferences
|
|
49
|
+
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
50
|
+
* @returns {Promise<PreferencesResponse>}
|
|
51
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_preferences}
|
|
52
|
+
*/
|
|
53
|
+
userPreferences() {
|
|
54
|
+
return this.call("user_preferences");
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get your user preference by name
|
|
59
|
+
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
60
|
+
* @param {Object} params
|
|
61
|
+
* @param {string} params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
62
|
+
* @returns {Promise<PreferenceResponse>}
|
|
63
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_preference}
|
|
64
|
+
*/
|
|
65
|
+
userPreference(params) {
|
|
66
|
+
return this.call("user_preference", params);
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Add a new preference to your server
|
|
71
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
72
|
+
* @param {Object} params
|
|
73
|
+
* @param {string} params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
74
|
+
* @param {"boolean"|"integer"|"string"|"special"} params.type boolean, integer, string, special
|
|
75
|
+
* @param {string|number} params.default string or integer default value
|
|
76
|
+
* @param {"interface"|"internal"|"options"|"playlist"|"plugins"|"streaming"} params.category Category type
|
|
77
|
+
* @param {string} [params.description]
|
|
78
|
+
* @param {string} [params.subcategory]
|
|
79
|
+
* @param {number} [params.level] access level required to change the value (default 100)
|
|
80
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
81
|
+
* @see {@link https://ampache.org/api/api-json-methods#preference_create}
|
|
82
|
+
*/
|
|
83
|
+
preferenceCreate(params) {
|
|
84
|
+
return this.call("preference_create", params);
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Edit a preference value and apply to all users if allowed
|
|
89
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
90
|
+
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
91
|
+
* @param {Object} params
|
|
92
|
+
* @param {string} params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
93
|
+
* @param {string|number} params.value (string/integer) Preference value
|
|
94
|
+
* @param {import("./base.js").BinaryBoolean} [params.all] 0, 1 apply to all users
|
|
95
|
+
* @param {import("./base.js").BinaryBoolean} [params.default] 0, 1 set as system default (New and public users). ACCESS: 100 (Admin)
|
|
96
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
97
|
+
* @see {@link https://ampache.org/api/api-json-methods#preference_edit}
|
|
98
|
+
*/
|
|
99
|
+
preferenceEdit(params) {
|
|
100
|
+
return this.call("preference_edit", params);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Delete a non-system preference by name
|
|
105
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
106
|
+
* @param {Object} params
|
|
107
|
+
* @param {string} params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
108
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
109
|
+
* @see {@link https://ampache.org/api/api-json-methods#preference_delete}
|
|
110
|
+
*/
|
|
111
|
+
preferenceDelete(params) {
|
|
112
|
+
return this.call("preference_delete", params);
|
|
113
|
+
},
|
|
114
|
+
};
|
package/src/shares.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ShareResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {string} name
|
|
5
|
+
* @property {string} owner
|
|
6
|
+
* @property {boolean} allow_stream
|
|
7
|
+
* @property {boolean} allow_download
|
|
8
|
+
* @property {number} creation_date
|
|
9
|
+
* @property {number} lastvisit_date
|
|
10
|
+
* @property {string} object_type
|
|
11
|
+
* @property {import("./base.js").UID} object_id
|
|
12
|
+
* @property {number} expire_days
|
|
13
|
+
* @property {number} max_counter
|
|
14
|
+
* @property {number} counter
|
|
15
|
+
* @property {string} secret
|
|
16
|
+
* @property {string} public_url
|
|
17
|
+
* @property {string} description
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} SharesResponse
|
|
22
|
+
* @property {number} total_count
|
|
23
|
+
* @property {string} md5
|
|
24
|
+
* @property {ShareResponse[]} share
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export const sharesMethods = {
|
|
28
|
+
/**
|
|
29
|
+
* This searches the shares and returns... shares
|
|
30
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
31
|
+
* @param {Object} [params]
|
|
32
|
+
* @param {string} [params.filter] UID to find
|
|
33
|
+
* @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 boolean to match the exact filter string
|
|
34
|
+
* @param {number} [params.offset]
|
|
35
|
+
* @param {number} [params.limit]
|
|
36
|
+
* @param {string} [params.cond]
|
|
37
|
+
* @param {string} [params.sort]
|
|
38
|
+
* @returns {Promise<SharesResponse>}
|
|
39
|
+
* @see {@link https://ampache.org/api/api-json-methods#shares}
|
|
40
|
+
*/
|
|
41
|
+
shares(params) {
|
|
42
|
+
return this.call("shares", params);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Return a share from UID
|
|
47
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
48
|
+
* @param {Object} params
|
|
49
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
50
|
+
* @returns {Promise<ShareResponse>}
|
|
51
|
+
* @see {@link https://ampache.org/api/api-json-methods#share}
|
|
52
|
+
*/
|
|
53
|
+
share(params) {
|
|
54
|
+
return this.call("share", params);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Create a public url that can be used by anyone to stream media.
|
|
59
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
60
|
+
* @param {Object} params
|
|
61
|
+
* @param {import("./base.js").UID} params.filter UID of object you are sharing
|
|
62
|
+
* @param {"song"|"album"|"artist"|"playlist"|"podcast"|"podcast_episode"|"video"} params.type
|
|
63
|
+
* @param {string} [params.description] description (will be filled for you if empty)
|
|
64
|
+
* @param {number} [params.expires] days to keep active
|
|
65
|
+
* @returns {Promise<ShareResponse>}
|
|
66
|
+
* @see {@link https://ampache.org/api/api-json-methods#share_create}
|
|
67
|
+
*/
|
|
68
|
+
shareCreate(params) {
|
|
69
|
+
return this.call("share_create", params);
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Update the description and/or expiration date for an existing share
|
|
74
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
75
|
+
* @param {Object} params
|
|
76
|
+
* @param {import("./base.js").UID} params.filter UID to find
|
|
77
|
+
* @param {import("./base.js").BinaryBoolean} [params.stream] 0, 1
|
|
78
|
+
* @param {import("./base.js").BinaryBoolean} [params.download] 0, 1
|
|
79
|
+
* @param {number} [params.expires] days to keep active
|
|
80
|
+
* @param {string} [params.description] description
|
|
81
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
82
|
+
* @see {@link https://ampache.org/api/api-json-methods#share_edit}
|
|
83
|
+
*/
|
|
84
|
+
shareEdit(params) {
|
|
85
|
+
return this.call("share_edit", params);
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Delete an existing share.
|
|
90
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
91
|
+
* @param {Object} params
|
|
92
|
+
* @param {import("./base.js").UID} params.filter UID of share to delete
|
|
93
|
+
* @returns {Promise<import("./base.js").Success>}
|
|
94
|
+
* @see {@link https://ampache.org/api/api-json-methods#share_delete}
|
|
95
|
+
*/
|
|
96
|
+
shareDelete(params) {
|
|
97
|
+
return this.call("share_delete", params);
|
|
98
|
+
},
|
|
99
|
+
};
|
package/src/shouts.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ShoutResponse
|
|
3
|
+
* @property {import("./base.js").UID} id
|
|
4
|
+
* @property {number} date
|
|
5
|
+
* @property {string} text
|
|
6
|
+
* @property {import("./users.js").UserSummary} user
|
|
7
|
+
* @property {"song"|"album"|"artist"|"playlist"} object_type
|
|
8
|
+
* @property {import("./base.js").UID} object_id
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const shoutsMethods = {
|
|
12
|
+
/**
|
|
13
|
+
* This gets the latest posted shouts
|
|
14
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
15
|
+
* @param {Object} [params]
|
|
16
|
+
* @param {string} [params.username] Username to find
|
|
17
|
+
* @param {number} [params.limit] Maximum number of results to return
|
|
18
|
+
* @returns {Promise<{ shout: ShoutResponse[] }>}
|
|
19
|
+
* @see {@link https://ampache.org/api/api-json-methods#last_shouts}
|
|
20
|
+
*/
|
|
21
|
+
last_shouts(params) {
|
|
22
|
+
return this.call("last_shouts", params);
|
|
23
|
+
},
|
|
24
|
+
};
|