javascript-ampache 1.0.8 → 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.
Files changed (50) hide show
  1. package/README.md +50 -47
  2. package/dist/base.d.ts +6 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.m.js +1 -1
  6. package/dist/index.m.js.map +1 -1
  7. package/dist/index.modern.mjs +1 -1
  8. package/dist/index.modern.mjs.map +1 -1
  9. package/dist/index.umd.js +1 -1
  10. package/dist/index.umd.js.map +1 -1
  11. package/package.json +38 -38
  12. package/src/albums/index.ts +86 -86
  13. package/src/albums/types.ts +38 -32
  14. package/src/artists/index.ts +88 -88
  15. package/src/artists/types.ts +38 -32
  16. package/src/auth/index.ts +103 -103
  17. package/src/auth/types.ts +25 -25
  18. package/src/base.ts +134 -97
  19. package/src/bookmarks/index.ts +115 -122
  20. package/src/bookmarks/types.ts +15 -9
  21. package/src/catalogs/index.ts +130 -119
  22. package/src/catalogs/types.ts +27 -15
  23. package/src/genres/index.ts +39 -40
  24. package/src/genres/types.ts +23 -17
  25. package/src/index.ts +63 -26
  26. package/src/labels/index.ts +43 -44
  27. package/src/labels/types.ts +20 -14
  28. package/src/licenses/index.ts +43 -44
  29. package/src/licenses/types.ts +14 -8
  30. package/src/live-streams/index.ts +104 -107
  31. package/src/live-streams/types.ts +16 -10
  32. package/src/playlists/index.ts +264 -269
  33. package/src/playlists/types.ts +20 -14
  34. package/src/podcasts/index.ts +174 -177
  35. package/src/podcasts/types.ts +85 -67
  36. package/src/preferences/index.ts +114 -116
  37. package/src/preferences/types.ts +18 -12
  38. package/src/shares/index.ts +100 -96
  39. package/src/shares/types.ts +25 -19
  40. package/src/shouts/index.ts +18 -22
  41. package/src/shouts/types.ts +9 -9
  42. package/src/songs/index.ts +208 -203
  43. package/src/songs/types.ts +77 -65
  44. package/src/system/index.ts +689 -572
  45. package/src/system/types.ts +33 -19
  46. package/src/users/index.ts +227 -245
  47. package/src/users/types.ts +38 -32
  48. package/src/utils.ts +25 -25
  49. package/src/videos/index.ts +49 -53
  50. package/src/videos/types.ts +42 -30
