javascript-ampache 1.1.10 → 2.0.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 (108) hide show
  1. package/README.md +16 -6
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.m.js +1 -1
  5. package/dist/index.m.js.map +1 -1
  6. package/dist/index.modern.mjs +1 -1
  7. package/dist/index.modern.mjs.map +1 -1
  8. package/dist/index.umd.js +1 -1
  9. package/dist/index.umd.js.map +1 -1
  10. package/package.json +8 -7
  11. package/src/albums.js +106 -0
  12. package/src/artists.js +105 -0
  13. package/src/auth.js +142 -0
  14. package/src/base.js +145 -0
  15. package/src/bookmarks.js +106 -0
  16. package/src/catalogs.js +133 -0
  17. package/src/genres.js +57 -0
  18. package/src/index.js +30 -0
  19. package/src/labels.js +53 -0
  20. package/src/licenses.js +47 -0
  21. package/src/live-streams.js +97 -0
  22. package/src/playlists.js +241 -0
  23. package/src/podcasts.js +230 -0
  24. package/src/preferences.js +114 -0
  25. package/src/shares.js +99 -0
  26. package/src/shouts.js +24 -0
  27. package/src/songs.js +273 -0
  28. package/src/system.js +510 -0
  29. package/src/users.js +224 -0
  30. package/src/{utils.ts → utils.js} +16 -16
  31. package/src/videos.js +84 -0
  32. package/dist/albums/index.d.ts +0 -64
  33. package/dist/albums/types.d.ts +0 -37
  34. package/dist/artists/index.d.ts +0 -64
  35. package/dist/artists/types.d.ts +0 -35
  36. package/dist/auth/index.d.ts +0 -56
  37. package/dist/auth/types.d.ts +0 -32
  38. package/dist/base.d.ts +0 -47
  39. package/dist/bookmarks/index.d.ts +0 -91
  40. package/dist/bookmarks/types.d.ts +0 -13
  41. package/dist/catalogs/index.d.ts +0 -87
  42. package/dist/catalogs/types.d.ts +0 -19
  43. package/dist/genres/index.d.ts +0 -28
  44. package/dist/genres/types.d.ts +0 -22
  45. package/dist/index.d.ts +0 -24
  46. package/dist/labels/index.d.ts +0 -32
  47. package/dist/labels/types.d.ts +0 -18
  48. package/dist/licenses/index.d.ts +0 -32
  49. package/dist/licenses/types.d.ts +0 -12
  50. package/dist/live-streams/index.d.ts +0 -80
  51. package/dist/live-streams/types.d.ts +0 -14
  52. package/dist/playlists/index.d.ts +0 -204
  53. package/dist/playlists/types.d.ts +0 -26
  54. package/dist/podcasts/index.d.ts +0 -121
  55. package/dist/podcasts/types.d.ts +0 -79
  56. package/dist/preferences/index.d.ts +0 -80
  57. package/dist/preferences/types.d.ts +0 -18
  58. package/dist/shares/index.d.ts +0 -69
  59. package/dist/shares/types.d.ts +0 -23
  60. package/dist/shouts/index.d.ts +0 -17
  61. package/dist/shouts/types.d.ts +0 -10
  62. package/dist/songs/index.d.ts +0 -143
  63. package/dist/songs/types.d.ts +0 -73
  64. package/dist/system/index.d.ts +0 -407
  65. package/dist/system/types.d.ts +0 -24
  66. package/dist/users/index.d.ts +0 -190
  67. package/dist/users/types.d.ts +0 -34
  68. package/dist/utils.d.ts +0 -4
  69. package/dist/videos/index.d.ts +0 -33
  70. package/dist/videos/types.d.ts +0 -38
  71. package/src/albums/index.ts +0 -88
  72. package/src/albums/types.ts +0 -40
  73. package/src/artists/index.ts +0 -88
  74. package/src/artists/types.ts +0 -38
  75. package/src/auth/index.ts +0 -118
  76. package/src/auth/types.ts +0 -32
  77. package/src/base.ts +0 -133
  78. package/src/bookmarks/index.ts +0 -116
  79. package/src/bookmarks/types.ts +0 -15
  80. package/src/catalogs/index.ts +0 -130
  81. package/src/catalogs/types.ts +0 -27
  82. package/src/genres/index.ts +0 -39
  83. package/src/genres/types.ts +0 -25
  84. package/src/index.ts +0 -63
  85. package/src/labels/index.ts +0 -43
  86. package/src/labels/types.ts +0 -20
  87. package/src/licenses/index.ts +0 -43
  88. package/src/licenses/types.ts +0 -14
  89. package/src/live-streams/index.ts +0 -104
  90. package/src/live-streams/types.ts +0 -16
  91. package/src/playlists/index.ts +0 -280
  92. package/src/playlists/types.ts +0 -29
  93. package/src/podcasts/index.ts +0 -174
  94. package/src/podcasts/types.ts +0 -85
  95. package/src/preferences/index.ts +0 -114
  96. package/src/preferences/types.ts +0 -20
  97. package/src/shares/index.ts +0 -100
  98. package/src/shares/types.ts +0 -25
  99. package/src/shouts/index.ts +0 -18
  100. package/src/shouts/types.ts +0 -11
  101. package/src/songs/index.ts +0 -221
  102. package/src/songs/types.ts +0 -77
  103. package/src/system/index.ts +0 -845
  104. package/src/system/types.ts +0 -42
  105. package/src/users/index.ts +0 -227
  106. package/src/users/types.ts +0 -38
  107. package/src/videos/index.ts +0 -49
  108. package/src/videos/types.ts +0 -42
