javascript-ampache 1.0.5 → 1.0.7
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/albums/types.d.ts +1 -0
- package/dist/artists/types.d.ts +1 -0
- package/dist/auth/index.d.ts +10 -1
- package/dist/auth/types.d.ts +15 -12
- package/dist/base.d.ts +2 -2
- package/dist/bookmarks/index.d.ts +24 -2
- 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/dist/playlists/index.d.ts +52 -0
- package/dist/playlists/types.d.ts +1 -0
- package/dist/podcasts/types.d.ts +2 -0
- package/dist/shares/index.d.ts +1 -1
- package/dist/songs/types.d.ts +1 -0
- package/dist/system/index.d.ts +25 -0
- package/dist/users/index.d.ts +4 -4
- package/dist/videos/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/albums/types.ts +1 -0
- package/src/artists/types.ts +1 -0
- package/src/auth/index.ts +15 -3
- package/src/auth/types.ts +15 -12
- package/src/base.ts +19 -18
- package/src/bookmarks/index.ts +30 -2
- package/src/playlists/index.ts +65 -0
- package/src/playlists/types.ts +1 -0
- package/src/podcasts/types.ts +2 -0
- package/src/shares/index.ts +1 -1
- package/src/songs/types.ts +1 -0
- package/src/system/index.ts +28 -0
- package/src/users/index.ts +4 -4
- package/src/videos/types.ts +1 -0
|
@@ -53,6 +53,44 @@ export declare class Playlists extends Base {
|
|
|
53
53
|
playlist(params: {
|
|
54
54
|
filter: UID;
|
|
55
55
|
}): Promise<Playlist>;
|
|
56
|
+
/**
|
|
57
|
+
* This returns a user's playlists based on the specified filter
|
|
58
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
59
|
+
* @param [params.filter] Filter results to match this string
|
|
60
|
+
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
61
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
62
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
63
|
+
* @param [params.offset]
|
|
64
|
+
* @param [params.limit]
|
|
65
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_playlists}
|
|
66
|
+
*/
|
|
67
|
+
userPlaylists(params?: {
|
|
68
|
+
filter?: string;
|
|
69
|
+
exact?: BinaryBoolean;
|
|
70
|
+
add?: Date;
|
|
71
|
+
update?: Date;
|
|
72
|
+
} & Pagination): Promise<Playlist[] | {
|
|
73
|
+
playlist: Playlist[];
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* This returns a user's smartlists based on the specified filter
|
|
77
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
78
|
+
* @param [params.filter] Filter results to match this string
|
|
79
|
+
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
80
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
81
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
82
|
+
* @param [params.offset]
|
|
83
|
+
* @param [params.limit]
|
|
84
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_smartlists}
|
|
85
|
+
*/
|
|
86
|
+
userSmartlists(params?: {
|
|
87
|
+
filter?: string;
|
|
88
|
+
exact?: BinaryBoolean;
|
|
89
|
+
add?: Date;
|
|
90
|
+
update?: Date;
|
|
91
|
+
} & Pagination): Promise<Playlist[] | {
|
|
92
|
+
playlist: Playlist[];
|
|
93
|
+
}>;
|
|
56
94
|
/**
|
|
57
95
|
* This creates a new playlist and returns it
|
|
58
96
|
* @remarks MINIMUM_API_VERSION=380001
|
|
@@ -64,6 +102,19 @@ export declare class Playlists extends Base {
|
|
|
64
102
|
name: string;
|
|
65
103
|
type?: 'public' | 'private';
|
|
66
104
|
}): Promise<Playlist>;
|
|
105
|
+
/**
|
|
106
|
+
* This adds an item to a playlist
|
|
107
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
108
|
+
* @param params.filter UID of Playlist
|
|
109
|
+
* @param params.id UID of the object to add to playlist
|
|
110
|
+
* @param params.type 'song', 'album', 'artist', 'playlist'
|
|
111
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_add}
|
|
112
|
+
*/
|
|
113
|
+
playlistAdd(params: {
|
|
114
|
+
filter: UID;
|
|
115
|
+
id: UID;
|
|
116
|
+
type: 'song' | 'album' | 'artist' | 'playlist';
|
|
117
|
+
}): Promise<Success>;
|
|
67
118
|
/**
|
|
68
119
|
* This modifies name and type of a playlist.
|
|
69
120
|
* NOTE items and tracks must be sent together and be of equal length.
|
|
@@ -100,6 +151,7 @@ export declare class Playlists extends Base {
|
|
|
100
151
|
* @param params.song UID of song to add to playlist
|
|
101
152
|
* @param [params.check] 0, 1 Whether to check and ignore duplicates (default = 0)
|
|
102
153
|
* @see {@link https://ampache.org/api/api-json-methods#playlist_add_song}
|
|
154
|
+
* @deprecated Being removed in 7.0.0. Use `playlist_add` instead.
|
|
103
155
|
*/
|
|
104
156
|
playlistAddSong(params: {
|
|
105
157
|
filter: UID;
|
package/dist/podcasts/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type Podcast = {
|
|
|
12
12
|
sync_date: string;
|
|
13
13
|
public_url: string;
|
|
14
14
|
art: string;
|
|
15
|
+
has_art: boolean;
|
|
15
16
|
flag: boolean;
|
|
16
17
|
rating: number | null;
|
|
17
18
|
averaterating: number | null;
|
|
@@ -43,6 +44,7 @@ export type PodcastEpisode = {
|
|
|
43
44
|
url: string;
|
|
44
45
|
catalog: UID;
|
|
45
46
|
art: string;
|
|
47
|
+
has_art: boolean;
|
|
46
48
|
flag: boolean;
|
|
47
49
|
rating: number | null;
|
|
48
50
|
averagerating: number | null;
|
package/dist/shares/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare class Shares extends Base {
|
|
|
36
36
|
*/
|
|
37
37
|
shareCreate(params: {
|
|
38
38
|
filter: UID;
|
|
39
|
-
type: 'song' | 'album' | 'artist';
|
|
39
|
+
type: 'song' | 'album' | 'artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'video';
|
|
40
40
|
description?: string;
|
|
41
41
|
expires?: number;
|
|
42
42
|
}): Promise<Share>;
|
package/dist/songs/types.d.ts
CHANGED
package/dist/system/index.d.ts
CHANGED
|
@@ -50,6 +50,31 @@ export declare class System extends Base {
|
|
|
50
50
|
} & Pagination): Promise<{
|
|
51
51
|
list: IndexEntry[];
|
|
52
52
|
}>;
|
|
53
|
+
/**
|
|
54
|
+
* This takes a collection of inputs and return ID's for the object type.
|
|
55
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
56
|
+
* @param params.type type of object to find
|
|
57
|
+
* @param [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
|
|
58
|
+
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
59
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
60
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
61
|
+
* @param [params.include] 0, 1, (include child objects)
|
|
62
|
+
* @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
|
|
63
|
+
* @param [params.offset]
|
|
64
|
+
* @param [params.limit]
|
|
65
|
+
* @see {@link https://ampache.org/api/api-json-methods#index}
|
|
66
|
+
*/
|
|
67
|
+
index(params: {
|
|
68
|
+
type: 'catalog' | 'song' | 'album' | 'artist' | 'album_artist' | 'song_artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'share' | 'video' | 'live_stream';
|
|
69
|
+
filter?: string;
|
|
70
|
+
exact?: BinaryBoolean;
|
|
71
|
+
add?: Date;
|
|
72
|
+
update?: Date;
|
|
73
|
+
include?: BinaryBoolean;
|
|
74
|
+
hide_search?: BinaryBoolean;
|
|
75
|
+
} & Pagination): Promise<{
|
|
76
|
+
index: [];
|
|
77
|
+
}>;
|
|
53
78
|
/**
|
|
54
79
|
* Return children of a parent object in a folder traversal/browse style
|
|
55
80
|
* If you don't send any parameters you'll get a catalog list (the 'root' path)
|
package/dist/users/index.d.ts
CHANGED
|
@@ -10,13 +10,13 @@ export declare class Users extends Base {
|
|
|
10
10
|
user: UserSummary[];
|
|
11
11
|
}>;
|
|
12
12
|
/**
|
|
13
|
-
* This get a user's public information
|
|
13
|
+
* This get a user's public information (or current user if username is omitted)
|
|
14
14
|
* @remarks MINIMUM_API_VERSION=380001
|
|
15
|
-
* @param params.username UID to find
|
|
15
|
+
* @param [params.username] UID to find
|
|
16
16
|
* @see {@link https://ampache.org/api/api-json-methods#user}
|
|
17
17
|
*/
|
|
18
|
-
user(params
|
|
19
|
-
username
|
|
18
|
+
user(params?: {
|
|
19
|
+
username?: string;
|
|
20
20
|
}): Promise<User>;
|
|
21
21
|
/**
|
|
22
22
|
* Create a new user
|
package/dist/videos/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/albums/types.ts
CHANGED
package/src/artists/types.ts
CHANGED
package/src/auth/index.ts
CHANGED
|
@@ -59,7 +59,7 @@ export class Auth extends Base {
|
|
|
59
59
|
ping (params?: { auth?: string, version?: string }) {
|
|
60
60
|
let query = 'ping';
|
|
61
61
|
query += qs.stringify(params, '&');
|
|
62
|
-
return this.request<AuthResponse>(query
|
|
62
|
+
return this.request<AuthResponse>(query);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -68,10 +68,22 @@ export class Auth extends Base {
|
|
|
68
68
|
* @param params.auth Session ID to destroy
|
|
69
69
|
* @see {@link https://ampache.org/api/api-json-methods#goodbye}
|
|
70
70
|
*/
|
|
71
|
-
goodbye (params: { auth }) {
|
|
71
|
+
goodbye (params: { auth: string }) {
|
|
72
72
|
let query = 'goodbye';
|
|
73
73
|
query += qs.stringify(params, '&');
|
|
74
|
-
return this.request<Success>(query
|
|
74
|
+
return this.request<Success>(query);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Email a new password to the user (if allowed) using a reset token.
|
|
79
|
+
* @remarks MINIMUM_API_VERSION=6.1.0
|
|
80
|
+
* @param params.auth Password reset token
|
|
81
|
+
* @see {@link https://ampache.org/api/api-json-methods#lost_password}
|
|
82
|
+
*/
|
|
83
|
+
lostPassword (params: { auth: string }) {
|
|
84
|
+
let query = 'lost_password';
|
|
85
|
+
query += qs.stringify(params, '&');
|
|
86
|
+
return this.request<Success>(query);
|
|
75
87
|
}
|
|
76
88
|
|
|
77
89
|
/**
|
package/src/auth/types.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
export type AuthResponse = {
|
|
2
|
-
auth: string,
|
|
3
|
-
api: string,
|
|
4
|
-
session_expire: string,
|
|
5
|
-
update: string,
|
|
6
2
|
add: string,
|
|
7
|
-
clean: string,
|
|
8
|
-
songs: number,
|
|
9
3
|
albums: number,
|
|
4
|
+
api: string,
|
|
10
5
|
artists: number,
|
|
6
|
+
auth: string,
|
|
7
|
+
catalogs: number,
|
|
8
|
+
compatible: string
|
|
9
|
+
clean: string,
|
|
11
10
|
genres: number,
|
|
11
|
+
labels: number,
|
|
12
|
+
licenses: number,
|
|
13
|
+
live_streams: number,
|
|
12
14
|
playlists: number,
|
|
13
|
-
user: number,
|
|
14
|
-
catalogs: number,
|
|
15
|
-
videos: number,
|
|
16
15
|
podcasts: number,
|
|
17
16
|
podcast_episodes: number,
|
|
17
|
+
server: string,
|
|
18
|
+
session_expire: string,
|
|
18
19
|
shares: number,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
songs: number,
|
|
21
|
+
update: string,
|
|
22
|
+
user: number,
|
|
23
|
+
version: string,
|
|
24
|
+
videos: number,
|
|
22
25
|
}
|
package/src/base.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type UID = string | number;
|
|
|
26
26
|
export abstract class Base {
|
|
27
27
|
sessionKey: string;
|
|
28
28
|
url: string;
|
|
29
|
-
version: string = '6.
|
|
29
|
+
version: string = '6.3.0';// default to latest version
|
|
30
30
|
debug: boolean;
|
|
31
31
|
|
|
32
32
|
constructor(config: Config) {
|
|
@@ -35,22 +35,22 @@ export abstract class Base {
|
|
|
35
35
|
this.debug = config.debug || false;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
protected request<T> (endpoint: string
|
|
39
|
-
let url = this.url + "/server/json.server.php?action=" + endpoint;
|
|
40
|
-
|
|
41
|
-
// some endpoints like ping() or goodbye() can pass their own auth
|
|
42
|
-
if (includeAuth) {
|
|
43
|
-
url += "&auth=" + this.sessionKey + "&version=" + this.version;
|
|
44
|
-
}
|
|
38
|
+
protected request<T> (endpoint: string): Promise<T> {
|
|
39
|
+
let url = this.url + "/server/json.server.php?action=" + endpoint + "&version=" + this.version;
|
|
45
40
|
|
|
46
41
|
if (this.debug) {
|
|
47
42
|
console.debug(
|
|
48
|
-
"javascript-ampache query URL %c" + url,
|
|
43
|
+
"javascript-ampache query URL %c" + url + "&auth=" + this.sessionKey,
|
|
49
44
|
"color: black; font-style: italic; background-color: orange;padding: 2px"
|
|
50
45
|
);
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
return fetch(url
|
|
48
|
+
return fetch(url, {
|
|
49
|
+
method: "GET",
|
|
50
|
+
headers: {
|
|
51
|
+
'Authorization': 'Bearer ' + this.sessionKey
|
|
52
|
+
}
|
|
53
|
+
}).then(r => {
|
|
54
54
|
if (r.ok) {
|
|
55
55
|
return r.json();
|
|
56
56
|
}
|
|
@@ -58,21 +58,22 @@ export abstract class Base {
|
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
protected binary<T> (endpoint: string
|
|
62
|
-
let url = this.url + "/server/json.server.php?action=" + endpoint;
|
|
63
|
-
|
|
64
|
-
if (includeAuth) {
|
|
65
|
-
url += "&auth=" + this.sessionKey + "&version=" + this.version;
|
|
66
|
-
}
|
|
61
|
+
protected binary<T> (endpoint: string): Promise<Blob> {
|
|
62
|
+
let url = this.url + "/server/json.server.php?action=" + endpoint + "&version=" + this.version;
|
|
67
63
|
|
|
68
64
|
if (this.debug) {
|
|
69
65
|
console.debug(
|
|
70
|
-
"javascript-ampache query URL %c" + url,
|
|
66
|
+
"javascript-ampache query URL %c" + url + "&auth=" + this.sessionKey,
|
|
71
67
|
"color: black; font-style: italic; background-color: orange;padding: 2px"
|
|
72
68
|
);
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
return fetch(url
|
|
71
|
+
return fetch(url,{
|
|
72
|
+
method: "GET",
|
|
73
|
+
headers: {
|
|
74
|
+
'Authorization': 'Bearer ' + this.sessionKey
|
|
75
|
+
}
|
|
76
|
+
})
|
|
76
77
|
.then(response => response.blob())
|
|
77
78
|
.then(r => {
|
|
78
79
|
return r;
|
package/src/bookmarks/index.ts
CHANGED
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
import qs from 'querystringify';
|
|
2
2
|
import { Bookmark } from './types';
|
|
3
|
-
import { Base, Success, UID } from '../base';
|
|
3
|
+
import { Base, BinaryBoolean, Success, UID } from '../base';
|
|
4
4
|
|
|
5
5
|
export class Bookmarks extends Base {
|
|
6
|
+
/**
|
|
7
|
+
* Get a single bookmark by bookmark_id
|
|
8
|
+
* @remarks MINIMUM_API_VERSION=6.1.0
|
|
9
|
+
* @param params.filter UID to find
|
|
10
|
+
* @param [params.include] 0,1, if true include the object in the bookmark
|
|
11
|
+
* @see {@link https://ampache.org/api/api-json-methods#bookmark}
|
|
12
|
+
*/
|
|
13
|
+
async bookmark (params: {
|
|
14
|
+
filter: UID,
|
|
15
|
+
include?: BinaryBoolean,
|
|
16
|
+
}) {
|
|
17
|
+
let query = 'bookmark';
|
|
18
|
+
query += qs.stringify(params, '&');
|
|
19
|
+
return this.request<Bookmark>(query);
|
|
20
|
+
}
|
|
21
|
+
|
|
6
22
|
/**
|
|
7
23
|
* Get information about bookmarked media this user is allowed to manage
|
|
8
24
|
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
25
|
+
* @param [params.client] filter by the agent/client name
|
|
26
|
+
* @param [params.include] 0,1, if true include the object in the bookmark
|
|
9
27
|
* @see {@link https://ampache.org/api/api-json-methods#bookmarks}
|
|
10
28
|
*/
|
|
11
|
-
async bookmarks (
|
|
29
|
+
async bookmarks (params: {
|
|
30
|
+
client?: string,
|
|
31
|
+
include?: BinaryBoolean,
|
|
32
|
+
}) {
|
|
12
33
|
let query = 'bookmarks';
|
|
34
|
+
query += qs.stringify(params, '&');
|
|
13
35
|
let data = await this.request<{bookmark: Bookmark[]}>(query);
|
|
14
36
|
return (data.bookmark) ? data.bookmark : data;
|
|
15
37
|
}
|
|
@@ -19,11 +41,13 @@ export class Bookmarks extends Base {
|
|
|
19
41
|
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
20
42
|
* @param params.filter UID to find
|
|
21
43
|
* @param params.type Object type
|
|
44
|
+
* @param [params.include] 0,1, if true include the object in the bookmark
|
|
22
45
|
* @see {@link https://ampache.org/api/api-json-methods#get_bookmark}
|
|
23
46
|
*/
|
|
24
47
|
getBookmark (params: {
|
|
25
48
|
filter: UID,
|
|
26
49
|
type: 'song' | 'video' | 'podcast_episode',
|
|
50
|
+
include?: BinaryBoolean,
|
|
27
51
|
}) {
|
|
28
52
|
let query = 'get_bookmark';
|
|
29
53
|
query += qs.stringify(params, '&');
|
|
@@ -38,6 +62,7 @@ export class Bookmarks extends Base {
|
|
|
38
62
|
* @param params.position current track time in seconds
|
|
39
63
|
* @param [params.client] Agent string. (Default: 'AmpacheAPI')
|
|
40
64
|
* @param [params.date] update time (Default: UNIXTIME())
|
|
65
|
+
* @param [params.include] 0,1, if true include the object in the bookmark
|
|
41
66
|
* @see {@link https://ampache.org/api/api-json-methods#bookmark_create}
|
|
42
67
|
*/
|
|
43
68
|
bookmarkCreate (params: {
|
|
@@ -46,6 +71,7 @@ export class Bookmarks extends Base {
|
|
|
46
71
|
position: number,
|
|
47
72
|
client?: string,
|
|
48
73
|
date?: number,
|
|
74
|
+
include?: BinaryBoolean,
|
|
49
75
|
}) {
|
|
50
76
|
let query = 'bookmark_create';
|
|
51
77
|
query += qs.stringify(params, '&');
|
|
@@ -60,6 +86,7 @@ export class Bookmarks extends Base {
|
|
|
60
86
|
* @param params.position current track time in seconds
|
|
61
87
|
* @param [params.client] Agent string. (Default: 'AmpacheAPI')
|
|
62
88
|
* @param [params.date] update time (Default: UNIXTIME())
|
|
89
|
+
* @param [params.include] 0,1, if true include the object in the bookmark
|
|
63
90
|
* @see {@link https://ampache.org/api/api-json-methods#bookmark_edit}
|
|
64
91
|
*/
|
|
65
92
|
bookmarkEdit (params: {
|
|
@@ -68,6 +95,7 @@ export class Bookmarks extends Base {
|
|
|
68
95
|
position: number,
|
|
69
96
|
client?: string,
|
|
70
97
|
date?: number,
|
|
98
|
+
include?: BinaryBoolean,
|
|
71
99
|
}) {
|
|
72
100
|
let query = 'bookmark_edit';
|
|
73
101
|
query += qs.stringify(params, '&');
|
package/src/playlists/index.ts
CHANGED
|
@@ -78,6 +78,52 @@ export class Playlists extends Base {
|
|
|
78
78
|
return this.request<Playlist>(query);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* This returns a user's playlists based on the specified filter
|
|
83
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
84
|
+
* @param [params.filter] Filter results to match this string
|
|
85
|
+
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
86
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
87
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
88
|
+
* @param [params.offset]
|
|
89
|
+
* @param [params.limit]
|
|
90
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_playlists}
|
|
91
|
+
*/
|
|
92
|
+
async userPlaylists (params?: {
|
|
93
|
+
filter?: string,
|
|
94
|
+
exact?: BinaryBoolean,
|
|
95
|
+
add?: Date,
|
|
96
|
+
update?: Date,
|
|
97
|
+
} & Pagination) {
|
|
98
|
+
let query = 'user_playlists';
|
|
99
|
+
query += qs.stringify(params, '&');
|
|
100
|
+
let data = await this.request<{playlist: Playlist[]}>(query);
|
|
101
|
+
return (data.playlist) ? data.playlist : data;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* This returns a user's smartlists based on the specified filter
|
|
106
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
107
|
+
* @param [params.filter] Filter results to match this string
|
|
108
|
+
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
109
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
110
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
111
|
+
* @param [params.offset]
|
|
112
|
+
* @param [params.limit]
|
|
113
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_smartlists}
|
|
114
|
+
*/
|
|
115
|
+
async userSmartlists (params?: {
|
|
116
|
+
filter?: string,
|
|
117
|
+
exact?: BinaryBoolean,
|
|
118
|
+
add?: Date,
|
|
119
|
+
update?: Date,
|
|
120
|
+
} & Pagination) {
|
|
121
|
+
let query = 'user_smartlists';
|
|
122
|
+
query += qs.stringify(params, '&');
|
|
123
|
+
let data = await this.request<{playlist: Playlist[]}>(query);
|
|
124
|
+
return (data.playlist) ? data.playlist : data;
|
|
125
|
+
}
|
|
126
|
+
|
|
81
127
|
/**
|
|
82
128
|
* This creates a new playlist and returns it
|
|
83
129
|
* @remarks MINIMUM_API_VERSION=380001
|
|
@@ -94,6 +140,24 @@ export class Playlists extends Base {
|
|
|
94
140
|
return this.request<Playlist>(query);
|
|
95
141
|
}
|
|
96
142
|
|
|
143
|
+
/**
|
|
144
|
+
* This adds an item to a playlist
|
|
145
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
146
|
+
* @param params.filter UID of Playlist
|
|
147
|
+
* @param params.id UID of the object to add to playlist
|
|
148
|
+
* @param params.type 'song', 'album', 'artist', 'playlist'
|
|
149
|
+
* @see {@link https://ampache.org/api/api-json-methods#playlist_add}
|
|
150
|
+
*/
|
|
151
|
+
playlistAdd (params: {
|
|
152
|
+
filter: UID,
|
|
153
|
+
id: UID,
|
|
154
|
+
type: 'song' | 'album' | 'artist' | 'playlist',
|
|
155
|
+
}) {
|
|
156
|
+
let query = 'playlist_add';
|
|
157
|
+
query += qs.stringify(params, '&');
|
|
158
|
+
return this.request<Success>(query);
|
|
159
|
+
}
|
|
160
|
+
|
|
97
161
|
/**
|
|
98
162
|
* This modifies name and type of a playlist.
|
|
99
163
|
* NOTE items and tracks must be sent together and be of equal length.
|
|
@@ -140,6 +204,7 @@ export class Playlists extends Base {
|
|
|
140
204
|
* @param params.song UID of song to add to playlist
|
|
141
205
|
* @param [params.check] 0, 1 Whether to check and ignore duplicates (default = 0)
|
|
142
206
|
* @see {@link https://ampache.org/api/api-json-methods#playlist_add_song}
|
|
207
|
+
* @deprecated Being removed in 7.0.0. Use `playlist_add` instead.
|
|
143
208
|
*/
|
|
144
209
|
playlistAddSong (params: {
|
|
145
210
|
filter: UID,
|
package/src/playlists/types.ts
CHANGED
package/src/podcasts/types.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type Podcast = {
|
|
|
13
13
|
sync_date: string,
|
|
14
14
|
public_url: string,
|
|
15
15
|
art: string,
|
|
16
|
+
has_art: boolean,
|
|
16
17
|
flag: boolean,
|
|
17
18
|
rating: number | null,
|
|
18
19
|
averaterating: number | null,
|
|
@@ -45,6 +46,7 @@ export type PodcastEpisode = {
|
|
|
45
46
|
url: string,
|
|
46
47
|
catalog: UID,
|
|
47
48
|
art: string,
|
|
49
|
+
has_art: boolean,
|
|
48
50
|
flag: boolean,
|
|
49
51
|
rating: number | null,
|
|
50
52
|
averagerating: number | null,
|
package/src/shares/index.ts
CHANGED
|
@@ -47,7 +47,7 @@ export class Shares extends Base {
|
|
|
47
47
|
*/
|
|
48
48
|
shareCreate (params: {
|
|
49
49
|
filter: UID,
|
|
50
|
-
type: 'song' | 'album' | 'artist',
|
|
50
|
+
type: 'song' | 'album' | 'artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'video',
|
|
51
51
|
description?: string,
|
|
52
52
|
expires?: number,
|
|
53
53
|
}) {
|
package/src/songs/types.ts
CHANGED
package/src/system/index.ts
CHANGED
|
@@ -101,6 +101,34 @@ export class System extends Base {
|
|
|
101
101
|
return this.request<{list: IndexEntry[]}>(query);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* This takes a collection of inputs and return ID's for the object type.
|
|
106
|
+
* @remarks MINIMUM_API_VERSION=6.3.0
|
|
107
|
+
* @param params.type type of object to find
|
|
108
|
+
* @param [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
|
|
109
|
+
* @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
|
|
110
|
+
* @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
|
|
111
|
+
* @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
|
|
112
|
+
* @param [params.include] 0, 1, (include child objects)
|
|
113
|
+
* @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
|
|
114
|
+
* @param [params.offset]
|
|
115
|
+
* @param [params.limit]
|
|
116
|
+
* @see {@link https://ampache.org/api/api-json-methods#index}
|
|
117
|
+
*/
|
|
118
|
+
async index (params: {
|
|
119
|
+
type: 'catalog' | 'song' | 'album' | 'artist' | 'album_artist' | 'song_artist' | 'playlist' | 'podcast' | 'podcast_episode' | 'share' | 'video' | 'live_stream'
|
|
120
|
+
filter?: string,
|
|
121
|
+
exact?: BinaryBoolean,
|
|
122
|
+
add?: Date,
|
|
123
|
+
update?: Date,
|
|
124
|
+
include?: BinaryBoolean,
|
|
125
|
+
hide_search?: BinaryBoolean
|
|
126
|
+
} & Pagination) {
|
|
127
|
+
let query = 'index';
|
|
128
|
+
query += qs.stringify(params, '&');
|
|
129
|
+
return this.request<{index: []}>(query);
|
|
130
|
+
}
|
|
131
|
+
|
|
104
132
|
/**
|
|
105
133
|
* Return children of a parent object in a folder traversal/browse style
|
|
106
134
|
* If you don't send any parameters you'll get a catalog list (the 'root' path)
|
package/src/users/index.ts
CHANGED
|
@@ -15,13 +15,13 @@ export class Users extends Base {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* This get a user's public information
|
|
18
|
+
* This get a user's public information (or current user if username is omitted)
|
|
19
19
|
* @remarks MINIMUM_API_VERSION=380001
|
|
20
|
-
* @param params.username UID to find
|
|
20
|
+
* @param [params.username] UID to find
|
|
21
21
|
* @see {@link https://ampache.org/api/api-json-methods#user}
|
|
22
22
|
*/
|
|
23
|
-
async user (params
|
|
24
|
-
username
|
|
23
|
+
async user (params?: {
|
|
24
|
+
username?: string
|
|
25
25
|
}) {
|
|
26
26
|
let query = 'user';
|
|
27
27
|
query += qs.stringify(params, '&');
|