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.
Files changed (86) hide show
  1. package/README.md +50 -47
  2. package/dist/albums/index.d.ts +7 -13
  3. package/dist/albums/types.d.ts +9 -4
  4. package/dist/artists/index.d.ts +8 -14
  5. package/dist/artists/types.d.ts +10 -5
  6. package/dist/auth/index.d.ts +1 -1
  7. package/dist/base.d.ts +5 -0
  8. package/dist/bookmarks/index.d.ts +20 -21
  9. package/dist/bookmarks/types.d.ts +7 -2
  10. package/dist/catalogs/index.d.ts +9 -11
  11. package/dist/catalogs/types.d.ts +8 -3
  12. package/dist/genres/index.d.ts +4 -6
  13. package/dist/genres/types.d.ts +6 -1
  14. package/dist/index.d.ts +19 -19
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.m.js +1 -1
  18. package/dist/index.m.js.map +1 -1
  19. package/dist/index.modern.mjs +1 -1
  20. package/dist/index.modern.mjs.map +1 -1
  21. package/dist/index.umd.js +1 -1
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/labels/index.d.ts +4 -6
  24. package/dist/labels/types.d.ts +6 -1
  25. package/dist/licenses/index.d.ts +4 -6
  26. package/dist/licenses/types.d.ts +6 -1
  27. package/dist/live-streams/index.d.ts +8 -10
  28. package/dist/live-streams/types.d.ts +6 -1
  29. package/dist/playlists/index.d.ts +15 -25
  30. package/dist/playlists/types.d.ts +7 -2
  31. package/dist/podcasts/index.d.ts +10 -16
  32. package/dist/podcasts/types.d.ts +20 -5
  33. package/dist/preferences/index.d.ts +8 -16
  34. package/dist/preferences/types.d.ts +6 -1
  35. package/dist/shares/index.d.ts +7 -9
  36. package/dist/shares/types.d.ts +6 -1
  37. package/dist/shouts/index.d.ts +4 -4
  38. package/dist/shouts/types.d.ts +1 -1
  39. package/dist/songs/index.d.ts +12 -28
  40. package/dist/songs/types.d.ts +12 -2
  41. package/dist/system/index.d.ts +24 -24
  42. package/dist/system/types.d.ts +9 -9
  43. package/dist/users/index.d.ts +10 -10
  44. package/dist/users/types.d.ts +7 -2
  45. package/dist/videos/index.d.ts +5 -9
  46. package/dist/videos/types.d.ts +12 -2
  47. package/package.json +38 -38
  48. package/src/albums/index.ts +86 -86
  49. package/src/albums/types.ts +38 -32
  50. package/src/artists/index.ts +88 -88
  51. package/src/artists/types.ts +38 -32
  52. package/src/auth/index.ts +103 -103
  53. package/src/auth/types.ts +25 -25
  54. package/src/base.ts +134 -119
  55. package/src/bookmarks/index.ts +116 -122
  56. package/src/bookmarks/types.ts +15 -9
  57. package/src/catalogs/index.ts +130 -119
  58. package/src/catalogs/types.ts +27 -15
  59. package/src/genres/index.ts +39 -40
  60. package/src/genres/types.ts +23 -17
  61. package/src/index.ts +63 -26
  62. package/src/labels/index.ts +43 -44
  63. package/src/labels/types.ts +20 -14
  64. package/src/licenses/index.ts +43 -44
  65. package/src/licenses/types.ts +14 -8
  66. package/src/live-streams/index.ts +104 -107
  67. package/src/live-streams/types.ts +16 -10
  68. package/src/playlists/index.ts +262 -269
  69. package/src/playlists/types.ts +20 -14
  70. package/src/podcasts/index.ts +174 -177
  71. package/src/podcasts/types.ts +85 -67
  72. package/src/preferences/index.ts +114 -116
  73. package/src/preferences/types.ts +18 -12
  74. package/src/shares/index.ts +100 -96
  75. package/src/shares/types.ts +25 -19
  76. package/src/shouts/index.ts +18 -22
  77. package/src/shouts/types.ts +9 -9
  78. package/src/songs/index.ts +208 -203
  79. package/src/songs/types.ts +77 -65
  80. package/src/system/index.ts +689 -572
  81. package/src/system/types.ts +33 -19
  82. package/src/users/index.ts +227 -245
  83. package/src/users/types.ts +38 -32
  84. package/src/utils.ts +25 -25
  85. package/src/videos/index.ts +49 -53
  86. 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
+ };