javascript-ampache 1.0.7 → 1.0.9

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.
@@ -1,5 +1,5 @@
1
1
  import { Label } from './types';
2
- import { Base, BinaryBoolean, Pagination, UID } from '../base';
2
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
3
3
  export declare class Labels extends Base {
4
4
  /**
5
5
  * This returns labels based on the specified filter
@@ -10,6 +10,8 @@ export declare class Labels extends Base {
10
10
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
11
11
  * @param [params.offset]
12
12
  * @param [params.limit]
13
+ * @param [params.cond]
14
+ * @param [params.sort]
13
15
  * @see {@link https://ampache.org/api/api-json-methods#labels}
14
16
  */
15
17
  labels(params?: {
@@ -17,7 +19,7 @@ export declare class Labels extends Base {
17
19
  exact?: BinaryBoolean;
18
20
  add?: Date;
19
21
  update?: Date;
20
- } & Pagination): Promise<Label[] | {
22
+ } & ExtendedPagination): Promise<Label[] | {
21
23
  label: Label[];
22
24
  }>;
23
25
  /**
@@ -1,5 +1,5 @@
1
1
  import { License } from './types';
2
- import { Base, BinaryBoolean, Pagination, UID } from '../base';
2
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
3
3
  export declare class Licenses extends Base {
4
4
  /**
5
5
  * This returns licenses based on the specified filter
@@ -10,6 +10,8 @@ export declare class Licenses extends Base {
10
10
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
11
11
  * @param [params.offset]
12
12
  * @param [params.limit]
13
+ * @param [params.cond]
14
+ * @param [params.sort]
13
15
  * @see {@link https://ampache.org/api/api-json-methods#licenses}
14
16
  */
15
17
  licenses(params?: {
@@ -17,7 +19,7 @@ export declare class Licenses extends Base {
17
19
  exact?: BinaryBoolean;
18
20
  add?: Date;
19
21
  update?: Date;
20
- } & Pagination): Promise<License[] | {
22
+ } & ExtendedPagination): Promise<License[] | {
21
23
  license: License[];
22
24
  }>;
23
25
  /**
@@ -1,5 +1,5 @@
1
1
  import { LiveStream } from './types';
2
- import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
2
+ import { Base, BinaryBoolean, ExtendedPagination, Success, UID } from '../base';
3
3
  export declare class LiveStreams extends Base {
4
4
  /**
5
5
  * This returns live_streams based on the specified filter
@@ -10,6 +10,8 @@ export declare class LiveStreams extends Base {
10
10
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
11
11
  * @param [params.offset]
12
12
  * @param [params.limit]
13
+ * @param [params.cond]
14
+ * @param [params.sort]
13
15
  * @see {@link https://ampache.org/api/api-json-methods#live_streams}
14
16
  */
15
17
  liveStreams(params?: {
@@ -17,7 +19,7 @@ export declare class LiveStreams extends Base {
17
19
  exact?: BinaryBoolean;
18
20
  add?: Date;
19
21
  update?: Date;
20
- } & Pagination): Promise<LiveStream[] | {
22
+ } & ExtendedPagination): Promise<LiveStream[] | {
21
23
  live_stream: LiveStream[];
22
24
  }>;
23
25
  /**
@@ -1,6 +1,6 @@
1
1
  import { Playlist } from './types';
2
2
  import { Song } from "../songs/types";
3
- import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
3
+ import { Base, BinaryBoolean, ExtendedPagination, Pagination, Success, UID } from '../base';
4
4
  export declare class Playlists extends Base {
5
5
  /**
6
6
  * This returns playlists based on the specified filter
@@ -13,6 +13,8 @@ export declare class Playlists extends Base {
13
13
  * @param [params.show_dupes] 0, 1 (if true ignore 'api_hide_dupe_searches' setting)
14
14
  * @param [params.offset]
15
15
  * @param [params.limit]
16
+ * @param [params.cond]
17
+ * @param [params.sort]
16
18
  * @see {@link https://ampache.org/api/api-json-methods#playlists}
17
19
  */
18
20
  playlists(params?: {
@@ -22,7 +24,7 @@ export declare class Playlists extends Base {
22
24
  update?: Date;
23
25
  hide_search?: BinaryBoolean;
24
26
  show_dupes?: BinaryBoolean;
25
- } & Pagination): Promise<Playlist[] | {
27
+ } & ExtendedPagination): Promise<Playlist[] | {
26
28
  playlist: Playlist[];
27
29
  }>;
28
30
  /**
@@ -62,6 +64,8 @@ export declare class Playlists extends Base {
62
64
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
63
65
  * @param [params.offset]
64
66
  * @param [params.limit]
67
+ * @param [params.cond]
68
+ * @param [params.sort]
65
69
  * @see {@link https://ampache.org/api/api-json-methods#user_playlists}
66
70
  */
67
71
  userPlaylists(params?: {
@@ -69,7 +73,7 @@ export declare class Playlists extends Base {
69
73
  exact?: BinaryBoolean;
70
74
  add?: Date;
71
75
  update?: Date;
72
- } & Pagination): Promise<Playlist[] | {
76
+ } & ExtendedPagination): Promise<Playlist[] | {
73
77
  playlist: Playlist[];
74
78
  }>;
75
79
  /**
@@ -81,6 +85,8 @@ export declare class Playlists extends Base {
81
85
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
82
86
  * @param [params.offset]
83
87
  * @param [params.limit]
88
+ * @param [params.cond]
89
+ * @param [params.sort]
84
90
  * @see {@link https://ampache.org/api/api-json-methods#user_smartlists}
85
91
  */
86
92
  userSmartlists(params?: {
@@ -88,7 +94,7 @@ export declare class Playlists extends Base {
88
94
  exact?: BinaryBoolean;
89
95
  add?: Date;
90
96
  update?: Date;
91
- } & Pagination): Promise<Playlist[] | {
97
+ } & ExtendedPagination): Promise<Playlist[] | {
92
98
  playlist: Playlist[];
93
99
  }>;
94
100
  /**
@@ -116,7 +122,7 @@ export declare class Playlists extends Base {
116
122
  type: 'song' | 'album' | 'artist' | 'playlist';
117
123
  }): Promise<Success>;
118
124
  /**
119
- * This modifies name and type of a playlist.
125
+ * This modifies name and type of the playlist.
120
126
  * NOTE items and tracks must be sent together and be of equal length.
121
127
  * @remarks MINIMUM_API_VERSION=400001
122
128
  * @param params.filter UID to find
@@ -1,5 +1,5 @@
1
1
  import { Podcast, PodcastEpisode, DeletedPodcastEpisode } from './types';
2
- import { Base, Pagination, Success, UID } from '../base';
2
+ import { Base, ExtendedPagination, Pagination, Success, UID } from '../base';
3
3
  export declare class Podcasts extends Base {
4
4
  /**
5
5
  * Get information about podcasts
@@ -8,12 +8,14 @@ export declare class Podcasts extends Base {
8
8
  * @param [params.include] episodes (include podcast_episodes in the response)
9
9
  * @param [params.offset]
10
10
  * @param [params.limit]
11
+ * @param [params.cond]
12
+ * @param [params.sort]
11
13
  * @see {@link https://ampache.org/api/api-json-methods#podcasts}
12
14
  */
13
15
  podcasts(params?: {
14
16
  filter?: string;
15
17
  include?: 'episodes';
16
- } & Pagination): Promise<Podcast[] | {
18
+ } & ExtendedPagination): Promise<Podcast[] | {
17
19
  podcast: Podcast[];
18
20
  }>;
