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/types.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type PodcastResponse = {
|
|
4
|
-
id: UID;
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
language: string;
|
|
8
|
-
copyright: string;
|
|
9
|
-
feed_url: string;
|
|
10
|
-
generator: string;
|
|
11
|
-
website: string;
|
|
12
|
-
build_date: string;
|
|
13
|
-
sync_date: string;
|
|
14
|
-
public_url: string;
|
|
15
|
-
art: string;
|
|
16
|
-
has_art: boolean;
|
|
17
|
-
flag: boolean;
|
|
18
|
-
rating: number | null;
|
|
19
|
-
averaterating: number | null;
|
|
20
|
-
podcast_episode: PodcastEpisodeResponse[];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type PodcastsResponse = {
|
|
24
|
-
total_count: number;
|
|
25
|
-
md5: string;
|
|
26
|
-
podcast: PodcastResponse[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type PodcastEpisodeResponse = {
|
|
30
|
-
id: UID;
|
|
31
|
-
title: string;
|
|
32
|
-
name: string;
|
|
33
|
-
description: string;
|
|
34
|
-
category: string;
|
|
35
|
-
author: string;
|
|
36
|
-
author_full: string;
|
|
37
|
-
website: string;
|
|
38
|
-
pubdate: string;
|
|
39
|
-
state: "completed" | "pending";
|
|
40
|
-
filelength: string;
|
|
41
|
-
filesize: string;
|
|
42
|
-
filename: string;
|
|
43
|
-
mime: string;
|
|
44
|
-
time: number;
|
|
45
|
-
size: number;
|
|
46
|
-
bitrate: number;
|
|
47
|
-
stream_bitrate: number;
|
|
48
|
-
rate: number;
|
|
49
|
-
mode: number | null;
|
|
50
|
-
channels: number | null;
|
|
51
|
-
public_url: string;
|
|
52
|
-
url: string;
|
|
53
|
-
catalog: UID;
|
|
54
|
-
art: string;
|
|
55
|
-
has_art: boolean;
|
|
56
|
-
flag: boolean;
|
|
57
|
-
rating: number | null;
|
|
58
|
-
averagerating: number | null;
|
|
59
|
-
playcount: number;
|
|
60
|
-
played: number;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export type PodcastEpisodesResponse = {
|
|
64
|
-
total_count: number;
|
|
65
|
-
md5: string;
|
|
66
|
-
podcast_episode: PodcastEpisodeResponse[];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type DeletedPodcastEpisodeResponse = {
|
|
70
|
-
id: UID;
|
|
71
|
-
addition_time: number;
|
|
72
|
-
delete_time: number;
|
|
73
|
-
title: string;
|
|
74
|
-
file: string;
|
|
75
|
-
catalog: UID;
|
|
76
|
-
total_count: number;
|
|
77
|
-
total_skip: number;
|
|
78
|
-
podcast: UID;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type DeletedPodcastEpisodesResponse = {
|
|
82
|
-
total_count: number;
|
|
83
|
-
md5: string;
|
|
84
|
-
deleted_podcast_episode: DeletedPodcastEpisodeResponse[];
|
|
85
|
-
};
|
package/src/preferences/index.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import { Base, BinaryBoolean, Success } from "../base";
|
|
3
|
-
import { PreferenceResponse, PreferencesResponse } from "./types";
|
|
4
|
-
|
|
5
|
-
export class Preferences extends Base {
|
|
6
|
-
/**
|
|
7
|
-
* Get your server preferences
|
|
8
|
-
* ACCESS REQUIRED: 100 (Admin)
|
|
9
|
-
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
10
|
-
* @see {@link https://ampache.org/api/api-json-methods#system_preferences}
|
|
11
|
-
*/
|
|
12
|
-
systemPreferences() {
|
|
13
|
-
let query = "system_preferences";
|
|
14
|
-
return this.request<PreferencesResponse>(query);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Get your system preference by name
|
|
19
|
-
* ACCESS REQUIRED: 100 (Admin)
|
|
20
|
-
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
21
|
-
* @param params.systemPreference Preference name e.g ('notify_email', 'ajax_load')
|
|
22
|
-
* @see {@link https://ampache.org/api/api-json-methods#system_preference}
|
|
23
|
-
*/
|
|
24
|
-
systemPreference(params: { filter: string }) {
|
|
25
|
-
let query = "system_preference";
|
|
26
|
-
query += qs.stringify(params, "&");
|
|
27
|
-
return this.request<PreferenceResponse>(query);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Get your user preferences
|
|
32
|
-
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
33
|
-
* @see {@link https://ampache.org/api/api-json-methods#user_preferences}
|
|
34
|
-
*/
|
|
35
|
-
userPreferences() {
|
|
36
|
-
let query = "user_preferences";
|
|
37
|
-
return this.request<PreferencesResponse>(query);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get your user preference by name
|
|
42
|
-
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
43
|
-
* @param params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
44
|
-
* @see {@link https://ampache.org/api/api-json-methods#user_preference}
|
|
45
|
-
*/
|
|
46
|
-
userPreference(params: { filter: string }) {
|
|
47
|
-
let query = "user_preference";
|
|
48
|
-
query += qs.stringify(params, "&");
|
|
49
|
-
return this.request<PreferenceResponse>(query);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Add a new preference to your server
|
|
54
|
-
* ACCESS REQUIRED: 100 (Admin)
|
|
55
|
-
* @param params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
56
|
-
* @param params.type boolean, integer, string, special
|
|
57
|
-
* @param params.default string or integer default value
|
|
58
|
-
* @param params.category Category type
|
|
59
|
-
* @param [params.description]
|
|
60
|
-
* @param [params.subcategory]
|
|
61
|
-
* @param [params.level] access level required to change the value (default 100)
|
|
62
|
-
* @see {@link https://ampache.org/api/api-json-methods#preference_create}
|
|
63
|
-
*/
|
|
64
|
-
preferenceCreate(params: {
|
|
65
|
-
filter: string;
|
|
66
|
-
type: "boolean" | "integer" | "string" | "special";
|
|
67
|
-
default: string | number;
|
|
68
|
-
category:
|
|
69
|
-
| "interface"
|
|
70
|
-
| "internal"
|
|
71
|
-
| "options"
|
|
72
|
-
| "playlist"
|
|
73
|
-
| "plugins"
|
|
74
|
-
| "streaming";
|
|
75
|
-
description?: string;
|
|
76
|
-
subcategory?: string;
|
|
77
|
-
level?: number;
|
|
78
|
-
}) {
|
|
79
|
-
let query = "preference_create";
|
|
80
|
-
query += qs.stringify(params, "&");
|
|
81
|
-
return this.request<Success>(query);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Edit a preference value and apply to all users if allowed
|
|
86
|
-
* ACCESS REQUIRED: 100 (Admin)
|
|
87
|
-
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
88
|
-
* @param params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
89
|
-
* @param params.value (string/integer) Preference value
|
|
90
|
-
* @param [params.all] 0, 1 apply to all users
|
|
91
|
-
* @see {@link https://ampache.org/api/api-json-methods#preference_edit}
|
|
92
|
-
*/
|
|
93
|
-
preferenceEdit(params: {
|
|
94
|
-
filter: string;
|
|
95
|
-
value: string | number;
|
|
96
|
-
all?: BinaryBoolean;
|
|
97
|
-
}) {
|
|
98
|
-
let query = "preference_edit";
|
|
99
|
-
query += qs.stringify(params, "&");
|
|
100
|
-
return this.request<Success>(query);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Delete a non-system preference by name
|
|
105
|
-
* ACCESS REQUIRED: 100 (Admin)
|
|
106
|
-
* @param params.filter Preference name e.g ('notify_email', 'ajax_load')
|
|
107
|
-
* @see {@link https://ampache.org/api/api-json-methods#preference_delete}
|
|
108
|
-
*/
|
|
109
|
-
preferenceDelete(params: { filter: string }) {
|
|
110
|
-
let query = "preference_delete";
|
|
111
|
-
query += qs.stringify(params, "&");
|
|
112
|
-
return this.request<Success>(query);
|
|
113
|
-
}
|
|
114
|
-
}
|
package/src/preferences/types.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type PreferenceResponse = {
|
|
4
|
-
id: UID;
|
|
5
|
-
name: string;
|
|
6
|
-
level: string;
|
|
7
|
-
description: string;
|
|
8
|
-
value: string;
|
|
9
|
-
type: string;
|
|
10
|
-
category: string;
|
|
11
|
-
subcategory: string | null;
|
|
12
|
-
has_access: boolean;
|
|
13
|
-
values?: string; // TODO verify type
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type PreferencesResponse = {
|
|
17
|
-
total_count: number;
|
|
18
|
-
md5: string;
|
|
19
|
-
preference: PreferenceResponse[];
|
|
20
|
-
};
|
package/src/shares/index.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import { ShareResponse, SharesResponse } from "./types";
|
|
3
|
-
import { Base, BinaryBoolean, ExtendedPagination, Success, UID } from "../base";
|
|
4
|
-
|
|
5
|
-
export class Shares extends Base {
|
|
6
|
-
/**
|
|
7
|
-
* This searches the shares and returns... shares
|
|
8
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
9
|
-
* @param [params.filter] UID to find
|
|
10
|
-
* @param [params.exact] 0, 1 boolean to match the exact filter string
|
|
11
|
-
* @param [params.offset]
|
|
12
|
-
* @param [params.limit]
|
|
13
|
-
* @param [params.cond]
|
|
14
|
-
* @param [params.sort]
|
|
15
|
-
* @see {@link https://ampache.org/api/api-json-methods#shares}
|
|
16
|
-
*/
|
|
17
|
-
shares(
|
|
18
|
-
params?: {
|
|
19
|
-
filter?: string;
|
|
20
|
-
exact?: BinaryBoolean;
|
|
21
|
-
} & ExtendedPagination,
|
|
22
|
-
) {
|
|
23
|
-
let query = "shares";
|
|
24
|
-
query += qs.stringify(params, "&");
|
|
25
|
-
return this.request<SharesResponse>(query);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Return a share from UID
|
|
30
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
31
|
-
* @param params.filter UID to find
|
|
32
|
-
* @see {@link https://ampache.org/api/api-json-methods#share}
|
|
33
|
-
*/
|
|
34
|
-
share(params: { filter: UID }) {
|
|
35
|
-
let query = "share";
|
|
36
|
-
query += qs.stringify(params, "&");
|
|
37
|
-
return this.request<ShareResponse>(query);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Create a public url that can be used by anyone to stream media.
|
|
42
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
43
|
-
* @param params.filter UID of object you are sharing
|
|
44
|
-
* @param params.type ('song', 'album', 'artist', 'playlist', 'podcast', 'podcast_episode', 'video')
|
|
45
|
-
* @param [params.description] description (will be filled for you if empty)
|
|
46
|
-
* @param [params.expires] days to keep active
|
|
47
|
-
* @see {@link https://ampache.org/api/api-json-methods#share_create}
|
|
48
|
-
*/
|
|
49
|
-
shareCreate(params: {
|
|
50
|
-
filter: UID;
|
|
51
|
-
type:
|
|
52
|
-
| "song"
|
|
53
|
-
| "album"
|
|
54
|
-
| "artist"
|
|
55
|
-
| "playlist"
|
|
56
|
-
| "podcast"
|
|
57
|
-
| "podcast_episode"
|
|
58
|
-
| "video";
|
|
59
|
-
description?: string;
|
|
60
|
-
expires?: number;
|
|
61
|
-
}) {
|
|
62
|
-
let query = "share_create";
|
|
63
|
-
query += qs.stringify(params, "&");
|
|
64
|
-
return this.request<ShareResponse>(query);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Update the description and/or expiration date for an existing share
|
|
69
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
70
|
-
* @param params.filter UID to find
|
|
71
|
-
* @param [params.stream] 0, 1
|
|
72
|
-
* @param [params.download] 0, 1
|
|
73
|
-
* @param [params.expires] days to keep active
|
|
74
|
-
* @param [params.description] description
|
|
75
|
-
* @see {@link https://ampache.org/api/api-json-methods#share_edit}
|
|
76
|
-
*/
|
|
77
|
-
shareEdit(params: {
|
|
78
|
-
filter: UID;
|
|
79
|
-
stream?: BinaryBoolean;
|
|
80
|
-
download?: BinaryBoolean;
|
|
81
|
-
expires?: number;
|
|
82
|
-
description?: string;
|
|
83
|
-
}) {
|
|
84
|
-
let query = "share_edit";
|
|
85
|
-
query += qs.stringify(params, "&");
|
|
86
|
-
return this.request<Success>(query);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Delete an existing share.
|
|
91
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
92
|
-
* @param params.filter UID of share to delete
|
|
93
|
-
* @see {@link https://ampache.org/api/api-json-methods#share_delete}
|
|
94
|
-
*/
|
|
95
|
-
shareDelete(params: { filter: UID }) {
|
|
96
|
-
let query = "share_delete";
|
|
97
|
-
query += qs.stringify(params, "&");
|
|
98
|
-
return this.request<Success>(query);
|
|
99
|
-
}
|
|
100
|
-
}
|
package/src/shares/types.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type ShareResponse = {
|
|
4
|
-
id: UID;
|
|
5
|
-
name: string;
|
|
6
|
-
owner: string;
|
|
7
|
-
allow_stream: boolean;
|
|
8
|
-
allow_download: boolean;
|
|
9
|
-
creation_date: number;
|
|
10
|
-
lastvisit_date: number;
|
|
11
|
-
object_type: string;
|
|
12
|
-
object_id: UID;
|
|
13
|
-
expire_days: number;
|
|
14
|
-
max_counter: number;
|
|
15
|
-
counter: number;
|
|
16
|
-
secret: string;
|
|
17
|
-
public_url: string;
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type SharesResponse = {
|
|
22
|
-
total_count: number;
|
|
23
|
-
md5: string;
|
|
24
|
-
share: ShareResponse[];
|
|
25
|
-
};
|
package/src/shouts/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import { ShoutResponse } from "./types";
|
|
3
|
-
import { Base } from "../base";
|
|
4
|
-
|
|
5
|
-
export class Shouts extends Base {
|
|
6
|
-
/**
|
|
7
|
-
* This gets the latest posted shouts
|
|
8
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
9
|
-
* @param [params.username] Username to find
|
|
10
|
-
* @param [params.limit] Maximum number of results to return
|
|
11
|
-
* @see {@link https://ampache.org/api/api-json-methods#last_shouts}
|
|
12
|
-
*/
|
|
13
|
-
last_shouts(params?: { username?: string; limit?: number }) {
|
|
14
|
-
let query = "last_shouts";
|
|
15
|
-
query += qs.stringify(params, "&");
|
|
16
|
-
return this.request<{ shout: ShoutResponse[] }>(query);
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/shouts/types.ts
DELETED
package/src/songs/index.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import { SongResponse, SongsResponse, DeletedSongsResponse } from "./types";
|
|
3
|
-
import {
|
|
4
|
-
Base,
|
|
5
|
-
BinaryBoolean,
|
|
6
|
-
ExtendedPagination,
|
|
7
|
-
Pagination,
|
|
8
|
-
Success,
|
|
9
|
-
UID,
|
|
10
|
-
} from "../base";
|
|
11
|
-
|
|
12
|
-
export class Songs extends Base {
|
|
13
|
-
/**
|
|
14
|
-
* Returns songs based on the specified filter
|
|
15
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
16
|
-
* @param [params.filter] Filter results to match this string
|
|
17
|
-
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
18
|
-
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
19
|
-
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
20
|
-
* @param [params.offset]
|
|
21
|
-
* @param [params.limit]
|
|
22
|
-
* @param [params.cond]
|
|
23
|
-
* @param [params.sort]
|
|
24
|
-
* @see {@link https://ampache.org/api/api-json-methods#songs}
|
|
25
|
-
*/
|
|
26
|
-
songs(
|
|
27
|
-
params?: {
|
|
28
|
-
filter?: string;
|
|
29
|
-
exact?: BinaryBoolean;
|
|
30
|
-
add?: Date;
|
|
31
|
-
update?: Date;
|
|
32
|
-
} & ExtendedPagination,
|
|
33
|
-
) {
|
|
34
|
-
let query = "songs";
|
|
35
|
-
query += qs.stringify(params, "&");
|
|
36
|
-
return this.request<SongsResponse>(query);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Returns a single song
|
|
41
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
42
|
-
* @param params.filter UID to find
|
|
43
|
-
* @see {@link https://ampache.org/api/api-json-methods#song}
|
|
44
|
-
*/
|
|
45
|
-
song(params: { filter: UID }) {
|
|
46
|
-
let query = "song";
|
|
47
|
-
query += qs.stringify(params, "&");
|
|
48
|
-
return this.request<SongResponse>(query);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Songs of the specified artist
|
|
53
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
54
|
-
* @param params.filter UID to find
|
|
55
|
-
* @param [params.top50] 0, 1 (if true filter to the artist top 50)
|
|
56
|
-
* @param [params.offset]
|
|
57
|
-
* @param [params.limit]
|
|
58
|
-
* @param [params.cond]
|
|
59
|
-
* @param [params.sort]
|
|
60
|
-
* @see {@link https://ampache.org/api/api-json-methods#artist_songs}
|
|
61
|
-
*/
|
|
62
|
-
artistSongs(
|
|
63
|
-
params: {
|
|
64
|
-
filter: UID;
|
|
65
|
-
top50?: BinaryBoolean;
|
|
66
|
-
} & ExtendedPagination,
|
|
67
|
-
) {
|
|
68
|
-
let query = "artist_songs";
|
|
69
|
-
query += qs.stringify(params, "&");
|
|
70
|
-
return this.request<SongsResponse>(query);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Songs of the specified album
|
|
75
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
76
|
-
* @param params.filter UID to find
|
|
77
|
-
* @param [params.offset]
|
|
78
|
-
* @param [params.limit]
|
|
79
|
-
* @param [params.cond]
|
|
80
|
-
* @param [params.sort]
|
|
81
|
-
* @see {@link https://ampache.org/api/api-json-methods#album_songs}
|
|
82
|
-
*/
|
|
83
|
-
albumSongs(
|
|
84
|
-
params: {
|
|
85
|
-
filter: UID;
|
|
86
|
-
} & ExtendedPagination,
|
|
87
|
-
) {
|
|
88
|
-
let query = "album_songs";
|
|
89
|
-
query += qs.stringify(params, "&");
|
|
90
|
-
return this.request<SongsResponse>(query);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Songs of the specified genre
|
|
95
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
96
|
-
* @param params.filter UID to find
|
|
97
|
-
* @param [params.offset]
|
|
98
|
-
* @param [params.limit]
|
|
99
|
-
* @param [params.cond]
|
|
100
|
-
* @param [params.sort]
|
|
101
|
-
* @see {@link https://ampache.org/api/api-json-methods#genre_songs}
|
|
102
|
-
*/
|
|
103
|
-
genreSongs(
|
|
104
|
-
params: {
|
|
105
|
-
filter: UID;
|
|
106
|
-
} & ExtendedPagination,
|
|
107
|
-
) {
|
|
108
|
-
let query = "genre_songs";
|
|
109
|
-
query += qs.stringify(params, "&");
|
|
110
|
-
return this.request<SongsResponse>(query);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* This returns the songs for a playlist
|
|
115
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
116
|
-
* @param params.filter UID to find
|
|
117
|
-
* @param [params.random] 0, 1 (if true get random songs using limit)
|
|
118
|
-
* @param [params.offset]
|
|
119
|
-
* @param [params.limit]
|
|
120
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_songs}
|
|
121
|
-
*/
|
|
122
|
-
playlistSongs(
|
|
123
|
-
params: {
|
|
124
|
-
filter: UID;
|
|
125
|
-
random?: BinaryBoolean;
|
|
126
|
-
} & Pagination,
|
|
127
|
-
) {
|
|
128
|
-
let query = "playlist_songs";
|
|
129
|
-
query += qs.stringify(params, "&");
|
|
130
|
-
return this.request<SongsResponse>(query);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* This returns the songs for a license
|
|
135
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
136
|
-
* @param params.filter UID to find
|
|
137
|
-
* @param [params.offset]
|
|
138
|
-
* @param [params.limit]
|
|
139
|
-
* @param [params.cond]
|
|
140
|
-
* @param [params.sort]
|
|
141
|
-
* @see {@link https://ampache.org/api/api-json-methods#license_songs}
|
|
142
|
-
*/
|
|
143
|
-
licenseSongs(
|
|
144
|
-
params: {
|
|
145
|
-
filter: UID;
|
|
146
|
-
} & ExtendedPagination,
|
|
147
|
-
) {
|
|
148
|
-
let query = "license_songs";
|
|
149
|
-
query += qs.stringify(params, "&");
|
|
150
|
-
return this.request<SongsResponse>(query);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Delete an existing song. (if you are allowed to)
|
|
155
|
-
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
156
|
-
* @param params.filter UID of song to delete
|
|
157
|
-
* @see {@link https://ampache.org/api/api-json-methods#song_delete}
|
|
158
|
-
*/
|
|
159
|
-
songDelete(params: { filter: UID }) {
|
|
160
|
-
let query = "song_delete";
|
|
161
|
-
query += qs.stringify(params, "&");
|
|
162
|
-
return this.request<Success>(query);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Get the full song file tags using VaInfo
|
|
167
|
-
* This is used to get tags for remote catalogs to allow maximum data to be returned
|
|
168
|
-
* @remarks MINIMUM_API_VERSION=6.7.0
|
|
169
|
-
* @param params.filter UID of song to fetch
|
|
170
|
-
* @see {@link https://ampache.org/api/api-json-methods#song_tags}
|
|
171
|
-
*/
|
|
172
|
-
songTags(params: { filter: UID }) {
|
|
173
|
-
let query = "song_tags";
|
|
174
|
-
query += qs.stringify(params, "&");
|
|
175
|
-
return this.request(query); // TODO response type
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* This takes a URL and returns the song object in question
|
|
180
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
181
|
-
* @param params.url Full Ampache URL from server
|
|
182
|
-
* @see {@link https://ampache.org/api/api-json-methods#url_to_song}
|
|
183
|
-
*/
|
|
184
|
-
urlToSong(params: { url: string }) {
|
|
185
|
-
let query = "url_to_song";
|
|
186
|
-
params.url = encodeURIComponent(params.url);
|
|
187
|
-
query += qs.stringify(params, "&");
|
|
188
|
-
return this.request<SongResponse>(query);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* This searches the songs and returns... songs
|
|
193
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
194
|
-
* @param params.filter Filter results to match this string
|
|
195
|
-
* @param [params.offset]
|
|
196
|
-
* @param [params.limit]
|
|
197
|
-
* @see {@link https://ampache.org/api/api-json-methods#search_songs}
|
|
198
|
-
*/
|
|
199
|
-
searchSongs(
|
|
200
|
-
params: {
|
|
201
|
-
filter: string;
|
|
202
|
-
} & Pagination,
|
|
203
|
-
) {
|
|
204
|
-
let query = "search_songs";
|
|
205
|
-
query += qs.stringify(params, "&");
|
|
206
|
-
return this.request<SongsResponse>(query);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Returns songs that have been deleted from the server
|
|
211
|
-
* @remarks MINIMUM_API_VERSION=500000
|
|
212
|
-
* @param [params.offset]
|
|
213
|
-
* @param [params.limit]
|
|
214
|
-
* @see {@link https://ampache.org/api/api-json-methods#deleted_songs}
|
|
215
|
-
*/
|
|
216
|
-
deletedSongs(params?: {} & Pagination) {
|
|
217
|
-
let query = "deleted_songs";
|
|
218
|
-
query += qs.stringify(params, "&");
|
|
219
|
-
return this.request<DeletedSongsResponse>(query);
|
|
220
|
-
}
|
|
221
|
-
}
|
package/src/songs/types.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ArtistSummary } from "../artists/types";
|
|
2
|
-
import { GenreSummary } from "../genres/types";
|
|
3
|
-
import { UID } from "../base";
|
|
4
|
-
import { AlbumSummary } from "../albums/types";
|
|
5
|
-
|
|
6
|
-
export type SongResponse = {
|
|
7
|
-
id: UID;
|
|
8
|
-
title: string;
|
|
9
|
-
name: string;
|
|
10
|
-
artist: ArtistSummary;
|
|
11
|
-
album: AlbumSummary;
|
|
12
|
-
albumartist: ArtistSummary;
|
|
13
|
-
disk: number;
|
|
14
|
-
track: number;
|
|
15
|
-
filename: string;
|
|
16
|
-
genre: GenreSummary[];
|
|
17
|
-
playlisttrack: number;
|
|
18
|
-
time: number;
|
|
19
|
-
year: number | string;
|
|
20
|
-
format: string;
|
|
21
|
-
stream_format: string;
|
|
22
|
-
rate: number;
|
|
23
|
-
mode: string;
|
|
24
|
-
mime: string;
|
|
25
|
-
stream_mime: string;
|
|
26
|
-
url: string;
|
|
27
|
-
size: number;
|
|
28
|
-
mbid: string | null;
|
|
29
|
-
album_mbid: string | null;
|
|
30
|
-
artist_mbid: string | null;
|
|
31
|
-
art: string;
|
|
32
|
-
has_art: boolean;
|
|
33
|
-
flag: boolean;
|
|
34
|
-
rating: number | null;
|
|
35
|
-
averagerating: number | null;
|
|
36
|
-
playcount: number;
|
|
37
|
-
catalog: number;
|
|
38
|
-
composer: string;
|
|
39
|
-
channels: number | null;
|
|
40
|
-
comment: string;
|
|
41
|
-
license: string | null;
|
|
42
|
-
publisher: string;
|
|
43
|
-
language: string;
|
|
44
|
-
lyrics: string;
|
|
45
|
-
replaygain_album_gain: number | null;
|
|
46
|
-
replaygain_album_peak: number | null;
|
|
47
|
-
replaygain_track_gain: number | null;
|
|
48
|
-
replaygain_track_peak: number | null;
|
|
49
|
-
r128_album_gain: number | null;
|
|
50
|
-
r128_track_gain: number | null;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export type SongsResponse = {
|
|
54
|
-
total_count: number;
|
|
55
|
-
md5: string;
|
|
56
|
-
song: SongResponse[];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export type DeletedSongResponse = {
|
|
60
|
-
id: UID;
|
|
61
|
-
addition_time: number;
|
|
62
|
-
delete_time: number;
|
|
63
|
-
update_time: number;
|
|
64
|
-
title: string;
|
|
65
|
-
file: string;
|
|
66
|
-
catalog: UID;
|
|
67
|
-
total_count: number;
|
|
68
|
-
total_skip: number;
|
|
69
|
-
album: UID;
|
|
70
|
-
artist: UID;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export type DeletedSongsResponse = {
|
|
74
|
-
total_count: number;
|
|
75
|
-
md5: string;
|
|
76
|
-
deleted_song: DeletedSongResponse[];
|
|
77
|
-
};
|