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,86 +1,86 @@
1
- import qs from 'querystringify';
2
- import { Album } from './types';
3
- import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
4
-
5
- export class Albums extends Base {
6
- /**
7
- * This returns albums based on the provided search filters
8
- * @remarks MINIMUM_API_VERSION=380001
9
- * @param [params.filter] UID to find
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.include] albums, songs (include child objects in the response)
14
- * @param [params.offset]
15
- * @param [params.limit]
16
- * @param [params.cond]
17
- * @param [params.sort]
18
- * @see {@link https://ampache.org/api/api-json-methods#albums}
19
- */
20
- async albums (params?: {
21
- filter?: number,
22
- exact?: BinaryBoolean,
23
- add?: Date,
24
- update?: Date,
25
- include?: "albums" | "songs",
26
- } & ExtendedPagination) {
27
- let query = 'albums';
28
- query += qs.stringify(params, '&');
29
- let data = await this.request<{album: Album[]}>(query);
30
- return (data.album) ? data.album : data;
31
- }
32
-
33
- /**
34
- * This returns a single album based on the UID provided
35
- * @remarks MINIMUM_API_VERSION=380001
36
- * @param params.filter UID to find
37
- * @param [params.include] songs (include child objects in the response)
38
- * @see {@link https://ampache.org/api/api-json-methods#album}
39
- */
40
- album (params: {
41
- filter: UID,
42
- include?: 'songs'
43
- }) {
44
- let query = 'album';
45
- query += qs.stringify(params, '&');
46
- return this.request<Album>(query);
47
- }
48
-
49
- /**
50
- * This returns the albums of an artist
51
- * @remarks MINIMUM_API_VERSION=380001
52
- * @param params.filter UID to find
53
- * @param [params.offset]
54
- * @param [params.limit]
55
- * @param [params.cond]
56
- * @param [params.sort]
57
- * @see {@link https://ampache.org/api/api-json-methods#artist_albums}
58
- */
59
- async artistAlbums (params: {
60
- filter: UID
61
- } & ExtendedPagination) {
62
- let query = 'artist_albums';
63
- query += qs.stringify(params, '&');
64
- let data = await this.request<{album: Album[]}>(query);
65
- return (data.album) ? data.album : data;
66
- }
67
-
68
- /**
69
- * This returns the albums associated with the genre in question
70
- * @remarks MINIMUM_API_VERSION=380001
71
- * @param params.filter UID to find
72
- * @param [params.offset]
73
- * @param [params.limit]
74
- * @param [params.cond]
75
- * @param [params.sort]
76
- * @see {@link https://ampache.org/api/api-json-methods#genre_albums}
77
- */
78
- async genreAlbums (params?: {
79
- filter: UID
80
- } & ExtendedPagination) {
81
- let query = 'genre_albums';
82
- query += qs.stringify(params, '&');
83
- let data = await this.request<{album: Album[]}>(query);
84
- return (data.album) ? data.album : data;
85
- }
86
- }
1
+ import qs from "querystringify";
2
+ import { AlbumResponse, AlbumsResponse } from "./types";
3
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
4
+
5
+ export class Albums extends Base {
6
+ /**
7
+ * This returns albums based on the provided search filters
8
+ * @remarks MINIMUM_API_VERSION=380001
9
+ * @param [params.filter] UID to find
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.include] albums, songs (include child objects in the response)
14
+ * @param [params.offset]
15
+ * @param [params.limit]
16
+ * @param [params.cond]
17
+ * @param [params.sort]
18
+ * @see {@link https://ampache.org/api/api-json-methods#albums}
19
+ */
20
+ albums(
21
+ params?: {
22
+ filter?: number;
23
+ exact?: BinaryBoolean;
24
+ add?: Date;
25
+ update?: Date;
26
+ include?: "albums" | "songs";
27
+ } & ExtendedPagination,
28
+ ) {
29
+ let query = "albums";
30
+ query += qs.stringify(params, "&");
31
+ return this.request<AlbumsResponse>(query);
32
+ }
33
+
34
+ /**
35
+ * This returns a single album based on the UID provided
36
+ * @remarks MINIMUM_API_VERSION=380001
37
+ * @param params.filter UID to find
38
+ * @param [params.include] songs (include child objects in the response)
39
+ * @see {@link https://ampache.org/api/api-json-methods#album}
40
+ */
41
+ album(params: { filter: UID; include?: "songs" }) {
42
+ let query = "album";
43
+ query += qs.stringify(params, "&");
44
+ return this.request<AlbumResponse>(query);
45
+ }
46
+
47
+ /**
48
+ * This returns the albums of an artist
49
+ * @remarks MINIMUM_API_VERSION=380001
50
+ * @param params.filter UID to find
51
+ * @param [params.offset]
52
+ * @param [params.limit]
53
+ * @param [params.cond]
54
+ * @param [params.sort]
55
+ * @see {@link https://ampache.org/api/api-json-methods#artist_albums}
56
+ */
57
+ artistAlbums(
58
+ params: {
59
+ filter: UID;
60
+ } & ExtendedPagination,
61
+ ) {
62
+ let query = "artist_albums";
63
+ query += qs.stringify(params, "&");
64
+ return this.request<AlbumsResponse>(query);
65
+ }
66
+
67
+ /**
68
+ * This returns the albums associated with the genre in question
69
+ * @remarks MINIMUM_API_VERSION=380001
70
+ * @param params.filter UID to find
71
+ * @param [params.offset]
72
+ * @param [params.limit]
73
+ * @param [params.cond]
74
+ * @param [params.sort]
75
+ * @see {@link https://ampache.org/api/api-json-methods#genre_albums}
76
+ */
77
+ genreAlbums(
78
+ params?: {
79
+ filter: UID;
80
+ } & ExtendedPagination,
81
+ ) {
82
+ let query = "genre_albums";
83
+ query += qs.stringify(params, "&");
84
+ return this.request<AlbumsResponse>(query);
85
+ }
86
+ }
@@ -1,32 +1,38 @@
1
- import { UID } from '../base';
2
- import { GenreSummary } from "../genres/types";
3
- import { ArtistSummary } from "../artists/types";
4
- import { Song } from "../songs/types";
5
-
6
- export type AlbumSummary = {
7
- id: UID,
8
- name: string,
9
- prefix: string | null,
10
- basename: string,
11
- }
12
-
13
- export type Album = {
14
- id: UID,
15
- name: string,
16
- prefix: string | null,
17
- basename: string,
18
- artist: ArtistSummary,
19
- time: number,
20
- year: number | string,
21
- tracks?: Song[],
22
- songcount: number,
23
- disccount: number,
24
- type: string | null,
25
- genre: GenreSummary[],
26
- art: string,
27
- has_art: boolean,
28
- flag: boolean,
29
- rating: number | null,
30
- averagerating: number | null,
31
- mbid: string | null
32
- }
1
+ import { UID } from "../base";
2
+ import { GenreSummary } from "../genres/types";
3
+ import { ArtistSummary } from "../artists/types";
4
+ import { SongResponse } from "../songs/types";
5
+
6
+ export type AlbumSummary = {
7
+ id: UID;
8
+ name: string;
9
+ prefix: string | null;
10
+ basename: string;
11
+ };
12
+
13
+ export type AlbumResponse = {
14
+ id: UID;
15
+ name: string;
16
+ prefix: string | null;
17
+ basename: string;
18
+ artist: ArtistSummary;
19
+ time: number;
20
+ year: number | string;
21
+ tracks?: SongResponse[];
22
+ songcount: number;
23
+ disccount: number;
24
+ type: string | null;
25
+ genre: GenreSummary[];
26
+ art: string;
27
+ has_art: boolean;
28
+ flag: boolean;
29
+ rating: number | null;
30
+ averagerating: number | null;
31
+ mbid: string | null;
32
+ };
33
+
34
+ export type AlbumsResponse = {
35
+ total_count: number;
36
+ md5: string;
37
+ album: AlbumResponse[];
38
+ };
@@ -1,88 +1,88 @@
1
- import qs from 'querystringify';
2
- import { Artist } from './types';
3
- import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
4
-
5
- export class Artists extends Base {
6
- /**
7
- * This takes a collection of inputs and returns artist objects
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.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.include] (albums | songs) include child objects in the response
14
- * @param [params.album_artist] 0, 1 (if true filter for album artists only)
15
- * @param [params.offset]
16
- * @param [params.limit]
17
- * @param [params.cond]
18
- * @param [params.sort]
19
- * @see {@link https://ampache.org/api/api-json-methods#artists}
20
- */
21
- async artists (params?: {
22
- filter?: string,
23
- exact?: BinaryBoolean,
24
- add?: Date,
25
- update?: Date,
26
- include?: 'albums' | 'songs',
27
- album_artist?: BinaryBoolean,
28
- } & ExtendedPagination) {
29
- let query = 'artists';
30
- query += qs.stringify(params, '&');
31
- let data = await this.request<{artist: Artist[]}>(query);
32
- return (data.artist) ? data.artist : data;
33
- }
34
-
35
- /**
36
- * This returns a single artist based on the UID of said artist
37
- * @remarks MINIMUM_API_VERSION=380001
38
- * @param params.filter UID to find
39
- * @param [params.include] (albums | songs) include child objects in the response
40
- * @see {@link https://ampache.org/api/api-json-methods#artist}
41
- */
42
- artist (params: {
43
- filter: UID,
44
- include?: 'albums' | 'songs',
45
- }) {
46
- let query = 'artist';
47
- query += qs.stringify(params, '&');
48
- return this.request<Artist>(query);
49
- }
50
-
51
- /**
52
- * This returns the artists associated with the genre in question as defined by the UID
53
- * @remarks MINIMUM_API_VERSION=380001
54
- * @param params.filter UID to find
55
- * @param [params.offset]
56
- * @param [params.limit]
57
- * @param [params.cond]
58
- * @param [params.sort]
59
- * @see {@link https://ampache.org/api/api-json-methods#genre_artists}
60
- */
61
- async genreArtists (params: {
62
- filter: UID
63
- } & ExtendedPagination) {
64
- let query = 'genre_artists';
65
- query += qs.stringify(params, '&');
66
- let data = await this.request<{artist: Artist[]}>(query);
67
- return (data.artist) ? data.artist : data;
68
- }
69
-
70
- /**
71
- * This returns the artists associated with the label in question as defined by the UID
72
- * @remarks MINIMUM_API_VERSION=420000
73
- * @param params.filter UID of find
74
- * @param [params.offset]
75
- * @param [params.limit]
76
- * @param [params.cond]
77
- * @param [params.sort]
78
- * @see {@link https://ampache.org/api/api-json-methods#label_artists}
79
- */
80
- async labelArtists (params: {
81
- filter: UID
82
- } & ExtendedPagination) {
83
- let query = 'label_artists';
84
- query += qs.stringify(params, '&');
85
- let data = await this.request<{artist: Artist[]}>(query);
86
- return (data.artist) ? data.artist : data;
87
- }
88
- }
1
+ import qs from "querystringify";
2
+ import { ArtistResponse, ArtistsResponse } from "./types";
3
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
4
+
5
+ export class Artists extends Base {
6
+ /**
7
+ * This takes a collection of inputs and returns artist objects
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.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.include] (albums | songs) include child objects in the response
14
+ * @param [params.album_artist] 0, 1 (if true filter for album artists only)
15
+ * @param [params.offset]
16
+ * @param [params.limit]
17
+ * @param [params.cond]
18
+ * @param [params.sort]
19
+ * @see {@link https://ampache.org/api/api-json-methods#artists}
20
+ */
21
+ artists(
22
+ params?: {
23
+ filter?: string;
24
+ exact?: BinaryBoolean;
25
+ add?: Date;
26
+ update?: Date;
27
+ include?: "albums" | "songs";
28
+ album_artist?: BinaryBoolean;
29
+ } & ExtendedPagination,
30
+ ) {
31
+ let query = "artists";
32
+ query += qs.stringify(params, "&");
33
+ return this.request<ArtistsResponse>(query);
34
+ }
35
+
36
+ /**
37
+ * This returns a single artist based on the UID of said artist
38
+ * @remarks MINIMUM_API_VERSION=380001
39
+ * @param params.filter UID to find
40
+ * @param [params.include] (albums | songs) include child objects in the response
41
+ * @see {@link https://ampache.org/api/api-json-methods#artist}
42
+ */
43
+ artist(params: { filter: UID; include?: "albums" | "songs" }) {
44
+ let query = "artist";
45
+ query += qs.stringify(params, "&");
46
+ return this.request<ArtistResponse>(query);
47
+ }
48
+
49
+ /**
50
+ * This returns the artists associated with the genre in question as defined by the UID
51
+ * @remarks MINIMUM_API_VERSION=380001
52
+ * @param params.filter UID to find
53
+ * @param [params.offset]
54
+ * @param [params.limit]
55
+ * @param [params.cond]
56
+ * @param [params.sort]
57
+ * @see {@link https://ampache.org/api/api-json-methods#genre_artists}
58
+ */
59
+ genreArtists(
60
+ params: {
61
+ filter: UID;
62
+ } & ExtendedPagination,
63
+ ) {
64
+ let query = "genre_artists";
65
+ query += qs.stringify(params, "&");
66
+ return this.request<ArtistsResponse>(query);
67
+ }
68
+
69
+ /**
70
+ * This returns the artists associated with the label in question as defined by the UID
71
+ * @remarks MINIMUM_API_VERSION=420000
72
+ * @param params.filter UID of find
73
+ * @param [params.offset]
74
+ * @param [params.limit]
75
+ * @param [params.cond]
76
+ * @param [params.sort]
77
+ * @see {@link https://ampache.org/api/api-json-methods#label_artists}
78
+ */
79
+ labelArtists(
80
+ params: {
81
+ filter: UID;
82
+ } & ExtendedPagination,
83
+ ) {
84
+ let query = "label_artists";
85
+ query += qs.stringify(params, "&");
86
+ return this.request<ArtistsResponse>(query);
87
+ }
88
+ }
@@ -1,32 +1,38 @@
1
- import { Album } from "../albums/types";
2
- import { Song } from "../songs/types";
3
- import { Genre } from "../genres/types";
4
-
5
- export type ArtistSummary = {
6
- id: string,
7
- name: string,
8
- prefix: string | null,
9
- basename: string
10
- }
11
-
12
- export type Artist = {
13
- id: string,
14
- name: string,
15
- prefix: string | null,
16
- basename: string,
17
- albums: Album[],
18
- albumcount: number,
19
- songs: Song[],
20
- songcount: number,
21
- genre: Genre[],
22
- art: string,
23
- has_art: boolean,
24
- flag: boolean,
25
- rating: number | null,
26
- averagerating: number | null,
27
- mbid: string | null,
28
- summary: string,
29
- time: number,
30
- yearformed: number,
31
- placeformed: string,
32
- }
1
+ import { AlbumResponse } from "../albums/types";
2
+ import { Song } from "../songs/types";
3
+ import { GenreResponse } from "../genres/types";
4
+
5
+ export type ArtistSummary = {
6
+ id: string;
7
+ name: string;
8
+ prefix: string | null;
9
+ basename: string;
10
+ };
11
+
12
+ export type ArtistResponse = {
13
+ id: string;
14
+ name: string;
15
+ prefix: string | null;
16
+ basename: string;
17
+ albums: AlbumResponse[];
18
+ albumcount: number;
19
+ songs: Song[];
20
+ songcount: number;
21
+ genre: GenreResponse[];
22
+ art: string;
23
+ has_art: boolean;
24
+ flag: boolean;
25
+ rating: number | null;
26
+ averagerating: number | null;
27
+ mbid: string | null;
28
+ summary: string;
29
+ time: number;
30
+ yearformed: number;
31
+ placeformed: string;
32
+ };
33
+
34
+ export type ArtistsResponse = {
35
+ total_count: number;
36
+ md5: string;
37
+ artist: ArtistResponse[];
38
+ };