javascript-ampache 1.0.9 → 1.1.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 +50 -47
- package/dist/base.d.ts +5 -0
- package/dist/index.js.map +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js.map +1 -1
- 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 +115 -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 +264 -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/podcasts/index.ts
CHANGED
|
@@ -1,177 +1,174 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return (data.deleted_podcast_episode) ? data.deleted_podcast_episode : data;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
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
|
+
}
|
package/src/podcasts/types.ts
CHANGED
|
@@ -1,67 +1,85 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type
|
|
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
|
-
}
|
|
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
|
+
};
|