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/licenses/types.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type LicenseResponse = {
|
|
4
|
-
id: UID;
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
external_link: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type LicensesResponse = {
|
|
11
|
-
total_count: number;
|
|
12
|
-
md5: string;
|
|
13
|
-
license: LicenseResponse[];
|
|
14
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import { LiveStreamResponse, LiveStreamsResponse } from "./types";
|
|
3
|
-
import { Base, BinaryBoolean, ExtendedPagination, Success, UID } from "../base";
|
|
4
|
-
|
|
5
|
-
export class LiveStreams extends Base {
|
|
6
|
-
/**
|
|
7
|
-
* This returns live_streams based on the specified filter
|
|
8
|
-
* @remarks MINIMUM_API_VERSION=5.1.0
|
|
9
|
-
* @param [params.filter] Filter results to match this string
|
|
10
|
-
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
11
|
-
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
12
|
-
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
13
|
-
* @param [params.offset]
|
|
14
|
-
* @param [params.limit]
|
|
15
|
-
* @param [params.cond]
|
|
16
|
-
* @param [params.sort]
|
|
17
|
-
* @see {@link https://ampache.org/api/api-json-methods#live_streams}
|
|
18
|
-
*/
|
|
19
|
-
liveStreams(
|
|
20
|
-
params?: {
|
|
21
|
-
filter?: string;
|
|
22
|
-
exact?: BinaryBoolean;
|
|
23
|
-
add?: Date;
|
|
24
|
-
update?: Date;
|
|
25
|
-
} & ExtendedPagination,
|
|
26
|
-
) {
|
|
27
|
-
let query = "live_streams";
|
|
28
|
-
query += qs.stringify(params, "&");
|
|
29
|
-
return this.request<LiveStreamsResponse>(query);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* This returns a single live_stream
|
|
34
|
-
* @remarks MINIMUM_API_VERSION=5.1.0
|
|
35
|
-
* @param params.filter UID to find
|
|
36
|
-
* @see {@link https://ampache.org/api/api-json-methods#live_stream}
|
|
37
|
-
*/
|
|
38
|
-
liveStream(params: { filter: UID }) {
|
|
39
|
-
let query = "live_stream";
|
|
40
|
-
query += qs.stringify(params, "&");
|
|
41
|
-
return this.request<LiveStreamResponse>(query);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Create a live_stream (radio station) object.
|
|
46
|
-
* ACCESS REQUIRED: 50 (Content Manager)
|
|
47
|
-
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
48
|
-
* @param params.name Stream title
|
|
49
|
-
* @param params.url URL of the http/s stream
|
|
50
|
-
* @param params.codec Stream codec
|
|
51
|
-
* @param params.catalog Catalog ID to associate with this stream
|
|
52
|
-
* @param [params.site_url] Homepage URL of the stream
|
|
53
|
-
* @see {@link https://ampache.org/api/api-json-methods#live_stream_create}
|
|
54
|
-
*/
|
|
55
|
-
liveStreamCreate(params: {
|
|
56
|
-
name: string;
|
|
57
|
-
url: string;
|
|
58
|
-
codec: "mp3" | "flac" | "ogg" | "vorbis" | "opus" | "aac" | "alac";
|
|
59
|
-
catalog: string;
|
|
60
|
-
site_url?: string;
|
|
61
|
-
}) {
|
|
62
|
-
let query = "live_stream_create";
|
|
63
|
-
query += qs.stringify(params, "&");
|
|
64
|
-
return this.request<LiveStreamResponse>(query);
|
|
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 params.filter Object to find
|
|
72
|
-
* @param [params.name] Stream title
|
|
73
|
-
* @param [params.url] URL of the http/s stream
|
|
74
|
-
* @param [params.codec] Stream codec
|
|
75
|
-
* @param [params.catalog] Catalog ID to associate with this stream
|
|
76
|
-
* @param [params.site_url] Homepage URL of the stream
|
|
77
|
-
* @see {@link https://ampache.org/api/api-json-methods#live_stream_edit}
|
|
78
|
-
*/
|
|
79
|
-
liveStreamEdit(params: {
|
|
80
|
-
filter: string;
|
|
81
|
-
name?: string;
|
|
82
|
-
url?: string;
|
|
83
|
-
codec?: "mp3" | "flac" | "ogg" | "vorbis" | "opus" | "aac" | "alac";
|
|
84
|
-
catalog?: string;
|
|
85
|
-
site_url?: string;
|
|
86
|
-
}) {
|
|
87
|
-
let query = "live_stream_edit";
|
|
88
|
-
query += qs.stringify(params, "&");
|
|
89
|
-
return this.request<LiveStreamResponse>(query);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Delete a live_stream (radio station) object (if it exists)
|
|
94
|
-
* ACCESS REQUIRED: 50 (Content Manager)
|
|
95
|
-
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
96
|
-
* @param params.filter Object to find
|
|
97
|
-
* @see {@link https://ampache.org/api/api-json-methods#live_stream_delete}
|
|
98
|
-
*/
|
|
99
|
-
liveStreamDelete(params: { filter: string }) {
|
|
100
|
-
let query = "live_stream_delete";
|
|
101
|
-
query += qs.stringify(params, "&");
|
|
102
|
-
return this.request<Success>(query);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type LiveStreamResponse = {
|
|
4
|
-
id: UID;
|
|
5
|
-
name: string;
|
|
6
|
-
url: string;
|
|
7
|
-
codec: string;
|
|
8
|
-
catalog: UID;
|
|
9
|
-
site_url: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type LiveStreamsResponse = {
|
|
13
|
-
total_count: number;
|
|
14
|
-
md5: string;
|
|
15
|
-
live_stream: LiveStreamResponse[];
|
|
16
|
-
};
|
package/src/playlists/index.ts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import { HashResponse, PlaylistResponse, PlaylistsResponse } from "./types";
|
|
3
|
-
import { SongsResponse } from "../songs/types";
|
|
4
|
-
import {
|
|
5
|
-
Base,
|
|
6
|
-
BinaryBoolean,
|
|
7
|
-
ExtendedPagination,
|
|
8
|
-
Pagination,
|
|
9
|
-
Success,
|
|
10
|
-
UID,
|
|
11
|
-
} from "../base";
|
|
12
|
-
|
|
13
|
-
export class Playlists extends Base {
|
|
14
|
-
/**
|
|
15
|
-
* This returns playlists based on the specified filter
|
|
16
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
17
|
-
* @param [params.filter] Filter results to match this string
|
|
18
|
-
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
19
|
-
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
20
|
-
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
21
|
-
* @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
|
|
22
|
-
* @param [params.show_dupes] 0, 1 (if true ignore 'api_hide_dupe_searches' setting)
|
|
23
|
-
* @param [params.include] 0, 1 (if true include the objects in the playlist)
|
|
24
|
-
* @param [params.offset]
|
|
25
|
-
* @param [params.limit]
|
|
26
|
-
* @param [params.cond]
|
|
27
|
-
* @param [params.sort]
|
|
28
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlists}
|
|
29
|
-
*/
|
|
30
|
-
playlists(
|
|
31
|
-
params?: {
|
|
32
|
-
filter?: string;
|
|
33
|
-
exact?: BinaryBoolean;
|
|
34
|
-
add?: Date;
|
|
35
|
-
update?: Date;
|
|
36
|
-
hide_search?: BinaryBoolean;
|
|
37
|
-
show_dupes?: BinaryBoolean;
|
|
38
|
-
include?: BinaryBoolean;
|
|
39
|
-
} & ExtendedPagination,
|
|
40
|
-
) {
|
|
41
|
-
let query = "playlists";
|
|
42
|
-
query += qs.stringify(params, "&");
|
|
43
|
-
return this.request<PlaylistsResponse>(query);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* This returns smartlists based on the specified filter. NOTE: Filtered from Playlists() so pagination is invalid.
|
|
48
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
49
|
-
* @param [params.filter] Filter results to match this string
|
|
50
|
-
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
51
|
-
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
52
|
-
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
53
|
-
* @param [params.show_dupes] 0, 1 (if true ignore 'api_hide_dupe_searches' setting)
|
|
54
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlists}
|
|
55
|
-
*/
|
|
56
|
-
smartlists(params?: {
|
|
57
|
-
filter?: string;
|
|
58
|
-
exact?: BinaryBoolean;
|
|
59
|
-
add?: Date;
|
|
60
|
-
update?: Date;
|
|
61
|
-
show_dupes?: BinaryBoolean;
|
|
62
|
-
}) {
|
|
63
|
-
let query = "playlists";
|
|
64
|
-
query += qs.stringify(params, "&");
|
|
65
|
-
return this.request<PlaylistsResponse>(query).then((response) => {
|
|
66
|
-
// filter out regular playlists
|
|
67
|
-
if (Array.isArray(response.playlist)) {
|
|
68
|
-
response.playlist = response.playlist.filter((item) =>
|
|
69
|
-
item.id.toString().startsWith("smart_"),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return response;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* This returns a single playlist
|
|
78
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
79
|
-
* @param params.filter UID to find
|
|
80
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist}
|
|
81
|
-
*/
|
|
82
|
-
playlist(params: { filter: UID }) {
|
|
83
|
-
let query = "playlist";
|
|
84
|
-
query += qs.stringify(params, "&");
|
|
85
|
-
return this.request<PlaylistResponse>(query);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* This returns a user's playlists based on the specified filter
|
|
90
|
-
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
91
|
-
* @param [params.filter] Filter results to match this string
|
|
92
|
-
* @param [params.include] 0, 1 (include playlist items)
|
|
93
|
-
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
94
|
-
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
95
|
-
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
96
|
-
* @param [params.offset]
|
|
97
|
-
* @param [params.limit]
|
|
98
|
-
* @param [params.cond]
|
|
99
|
-
* @param [params.sort]
|
|
100
|
-
* @see {@link https://ampache.org/api/api-json-methods#user_playlists}
|
|
101
|
-
*/
|
|
102
|
-
userPlaylists(
|
|
103
|
-
params?: {
|
|
104
|
-
filter?: string;
|
|
105
|
-
include?: BinaryBoolean;
|
|
106
|
-
exact?: BinaryBoolean;
|
|
107
|
-
add?: Date;
|
|
108
|
-
update?: Date;
|
|
109
|
-
} & ExtendedPagination,
|
|
110
|
-
) {
|
|
111
|
-
let query = "user_playlists";
|
|
112
|
-
query += qs.stringify(params, "&");
|
|
113
|
-
return this.request<PlaylistsResponse>(query);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* This returns a user's smartlists based on the specified filter
|
|
118
|
-
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
119
|
-
* @param [params.filter] Filter results to match this string
|
|
120
|
-
* @param [params.include] 0, 1 (include playlist items)
|
|
121
|
-
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
122
|
-
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
123
|
-
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
124
|
-
* @param [params.offset]
|
|
125
|
-
* @param [params.limit]
|
|
126
|
-
* @param [params.cond]
|
|
127
|
-
* @param [params.sort]
|
|
128
|
-
* @see {@link https://ampache.org/api/api-json-methods#user_smartlists}
|
|
129
|
-
*/
|
|
130
|
-
userSmartlists(
|
|
131
|
-
params?: {
|
|
132
|
-
filter?: string;
|
|
133
|
-
include?: BinaryBoolean;
|
|
134
|
-
exact?: BinaryBoolean;
|
|
135
|
-
add?: Date;
|
|
136
|
-
update?: Date;
|
|
137
|
-
} & ExtendedPagination,
|
|
138
|
-
) {
|
|
139
|
-
let query = "user_smartlists";
|
|
140
|
-
query += qs.stringify(params, "&");
|
|
141
|
-
return this.request<PlaylistsResponse>(query);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* This creates a new playlist and returns it
|
|
146
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
147
|
-
* @param params.name Playlist name
|
|
148
|
-
* @param [params.type] public, private (Playlist type)
|
|
149
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_create}
|
|
150
|
-
*/
|
|
151
|
-
playlistCreate(params: { name: string; type?: "public" | "private" }) {
|
|
152
|
-
let query = "playlist_create";
|
|
153
|
-
query += qs.stringify(params, "&");
|
|
154
|
-
return this.request<PlaylistResponse>(query);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* This adds an item to a playlist
|
|
159
|
-
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
160
|
-
* @param params.filter UID of Playlist
|
|
161
|
-
* @param params.id UID of the object to add to playlist
|
|
162
|
-
* @param params.type 'song', 'album', 'artist', 'playlist'
|
|
163
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_add}
|
|
164
|
-
*/
|
|
165
|
-
playlistAdd(params: {
|
|
166
|
-
filter: UID;
|
|
167
|
-
id: UID;
|
|
168
|
-
type: "song" | "album" | "artist" | "playlist";
|
|
169
|
-
}) {
|
|
170
|
-
let query = "playlist_add";
|
|
171
|
-
query += qs.stringify(params, "&");
|
|
172
|
-
return this.request<Success>(query);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* This modifies name and type of the playlist.
|
|
177
|
-
* NOTE items and tracks must be sent together and be of equal length.
|
|
178
|
-
* @remarks MINIMUM_API_VERSION=400001
|
|
179
|
-
* @param params.filter UID to find
|
|
180
|
-
* @param [params.name] Playlist name
|
|
181
|
-
* @param [params.type] public, private (Playlist type)
|
|
182
|
-
* @param [params.owner] Change playlist owner to the user id (-1 = System playlist)
|
|
183
|
-
* @param [params.items] comma-separated song_id's (replaces existing items with a new id)
|
|
184
|
-
* @param [params.tracks] comma-separated playlisttrack numbers matched to 'items' in order
|
|
185
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_edit}
|
|
186
|
-
*/
|
|
187
|
-
playlistEdit(params: {
|
|
188
|
-
filter: UID;
|
|
189
|
-
name?: string;
|
|
190
|
-
type?: "public" | "private";
|
|
191
|
-
owner?: string;
|
|
192
|
-
items?: string;
|
|
193
|
-
tracks?: string;
|
|
194
|
-
}) {
|
|
195
|
-
let query = "playlist_edit";
|
|
196
|
-
query += qs.stringify(params, "&");
|
|
197
|
-
return this.request<Success>(query);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* This deletes a playlist
|
|
202
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
203
|
-
* @param params.filter UID of playlist to delete
|
|
204
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_delete}
|
|
205
|
-
*/
|
|
206
|
-
playlistDelete(params: { filter: UID }) {
|
|
207
|
-
let query = "playlist_delete";
|
|
208
|
-
query += qs.stringify(params, "&");
|
|
209
|
-
return this.request<Success>(query);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* This adds a song to a playlist
|
|
214
|
-
* @remarks MINIMUM_API_VERSION=380001; CHANGED_IN_API_VERSION=400003
|
|
215
|
-
* @param params.filter UID of Playlist
|
|
216
|
-
* @param params.song UID of song to add to playlist
|
|
217
|
-
* @param [params.check] 0, 1 Whether to check and ignore duplicates (default = 0)
|
|
218
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_add_song}
|
|
219
|
-
* @deprecated Being removed in 7.0.0. Use `playlist_add` instead.
|
|
220
|
-
*/
|
|
221
|
-
playlistAddSong(params: { filter: UID; song: UID; check?: BinaryBoolean }) {
|
|
222
|
-
let query = "playlist_add_song";
|
|
223
|
-
query += qs.stringify(params, "&");
|
|
224
|
-
return this.request<Success>(query);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* This remove a song from a playlist
|
|
229
|
-
* @remarks MINIMUM_API_VERSION=380001; CHANGED_IN_API_VERSION=400001
|
|
230
|
-
* @param params.filter UID of Playlist
|
|
231
|
-
* @param [params.song] UID of song to remove from playlist
|
|
232
|
-
* @param [params.track] Track number to remove from playlist
|
|
233
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_remove_song}
|
|
234
|
-
*/
|
|
235
|
-
playlistRemoveSong(params: { filter: UID; song?: UID; track?: number }) {
|
|
236
|
-
let query = "playlist_remove_song";
|
|
237
|
-
query += qs.stringify(params, "&");
|
|
238
|
-
return this.request<Success>(query);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Get a list of song JSON, indexes or id's based on some simple search criteria
|
|
243
|
-
* @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
|
|
244
|
-
* @param [params.mode] (default = 'random')
|
|
245
|
-
* @param [params.filter] string LIKE matched to song title
|
|
246
|
-
* @param [params.album] UID of album
|
|
247
|
-
* @param [params.artist] UID of artist
|
|
248
|
-
* @param [params.flag] 0, 1 (get flagged songs only. default = 0)
|
|
249
|
-
* @param [params.format] song, index, id (default = 'song')
|
|
250
|
-
* @param [params.offset]
|
|
251
|
-
* @param [params.limit]
|
|
252
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_generate}
|
|
253
|
-
*/
|
|
254
|
-
playlistGenerate(
|
|
255
|
-
params?: {
|
|
256
|
-
mode?: "recent" | "forgotten" | "unplayed" | "random";
|
|
257
|
-
filter?: string;
|
|
258
|
-
album?: number;
|
|
259
|
-
artist?: number;
|
|
260
|
-
flag?: BinaryBoolean;
|
|
261
|
-
format?: "song" | "index" | "id";
|
|
262
|
-
} & Pagination,
|
|
263
|
-
) {
|
|
264
|
-
let query = "playlist_generate";
|
|
265
|
-
query += qs.stringify(params, "&");
|
|
266
|
-
return this.request<SongsResponse>(query);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* This returns the md5 hash for the songs in a playlist
|
|
271
|
-
* @remarks MINIMUM_API_VERSION=6.6.0
|
|
272
|
-
* @param params.filter string UID of Playlist
|
|
273
|
-
* @see {@link https://ampache.org/api/api-json-methods#playlist_hash}
|
|
274
|
-
*/
|
|
275
|
-
playlistHash(
|
|
276
|
-
params: {
|
|
277
|
-
filter: UID;
|
|
278
|
-
},
|
|
279
|
-
) {
|
|
280
|
-
let query = "playlist_hash";
|
|
281
|
-
query += qs.stringify(params, "&");
|
|
282
|
-
return this.request<HashResponse>(query);
|
|
283
|
-
}
|
|
284
|
-
}
|
package/src/playlists/types.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
import { UserSummary } from "../users/types"
|
|
3
|
-
|
|
4
|
-
export type PlaylistResponse = {
|
|
5
|
-
id: UID;
|
|
6
|
-
name: string;
|
|
7
|
-
owner: string;
|
|
8
|
-
items: number;
|
|
9
|
-
type: "public" | "private";
|
|
10
|
-
art: string;
|
|
11
|
-
has_art: boolean;
|
|
12
|
-
flag: boolean;
|
|
13
|
-
rating: number | null;
|
|
14
|
-
averagerating: number | null;
|
|
15
|
-
user: UserSummary;
|
|
16
|
-
has_access: boolean;
|
|
17
|
-
has_collaborate: boolean;
|
|
18
|
-
last_update: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type PlaylistsResponse = {
|
|
22
|
-
total_count: number;
|
|
23
|
-
md5: string;
|
|
24
|
-
playlist: PlaylistResponse[];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type HashResponse = {
|
|
28
|
-
md5: string;
|
|
29
|
-
};
|
package/src/podcasts/index.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import qs from "querystringify";
|
|
2
|
-
import {
|
|
3
|
-
PodcastResponse,
|
|
4
|
-
PodcastsResponse,
|
|
5
|
-
PodcastEpisodeResponse,
|
|
6
|
-
PodcastEpisodesResponse,
|
|
7
|
-
DeletedPodcastEpisodeResponse,
|
|
8
|
-
DeletedPodcastEpisodesResponse,
|
|
9
|
-
} from "./types";
|
|
10
|
-
import { Base, ExtendedPagination, Pagination, Success, UID } from "../base";
|
|
11
|
-
|
|
12
|
-
export class Podcasts extends Base {
|
|
13
|
-
/**
|
|
14
|
-
* Get information about podcasts
|
|
15
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
16
|
-
* @param [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
|
|
17
|
-
* @param [params.include] episodes (include podcast_episodes in the response)
|
|
18
|
-
* @param [params.offset]
|
|
19
|
-
* @param [params.limit]
|
|
20
|
-
* @param [params.cond]
|
|
21
|
-
* @param [params.sort]
|
|
22
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcasts}
|
|
23
|
-
*/
|
|
24
|
-
podcasts(
|
|
25
|
-
params?: {
|
|
26
|
-
filter?: string;
|
|
27
|
-
include?: "episodes";
|
|
28
|
-
} & ExtendedPagination,
|
|
29
|
-
) {
|
|
30
|
-
let query = "podcasts";
|
|
31
|
-
query += qs.stringify(params, "&");
|
|
32
|
-
return this.request<PodcastsResponse>(query);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Get information about podcasts
|
|
37
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
38
|
-
* @param params.filter UID to find
|
|
39
|
-
* @param [params.include] episodes (include podcast_episodes in the response)
|
|
40
|
-
* @param [params.offset]
|
|
41
|
-
* @param [params.limit]
|
|
42
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast}
|
|
43
|
-
*/
|
|
44
|
-
podcast(
|
|
45
|
-
params?: {
|
|
46
|
-
filter: UID;
|
|
47
|
-
include?: "episodes";
|
|
48
|
-
} & Pagination,
|
|
49
|
-
) {
|
|
50
|
-
let query = "podcast";
|
|
51
|
-
query += qs.stringify(params, "&");
|
|
52
|
-
return this.request<PodcastResponse>(query);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create a podcast that can be used by anyone to stream media.
|
|
57
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
58
|
-
* @param params.url RSS url for podcast
|
|
59
|
-
* @param params.catalog UID of podcast catalog
|
|
60
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast_create}
|
|
61
|
-
*/
|
|
62
|
-
podcastCreate(params: { url: string; catalog: UID }) {
|
|
63
|
-
let query = "podcast_create";
|
|
64
|
-
query += qs.stringify(params, "&");
|
|
65
|
-
return this.request<PodcastResponse>(query);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Update the description and/or expiration date for an existing podcast.
|
|
70
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
71
|
-
* @param params.filter UID to find
|
|
72
|
-
* @param [params.feed] RSS url for podcast
|
|
73
|
-
* @param [params.title] Podcast title
|
|
74
|
-
* @param [params.website] Source website URL
|
|
75
|
-
* @param [params.description] Podcast description
|
|
76
|
-
* @param [params.generator] Podcast generator
|
|
77
|
-
* @param [params.copyright] Podcast copyright
|
|
78
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast_edit}
|
|
79
|
-
*/
|
|
80
|
-
podcastEdit(params: {
|
|
81
|
-
filter: UID;
|
|
82
|
-
feed?: string;
|
|
83
|
-
title?: string;
|
|
84
|
-
website?: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
generator?: string;
|
|
87
|
-
copyright?: string;
|
|
88
|
-
}) {
|
|
89
|
-
let query = "podcast_edit";
|
|
90
|
-
query += qs.stringify(params, "&");
|
|
91
|
-
return this.request<Success>(query);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Delete an existing podcast
|
|
96
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
97
|
-
* @param params.filter UID of podcast to delete
|
|
98
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast_delete}
|
|
99
|
-
*/
|
|
100
|
-
podcastDelete(params: { filter: UID }) {
|
|
101
|
-
let query = "podcast_delete";
|
|
102
|
-
query += qs.stringify(params, "&");
|
|
103
|
-
return this.request<Success>(query);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* This returns the episodes for a podcast
|
|
108
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
109
|
-
* @param params.filter UID of podcast
|
|
110
|
-
* @param [params.offset]
|
|
111
|
-
* @param [params.limit]
|
|
112
|
-
* @param [params.cond]
|
|
113
|
-
* @param [params.sort]
|
|
114
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast_episodes}
|
|
115
|
-
*/
|
|
116
|
-
podcastEpisodes(
|
|
117
|
-
params: {
|
|
118
|
-
filter: UID;
|
|
119
|
-
} & ExtendedPagination,
|
|
120
|
-
) {
|
|
121
|
-
let query = "podcast_episodes";
|
|
122
|
-
query += qs.stringify(params, "&");
|
|
123
|
-
return this.request<PodcastEpisodesResponse>(query);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Get the podcast_episode from a UID
|
|
128
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
129
|
-
* @param params.filter UID of podcast
|
|
130
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast_episode}
|
|
131
|
-
*/
|
|
132
|
-
podcastEpisode(params: { filter: UID }) {
|
|
133
|
-
let query = "podcast_episode";
|
|
134
|
-
query += qs.stringify(params, "&");
|
|
135
|
-
return this.request<PodcastEpisodeResponse>(query);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Delete an existing podcast_episode
|
|
140
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
141
|
-
* @param params.filter UID of podcast episode to delete
|
|
142
|
-
* @see {@link https://ampache.org/api/api-json-methods#podcast_episode_delete}
|
|
143
|
-
*/
|
|
144
|
-
podcastEpisodeDelete(params: { filter: UID }) {
|
|
145
|
-
let query = "podcast_episode_delete";
|
|
146
|
-
query += qs.stringify(params, "&");
|
|
147
|
-
return this.request<Success>(query);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Sync and download new podcast episodes
|
|
152
|
-
* ACCESS REQUIRED: 50 (Content Manager)
|
|
153
|
-
* @remarks MINIMUM_API_VERSION=420000
|
|
154
|
-
* @param params.id UID of podcast
|
|
155
|
-
* @see {@link https://ampache.org/api/api-json-methods#update_podcast}
|
|
156
|
-
*/
|
|
157
|
-
updatePodcast(params: { id: UID }) {
|
|
158
|
-
let query = "update_podcast";
|
|
159
|
-
query += qs.stringify(params, "&");
|
|
160
|
-
return this.request<Success>(query);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* This returns the episodes for a podcast that have been deleted
|
|
165
|
-
* @param [params.offset]
|
|
166
|
-
* @param [params.limit]
|
|
167
|
-
* @see {@link https://ampache.org/api/api-json-methods#deleted_podcast_episodes}
|
|
168
|
-
*/
|
|
169
|
-
deletedPodcastEpisodes(params?: {} & Pagination) {
|
|
170
|
-
let query = "deleted_podcast_episodes";
|
|
171
|
-
query += qs.stringify(params, "&");
|
|
172
|
-
return this.request<DeletedPodcastEpisodesResponse>(query);
|
|
173
|
-
}
|
|
174
|
-
}
|