19
21
  /**
@@ -76,11 +78,13 @@ export declare class Podcasts extends Base {
76
78
  * @param params.filter UID of podcast
77
79
  * @param [params.offset]
78
80
  * @param [params.limit]
81
+ * @param [params.cond]
82
+ * @param [params.sort]
79
83
  * @see {@link https://ampache.org/api/api-json-methods#podcast_episodes}
80
84
  */
81
85
  podcastEpisodes(params: {
82
86
  filter: UID;
83
- } & Pagination): Promise<PodcastEpisode[] | {
87
+ } & ExtendedPagination): Promise<PodcastEpisode[] | {
84
88
  podcast_episode: PodcastEpisode[];
85
89
  }>;
86
90
  /**
@@ -1,5 +1,5 @@
1
1
  import { Share } from './types';
2
- import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
2
+ import { Base, BinaryBoolean, ExtendedPagination, Success, UID } from '../base';
3
3
  export declare class Shares extends Base {
4
4
  /**
5
5
  * This searches the shares and returns... shares
@@ -8,12 +8,14 @@ export declare class Shares extends Base {
8
8
  * @param [params.exact] 0, 1 boolean to match the exact filter string
9
9
  * @param [params.offset]
10
10
  * @param [params.limit]
11
+ * @param [params.cond]
12
+ * @param [params.sort]
11
13
  * @see {@link https://ampache.org/api/api-json-methods#shares}
12
14
  */