@@ -1,177 +1,174 @@
1
- import qs from 'querystringify';
2
- import { Podcast, PodcastEpisode, DeletedPodcastEpisode } from './types';
3
- import {Base, ExtendedPagination, Pagination, Success, UID} from '../base';
4
-
5
- export class Podcasts extends Base {
6
- /**
7
- * Get information about podcasts
8
- * @remarks MINIMUM_API_VERSION=420000
9
- * @param [params.filter] Value is Alpha Match for returned results, may be more than one letter/number
10
- * @param [params.include] episodes (include podcast_episodes in the response)
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#podcasts}
16
- */
17
- async podcasts (params?: {
18
- filter?: string,
19
- include?: 'episodes',
20
- } & ExtendedPagination) {
21
- let query = 'podcasts';
22
- query += qs.stringify(params, '&');
23
- let data = await this.request<{podcast: Podcast[]}>(query);
24
- return (data.podcast) ? data.podcast : data;
25
- }
26
-
27
- /**
28
- * Get information about podcasts
29
- * @remarks MINIMUM_API_VERSION=420000
30
- * @param params.filter UID to find
31
- * @param [params.include] episodes (include podcast_episodes in the response)
32
- * @param [params.offset]
33
- * @param [params.limit]
34
- * @see {@link https://ampache.org/api/api-json-methods#podcast}
35
- */
36
- async podcast (params?: {
37
- filter: UID,
38
- include?: 'episodes',
39
- } & Pagination) {
40
- let query = 'podcast';
41
- query += qs.stringify(params, '&');
42
- return this.request<Podcast>(query);
43
- }
44
-
45
- /**
46
- * Create a podcast that can be used by anyone to stream media.
47
- * @remarks MINIMUM_API_VERSION=420000
48
- * @param params.url RSS url for podcast
49
- * @param params.catalog UID of podcast catalog
50
- * @see {@link https://ampache.org/api/api-json-methods#podcast_create}
51
- */
52
- podcastCreate (params: {
53
- url: string,
54
- catalog: UID,
55
- }) {
56
- let query = 'podcast_create';
57
- query += qs.stringify(params, '&');
58
- return this.request<Podcast>(query);
59
- }
60
-
61
- /**
62
- * Update the description and/or expiration date for an existing podcast.
63
- * @remarks MINIMUM_API_VERSION=420000
64
- * @param params.filter UID to find
65
- * @param [params.feed] RSS url for podcast
66
- * @param [params.title] Podcast title
67
- * @param [params.website] Source website URL
68
- * @param [params.description] Podcast description
69
- * @param [params.generator] Podcast generator
70
- * @param [params.copyright] Podcast copyright
71
- * @see {@link https://ampache.org/api/api-json-methods#podcast_edit}
72
- */
73
- podcastEdit (params: {
74
- filter: UID,
75
- feed?: string,
76
- title?: string,
77
- website?: string,
78
- description?: string,
79
- generator?: string,
80
- copyright?: string,
81
- }) {
82
- let query = 'podcast_edit';
83
- query += qs.stringify(params, '&');
84
- return this.request<Success>(query);
85
- }
86
-
87
- /**
88
- * Delete an existing podcast
89
- * @remarks MINIMUM_API_VERSION=420000
90
- * @param params.filter UID of podcast to delete
91
- * @see {@link https://ampache.org/api/api-json-methods#podcast_delete}
92
- */
93
- podcastDelete (params: {
94
- filter: UID
95
- }) {
96
- let query = 'podcast_delete';
97
- query += qs.stringify(params, '&');
98
- return this.request<Success>(query);
99
- }
100
-
101
- /**
102
- * This returns the episodes for a podcast
103
- * @remarks MINIMUM_API_VERSION=420000
104
- * @param params.filter UID of podcast
105
- * @param [params.offset]
106
- * @param [params.limit]
107
- * @param [params.cond]
108
- * @param [params.sort]
109
- * @see {@link https://ampache.org/api/api-json-methods#podcast_episodes}
110
- */
111
- async podcastEpisodes (params: {
112
- filter: UID,
113
- } & ExtendedPagination) {
114
- let query = 'podcast_episodes';
115
- query += qs.stringify(params, '&');
116
- let data = await this.request<{podcast_episode: PodcastEpisode[]}>(query);
117
- return (data.podcast_episode) ? data.podcast_episode : data;
118
- }
119
-
120
- /**
121
- * Get the podcast_episode from a UID
122
- * @remarks MINIMUM_API_VERSION=420000
123
- * @param params.filter UID of podcast
124
- * @see {@link https://ampache.org/api/api-json-methods#podcast_episode}
125
- */
126
- podcastEpisode (params: {
127
- filter: UID,
128
- }) {
129
- let query = 'podcast_episode';
130
- query += qs.stringify(params, '&');
131
- return this.request<PodcastEpisode>(query);
132
- }
133
-
134
- /**
135
- * Delete an existing podcast_episode
136
- * @remarks MINIMUM_API_VERSION=420000
137
- * @param params.filter UID of podcast episode to delete
138
- * @see {@link https://ampache.org/api/api-json-methods#podcast_episode_delete}
139
- */
140
- podcastEpisodeDelete (params: {
141
- filter: UID,
142
- }) {
143
- let query = 'podcast_episode_delete';
144
- query += qs.stringify(params, '&');
145
- return this.request<Success>(query);
146
- }
147
-
148
- /**
149
- * Sync and download new podcast episodes
150
- * ACCESS REQUIRED: 50 (Content Manager)
151
- * @remarks MINIMUM_API_VERSION=420000
152
- * @param params.id UID of podcast
153
- * @see {@link https://ampache.org/api/api-json-methods#update_podcast}
154
- */
155
- updatePodcast (params: {
156
- id: UID,
157
- }) {
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
- async deletedPodcastEpisodes (params?: {
170
-
171
- } & Pagination) {
172
- let query = 'deleted_podcast_episodes';
173
- query += qs.stringify(params, '&');
174
- let data = await this.request<{deleted_podcast_episode: DeletedPodcastEpisode[]}>(query);
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
+ }
@@ -1,67 +1,85 @@
1
- import { UID } from "../base";
2
-
3
- export type Podcast = {
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: PodcastEpisode[]
21
- }
22
-
23
- export type PodcastEpisode = {
24
- id: UID,
25
- title: string,
26
- name: string,
27
- description: string,
28
- category: string,
29
- author: string,
30
- author_full: string,
31
- website: string,
32
- pubdate: string,
33
- state: 'completed' | 'pending'
34
- filelength: string,
35
- filesize: string,
36
- filename: string,
37
- mime: string,
38
- time: number,
39
- size: number,
40
- bitrate: number,
41
- stream_bitrate: number,
42
- rate: number,
43
- mode: number | null,
44
- channels: number | null,
45
- public_url: string,
46
- url: string,
47
- catalog: UID,
48
- art: string,
49
- has_art: boolean,
50
- flag: boolean,
51
- rating: number | null,
52
- averagerating: number | null,
53
- playcount: number,
54
- played: number,
55
- }
56
-
57
- export type DeletedPodcastEpisode = {
58
- id: UID,
59
- addition_time: number,
60
- delete_time: number,
61
- title: string,
62
- file: string,
63
- catalog: UID,
64
- total_count: number,
65
- total_skip: number,
66
- podcast: UID,
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
+ };