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,53 +1,49 @@
1
- import qs from 'querystringify';
2
- import { Video, DeletedVideo } from './types';
3
- import { Base, BinaryBoolean, Pagination, UID } from '../base';
4
-
5
- export class Videos extends Base {
6
- /**
7
- * Get videos
8
- * @remarks MINIMUM_API_VERSION=380001
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.offset]
12
- * @param [params.limit]
13
- * @see {@link https://ampache.org/api/api-json-methods#videos}
14
- */
15
- async videos (params?: {
16
- filter?: string,
17
- exact?: BinaryBoolean,
18
- } & Pagination) {
19
- let query = 'videos';
20
- query += qs.stringify(params, '&');
21
- let data = await this.request<{video: Video[]}>(query);
22
- return (data.video) ? data.video : data;
23
- }
24
-
25
- /**
26
- * This returns a single video
27
- * @remarks MINIMUM_API_VERSION=380001
28
- * @param params.filter UID to find
29
- * @see {@link https://ampache.org/api/api-json-methods#video}
30
- */
31
- video (params: {
32
- filter: UID,
33
- }) {
34
- let query = 'video';
35
- query += qs.stringify(params, '&');
36
- return this.request<Video>(query);
37
- }
38
-
39
- /**
40
- * This returns video objects that have been deleted
41
- * @param [params.offset]
42
- * @param [params.limit]
43
- * @see {@link https://ampache.org/api/api-json-methods#deleted_videos}
44
- */
45
- async deletedVideos (params?: {
46
-
47
- } & Pagination) {
48
- let query = 'deleted_videos';
49
- query += qs.stringify(params, '&');
50
- let data = await this.request<{deleted_video: DeletedVideo[]}>(query);
51
- return (data.deleted_video) ? data.deleted_video : data;
52
- }
53
- }
1
+ import qs from "querystringify";
2
+ import { VideoResponse, VideosResponse, DeletedVideosResponse } from "./types";
3
+ import { Base, BinaryBoolean, Pagination, UID } from "../base";
4
+
5
+ export class Videos extends Base {
6
+ /**
7
+ * Get videos
8
+ * @remarks MINIMUM_API_VERSION=380001
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.offset]
12
+ * @param [params.limit]
13
+ * @see {@link https://ampache.org/api/api-json-methods#videos}
14
+ */
15
+ videos(
16
+ params?: {
17
+ filter?: string;
18
+ exact?: BinaryBoolean;
19
+ } & Pagination,
20
+ ) {
21
+ let query = "videos";
22
+ query += qs.stringify(params, "&");
23
+ return this.request<VideosResponse>(query);
24
+ }
25
+
26
+ /**
27
+ * This returns a single video
28
+ * @remarks MINIMUM_API_VERSION=380001
29
+ * @param params.filter UID to find
30
+ * @see {@link https://ampache.org/api/api-json-methods#video}
31
+ */
32
+ video(params: { filter: UID }) {
33
+ let query = "video";
34
+ query += qs.stringify(params, "&");
35
+ return this.request<VideoResponse>(query);
36
+ }
37
+
38
+ /**
39
+ * This returns video objects that have been deleted
40
+ * @param [params.offset]
41
+ * @param [params.limit]
42
+ * @see {@link https://ampache.org/api/api-json-methods#deleted_videos}
43
+ */
44
+ deletedVideos(params?: {} & Pagination) {
45
+ let query = "deleted_videos";
46
+ query += qs.stringify(params, "&");
47
+ return this.request<DeletedVideosResponse>(query);
48
+ }
49
+ }
@@ -1,30 +1,42 @@
1
- import { UID } from "../base";
2
- import { GenreSummary } from "../genres/types";
3
-
4
- export type Video = {
5
- id: UID,
6
- title: string,
7
- mime: string,
8
- resolution: string,
9
- size: number,
10
- genre: GenreSummary[],
11
- time: number,
12
- url: string,
13
- art: string,
14
- has_art: boolean,
15
- flag: boolean,
16
- rating: number | null,
17
- averagerating: number | null,
18
- playcount: number,
19
- }
20
-
21
- export type DeletedVideo = {
22
- id: UID,
23
- addition_time: number,
24
- delete_time: number,
25
- title: string,
26
- file: string,
27
- catalog: UID,
28
- total_count: number,
29
- total_skip: number,
30
- }
1
+ import { UID } from "../base";
2
+ import { GenreSummary } from "../genres/types";
3
+
4
+ export type VideoResponse = {
5
+ id: UID;
6
+ title: string;
7
+ mime: string;
8
+ resolution: string;
9
+ size: number;
10
+ genre: GenreSummary[];
11
+ time: number;
12
+ url: string;
13
+ art: string;
14
+ has_art: boolean;
15
+ flag: boolean;
16
+ rating: number | null;
17
+ averagerating: number | null;
18
+ playcount: number;
19
+ };
20
+
21
+ export type VideosResponse = {
22
+ total_count: number;
23
+ md5: string;
24
+ video: VideoResponse[];
25
+ };
26
+
27
+ export type DeletedVideoResponse = {
28
+ id: UID;
29
+ addition_time: number;
30
+ delete_time: number;
31
+ title: string;
32
+ file: string;
33
+ catalog: UID;
34
+ total_count: number;
35
+ total_skip: number;
36
+ };
37
+
38
+ export type DeletedVideosResponse = {
39
+ total_count: number;
40
+ md5: string;
41
+ deleted_video: DeletedVideoResponse[];
42
+ };