13
15
  shares(params?: {
14
16
  filter?: string;
15
17
  exact?: BinaryBoolean;
16
- } & Pagination): Promise<Share[] | {
18
+ } & ExtendedPagination): Promise<Share[] | {
17
19
  share: Share[];
18
20
  }>;
19
21
  /**
@@ -1,5 +1,5 @@
1
1
  import { Song, DeletedSong } from './types';
2
- import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
2
+ import { Base, BinaryBoolean, ExtendedPagination, Pagination, Success, UID } from '../base';
3
3
  export declare class Songs extends Base {
4
4
  /**
5
5
  * Returns songs based on the specified filter
@@ -10,6 +10,8 @@ export declare class Songs extends Base {
10
10
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
11
11
  * @param [params.offset]
12
12
  * @param [params.limit]
13
+ * @param [params.cond]
14
+ * @param [params.sort]
13
15
  * @see {@link https://ampache.org/api/api-json-methods#songs}
14
16
  */
15
17
  songs(params?: {
@@ -17,7 +19,7 @@ export declare class Songs extends Base {
17
19
  exact?: BinaryBoolean;
18
20
  add?: Date;
19
21
  update?: Date;
20
- } & Pagination): Promise<Song[] | {
22
+ } & ExtendedPagination): Promise<Song[] | {
21
23
  song: Song[];
22
24
  }>;
23
25
  /**
@@ -36,12 +38,14 @@ export declare class Songs extends Base {
36
38
  * @param [params.top50] 0, 1 (if true filter to the artist top 50)
37
39
  * @param [params.offset]
38
40
  * @param [params.limit]
41
+ * @param [params.cond]
42
+ * @param [params.sort]
39
43
  * @see {@link https://ampache.org/api/api-json-methods#artist_songs}
40
44
  */
41
45
  artistSongs(params: {
42
46
  filter: UID;
43
47
  top50?: BinaryBoolean;
44
- } & Pagination): Promise<Song[] | {
48
+ } & ExtendedPagination): Promise<Song[] | {
45
49
  song: Song[];
46
50
  }>;
47
51
  /**
@@ -50,11 +54,13 @@ export declare class Songs extends Base {
50
54
  * @param params.filter UID to find
51
55
  * @param [params.offset]
52
56
  * @param [params.limit]
57
+ * @param [params.cond]
58
+ * @param [params.sort]
53
59
  * @see {@link https://ampache.org/api/api-json-methods#album_songs}
54
60
  */
55
61
  albumSongs(params: {
56
62
  filter: UID;
57
- } & Pagination): Promise<Song[] | {
63
+ } & ExtendedPagination): Promise<Song[] | {
58
64
  song: Song[];
59
65
  }>;
60
66
  /**
@@ -63,11 +69,13 @@ export declare class Songs extends Base {
63
69
  * @param params.filter UID to find
64
70
  * @param [params.offset]
65
71
  * @param [params.limit]
72
+ * @param [params.cond]
73
+ * @param [params.sort]
66
74
  * @see {@link https://ampache.org/api/api-json-methods#genre_songs}
67
75
  */
68
76
  genreSongs(params: {
69
77
  filter: UID;
70
- } & Pagination): Promise<Song[] | {
78
+ } & ExtendedPagination): Promise<Song[] | {
71
79
  song: Song[];
72
80
  }>;
