javascript-ampache 0.0.1 → 1.0.1
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/dist/base.d.ts +1 -0
- package/dist/catalogs/index.d.ts +34 -0
- 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.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/live-streams/index.d.ts +49 -1
- package/dist/podcasts/types.d.ts +6 -1
- package/dist/preferences/index.d.ts +1 -1
- package/dist/system/index.d.ts +48 -3
- package/dist/system/types.d.ts +7 -0
- package/dist/users/index.d.ts +52 -0
- package/package.json +1 -1
- package/src/base.ts +21 -0
- package/src/catalogs/index.ts +44 -0
- package/src/live-streams/index.ts +64 -1
- package/src/podcasts/types.ts +6 -1
- package/src/preferences/index.ts +1 -1
- package/src/system/index.ts +56 -5
- package/src/system/types.ts +9 -1
- package/src/users/index.ts +62 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LiveStream } from './types';
|
|
2
|
-
import { Base, BinaryBoolean, Pagination, UID } from '../base';
|
|
2
|
+
import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
|
|
3
3
|
export declare class LiveStreams extends Base {
|
|
4
4
|
/**
|
|
5
5
|
* This returns live_streams based on the specified filter
|
|
@@ -29,4 +29,52 @@ export declare class LiveStreams extends Base {
|
|
|
29
29
|
liveStream(params: {
|
|
30
30
|
filter: UID;
|
|
31
31
|
}): Promise<LiveStream>;
|
|
32
|
+
/**
|
|
33
|
+
* Create a live_stream (radio station) object.
|
|
34
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
35
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
36
|
+
* @param params.name Stream title
|
|
37
|
+
* @param params.url URL of the http/s stream
|
|
38
|
+
* @param params.codec Stream codec
|
|
39
|
+
* @param params.catalog Catalog ID to associate with this stream
|
|
40
|
+
* @param [params.site_url] Homepage URL of the stream
|
|
41
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_create}
|
|
42
|
+
*/
|
|
43
|
+
liveStreamCreate(params: {
|
|
44
|
+
name: string;
|
|
45
|
+
url: string;
|
|
46
|
+
codec: 'mp3' | 'flac' | 'ogg' | 'vorbis' | 'opus' | 'aac' | 'alac';
|
|
47
|
+
catalog: string;
|
|
48
|
+
site_url?: string;
|
|
49
|
+
}): Promise<LiveStream>;
|
|
50
|
+
/**
|
|
51
|
+
* Edit a live_stream (radio station) object.
|
|
52
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
53
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
54
|
+
* @param params.filter Object to find
|
|
55
|
+
* @param [params.name] Stream title
|
|
56
|
+
* @param [params.url] URL of the http/s stream
|
|
57
|
+
* @param [params.codec] Stream codec
|
|
58
|
+
* @param [params.catalog] Catalog ID to associate with this stream
|
|
59
|
+
* @param [params.site_url] Homepage URL of the stream
|
|
60
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_edit}
|
|
61
|
+
*/
|
|
62
|
+
liveStreamEdit(params: {
|
|
63
|
+
filter: string;
|
|
64
|
+
name?: string;
|
|
65
|
+
url?: string;
|
|
66
|
+
codec?: 'mp3' | 'flac' | 'ogg' | 'vorbis' | 'opus' | 'aac' | 'alac';
|
|
67
|
+
catalog?: string;
|
|
68
|
+
site_url?: string;
|
|
69
|
+
}): Promise<LiveStream>;
|
|
70
|
+
/**
|
|
71
|
+
* Delete a live_stream (radio station) object (if it exists)
|
|
72
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
73
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
74
|
+
* @param params.filter Object to find
|
|
75
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_delete}
|
|
76
|
+
*/
|
|
77
|
+
liveStreamDelete(params: {
|
|
78
|
+
filter: string;
|
|
79
|
+
}): Promise<Success>;
|
|
32
80
|
}
|
package/dist/podcasts/types.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export type PodcastEpisode = {
|
|
|
34
34
|
mime: string;
|
|
35
35
|
time: number;
|
|
36
36
|
size: number;
|
|
37
|
+
bitrate: number;
|
|
38
|
+
stream_bitrate: number;
|
|
39
|
+
rate: number;
|
|
40
|
+
mode: number | null;
|
|
41
|
+
channels: number | null;
|
|
37
42
|
public_url: string;
|
|
38
43
|
url: string;
|
|
39
44
|
catalog: UID;
|
|
@@ -42,7 +47,7 @@ export type PodcastEpisode = {
|
|
|
42
47
|
rating: number | null;
|
|
43
48
|
averagerating: number | null;
|
|
44
49
|
playcount: number;
|
|
45
|
-
played:
|
|
50
|
+
played: number;
|
|
46
51
|
};
|
|
47
52
|
export type DeletedPodcastEpisode = {
|
|
48
53
|
id: UID;
|
|
@@ -53,7 +53,7 @@ export declare class Preferences extends Base {
|
|
|
53
53
|
filter: string;
|
|
54
54
|
type: 'boolean' | 'integer' | 'string' | 'special';
|
|
55
55
|
default: string | number;
|
|
56
|
-
category: 'interface' | 'internal' | 'options' | 'playlist' | 'plugins' | 'streaming'
|
|
56
|
+
category: 'interface' | 'internal' | 'options' | 'playlist' | 'plugins' | 'streaming';
|
|
57
57
|
description?: string;
|
|
58
58
|
subcategory?: string;
|
|
59
59
|
level?: number;
|
package/dist/system/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
|
|
2
|
+
import { IndexEntry } from "./types";
|
|
2
3
|
export declare class System extends Base {
|
|
3
4
|
/**
|
|
4
5
|
* Check Ampache for updates and run the update if there is one.
|
|
@@ -18,6 +19,7 @@ export declare class System extends Base {
|
|
|
18
19
|
* @param [params.offset]
|
|
19
20
|
* @param [params.limit]
|
|
20
21
|
* @see {@link https://ampache.org/api/api-json-methods#get_indexes}
|
|
22
|
+
* @deprecated Being removed in 7.0.0. Use `list` instead.
|
|
21
23
|
*/
|
|
22
24
|
getIndexes(params: {
|
|
23
25
|
type: 'song' | 'album' | 'artist' | 'album_artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'live_stream';
|
|
@@ -25,8 +27,51 @@ export declare class System extends Base {
|
|
|
25
27
|
add?: Date;
|
|
26
28
|
update?: Date;
|
|
27
29
|
include?: BinaryBoolean;
|
|
28
|
-
hide_search?:
|
|
30
|
+
hide_search?: BinaryBoolean;
|
|
29
31
|
} & Pagination): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* This takes a named array of objects and returning `id`, `name`, `prefix` and `basename`
|
|
34
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
35
|
+
* @param params.type type of object to find
|
|
36
|
+
* @param [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
|
|
37
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
38
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
39
|
+
* @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
|
|
40
|
+
* @param [params.offset]
|
|
41
|
+
* @param [params.limit]
|
|
42
|
+
* @see {@link https://ampache.org/api/api-json-methods#list}
|
|
43
|
+
*/
|
|
44
|
+
list(params: {
|
|
45
|
+
type: 'song' | 'album' | 'artist' | 'album_artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'live_stream';
|
|
46
|
+
filter?: string;
|
|
47
|
+
add?: Date;
|
|
48
|
+
update?: Date;
|
|
49
|
+
hide_search?: BinaryBoolean;
|
|
50
|
+
} & Pagination): Promise<{
|
|
51
|
+
list: IndexEntry[];
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Return children of a parent object in a folder traversal/browse style
|
|
55
|
+
* If you don't send any parameters you'll get a catalog list (the 'root' path)
|
|
56
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
57
|
+
* @param [params.filter] object_id
|
|
58
|
+
* @param [params.type] type of object to find
|
|
59
|
+
* @param [params.catalog] catalog ID you are browsing (required on 'artist', 'album', 'podcast')
|
|
60
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
61
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
62
|
+
* @param [params.offset]
|
|
63
|
+
* @param [params.limit]
|
|
64
|
+
* @see {@link https://ampache.org/api/api-json-methods#browse}
|
|
65
|
+
*/
|
|
66
|
+
browse(params: {
|
|
67
|
+
filter?: UID;
|
|
68
|
+
type?: 'root' | 'catalog' | 'artist' | 'album' | 'podcast';
|
|
69
|
+
catalog?: number;
|
|
70
|
+
add?: Date;
|
|
71
|
+
update?: Date;
|
|
72
|
+
} & Pagination): Promise<{
|
|
73
|
+
browse: IndexEntry[];
|
|
74
|
+
}>;
|
|
30
75
|
/**
|
|
31
76
|
* Return similar artist IDs or similar song IDs compared to the input filter
|
|
32
77
|
* @remarks MINIMUM_API_VERSION=420000
|
|
@@ -200,7 +245,7 @@ export declare class System extends Base {
|
|
|
200
245
|
id: UID;
|
|
201
246
|
type: 'song' | 'podcast_episode' | 'search' | 'playlist';
|
|
202
247
|
format?: string;
|
|
203
|
-
}): Promise<
|
|
248
|
+
}): Promise<Blob>;
|
|
204
249
|
/**
|
|
205
250
|
* Get an art image file.
|
|
206
251
|
* @remarks MINIMUM_API_VERSION=400001
|
|
@@ -260,7 +305,7 @@ export declare class System extends Base {
|
|
|
260
305
|
*/
|
|
261
306
|
advancedSearch(params: {
|
|
262
307
|
operator: 'and' | 'or';
|
|
263
|
-
type: 'song' | 'album' | 'artist' | 'label' | 'playlist' | 'podcast' | 'podcast_episode' | 'genre' | 'user' | 'video';
|
|
308
|
+
type: 'song' | 'album' | 'album_disk' | 'artist' | 'label' | 'playlist' | 'podcast' | 'podcast_episode' | 'genre' | 'user' | 'video';
|
|
264
309
|
rules: Array<Array<string>>;
|
|
265
310
|
random?: BinaryBoolean;
|
|
266
311
|
} & Pagination): Promise<any>;
|
package/dist/system/types.d.ts
CHANGED
|
@@ -5,5 +5,12 @@ import { Playlist } from "../playlists/types";
|
|
|
5
5
|
import { Podcast, PodcastEpisode } from "../podcasts/types";
|
|
6
6
|
import { LiveStream } from "../live-streams/types";
|
|
7
7
|
import { Video } from "../videos/types";
|
|
8
|
+
import { UID } from "../base";
|
|
8
9
|
export type IndexType = Song | Album | Artist | Playlist | Podcast | PodcastEpisode | LiveStream;
|
|
9
10
|
export type StatsType = Song | Album | Artist | Video | Playlist | Podcast | PodcastEpisode;
|
|
11
|
+
export type IndexEntry = {
|
|
12
|
+
id: UID;
|
|
13
|
+
name: string;
|
|
14
|
+
prefix: string;
|
|
15
|
+
basename: string;
|
|
16
|
+
};
|
package/dist/users/index.d.ts
CHANGED
|
@@ -38,6 +38,21 @@ export declare class Users extends Base {
|
|
|
38
38
|
disable?: BinaryBoolean;
|
|
39
39
|
catalog_filter_group?: number;
|
|
40
40
|
}): Promise<Success>;
|
|
41
|
+
/**
|
|
42
|
+
* Register as a new user if allowed.
|
|
43
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
44
|
+
* @param params.username Username
|
|
45
|
+
* @param params.password SHA256 hashed password
|
|
46
|
+
* @param params.email Email
|
|
47
|
+
* @param [params.fullname] Full Name
|
|
48
|
+
* @see {@link https://ampache.org/api/api-json-methods/#register}
|
|
49
|
+
*/
|
|
50
|
+
register(params: {
|
|
51
|
+
username: string;
|
|
52
|
+
password: string;
|
|
53
|
+
email: string;
|
|
54
|
+
fullname?: string;
|
|
55
|
+
}): Promise<Success>;
|
|
41
56
|
/**
|
|
42
57
|
* Update an existing user
|
|
43
58
|
* ACCESS REQUIRED: 100 (Admin)
|
|
@@ -52,6 +67,7 @@ export declare class Users extends Base {
|
|
|
52
67
|
* @param [params.disable] 0, 1
|
|
53
68
|
* @param [params.maxbitrate] Max bitrate for transcoding
|
|
54
69
|
* @see {@link https://ampache.org/api/api-json-methods#user_update}
|
|
70
|
+
* @deprecated Being removed in 7.0.0. Use `user_edit` instead.
|
|
55
71
|
*/
|
|
56
72
|
userUpdate(params: {
|
|
57
73
|
username: string;
|
|
@@ -64,6 +80,42 @@ export declare class Users extends Base {
|
|
|
64
80
|
disable?: BinaryBoolean;
|
|
65
81
|
maxbitrate?: string;
|
|
66
82
|
}): Promise<Success>;
|
|
83
|
+
/**
|
|
84
|
+
* Update an existing user
|
|
85
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
86
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
87
|
+
* @param params.username Username
|
|
88
|
+
* @param [params.password] Password
|
|
89
|
+
* @param [params.email] Email
|
|
90
|
+
* @param [params.fullname] Full Name
|
|
91
|
+
* @param [params.website] Website
|
|
92
|
+
* @param [params.state] State
|
|
93
|
+
* @param [params.city] City
|
|
94
|
+
* @param [params.disable] 0, 1
|
|
95
|
+
* @param [params.maxbitrate] Max bitrate for transcoding
|
|
96
|
+
* @param [params.group] Catalog filter group, default = 0
|
|
97
|
+
* @param [params.fullname_public] show fullname in public display
|
|
98
|
+
* @param [params.reset_apikey] reset user Api Key
|
|
99
|
+
* @param [params.reset_streamtoken] reset user Stream Token
|
|
100
|
+
* @param [params.clear_stats] reset all stats for this user
|
|
101
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_edit}
|
|
102
|
+
*/
|
|
103
|
+
userEdit(params: {
|
|
104
|
+
username: string;
|
|
105
|
+
password?: string;
|
|
106
|
+
email?: string;
|
|
107
|
+
fullname?: string;
|
|
108
|
+
website?: string;
|
|
109
|
+
state?: string;
|
|
110
|
+
city?: string;
|
|
111
|
+
maxbitrate?: string;
|
|
112
|
+
group?: number;
|
|
113
|
+
disable?: BinaryBoolean;
|
|
114
|
+
fullname_public?: BinaryBoolean;
|
|
115
|
+
reset_apikey?: BinaryBoolean;
|
|
116
|
+
reset_streamtoken?: BinaryBoolean;
|
|
117
|
+
clear_stats?: BinaryBoolean;
|
|
118
|
+
}): Promise<Success>;
|
|
67
119
|
/**
|
|
68
120
|
* Delete an existing user.
|
|
69
121
|
* ACCESS REQUIRED: 100 (Admin)
|
package/package.json
CHANGED
package/src/base.ts
CHANGED
|
@@ -58,6 +58,27 @@ export abstract class Base {
|
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
protected binary<T> (endpoint: string, includeAuth: boolean = true): Promise<Blob> {
|
|
62
|
+
let url = this.url + "/server/json.server.php?action=" + endpoint;
|
|
63
|
+
|
|
64
|
+
if (includeAuth) {
|
|
65
|
+
url += "&auth=" + this.sessionKey + "&version=" + this.version;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (this.debug) {
|
|
69
|
+
console.debug(
|
|
70
|
+
"javascript-ampache query URL %c" + url,
|
|
71
|
+
"color: black; font-style: italic; background-color: orange;padding: 2px"
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return fetch(url)
|
|
76
|
+
.then(response => response.blob())
|
|
77
|
+
.then(r => {
|
|
78
|
+
return r;
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
61
82
|
public setSessionKey(sessionKey: string) {
|
|
62
83
|
this.sessionKey = sessionKey;
|
|
63
84
|
}
|
package/src/catalogs/index.ts
CHANGED
|
@@ -68,4 +68,48 @@ export class Catalogs extends Base {
|
|
|
68
68
|
query += qs.stringify(params, '&');
|
|
69
69
|
return this.request<Success>(query);
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Create a new catalog.
|
|
74
|
+
* ACCESS REQUIRED: 75 (Catalog Manager)
|
|
75
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
76
|
+
* @param params.name Name for the catalog
|
|
77
|
+
* @param params.path URL or folder path for your catalog
|
|
78
|
+
* @param [params.type] Default: 'local'
|
|
79
|
+
* @param [params.media_type] Default: 'music'
|
|
80
|
+
* @param [params.file_pattern] Pattern used identify tags from the file name. Default: '%T - %t'
|
|
81
|
+
* @param [params.folder_pattern] Pattern used identify tags from the folder name. Default: '%a/%A'
|
|
82
|
+
* @param [params.username] login to remote catalog
|
|
83
|
+
* @param [params.password] password to remote catalog
|
|
84
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_add}
|
|
85
|
+
*/
|
|
86
|
+
catalogAdd(params: {
|
|
87
|
+
name: string,
|
|
88
|
+
path: string,
|
|
89
|
+
type?: 'local' | 'beets' | 'remote' | 'subsonic' | 'seafile' | 'beetsremote',
|
|
90
|
+
media_type?: 'music' | 'podcast' | 'clip' | 'tvshow' | 'movie' | 'personal_video',
|
|
91
|
+
file_pattern?: string,
|
|
92
|
+
folder_pattern?: string,
|
|
93
|
+
username?: string,
|
|
94
|
+
password?: string,
|
|
95
|
+
}) {
|
|
96
|
+
let query = 'catalog_add';
|
|
97
|
+
query += qs.stringify(params, '&');
|
|
98
|
+
return this.request<Catalog>(query);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Delete an existing catalog. (if it exists)
|
|
103
|
+
* ACCESS REQUIRED: 75 (Catalog Manager)
|
|
104
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
105
|
+
* @param params.filter ID of the catalog
|
|
106
|
+
* @see {@link https://ampache.org/api/api-json-methods#catalog_delete}
|
|
107
|
+
*/
|
|
108
|
+
catalogDelete(params: {
|
|
109
|
+
filter: UID,
|
|
110
|
+
}) {
|
|
111
|
+
let query = 'catalog_delete';
|
|
112
|
+
query += qs.stringify(params, '&');
|
|
113
|
+
return this.request<Success>(query);
|
|
114
|
+
}
|
|
71
115
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import qs from 'querystringify';
|
|
2
2
|
import { LiveStream } from './types';
|
|
3
|
-
import { Base, BinaryBoolean, Pagination, UID } from '../base';
|
|
3
|
+
import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
|
|
4
4
|
|
|
5
5
|
export class LiveStreams extends Base {
|
|
6
6
|
/**
|
|
@@ -39,4 +39,67 @@ export class LiveStreams extends Base {
|
|
|
39
39
|
query += qs.stringify(params, '&');
|
|
40
40
|
return this.request<LiveStream>(query);
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create a live_stream (radio station) object.
|
|
45
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
46
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
47
|
+
* @param params.name Stream title
|
|
48
|
+
* @param params.url URL of the http/s stream
|
|
49
|
+
* @param params.codec Stream codec
|
|
50
|
+
* @param params.catalog Catalog ID to associate with this stream
|
|
51
|
+
* @param [params.site_url] Homepage URL of the stream
|
|
52
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_create}
|
|
53
|
+
*/
|
|
54
|
+
liveStreamCreate (params: {
|
|
55
|
+
name: string,
|
|
56
|
+
url: string,
|
|
57
|
+
codec: 'mp3' | 'flac' | 'ogg' | 'vorbis' | 'opus' | 'aac' | 'alac',
|
|
58
|
+
catalog: string,
|
|
59
|
+
site_url?: string
|
|
60
|
+
}) {
|
|
61
|
+
let query = 'live_stream_create';
|
|
62
|
+
query += qs.stringify(params, '&');
|
|
63
|
+
return this.request<LiveStream>(query);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Edit a live_stream (radio station) object.
|
|
68
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
69
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
70
|
+
* @param params.filter Object to find
|
|
71
|
+
* @param [params.name] Stream title
|
|
72
|
+
* @param [params.url] URL of the http/s stream
|
|
73
|
+
* @param [params.codec] Stream codec
|
|
74
|
+
* @param [params.catalog] Catalog ID to associate with this stream
|
|
75
|
+
* @param [params.site_url] Homepage URL of the stream
|
|
76
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_edit}
|
|
77
|
+
*/
|
|
78
|
+
liveStreamEdit (params: {
|
|
79
|
+
filter: string,
|
|
80
|
+
name?: string,
|
|
81
|
+
url?: string,
|
|
82
|
+
codec?: 'mp3' | 'flac' | 'ogg' | 'vorbis' | 'opus' | 'aac' | 'alac',
|
|
83
|
+
catalog?: string,
|
|
84
|
+
site_url?: string
|
|
85
|
+
}) {
|
|
86
|
+
let query = 'live_stream_edit';
|
|
87
|
+
query += qs.stringify(params, '&');
|
|
88
|
+
return this.request<LiveStream>(query);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Delete a live_stream (radio station) object (if it exists)
|
|
93
|
+
* ACCESS REQUIRED: 50 (Content Manager)
|
|
94
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
95
|
+
* @param params.filter Object to find
|
|
96
|
+
* @see {@link https://ampache.org/api/api-json-methods#live_stream_delete}
|
|
97
|
+
*/
|
|
98
|
+
liveStreamDelete (params: {
|
|
99
|
+
filter: string,
|
|
100
|
+
}) {
|
|
101
|
+
let query = 'live_stream_delete';
|
|
102
|
+
query += qs.stringify(params, '&');
|
|
103
|
+
return this.request<Success>(query);
|
|
104
|
+
}
|
|
42
105
|
}
|
package/src/podcasts/types.ts
CHANGED
|
@@ -36,6 +36,11 @@ export type PodcastEpisode = {
|
|
|
36
36
|
mime: string,
|
|
37
37
|
time: number,
|
|
38
38
|
size: number,
|
|
39
|
+
bitrate: number,
|
|
40
|
+
stream_bitrate: number,
|
|
41
|
+
rate: number,
|
|
42
|
+
mode: number | null,
|
|
43
|
+
channels: number | null,
|
|
39
44
|
public_url: string,
|
|
40
45
|
url: string,
|
|
41
46
|
catalog: UID,
|
|
@@ -44,7 +49,7 @@ export type PodcastEpisode = {
|
|
|
44
49
|
rating: number | null,
|
|
45
50
|
averagerating: number | null,
|
|
46
51
|
playcount: number,
|
|
47
|
-
played:
|
|
52
|
+
played: number,
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
export type DeletedPodcastEpisode = {
|
package/src/preferences/index.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class Preferences extends Base {
|
|
|
73
73
|
filter: string,
|
|
74
74
|
type: 'boolean' | 'integer' | 'string' | 'special',
|
|
75
75
|
default: string | number,
|
|
76
|
-
category: 'interface' | 'internal' | 'options' | 'playlist' | 'plugins' | 'streaming'
|
|
76
|
+
category: 'interface' | 'internal' | 'options' | 'playlist' | 'plugins' | 'streaming',
|
|
77
77
|
description?: string,
|
|
78
78
|
subcategory?: string,
|
|
79
79
|
level?: number,
|
package/src/system/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { LiveStream } from "../live-streams/types";
|
|
|
10
10
|
import { Label } from "../labels/types";
|
|
11
11
|
import { Genre } from "../genres/types";
|
|
12
12
|
import { User } from "../users/types";
|
|
13
|
+
import { IndexEntry } from "./types";
|
|
13
14
|
|
|
14
15
|
export class System extends Base {
|
|
15
16
|
/**
|
|
@@ -34,6 +35,7 @@ export class System extends Base {
|
|
|
34
35
|
* @param [params.offset]
|
|
35
36
|
* @param [params.limit]
|
|
36
37
|
* @see {@link https://ampache.org/api/api-json-methods#get_indexes}
|
|
38
|
+
* @deprecated Being removed in 7.0.0. Use `list` instead.
|
|
37
39
|
*/
|
|
38
40
|
async getIndexes (params: {
|
|
39
41
|
type: 'song' | 'album' | 'artist' | 'album_artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'live_stream',
|
|
@@ -41,7 +43,7 @@ export class System extends Base {
|
|
|
41
43
|
add?: Date,
|
|
42
44
|
update?: Date,
|
|
43
45
|
include?: BinaryBoolean,
|
|
44
|
-
hide_search?:
|
|
46
|
+
hide_search?: BinaryBoolean
|
|
45
47
|
} & Pagination) {
|
|
46
48
|
let query = 'get_indexes';
|
|
47
49
|
query += qs.stringify(params, '&');
|
|
@@ -75,6 +77,55 @@ export class System extends Base {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
/**
|
|
81
|
+
* This takes a named array of objects and returning `id`, `name`, `prefix` and `basename`
|
|
82
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
83
|
+
* @param params.type type of object to find
|
|
84
|
+
* @param [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
|
|
85
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
86
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
87
|
+
* @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
|
|
88
|
+
* @param [params.offset]
|
|
89
|
+
* @param [params.limit]
|
|
90
|
+
* @see {@link https://ampache.org/api/api-json-methods#list}
|
|
91
|
+
*/
|
|
92
|
+
async list (params: {
|
|
93
|
+
type: 'song' | 'album' | 'artist' | 'album_artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'live_stream',
|
|
94
|
+
filter?: string,
|
|
95
|
+
add?: Date,
|
|
96
|
+
update?: Date,
|
|
97
|
+
hide_search?: BinaryBoolean
|
|
98
|
+
} & Pagination) {
|
|
99
|
+
let query = 'list';
|
|
100
|
+
query += qs.stringify(params, '&');
|
|
101
|
+
return this.request<{list: IndexEntry[]}>(query);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Return children of a parent object in a folder traversal/browse style
|
|
106
|
+
* If you don't send any parameters you'll get a catalog list (the 'root' path)
|
|
107
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
108
|
+
* @param [params.filter] object_id
|
|
109
|
+
* @param [params.type] type of object to find
|
|
110
|
+
* @param [params.catalog] catalog ID you are browsing (required on 'artist', 'album', 'podcast')
|
|
111
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
112
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
113
|
+
* @param [params.offset]
|
|
114
|
+
* @param [params.limit]
|
|
115
|
+
* @see {@link https://ampache.org/api/api-json-methods#browse}
|
|
116
|
+
*/
|
|
117
|
+
async browse (params: {
|
|
118
|
+
filter?: UID,
|
|
119
|
+
type?: 'root' | 'catalog' | 'artist' | 'album' | 'podcast',
|
|
120
|
+
catalog?: number,
|
|
121
|
+
add?: Date,
|
|
122
|
+
update?: Date,
|
|
123
|
+
} & Pagination) {
|
|
124
|
+
let query = 'browse';
|
|
125
|
+
query += qs.stringify(params, '&');
|
|
126
|
+
return this.request<{browse: IndexEntry[]}>(query);
|
|
127
|
+
}
|
|
128
|
+
|
|
78
129
|
/**
|
|
79
130
|
* Return similar artist IDs or similar song IDs compared to the input filter
|
|
80
131
|
* @remarks MINIMUM_API_VERSION=420000
|
|
@@ -319,7 +370,7 @@ export class System extends Base {
|
|
|
319
370
|
}) {
|
|
320
371
|
let query = 'stream';
|
|
321
372
|
query += qs.stringify(params, '&');
|
|
322
|
-
return this.
|
|
373
|
+
return this.binary(query);
|
|
323
374
|
}
|
|
324
375
|
|
|
325
376
|
/**
|
|
@@ -338,7 +389,7 @@ export class System extends Base {
|
|
|
338
389
|
}) {
|
|
339
390
|
let query = 'download';
|
|
340
391
|
query += qs.stringify(params, '&');
|
|
341
|
-
return this.
|
|
392
|
+
return this.binary(query);
|
|
342
393
|
}
|
|
343
394
|
|
|
344
395
|
/**
|
|
@@ -354,7 +405,7 @@ export class System extends Base {
|
|
|
354
405
|
}) {
|
|
355
406
|
let query = 'get_art';
|
|
356
407
|
query += qs.stringify(params, '&');
|
|
357
|
-
return this.
|
|
408
|
+
return this.binary(query);
|
|
358
409
|
}
|
|
359
410
|
|
|
360
411
|
/**
|
|
@@ -419,7 +470,7 @@ export class System extends Base {
|
|
|
419
470
|
*/
|
|
420
471
|
async advancedSearch (params: {
|
|
421
472
|
operator: 'and' | 'or',
|
|
422
|
-
type: 'song' | 'album' | 'artist' | 'label' | 'playlist' | 'podcast' | 'podcast_episode' | 'genre' | 'user' | 'video',
|
|
473
|
+
type: 'song' | 'album' | 'album_disk' | 'artist' | 'label' | 'playlist' | 'podcast' | 'podcast_episode' | 'genre' | 'user' | 'video',
|
|
423
474
|
rules: Array<Array<string>>,
|
|
424
475
|
random?: BinaryBoolean,
|
|
425
476
|
} & Pagination) {
|
package/src/system/types.ts
CHANGED
|
@@ -5,7 +5,15 @@ import { Playlist } from "../playlists/types";
|
|
|
5
5
|
import { Podcast, PodcastEpisode } from "../podcasts/types";
|
|
6
6
|
import { LiveStream } from "../live-streams/types";
|
|
7
7
|
import { Video } from "../videos/types";
|
|
8
|
+
import { UID } from "../base";
|
|
8
9
|
|
|
9
10
|
export type IndexType = Song | Album | Artist | Playlist | Podcast | PodcastEpisode | LiveStream;
|
|
10
11
|
|
|
11
|
-
export type StatsType = Song | Album | Artist | Video | Playlist | Podcast | PodcastEpisode;
|
|
12
|
+
export type StatsType = Song | Album | Artist | Video | Playlist | Podcast | PodcastEpisode;
|
|
13
|
+
|
|
14
|
+
export type IndexEntry = {
|
|
15
|
+
id: UID,
|
|
16
|
+
name: string,
|
|
17
|
+
prefix: string,
|
|
18
|
+
basename: string,
|
|
19
|
+
}
|
package/src/users/index.ts
CHANGED
|
@@ -53,6 +53,26 @@ export class Users extends Base {
|
|
|
53
53
|
return this.request<Success>(query);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Register as a new user if allowed.
|
|
58
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
59
|
+
* @param params.username Username
|
|
60
|
+
* @param params.password SHA256 hashed password
|
|
61
|
+
* @param params.email Email
|
|
62
|
+
* @param [params.fullname] Full Name
|
|
63
|
+
* @see {@link https://ampache.org/api/api-json-methods/#register}
|
|
64
|
+
*/
|
|
65
|
+
register (params: {
|
|
66
|
+
username: string,
|
|
67
|
+
password: string,
|
|
68
|
+
email: string,
|
|
69
|
+
fullname?: string
|
|
70
|
+
}) {
|
|
71
|
+
let query = 'register';
|
|
72
|
+
query += qs.stringify(params, '&');
|
|
73
|
+
return this.request<Success>(query);
|
|
74
|
+
}
|
|
75
|
+
|
|
56
76
|
/**
|
|
57
77
|
* Update an existing user
|
|
58
78
|
* ACCESS REQUIRED: 100 (Admin)
|
|
@@ -67,6 +87,7 @@ export class Users extends Base {
|
|
|
67
87
|
* @param [params.disable] 0, 1
|
|
68
88
|
* @param [params.maxbitrate] Max bitrate for transcoding
|
|
69
89
|
* @see {@link https://ampache.org/api/api-json-methods#user_update}
|
|
90
|
+
* @deprecated Being removed in 7.0.0. Use `user_edit` instead.
|
|
70
91
|
*/
|
|
71
92
|
userUpdate (params: {
|
|
72
93
|
username: string,
|
|
@@ -84,6 +105,47 @@ export class Users extends Base {
|
|
|
84
105
|
return this.request<Success>(query);
|
|
85
106
|
}
|
|
86
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Update an existing user
|
|
110
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
111
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
112
|
+
* @param params.username Username
|
|
113
|
+
* @param [params.password] Password
|
|
114
|
+
* @param [params.email] Email
|
|
115
|
+
* @param [params.fullname] Full Name
|
|
116
|
+
* @param [params.website] Website
|
|
117
|
+
* @param [params.state] State
|
|
118
|
+
* @param [params.city] City
|
|
119
|
+
* @param [params.disable] 0, 1
|
|
120
|
+
* @param [params.maxbitrate] Max bitrate for transcoding
|
|
121
|
+
* @param [params.group] Catalog filter group, default = 0
|
|
122
|
+
* @param [params.fullname_public] show fullname in public display
|
|
123
|
+
* @param [params.reset_apikey] reset user Api Key
|
|
124
|
+
* @param [params.reset_streamtoken] reset user Stream Token
|
|
125
|
+
* @param [params.clear_stats] reset all stats for this user
|
|
126
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_edit}
|
|
127
|
+
*/
|
|
128
|
+
userEdit (params: {
|
|
129
|
+
username: string,
|
|
130
|
+
password?: string,
|
|
131
|
+
email?: string,
|
|
132
|
+
fullname?: string,
|
|
133
|
+
website?: string,
|
|
134
|
+
state?: string,
|
|
135
|
+
city?: string,
|
|
136
|
+
maxbitrate?: string,
|
|
137
|
+
group?: number,
|
|
138
|
+
disable?: BinaryBoolean,
|
|
139
|
+
fullname_public?: BinaryBoolean,
|
|
140
|
+
reset_apikey?: BinaryBoolean,
|
|
141
|
+
reset_streamtoken?: BinaryBoolean,
|
|
142
|
+
clear_stats?: BinaryBoolean,
|
|
143
|
+
}) {
|
|
144
|
+
let query = 'user_edit';
|
|
145
|
+
query += qs.stringify(params, '&');
|
|
146
|
+
return this.request<Success>(query);
|
|
147
|
+
}
|
|
148
|
+
|
|
87
149
|
/**
|
|
88
150
|
* Delete an existing user.
|
|
89
151
|
* ACCESS REQUIRED: 100 (Admin)
|