javascript-ampache 1.0.9 → 1.1.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/README.md +50 -47
- package/dist/albums/index.d.ts +7 -13
- package/dist/albums/types.d.ts +9 -4
- package/dist/artists/index.d.ts +8 -14
- package/dist/artists/types.d.ts +10 -5
- package/dist/auth/index.d.ts +1 -1
- package/dist/base.d.ts +5 -0
- package/dist/bookmarks/index.d.ts +20 -21
- package/dist/bookmarks/types.d.ts +7 -2
- package/dist/catalogs/index.d.ts +9 -11
- package/dist/catalogs/types.d.ts +8 -3
- package/dist/genres/index.d.ts +4 -6
- package/dist/genres/types.d.ts +6 -1
- package/dist/index.d.ts +19 -19
- 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/labels/index.d.ts +4 -6
- package/dist/labels/types.d.ts +6 -1
- package/dist/licenses/index.d.ts +4 -6
- package/dist/licenses/types.d.ts +6 -1
- package/dist/live-streams/index.d.ts +8 -10
- package/dist/live-streams/types.d.ts +6 -1
- package/dist/playlists/index.d.ts +15 -25
- package/dist/playlists/types.d.ts +7 -2
- package/dist/podcasts/index.d.ts +10 -16
- package/dist/podcasts/types.d.ts +20 -5
- package/dist/preferences/index.d.ts +8 -16
- package/dist/preferences/types.d.ts +6 -1
- package/dist/shares/index.d.ts +7 -9
- package/dist/shares/types.d.ts +6 -1
- package/dist/shouts/index.d.ts +4 -4
- package/dist/shouts/types.d.ts +1 -1
- package/dist/songs/index.d.ts +12 -28
- package/dist/songs/types.d.ts +12 -2
- package/dist/system/index.d.ts +24 -24
- package/dist/system/types.d.ts +9 -9
- package/dist/users/index.d.ts +10 -10
- package/dist/users/types.d.ts +7 -2
- package/dist/videos/index.d.ts +5 -9
- package/dist/videos/types.d.ts +12 -2
- package/package.json +38 -38
- package/src/albums/index.ts +86 -86
- package/src/albums/types.ts +38 -32
- package/src/artists/index.ts +88 -88
- package/src/artists/types.ts +38 -32
- package/src/auth/index.ts +103 -103
- package/src/auth/types.ts +25 -25
- package/src/base.ts +134 -119
- package/src/bookmarks/index.ts +116 -122
- package/src/bookmarks/types.ts +15 -9
- package/src/catalogs/index.ts +130 -119
- package/src/catalogs/types.ts +27 -15
- package/src/genres/index.ts +39 -40
- package/src/genres/types.ts +23 -17
- package/src/index.ts +63 -26
- package/src/labels/index.ts +43 -44
- package/src/labels/types.ts +20 -14
- package/src/licenses/index.ts +43 -44
- package/src/licenses/types.ts +14 -8
- package/src/live-streams/index.ts +104 -107
- package/src/live-streams/types.ts +16 -10
- package/src/playlists/index.ts +262 -269
- package/src/playlists/types.ts +20 -14
- package/src/podcasts/index.ts +174 -177
- package/src/podcasts/types.ts +85 -67
- package/src/preferences/index.ts +114 -116
- package/src/preferences/types.ts +18 -12
- package/src/shares/index.ts +100 -96
- package/src/shares/types.ts +25 -19
- package/src/shouts/index.ts +18 -22
- package/src/shouts/types.ts +9 -9
- package/src/songs/index.ts +208 -203
- package/src/songs/types.ts +77 -65
- package/src/system/index.ts +689 -572
- package/src/system/types.ts +33 -19
- package/src/users/index.ts +227 -245
- package/src/users/types.ts +38 -32
- package/src/utils.ts +25 -25
- package/src/videos/index.ts +49 -53
- package/src/videos/types.ts +42 -30
package/src/preferences/index.ts
CHANGED
|
@@ -1,116 +1,114 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import { Base, BinaryBoolean, Success } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export class Preferences extends Base {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
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
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
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
|
+
};
|
|
13
|
+
|
|
14
|
+
export type PreferencesResponse = {
|
|
15
|
+
total_count: number;
|
|
16
|
+
md5: string;
|
|
17
|
+
preference: PreferenceResponse[];
|
|
18
|
+
};
|
package/src/shares/index.ts
CHANGED
|
@@ -1,96 +1,100 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
import { Base, BinaryBoolean, ExtendedPagination, Success, UID } from
|
|
4
|
-
|
|
5
|
-
export class Shares extends Base {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
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
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
import { Base } from
|
|
4
|
-
|
|
5
|
-
export class Shouts extends Base {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let data = await this.request<{shout: Shout[]}>(query);
|
|
20
|
-
return (data.shout) ? data.shout : data;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
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
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
import { UserSummary } from "../users/types";
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import { UID } from "../base";
|
|
2
|
+
import { UserSummary } from "../users/types";
|
|
3
|
+
|
|
4
|
+
export type ShoutResponse = {
|
|
5
|
+
id: UID;
|
|
6
|
+
date: number;
|
|
7
|
+
text: string;
|
|
8
|
+
user: UserSummary;
|
|
9
|
+
};
|