73
81
  /**
@@ -91,11 +99,13 @@ export declare class Songs extends Base {
91
99
  * @param params.filter UID to find
92
100
  * @param [params.offset]
93
101
  * @param [params.limit]
102
+ * @param [params.cond]
103
+ * @param [params.sort]
94
104
  * @see {@link https://ampache.org/api/api-json-methods#license_songs}
95
105
  */
96
106
  licenseSongs(params: {
97
107
  filter: UID;
98
- } & Pagination): Promise<Song[] | {
108
+ } & ExtendedPagination): Promise<Song[] | {
99
109
  song: Song[];
100
110
  }>;
101
111
  /**
@@ -1,4 +1,4 @@
1
- import { Base, BinaryBoolean, Pagination, Success, UID } from '../base';
1
+ import { Base, BinaryBoolean, ExtendedPagination, Pagination, Success, UID } from '../base';
2
2
  import { IndexEntry } from "./types";
3
3
  export declare class System extends Base {
4
4
  /**
@@ -18,6 +18,8 @@ export declare class System extends Base {
18
18
  * @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
19
19
  * @param [params.offset]
20
20
  * @param [params.limit]
21
+ * @param [params.cond]
22
+ * @param [params.sort]
21
23
  * @see {@link https://ampache.org/api/api-json-methods#get_indexes}
22
24
  * @deprecated Being removed in 7.0.0. Use `list` instead.
23
25
  */
@@ -28,7 +30,7 @@ export declare class System extends Base {
28
30
  update?: Date;
29
31
  include?: BinaryBoolean;
30
32
  hide_search?: BinaryBoolean;
31
- } & Pagination): Promise<any>;
33
+ } & ExtendedPagination): Promise<any>;
32
34
  /**
33
35
  * This takes a named array of objects and returning `id`, `name`, `prefix` and `basename`
34
36
  * @remarks MINIMUM_API_VERSION=6.0.0
@@ -39,6 +41,8 @@ export declare class System extends Base {
39
41
  * @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
40
42
  * @param [params.offset]
41
43
  * @param [params.limit]
44
+ * @param [params.cond]
45
+ * @param [params.sort]
42
46
  * @see {@link https://ampache.org/api/api-json-methods#list}
43
47
  */
44
48
  list(params: {
@@ -47,7 +51,7 @@ export declare class System extends Base {
47
51
  add?: Date;
48
52
  update?: Date;
49
53
  hide_search?: BinaryBoolean;
50
- } & Pagination): Promise<{
54
+ } & ExtendedPagination): Promise<{
51
55
  list: IndexEntry[];
52
56
  }>;
53
57
  /**
@@ -62,6 +66,8 @@ export declare class System extends Base {
62
66
  * @param [params.hide_search] 0, 1 (if true do not include searches/smartlists in the result)
63
67
  * @param [params.offset]
64
68
  * @param [params.limit]
69
+ * @param [params.cond]
70
+ * @param [params.sort]
65
71
  * @see {@link https://ampache.org/api/api-json-methods#index}
66
72
  */
67
73
  index(params: {
@@ -72,7 +78,7 @@ export declare class System extends Base {
72
78
  update?: Date;
73
79
  include?: BinaryBoolean;
74
80
  hide_search?: BinaryBoolean;
75
- } & Pagination): Promise<{
81
+ } & ExtendedPagination): Promise<{
76
82
  index: [];
77
83
  }>;
78
84
  /**
@@ -86,6 +92,8 @@ export declare class System extends Base {
86
92
  * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
87
93
  * @param [params.offset]
88
94
  * @param [params.limit]
95
+ * @param [params.cond]
96
+ * @param [params.sort]
89
97
  * @see {@link https://ampache.org/api/api-json-methods#browse}
90
98
  */
91
99
  browse(params: {
@@ -94,7 +102,7 @@ export declare class System extends Base {
94
102
  catalog?: number;
95
103
  add?: Date;
96
104
  update?: Date;
97
- } & Pagination): Promise<{
105
+ } & ExtendedPagination): Promise<{
98
106
  browse: IndexEntry[];
99
107
  }>;
