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.
Files changed (46) hide show
  1. package/README.md +50 -47
  2. package/dist/base.d.ts +5 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.m.js.map +1 -1
  5. package/dist/index.modern.mjs.map +1 -1
  6. package/dist/index.umd.js.map +1 -1
  7. package/package.json +38 -38
  8. package/src/albums/index.ts +86 -86
  9. package/src/albums/types.ts +38 -32
  10. package/src/artists/index.ts +88 -88
  11. package/src/artists/types.ts +38 -32
  12. package/src/auth/index.ts +103 -103
  13. package/src/auth/types.ts +25 -25
  14. package/src/base.ts +134 -119
  15. package/src/bookmarks/index.ts +115 -122
  16. package/src/bookmarks/types.ts +15 -9
  17. package/src/catalogs/index.ts +130 -119
  18. package/src/catalogs/types.ts +27 -15
  19. package/src/genres/index.ts +39 -40
  20. package/src/genres/types.ts +23 -17
  21. package/src/index.ts +63 -26
  22. package/src/labels/index.ts +43 -44
  23. package/src/labels/types.ts +20 -14
  24. package/src/licenses/index.ts +43 -44
  25. package/src/licenses/types.ts +14 -8
  26. package/src/live-streams/index.ts +104 -107
  27. package/src/live-streams/types.ts +16 -10
  28. package/src/playlists/index.ts +264 -269
  29. package/src/playlists/types.ts +20 -14
  30. package/src/podcasts/index.ts +174 -177
  31. package/src/podcasts/types.ts +85 -67
  32. package/src/preferences/index.ts +114 -116
  33. package/src/preferences/types.ts +18 -12
  34. package/src/shares/index.ts +100 -96
  35. package/src/shares/types.ts +25 -19
  36. package/src/shouts/index.ts +18 -22
  37. package/src/shouts/types.ts +9 -9
  38. package/src/songs/index.ts +208 -203
  39. package/src/songs/types.ts +77 -65
  40. package/src/system/index.ts +689 -572
  41. package/src/system/types.ts +33 -19
  42. package/src/users/index.ts +227 -245
  43. package/src/users/types.ts +38 -32
  44. package/src/utils.ts +25 -25
  45. package/src/videos/index.ts +49 -53
  46. package/src/videos/types.ts +42 -30
@@ -1,107 +1,104 @@
1
- import qs from 'querystringify';
2
- import { LiveStream } 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
- async liveStreams (params?: {
20
- filter?: string,
21
- exact?: BinaryBoolean,
22
- add?: Date,
23
- update?: Date,
24
- } & ExtendedPagination) {
25
- let query = 'live_streams';
26
- query += qs.stringify(params, '&');
27
- let data = await this.request<{live_stream: LiveStream[]}>(query);
28
- return (data.live_stream) ? data.live_stream : data;
29
- }
30
-
31
- /**
32
- * This returns a single live_stream
33
- * @remarks MINIMUM_API_VERSION=5.1.0
34
- * @param params.filter UID to find
35
- * @see {@link https://ampache.org/api/api-json-methods#live_stream}
36
- */
37
- liveStream (params: {
38
- filter: UID,
39
- }) {
40
- let query = 'live_stream';
41
- query += qs.stringify(params, '&');
42
- return this.request<LiveStream>(query);
43
- }
44
-
45
- /**
46
- * Create a live_stream (radio station) object.
47
- * ACCESS REQUIRED: 50 (Content Manager)
48
- * @remarks MINIMUM_API_VERSION=6.0.0
49
- * @param params.name Stream title
50
- * @param params.url URL of the http/s stream
51
- * @param params.codec Stream codec
52
- * @param params.catalog Catalog ID to associate with this stream
53
- * @param [params.site_url] Homepage URL of the stream
54
- * @see {@link https://ampache.org/api/api-json-methods#live_stream_create}
55
- */
56
- liveStreamCreate (params: {
57
- name: string,
58
- url: string,
59
- codec: 'mp3' | 'flac' | 'ogg' | 'vorbis' | 'opus' | 'aac' | 'alac',
60
- catalog: string,
61
- site_url?: string
62
- }) {
63
- let query = 'live_stream_create';
64
- query += qs.stringify(params, '&');
65
- return this.request<LiveStream>(query);
66
- }
67
-
68
- /**
69
- * Edit a live_stream (radio station) object.
70
- * ACCESS REQUIRED: 50 (Content Manager)
71
- * @remarks MINIMUM_API_VERSION=6.0.0
72
- * @param params.filter Object to find
73
- * @param [params.name] Stream title
74
- * @param [params.url] URL of the http/s stream
75
- * @param [params.codec] Stream codec
76
- * @param [params.catalog] Catalog ID to associate with this stream
77
- * @param [params.site_url] Homepage URL of the stream
78
- * @see {@link https://ampache.org/api/api-json-methods#live_stream_edit}
79
- */
80
- liveStreamEdit (params: {
81
- filter: string,
82
- name?: string,
83
- url?: string,
84
- codec?: 'mp3' | 'flac' | 'ogg' | 'vorbis' | 'opus' | 'aac' | 'alac',
85
- catalog?: string,
86
- site_url?: string
87
- }) {
88
- let query = 'live_stream_edit';
89
- query += qs.stringify(params, '&');
90
- return this.request<LiveStream>(query);
91
- }
92
-
93
- /**
94
- * Delete a live_stream (radio station) object (if it exists)
95
- * ACCESS REQUIRED: 50 (Content Manager)
96
- * @remarks MINIMUM_API_VERSION=6.0.0
97
- * @param params.filter Object to find
98
- * @see {@link https://ampache.org/api/api-json-methods#live_stream_delete}
99
- */
100
- liveStreamDelete (params: {
101
- filter: string,
102
- }) {
103
- let query = 'live_stream_delete';
104
- query += qs.stringify(params, '&');
105
- return this.request<Success>(query);
106
- }
107
- }
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,10 +1,16 @@
1
- import { UID } from "../base";
2
-
3
- export type LiveStream = {
4
- id: UID,
5
- name: string,
6
- url: string,
7
- codec: string,
8
- catalog: UID,
9
- site_url: string,
10
- }
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
+ };