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.
- package/README.md +50 -47
- package/dist/base.d.ts +5 -0
- package/dist/index.js.map +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +38 -38
- package/src/albums/index.ts +86 -86
- package/src/albums/types.ts +38 -32
- package/src/artists/index.ts +88 -88
- package/src/artists/types.ts +38 -32
- package/src/auth/index.ts +103 -103
- package/src/auth/types.ts +25 -25
- package/src/base.ts +134 -119
- package/src/bookmarks/index.ts +115 -122
- package/src/bookmarks/types.ts +15 -9
- package/src/catalogs/index.ts +130 -119
- package/src/catalogs/types.ts +27 -15
- package/src/genres/index.ts +39 -40
- package/src/genres/types.ts +23 -17
- package/src/index.ts +63 -26
- package/src/labels/index.ts +43 -44
- package/src/labels/types.ts +20 -14
- package/src/licenses/index.ts +43 -44
- package/src/licenses/types.ts +14 -8
- package/src/live-streams/index.ts +104 -107
- package/src/live-streams/types.ts +16 -10
- package/src/playlists/index.ts +264 -269
- package/src/playlists/types.ts +20 -14
- package/src/podcasts/index.ts +174 -177
- package/src/podcasts/types.ts +85 -67
- package/src/preferences/index.ts +114 -116
- package/src/preferences/types.ts +18 -12
- package/src/shares/index.ts +100 -96
- package/src/shares/types.ts +25 -19
- package/src/shouts/index.ts +18 -22
- package/src/shouts/types.ts +9 -9
- package/src/songs/index.ts +208 -203
- package/src/songs/types.ts +77 -65
- package/src/system/index.ts +689 -572
- package/src/system/types.ts +33 -19
- package/src/users/index.ts +227 -245
- package/src/users/types.ts +38 -32
- package/src/utils.ts +25 -25
- package/src/videos/index.ts +49 -53
- package/src/videos/types.ts +42 -30
package/src/genres/index.ts
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
import { Base, BinaryBoolean, ExtendedPagination, UID } from
|
|
4
|
-
|
|
5
|
-
export class Genres extends Base {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
1
|
+
import qs from "querystringify";
|
|
2
|
+
import { GenreResponse, GenresResponse } from "./types";
|
|
3
|
+
import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
|
|
4
|
+
|
|
5
|
+
export class Genres extends Base {
|
|
6
|
+
/**
|
|
7
|
+
* This returns the genres (Tags) based on the specified filter
|
|
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.offset]
|
|
12
|
+
* @param [params.limit]
|
|
13
|
+
* @param [params.cond]
|
|
14
|
+
* @param [params.sort]
|
|
15
|
+
* @see {@link https://ampache.org/api/api-json-methods#genres}
|
|
16
|
+
*/
|
|
17
|
+
genres(
|
|
18
|
+
params?: {
|
|
19
|
+
filter?: string;
|
|
20
|
+
exact?: BinaryBoolean;
|
|
21
|
+
} & ExtendedPagination,
|
|
22
|
+
) {
|
|
23
|
+
let query = "genres";
|
|
24
|
+
query += qs.stringify(params, "&");
|
|
25
|
+
return this.request<GenresResponse>(query);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This returns a single genre based on UID
|
|
30
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
31
|
+
* @param params.filter UID to find
|
|
32
|
+
* @see {@link https://ampache.org/api/api-json-methods#genre}
|
|
33
|
+
*/
|
|
34
|
+
genre(params: { filter: UID }) {
|
|
35
|
+
let query = "genre";
|
|
36
|
+
query += qs.stringify(params, "&");
|
|
37
|
+
return this.request<GenreResponse>(query);
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/genres/types.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type GenreSummary = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
import { UID } from "../base";
|
|
2
|
+
|
|
3
|
+
export type GenreSummary = {
|
|
4
|
+
id: UID;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type GenreResponse = {
|
|
9
|
+
id: UID;
|
|
10
|
+
name: string;
|
|
11
|
+
albums: number;
|
|
12
|
+
artists: number;
|
|
13
|
+
songs: number;
|
|
14
|
+
videos: number;
|
|
15
|
+
playlists: number;
|
|
16
|
+
live_streams: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type GenresResponse = {
|
|
20
|
+
total_count: number;
|
|
21
|
+
md5: string;
|
|
22
|
+
genre: GenreResponse[];
|
|
23
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,26 +1,63 @@
|
|
|
1
|
-
import { Albums } from
|
|
2
|
-
import { Artists } from
|
|
3
|
-
import { Auth } from
|
|
4
|
-
import { Bookmarks } from
|
|
5
|
-
import { Catalogs } from
|
|
6
|
-
import { Genres } from
|
|
7
|
-
import { Labels } from
|
|
8
|
-
import { Licenses } from
|
|
9
|
-
import { LiveStreams } from
|
|
10
|
-
import { Playlists } from
|
|
11
|
-
import { Podcasts } from
|
|
12
|
-
import { Preferences } from
|
|
13
|
-
import { Shares } from
|
|
14
|
-
import { Shouts } from
|
|
15
|
-
import { Songs } from
|
|
16
|
-
import { System } from
|
|
17
|
-
import { Users } from
|
|
18
|
-
import { Videos } from
|
|
19
|
-
import { applyMixins } from
|
|
20
|
-
import { Base } from
|
|
21
|
-
|
|
22
|
-
class AmpacheAPI extends Base {}
|
|
23
|
-
interface AmpacheAPI
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { Albums } from "./albums";
|
|
2
|
+
import { Artists } from "./artists";
|
|
3
|
+
import { Auth } from "./auth";
|
|
4
|
+
import { Bookmarks } from "./bookmarks";
|
|
5
|
+
import { Catalogs } from "./catalogs";
|
|
6
|
+
import { Genres } from "./genres";
|
|
7
|
+
import { Labels } from "./labels";
|
|
8
|
+
import { Licenses } from "./licenses";
|
|
9
|
+
import { LiveStreams } from "./live-streams";
|
|
10
|
+
import { Playlists } from "./playlists";
|
|
11
|
+
import { Podcasts } from "./podcasts";
|
|
12
|
+
import { Preferences } from "./preferences";
|
|
13
|
+
import { Shares } from "./shares";
|
|
14
|
+
import { Shouts } from "./shouts";
|
|
15
|
+
import { Songs } from "./songs";
|
|
16
|
+
import { System } from "./system";
|
|
17
|
+
import { Users } from "./users";
|
|
18
|
+
import { Videos } from "./videos";
|
|
19
|
+
import { applyMixins } from "./utils";
|
|
20
|
+
import { Base } from "./base";
|
|
21
|
+
|
|
22
|
+
class AmpacheAPI extends Base {}
|
|
23
|
+
interface AmpacheAPI
|
|
24
|
+
extends Albums,
|
|
25
|
+
Artists,
|
|
26
|
+
Auth,
|
|
27
|
+
Bookmarks,
|
|
28
|
+
Catalogs,
|
|
29
|
+
Genres,
|
|
30
|
+
Labels,
|
|
31
|
+
Licenses,
|
|
32
|
+
LiveStreams,
|
|
33
|
+
Playlists,
|
|
34
|
+
Podcasts,
|
|
35
|
+
Preferences,
|
|
36
|
+
Shares,
|
|
37
|
+
Shouts,
|
|
38
|
+
Songs,
|
|
39
|
+
System,
|
|
40
|
+
Users,
|
|
41
|
+
Videos {}
|
|
42
|
+
applyMixins(AmpacheAPI, [
|
|
43
|
+
Albums,
|
|
44
|
+
Artists,
|
|
45
|
+
Auth,
|
|
46
|
+
Bookmarks,
|
|
47
|
+
Catalogs,
|
|
48
|
+
Genres,
|
|
49
|
+
Labels,
|
|
50
|
+
Licenses,
|
|
51
|
+
LiveStreams,
|
|
52
|
+
Playlists,
|
|
53
|
+
Podcasts,
|
|
54
|
+
Preferences,
|
|
55
|
+
Shares,
|
|
56
|
+
Shouts,
|
|
57
|
+
Songs,
|
|
58
|
+
System,
|
|
59
|
+
Users,
|
|
60
|
+
Videos,
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
export default AmpacheAPI;
|
package/src/labels/index.ts
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
import { Base, BinaryBoolean, ExtendedPagination, UID } from
|
|
4
|
-
|
|
5
|
-
export class Labels extends Base {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
1
|
+
import qs from "querystringify";
|
|
2
|
+
import { LabelResponse, LabelsResponse } from "./types";
|
|
3
|
+
import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
|
|
4
|
+
|
|
5
|
+
export class Labels extends Base {
|
|
6
|
+
/**
|
|
7
|
+
* This returns labels based on the specified filter
|
|
8
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
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#labels}
|
|
18
|
+
*/
|
|
19
|
+
labels(
|
|
20
|
+
params?: {
|
|
21
|
+
filter?: string;
|
|
22
|
+
exact?: BinaryBoolean;
|
|
23
|
+
add?: Date;
|
|
24
|
+
update?: Date;
|
|
25
|
+
} & ExtendedPagination,
|
|
26
|
+
) {
|
|
27
|
+
let query = "labels";
|
|
28
|
+
query += qs.stringify(params, "&");
|
|
29
|
+
return this.request<LabelsResponse>(query);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This returns a single label
|
|
34
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
35
|
+
* @param params.filter UID to find
|
|
36
|
+
* @see {@link https://ampache.org/api/api-json-methods#label}
|
|
37
|
+
*/
|
|
38
|
+
label(params: { filter: UID }) {
|
|
39
|
+
let query = "label";
|
|
40
|
+
query += qs.stringify(params, "&");
|
|
41
|
+
return this.request<LabelResponse>(query);
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/labels/types.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
import { UID } from "../base";
|
|
2
|
+
|
|
3
|
+
export type LabelResponse = {
|
|
4
|
+
id: UID;
|
|
5
|
+
name: string;
|
|
6
|
+
artists: number;
|
|
7
|
+
summary: string | null;
|
|
8
|
+
external_link: string | null;
|
|
9
|
+
address: string | null;
|
|
10
|
+
category: string | null;
|
|
11
|
+
email: string | null;
|
|
12
|
+
website: string | null;
|
|
13
|
+
user: UID;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type LabelsResponse = {
|
|
17
|
+
total_count: number;
|
|
18
|
+
md5: string;
|
|
19
|
+
label: LabelResponse[];
|
|
20
|
+
};
|
package/src/licenses/index.ts
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
import { Base, BinaryBoolean, ExtendedPagination, UID } from
|
|
4
|
-
|
|
5
|
-
export class Licenses extends Base {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
1
|
+
import qs from "querystringify";
|
|
2
|
+
import { LicenseResponse, LicensesResponse } from "./types";
|
|
3
|
+
import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
|
|
4
|
+
|
|
5
|
+
export class Licenses extends Base {
|
|
6
|
+
/**
|
|
7
|
+
* This returns licenses based on the specified filter
|
|
8
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
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#licenses}
|
|
18
|
+
*/
|
|
19
|
+
licenses(
|
|
20
|
+
params?: {
|
|
21
|
+
filter?: string;
|
|
22
|
+
exact?: BinaryBoolean;
|
|
23
|
+
add?: Date;
|
|
24
|
+
update?: Date;
|
|
25
|
+
} & ExtendedPagination,
|
|
26
|
+
) {
|
|
27
|
+
let query = "licenses";
|
|
28
|
+
query += qs.stringify(params, "&");
|
|
29
|
+
return this.request<LicensesResponse>(query);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This returns a single license
|
|
34
|
+
* @remarks MINIMUM_API_VERSION=420000
|
|
35
|
+
* @param params.filter UID to find
|
|
36
|
+
* @see {@link https://ampache.org/api/api-json-methods#license}
|
|
37
|
+
*/
|
|
38
|
+
license(params: { filter: UID }) {
|
|
39
|
+
let query = "license";
|
|
40
|
+
query += qs.stringify(params, "&");
|
|
41
|
+
return this.request<LicenseResponse>(query);
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/licenses/types.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { UID } from "../base";
|
|
2
|
+
|
|
3
|
+
export type LicenseResponse = {
|
|
4
|
+
id: UID;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
external_link: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type LicensesResponse = {
|
|
11
|
+
total_count: number;
|
|
12
|
+
md5: string;
|
|
13
|
+
license: LicenseResponse[];
|
|
14
|
+
};
|