100
108
  /**
@@ -244,7 +252,7 @@ export declare class System extends Base {
244
252
  * @param params.id UID to find
245
253
  * @param params.type Object type
246
254
  * @param [params.bitrate] Max bitrate for transcoding
247
- * @param [params.format] mp3, ogg, raw, etc (raw returns the original format)
255
+ * @param [params.format] mp3, ogg, raw, etc. (raw returns the original format)
248
256
  * @param [params.offset] Time offset
249
257
  * @param [params.length] 0, 1 (estimate content length)
250
258
  * @see {@link https://ampache.org/api/api-json-methods#stream}
@@ -263,7 +271,7 @@ export declare class System extends Base {
263
271
  * @remarks MINIMUM_API_VERSION=400001
264
272
  * @param params.id UID to find
265
273
  * @param params.type Object type
266
- * @param [params.format] mp3, ogg, raw, etc (raw returns the original format)
274
+ * @param [params.format] mp3, ogg, raw, etc. (raw returns the original format)
267
275
  * @see {@link https://ampache.org/api/api-json-methods#download}
268
276
  */
269
277
  download(params: {
@@ -1,5 +1,5 @@
1
1
  import { User, UserSummary, Activity } from './types';
2
- import { Base, BinaryBoolean, Success } from '../base';
2
+ import { Base, BinaryBoolean, ExtendedPagination, Success } from '../base';
3
3
  export declare class Users extends Base {
4
4
  /**
5
5
  * Get ids and usernames for your site
@@ -130,11 +130,15 @@ export declare class Users extends Base {
130
130
  * This gets the followers for the requested username
131
131
  * @remarks MINIMUM_API_VERSION=380001
132
132
  * @param params.username UID to find
133
+ * @param [params.offset]
134
+ * @param [params.limit]
135
+ * @param [params.cond]
136
+ * @param [params.sort]
133
137
  * @see {@link https://ampache.org/api/api-json-methods#followers}
134
138
  */
135
139
  followers(params: {
136
140
  username: string;
137
- }): Promise<UserSummary[] | {
141
+ } & ExtendedPagination): Promise<UserSummary[] | {
138
142
  user: UserSummary[];
139
143
  }>;
140
144
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-ampache",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A JS library for the Ampache API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.m.js",
@@ -13,14 +13,14 @@
13
13
  "test": "jest"
14
14
  },
15
15
  "devDependencies": {
16
- "@types/jest": "^25.2.1",
16
+ "@types/jest": "^25.2.3",
17
+ "isomorphic-unfetch": "^3.1.0",
17
18
  "jest": "^29.3.1",
19
+ "jssha": "^3.3.0",
18
20
  "microbundle": "^0.15.1",
19
21
  "nock": "^13.0.0",
20
- "rimraf": "^5.0.0",
21
- "isomorphic-unfetch": "^3.0.0",
22
- "jssha": "^3.3.0",
23
- "querystringify": "2.2.0"
22
+ "querystringify": "2.2.0",
23
+ "rimraf": "^5.0.0"
24
24
  },
25
25
  "keywords": [
26
26
  "ampache",
@@ -1,6 +1,6 @@
1
1
  import qs from 'querystringify';
2
2
  import { Album } from './types';
3
- import { Base, BinaryBoolean, Pagination, UID } from '../base';
3
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
4
4
 
5
5
  export class Albums extends Base {
6
6
  /**
@@ -13,6 +13,8 @@ export class Albums extends Base {
13
13
  * @param [params.include] albums, songs (include child objects in the response)
14
14
  * @param [params.offset]
15
15
  * @param [params.limit]
16
+ * @param [params.cond]
17
+ * @param [params.sort]
16
18
  * @see {@link https://ampache.org/api/api-json-methods#albums}
17
19
  */
18
20
  async albums (params?: {
@@ -21,7 +23,7 @@ export class Albums extends Base {
21
23
  add?: Date,
22
24
  update?: Date,
23
25
  include?: "albums" | "songs",
24
- } & Pagination) {
26
+ } & ExtendedPagination) {
25
27
  let query = 'albums';
26
28
  query += qs.stringify(params, '&');
27
29
  let data = await this.request<{album: Album[]}>(query);
@@ -50,11 +52,13 @@ export class Albums extends Base {
50
52
  * @param params.filter UID to find
51
53
  * @param [params.offset]
52
54
  * @param [params.limit]
55
+ * @param [params.cond]
56
+ * @param [params.sort]
53
57
  * @see {@link https://ampache.org/api/api-json-methods#artist_albums}
54
58
  */
55
59
  async artistAlbums (params: {
56
60
  filter: UID
57
- } & Pagination) {
61
+ } & ExtendedPagination) {
58
62
  let query = 'artist_albums';
59
63
  query += qs.stringify(params, '&');
60
64
  let data = await this.request<{album: Album[]}>(query);
@@ -67,11 +71,13 @@ export class Albums extends Base {
67
71
  * @param params.filter UID to find
68
72
  * @param [params.offset]
69
73
  * @param [params.limit]
74
+ * @param [params.cond]
75
+ * @param [params.sort]
70
76
  * @see {@link https://ampache.org/api/api-json-methods#genre_albums}
71
77
  */
72
78
  async genreAlbums (params?: {
73
79
  filter: UID
74
- } & Pagination) {
80
+ } & ExtendedPagination) {
75
81
  let query = 'genre_albums';
76
82
  query += qs.stringify(params, '&');
77
83
  let data = await this.request<{album: Album[]}>(query);
@@ -1,6 +1,6 @@
1
1
  import qs from 'querystringify';
2
2
  import { Artist } from './types';
3
- import { Base, BinaryBoolean, Pagination, UID } from '../base';
3
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
4
4
 
5
5
  export class Artists extends Base {
6
6
  /**
@@ -14,6 +14,8 @@ export class Artists extends Base {
14
14
  * @param [params.album_artist] 0, 1 (if true filter for album artists only)
15
15
  * @param [params.offset]
16
16
  * @param [params.limit]
17
+ * @param [params.cond]
18
+ * @param [params.sort]
17
19
  * @see {@link https://ampache.org/api/api-json-methods#artists}
18
20
  */
19
21
  async artists (params?: {
@@ -23,7 +25,7 @@ export class Artists extends Base {
23
25
  update?: Date,
24
26
  include?: 'albums' | 'songs',
25
27
  album_artist?: BinaryBoolean,
26
- } & Pagination) {
28
+ } & ExtendedPagination) {
27
29
  let query = 'artists';
28
30
  query += qs.stringify(params, '&');
29
31
  let data = await this.request<{artist: Artist[]}>(query);
@@ -52,11 +54,13 @@ export class Artists extends Base {
52
54
  * @param params.filter UID to find
53
55
  * @param [params.offset]
54
56
  * @param [params.limit]
57
+ * @param [params.cond]
58
+ * @param [params.sort]
55
59
  * @see {@link https://ampache.org/api/api-json-methods#genre_artists}
56
60
  */
57
61
  async genreArtists (params: {
58
62
  filter: UID
59
- } & Pagination) {
63
+ } & ExtendedPagination) {
60
64
  let query = 'genre_artists';
61
65
  query += qs.stringify(params, '&');
62
66
  let data = await this.request<{artist: Artist[]}>(query);
@@ -69,11 +73,13 @@ export class Artists extends Base {
69
73
  * @param params.filter UID of find
70
74
  * @param [params.offset]
71
75
  * @param [params.limit]
76
+ * @param [params.cond]
77
+ * @param [params.sort]
72
78
  * @see {@link https://ampache.org/api/api-json-methods#label_artists}
73
79
  */
74
80
  async labelArtists (params: {
75
81
  filter: UID
76
- } & Pagination) {
82
+ } & ExtendedPagination) {
77
83
  let query = 'label_artists';
78
84
  query += qs.stringify(params, '&');
79
85
  let data = await this.request<{artist: Artist[]}>(query);
package/src/base.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import fetch from 'isomorphic-unfetch';
2
+ import qs from 'querystringify';
2
3
 
3
4
  type Config = {
4
5
  url: string,
@@ -19,6 +20,17 @@ export type Pagination = {
19
20
  limit?: number,
20
21
  }
21
22
 
23
+ /**
24
+ * @param [offset] Return results starting from this index position
25
+ * @param [limit] Maximum number of results to return
26
+ * @param [cond] Apply additional filters to the browse using ; separated comma string pairs (e.g. 'filter1,value1;filter2,value2')
27
+ * @param [sort] Sort name or comma-separated key pair. (e.g. 'name,order') Default order 'ASC' (e.g. 'name,ASC' == 'name')
28
+ */
29
+ export type ExtendedPagination = Pagination & {
30
+ cond?: string,
31
+ sort?: string,
32
+ }
33
+
22
34
  export type BinaryBoolean = 0 | 1;
23
35
 
24
36
  export type UID = string | number;
@@ -83,4 +95,25 @@ export abstract class Base {
83
95
  public setSessionKey(sessionKey: string) {
84
96
  this.sessionKey = sessionKey;
85
97
  }
98
+
99
+ /**
100
+ * Construct and return a URL
101
+ * @param endpoint
102
+ * @param [params]
103
+ */
104
+ public rawURL(endpoint: string, params?: {}) {
105
+ let query = endpoint;
106
+ query += qs.stringify(params, '&');
107
+
108
+ let url = this.url + "/server/json.server.php?action=" + query + "&version=" + this.version;
109
+
110
+ if (this.debug) {
111
+ console.debug(
112
+ "javascript-ampache query URL %c" + url + "&auth=" + this.sessionKey,
113
+ "color: black; font-style: italic; background-color: orange;padding: 2px"
114
+ );
115
+ }
116
+
117
+ return url;
118
+ }
86
119
  }
@@ -37,7 +37,7 @@ export class Bookmarks extends Base {
37
37
  }
38
38
 
39
39
  /**
40
- * Get the bookmark from it's object_id and object_type.
40
+ * Get the bookmark from its object_id and object_type.
41
41
  * @remarks MINIMUM_API_VERSION=5.0.0
42
42
  * @param params.filter UID to find
43
43
  * @param params.type Object type
@@ -1,17 +1,21 @@
1
1
  import qs from 'querystringify';
2
2
  import { Catalog } from './types';
3
- import { Base, Success, UID } from '../base';
3
+ import {Base, ExtendedPagination, Success, UID} from '../base';
4
4
 
5
5
  export class Catalogs extends Base {
6
6
  /**
7
7
  * This searches the catalogs and returns... catalogs
8
8
  * @remarks MINIMUM_API_VERSION=420000
9
9
  * @param [params.filter] Catalog type
10
+ * @param [params.offset]
11
+ * @param [params.limit]
12
+ * @param [params.cond]
13
+ * @param [params.sort]
10
14
  * @see {@link https://ampache.org/api/api-json-methods#catalogs}
11
15
  */
12
16
  async catalogs (params?: {
13
17
  filter?: 'music' | 'clip' | 'tvshow' | 'movie' | 'personal_video' | 'podcast',
14
- }) {
18
+ } & ExtendedPagination) {
15
19
  let query = 'catalogs';
16
20
  query += qs.stringify(params, '&');
17
21
  let data = await this.request<{catalog: Catalog[]}>(query);
@@ -1,6 +1,6 @@
1
1
  import qs from 'querystringify';
2
2
  import { Genre } from './types';
3
- import { Base, BinaryBoolean, Pagination, UID } from '../base';
3
+ import { Base, BinaryBoolean, ExtendedPagination, UID } from '../base';
4
4
 
5
5
  export class Genres extends Base {
6
6
  /**
@@ -10,12 +10,14 @@ export class Genres extends Base {
10
10
  * @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
11
11
  * @param [params.offset]
12
12
  * @param [params.limit]
13
+ * @param [params.cond]
14
+ * @param [params.sort]
13
15
  * @see {@link https://ampache.org/api/api-json-methods#genres}
14
16
  */
15
17
  async genres (params?: {
16
18
  filter?: string,
17
19
  exact?: BinaryBoolean,
18
- } & Pagination) {
20
+ } & ExtendedPagination) {
19
21
  let query = 'genres';
20
22
  query += qs.stringify(params, '&');
21
23
  let data = await this.request<{genre: Genre[]}>(query);