package/src/auth/types.ts DELETED
@@ -1,32 +0,0 @@
1
- export type AuthResponse = {
2
- add: string;
3
- albums: number;
4
- api: string;
5
- artists: number;
6
- auth: string;
7
- catalogs: number;
8
- compatible: string;
9
- clean: string;
10
- genres: number;
11
- labels: number;
12
- licenses: number;
13
- live_streams: number;
14
- playlists: number;
15
- podcasts: number;
16
- podcast_episodes: number;
17
- server: string;
18
- session_expire: string;
19
- shares: number;
20
- songs: number;
21
- update: string;
22
- user: number;
23
- username: string;
24
- version: string;
25
- videos: number;
26
- max_song: number;
27
- max_album: number;
28
- max_artist: number;
29
- max_video: number;
30
- max_podcast: number;
31
- max_podcast_episode: number;
32
- };
package/src/base.ts DELETED
@@ -1,133 +0,0 @@
1
- import fetch from "isomorphic-unfetch";
2
- import qs from "querystringify";
3
- import { outputDebugURL } from "./utils";
4
-
5
- type Config = {
6
- url: string;
7
- sessionKey?: string;
8
- useBearerToken?: boolean;
9
- debug?: boolean;
10
- };
11
-
12
- export type Success = {
13
- success: string;
14
- };
15
-
16
- /**
17
- * @param [offset] Return results starting from this index position
18
- * @param [limit] Maximum number of results to return
19
- */
20
- export type Pagination = {
21
- offset?: number;
22
- limit?: number;
23
- };
24
-
25
- /**
26
- * @param [offset] Return results starting from this index position
27
- * @param [limit] Maximum number of results to return
28
- * @param [cond] Apply additional filters to the browse using ; separated comma string pairs (e.g. 'filter1,value1;filter2,value2')
29
- * @param [sort] Sort name or comma-separated key pair. (e.g. 'name,order') Default order 'ASC' (e.g. 'name,ASC' == 'name')
30
- */
31
- export type ExtendedPagination = Pagination & {
32
- cond?: string;
33
- sort?: string;
34
- };
35
-
36
- export type BinaryBoolean = 0 | 1;
37
-
38
- export type UID = string | number;
39
-
40
- export abstract class Base {
41
- sessionKey: string;
42
- url: string;
43
- version: string = "6.6.8";
44
- useBearerToken: boolean;
45
- debug: boolean;
46
-
47
- constructor(config: Config) {
48
- this.sessionKey = config.sessionKey || null;
49
- this.url = config.url;
50
- this.useBearerToken = config.useBearerToken || false;
51
- this.debug = config.debug || false;
52
- }
53
-
54
- protected request<T>(endpoint: string): Promise<T> {
55
- let url =
56
- this.url +
57
- "/server/json.server.php?action=" +
58
- endpoint +
59
- "&version=" +
60
- this.version;
61
-
62
- if (!this.useBearerToken) {
63
- url += "&auth=" + this.sessionKey;
64
- }
65
-
66
- if (this.debug) {
67
- outputDebugURL(url, this);
68
- }
69
-
70
- return fetch(url, {
71
- method: "GET",
72
- headers: this.useBearerToken ? { Authorization: "Bearer " + this.sessionKey } : {},
73
- }).then((r) => {
74
- if (r.ok) {
75
- return r.json();
76
- }
77
- throw new Error(r.statusText);
78
- });
79
- }
80
-
81
- protected binary<T>(endpoint: string): Promise<Blob> {
82
- let url =
83
- this.url +
84
- "/server/json.server.php?action=" + endpoint +
85
- "&version=" + this.version;
86
-
87
- if (!this.useBearerToken) {
88
- url += "&auth=" + this.sessionKey;
89
- }
90
-
91
- if (this.debug) {
92
- outputDebugURL(url, this);
93
- }
94
-
95
- return fetch(url, {
96
- method: "GET",
97
- headers: this.useBearerToken ? { Authorization: "Bearer " + this.sessionKey } : {},
98
- })
99
- .then((response) => response.blob())
100
- .then((r) => {
101
- return r;
102
- });
103
- }
104
-
105
- public setSessionKey(sessionKey: string) {
106
- this.sessionKey = sessionKey;
107
- }
108
-
109
- /**
110
- * Construct and return a URL
111
- * @param endpoint
112
- * @param [params]
113
- */
114
- public rawURL(endpoint: string, params?: {}) {
115
- let query = endpoint;
116
- query += qs.stringify(params, "&");
117
-
118
- let url =
119
- this.url +
120
- "/server/json.server.php?action=" + query +
121
- "&version=" + this.version;
122
-
123
- if (!this.useBearerToken) {
124
- url += "&auth=" + this.sessionKey;
125
- }
126
-
127
- if (this.debug) {
128
- outputDebugURL(url, this);
129
- }
130
-
131
- return url;
132
- }
133
- }
@@ -1,116 +0,0 @@
1
- import qs from "querystringify";
2
- import { BookmarkResponse, BookmarksResponse } from "./types";
3
- import { Base, BinaryBoolean, Success, UID } from "../base";
4
-
5
- export class Bookmarks extends Base {
6
- /**
7
- * Get a single bookmark by bookmark_id
8
- * @remarks MINIMUM_API_VERSION=6.1.0
9
- * @param params.filter UID to find
10
- * @param [params.include] 0,1, if true include the object in the bookmark
11
- * @see {@link https://ampache.org/api/api-json-methods#bookmark}
12
- */
13
- bookmark(params: { filter: UID; include?: BinaryBoolean }) {
14
- let query = "bookmark";
15
- query += qs.stringify(params, "&");
16
- return this.request<BookmarkResponse>(query);
17
- }
18
-
19
- /**
20
- * Get information about bookmarked media this user is allowed to manage
21
- * @remarks MINIMUM_API_VERSION=5.0.0
22
- * @param [params.client] filter by the agent/client name
23
- * @param [params.include] 0,1, if true include the object in the bookmark
24
- * @see {@link https://ampache.org/api/api-json-methods#bookmarks}
25
- */
26
- bookmarks(params: { client?: string; include?: BinaryBoolean }) {
27
- let query = "bookmarks";
28
- query += qs.stringify(params, "&");
29
- return this.request<BookmarksResponse>(query);
30
- }
31
-
32
- /**
33
- * Get the bookmark/s from its object_id and object_type.
34
- * @remarks MINIMUM_API_VERSION=5.0.0
35
- * @param params.filter UID to find
36
- * @param params.type Object type
37
- * @param [params.include] 0,1, if true include the object in the bookmark
38
- * @see {@link https://ampache.org/api/api-json-methods#get_bookmark}
39
- */
40
- getBookmark(params: {
41
- filter: UID;
42
- type: "song" | "video" | "podcast_episode";
43
- include?: BinaryBoolean;
44
- all?: BinaryBoolean;
45
- }) {
46
- let query = "get_bookmark";
47
- query += qs.stringify(params, "&");
48
- return this.request<BookmarkResponse>(query);
49
- }
50
-
51
- /**
52
- * Create a placeholder for the current media that you can return to later.
53
- * @remarks MINIMUM_API_VERSION=5.0.0
54
- * @param params.filter UID to find
55
- * @param params.type Object type
56
- * @param params.position current track time in seconds
57
- * @param [params.client] Agent string. (Default: 'AmpacheAPI')
58
- * @param [params.date] update time (Default: UNIXTIME())
59
- * @param [params.include] 0,1, if true include the object in the bookmark
60
- * @see {@link https://ampache.org/api/api-json-methods#bookmark_create}
61
- */
62
- bookmarkCreate(params: {
63
- filter: UID;
64
- type: "song" | "video" | "podcast_episode";
65
- position: number;
66
- client?: string;
67
- date?: number;
68
- include?: BinaryBoolean;
69
- }) {
70
- let query = "bookmark_create";
71
- query += qs.stringify(params, "&");
72
- return this.request<BookmarkResponse>(query);
73
- }
74
-
75
- /**
76
- * Edit a placeholder for the current media that you can return to later.
77
- * @remarks MINIMUM_API_VERSION=5.0.0
78
- * @param params.filter UID to find
79
- * @param params.type Object type
80
- * @param params.position current track time in seconds
81
- * @param [params.client] Agent string. (Default: 'AmpacheAPI')
82
- * @param [params.date] update time (Default: UNIXTIME())
83
- * @param [params.include] 0,1, if true include the object in the bookmark
84
- * @see {@link https://ampache.org/api/api-json-methods#bookmark_edit}
85
- */
86
- bookmarkEdit(params: {
87
- filter: UID;
88
- type: "song" | "video" | "podcast_episode";
89
- position: number;
90
- client?: string;
91
- date?: number;
92
- include?: BinaryBoolean;
93
- }) {
94
- let query = "bookmark_edit";
95
- query += qs.stringify(params, "&");
96
- return this.request<BookmarkResponse>(query);
97
- }
98
-
99
- /**
100
- * Delete an existing bookmark. (if it exists)
101
- * @remarks MINIMUM_API_VERSION=5.0.0
102
- * @param params.filter UID to find
103
- * @param params.type Object type
104
- * @param [params.client] Agent string. (Default: 'AmpacheAPI')
105
- @see {@link https://ampache.org/api/api-json-methods#bookmark_delete}
106
- */
107
- bookmarkDelete(params: {
108
- filter: UID;
109
- type: "song" | "video" | "podcast_episode";
110
- client?: string;
111
- }) {
112
- let query = "bookmark_delete";
113
- query += qs.stringify(params, "&");
114
- return this.request<Success>(query);
115
- }
116
- }
@@ -1,15 +0,0 @@
1
- import { UID } from "../base";
2
-
3
- export type BookmarkResponse = {
4
- id: UID;
5
- type: "song" | "video" | "podcast_episode";
6
- position: number;
7
- client?: string;
8
- date?: number;
9
- };
10
-
11
- export type BookmarksResponse = {
12
- total_count: number;
13
- md5: string;
14
- bookmark: BookmarkResponse[];
15
- };
@@ -1,130 +0,0 @@
1
- import qs from "querystringify";
2
- import { CatalogResponse, CatalogsResponse } from "./types";
3
- import { Base, ExtendedPagination, Success, UID } from "../base";
4
-
5
- export class Catalogs extends Base {
6
- /**
7
- * This searches the catalogs and returns... catalogs
8
- * @remarks MINIMUM_API_VERSION=420000
9
- * @param [params.filter] Catalog type
10
- * @param [params.offset]
11
- * @param [params.limit]
12
- * @param [params.cond]
13
- * @param [params.sort]
14
- * @see {@link https://ampache.org/api/api-json-methods#catalogs}
15
- */
16
- catalogs(
17
- params?: {
18
- filter?:
19
- | "music"
20
- | "clip"
21
- | "tvshow"
22
- | "movie"
23
- | "personal_video"
24
- | "podcast";
25
- } & ExtendedPagination,
26
- ) {
27
- let query = "catalogs";
28
- query += qs.stringify(params, "&");
29
- return this.request<CatalogsResponse>(query);
30
- }
31
-
32
- /**
33
- * Return catalog by UID
34
- * @remarks MINIMUM_API_VERSION=420000
35
- * @param params.filter UID to find
36
- * @see {@link https://ampache.org/api/api-json-methods#catalog}
37
- */
38
- catalog(params: { filter: UID }) {
39
- let query = "catalog";
40
- query += qs.stringify(params, "&");
41
- return this.request<CatalogResponse>(query);
42
- }
43
-
44
- /**
45
- * Kick off a catalog update or clean for the selected catalog
46
- * ACCESS REQUIRED: 75 (Catalog Manager)
47
- * @remarks MINIMUM_API_VERSION=400001
48
- * @param params.task add_to_catalog, clean_catalog
49
- * @param params.catalog UID of catalog
50
- * @see {@link https://ampache.org/api/api-json-methods#catalog_action}
51
- */
52
- catalogAction(params: {
53
- task: "add_to_catalog" | "clean_catalog";
54
- catalog: UID;
55
- }) {
56
- let query = "catalog_action";
57
- query += qs.stringify(params, "&");
58
- return this.request<Success>(query);
59
- }
60
-
61
- /**
62
- * Perform actions on local catalog files. Single file versions of catalog add, clean, verify and remove (delete).
63
- * Make sure you remember to urlencode those file names!
64
- * ACCESS REQUIRED: 50 (Content Manager)
65
- * @remarks MINIMUM_API_VERSION=420000
66
- * @param params.file FULL path to local file
67
- * @param params.task add, clean, verify, remove, (can include comma-separated values)
68
- * @param params.catalog UID of catalog
69
- * @see {@link https://ampache.org/api/api-json-methods#catalog_file}
70
- */
71
- catalogFile(params: { file: string; task: string; catalog: UID }) {
72
- let query = "catalog_file";
73
- query += qs.stringify(params, "&");
74
- return this.request<Success>(query);
75
- }
76
-
77
- /**
78
- * Create a new catalog.
79
- * ACCESS REQUIRED: 75 (Catalog Manager)
80
- * @remarks MINIMUM_API_VERSION=6.0.0
81
- * @param params.name Name for the catalog
82
- * @param params.path URL or folder path for your catalog
83
- * @param [params.type] Default: 'local'
84
- * @param [params.media_type] Default: 'music'
85
- * @param [params.file_pattern] Pattern used identify tags from the file name. Default: '%T - %t'
86
- * @param [params.folder_pattern] Pattern used identify tags from the folder name. Default: '%a/%A'
87
- * @param [params.username] login to remote catalog
88
- * @param [params.password] password to remote catalog
89
- * @see {@link https://ampache.org/api/api-json-methods#catalog_add}
90
- */
91
- catalogAdd(params: {
92
- name: string;
93
- path: string;
94
- type?:
95
- | "local"
96
- | "beets"
97
- | "remote"
98
- | "subsonic"
99
- | "seafile"
100
- | "beetsremote";
101
- media_type?:
102
- | "music"
103
- | "podcast"
104
- | "clip"
105
- | "tvshow"
106
- | "movie"
107
- | "personal_video";
108
- file_pattern?: string;
109
- folder_pattern?: string;
110
- username?: string;
111
- password?: string;
112
- }) {
113
- let query = "catalog_add";
114
- query += qs.stringify(params, "&");
115
- return this.request<CatalogResponse>(query);
116
- }
117
-
118
- /**
119
- * Delete an existing catalog. (if it exists)
120
- * ACCESS REQUIRED: 75 (Catalog Manager)
121
- * @remarks MINIMUM_API_VERSION=6.0.0
122
- * @param params.filter ID of the catalog
123
- * @see {@link https://ampache.org/api/api-json-methods#catalog_delete}
124
- */
125
- catalogDelete(params: { filter: UID }) {
126
- let query = "catalog_delete";
127
- query += qs.stringify(params, "&");
128
- return this.request<Success>(query);
129
- }
130
- }
@@ -1,27 +0,0 @@
1
- import { UID } from "../base";
2
-
3
- export type CatalogResponse = {
4
- id: UID;
5
- name: string;
6
- type: "local" | "remote";
7
- gather_types:
8
- | "podcast"
9
- | "clip"
10
- | "tvshow"
11
- | "movie"
12
- | "personal_video"
13
- | "music";
14
- enabled: boolean;
15
- last_add: number;
16
- last_clean: number;
17
- last_update: number;
18
- path: string;
19
- rename_pattern: string;
20
- sort_pattern: string;
21
- };
22
-
23
- export type CatalogsResponse = {
24
- total_count: number;
25
- md5: string;
26
- catalog: CatalogResponse[];
27
- };
@@ -1,39 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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
- is_hidden: boolean;
18
- merge: GenreSummary[];
19
- };
20
-
21
- export type GenresResponse = {
22
- total_count: number;
23
- md5: string;
24
- genre: GenreResponse[];
25
- };
package/src/index.ts DELETED
@@ -1,63 +0,0 @@
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;
@@ -1,43 +0,0 @@
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
- }
@@ -1,20 +0,0 @@
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
- };
@@ -1,43 +0,0 @@
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
- }