javascript-ampache 1.2.0 → 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 -208
  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 -146
  63. package/dist/songs/types.d.ts +0 -73
  64. package/dist/system/index.d.ts +0 -419
  65. package/dist/system/types.d.ts +0 -31
  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 -284
  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 -860
  104. package/src/system/types.ts +0 -50
  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/users.js ADDED
@@ -0,0 +1,224 @@
1
+ /**
2
+ * @typedef {Object} UserSummary
3
+ * @property {import("./base.js").UID} id
4
+ * @property {string} username
5
+ */
6
+
7
+ /**
8
+ * @typedef {Object} UserResponse
9
+ * @property {import("./base.js").UID} id
10
+ * @property {string} username
11
+ * @property {string} auth
12
+ * @property {string} email
13
+ * @property {number} access
14
+ * @property {string|null} streamtoken
15
+ * @property {number} fullname_public
16
+ * @property {string|null} validation
17
+ * @property {boolean} disabled
18
+ * @property {number} create_date
19
+ * @property {number} last_seen
20
+ * @property {string|null} website
21
+ * @property {string|null} state
22
+ * @property {string|null} city
23
+ */
24
+
25
+ /**
26
+ * @typedef {Object} UsersResponse
27
+ * @property {number} total_count
28
+ * @property {string} md5
29
+ * @property {UserResponse[]} user
30
+ */
31
+
32
+ /**
33
+ * @typedef {Object} ActivityResponse
34
+ * @property {import("./base.js").UID} id
35
+ * @property {number} date
36
+ * @property {string} object_type
37
+ * @property {import("./base.js").UID} object_id
38
+ * @property {string} action
39
+ * @property {UserSummary} user
40
+ */
41
+
42
+ export const usersMethods = {
43
+ /**
44
+ * Get ids and usernames for your site
45
+ * @remarks MINIMUM_API_VERSION=5.0.0
46
+ * @returns {Promise<{ user: UserSummary[] }>}
47
+ * @see {@link https://ampache.org/api/api-json-methods#users}
48
+ */
49
+ users() {
50
+ return this.call("users");
51
+ },
52
+
53
+ /**
54
+ * This get a user's public information (or current user if username is omitted)
55
+ * @remarks MINIMUM_API_VERSION=380001
56
+ * @param {Object} [params]
57
+ * @param {string} [params.username] Username of the user to get details for
58
+ * @returns {Promise<UserResponse>}
59
+ * @see {@link https://ampache.org/api/api-json-methods#user}
60
+ */
61
+ user(params) {
62
+ return this.call("user", params);
63
+ },
64
+
65
+ /**
66
+ * Create a new user
67
+ * ACCESS REQUIRED: 100 (Admin)
68
+ * @remarks MINIMUM_API_VERSION=400001
69
+ * @param {Object} params
70
+ * @param {string} params.username Username
71
+ * @param {string} params.password SHA256 hashed password
72
+ * @param {string} params.email Email
73
+ * @param {string} [params.fullname] Full Name
74
+ * @param {import("./base.js").BinaryBoolean} [params.disable] 0, 1
75
+ * @param {number} [params.group] Catalog filter group (API param: group), default = 0
76
+ * @returns {Promise<import("./base.js").Success>}
77
+ * @see {@link https://ampache.org/api/api-json-methods#user_create}
78
+ */
79
+ userCreate(params) {
80
+ return this.call("user_create", params);
81
+ },
82
+
83
+ /**
84
+ * Register as a new user if allowed.
85
+ * @remarks MINIMUM_API_VERSION=6.0.0
86
+ * @param {Object} params
87
+ * @param {string} params.username Username
88
+ * @param {string} params.password SHA256 hashed password
89
+ * @param {string} params.email Email
90
+ * @param {string} [params.fullname] Full Name
91
+ * @returns {Promise<import("./base.js").Success>}
92
+ * @see {@link https://ampache.org/api/api-json-methods/#register}
93
+ */
94
+ register(params) {
95
+ return this.call("register", params);
96
+ },
97
+
98
+ /**
99
+ * Update an existing user
100
+ * ACCESS REQUIRED: 100 (Admin)
101
+ * @remarks MINIMUM_API_VERSION=400001
102
+ * @param {Object} params
103
+ * @param {string} params.username Username
104
+ * @param {string} [params.password] Password
105
+ * @param {string} [params.email] Email
106
+ * @param {string} [params.fullname] Full Name
107
+ * @param {string} [params.website] Website
108
+ * @param {string} [params.state] State
109
+ * @param {string} [params.city] City
110
+ * @param {import("./base.js").BinaryBoolean} [params.disable] 0, 1
111
+ * @param {string} [params.maxbitrate] Max bitrate for transcoding
112
+ * @returns {Promise<import("./base.js").Success>}
113
+ * @deprecated Being removed in 7.0.0. Use `user_edit` instead.
114
+ * @see {@link https://ampache.org/api/api-json-methods#user_update}
115
+ */
116
+ userUpdate(params) {
117
+ return this.call("user_update", params);
118
+ },
119
+
120
+ /**
121
+ * Update an existing user
122
+ * ACCESS REQUIRED: 100 (Admin)
123
+ * @remarks MINIMUM_API_VERSION=6.0.0
124
+ * @param {Object} params
125
+ * @param {string} params.username Username
126
+ * @param {string} [params.password] Password
127
+ * @param {string} [params.email] Email
128
+ * @param {string} [params.fullname] Full Name
129
+ * @param {string} [params.website] Website
130
+ * @param {string} [params.state] State
131
+ * @param {string} [params.city] City
132
+ * @param {string} [params.maxbitrate] Max bitrate for transcoding
133
+ * @param {number} [params.group] Catalog filter group, default = 0
134
+ * @param {import("./base.js").BinaryBoolean} [params.disable] 0, 1
135
+ * @param {import("./base.js").BinaryBoolean} [params.fullname_public] show fullname in public display
136
+ * @param {import("./base.js").BinaryBoolean} [params.reset_apikey] reset user Api Key
137
+ * @param {import("./base.js").BinaryBoolean} [params.reset_streamtoken] reset user Stream Token
138
+ * @param {import("./base.js").BinaryBoolean} [params.clear_stats] reset all stats for this user
139
+ * @returns {Promise<import("./base.js").Success>}
140
+ * @see {@link https://ampache.org/api/api-json-methods#user_edit}
141
+ */
142
+ userEdit(params) {
143
+ return this.call("user_edit", params);
144
+ },
145
+
146
+ /**
147
+ * Delete an existing user.
148
+ * ACCESS REQUIRED: 100 (Admin)
149
+ * @remarks MINIMUM_API_VERSION=400001
150
+ * @param {Object} params
151
+ * @param {string} params.username Username of user to delete (required by API)
152
+ * @returns {Promise<import("./base.js").Success>}
153
+ * @see {@link https://ampache.org/api/api-json-methods#user_delete}
154
+ */
155
+ userDelete(params) {
156
+ return this.call("user_delete", params);
157
+ },
158
+
159
+ /**
160
+ * This gets the followers for the requested username
161
+ * @remarks MINIMUM_API_VERSION=380001
162
+ * @param {Object} params
163
+ * @param {string} params.username UID to find
164
+ * @param {number} [params.offset]
165
+ * @param {number} [params.limit]
166
+ * @param {string} [params.cond]
167
+ * @param {string} [params.sort]
168
+ * @returns {Promise<{ user: UserSummary[] }>}
169
+ * @see {@link https://ampache.org/api/api-json-methods#followers}
170
+ */
171
+ followers(params) {
172
+ return this.call("followers", params);
173
+ },
174
+
175
+ /**
176
+ * Get a list of people that this user follows
177
+ * @remarks MINIMUM_API_VERSION=380001
178
+ * @param {Object} params
179
+ * @param {string} params.username
180
+ * @returns {Promise<{ user: UserSummary[] }>}
181
+ * @see {@link https://ampache.org/api/api-json-methods#following}
182
+ */
183
+ following(params) {
184
+ return this.call("following", params);
185
+ },
186
+
187
+ /**
188
+ * This will follow/unfollow a user
189
+ * @param {Object} params
190
+ * @param {string} params.username Username string to find
191
+ * @returns {Promise<import("./base.js").Success>}
192
+ * @see {@link https://ampache.org/api/api-json-methods#toggle_follow}
193
+ */
194
+ toggleFollow(params) {
195
+ return this.call("toggle_follow", params);
196
+ },
197
+
198
+ /**
199
+ * This get a user timeline
200
+ * @remarks MINIMUM_API_VERSION=380001
201
+ * @param {Object} params
202
+ * @param {string} params.username Username to find
203
+ * @param {number} [params.limit] Max results to return
204
+ * @param {number} [params.since] UNIXTIME
205
+ * @returns {Promise<{ activity: ActivityResponse[] }>}
206
+ * @see {@link https://ampache.org/api/api-json-methods#timeline}
207
+ */
208
+ timeline(params) {
209
+ return this.call("timeline", params);
210
+ },
211
+
212
+ /**
213
+ * This get current user friends timeline
214
+ * @remarks MINIMUM_API_VERSION=380001
215
+ * @param {Object} [params]
216
+ * @param {number} [params.limit] Max results to return
217
+ * @param {number} [params.since] UNIXTIME
218
+ * @returns {Promise<{ activity: ActivityResponse[] }>}
219
+ * @see {@link https://ampache.org/api/api-json-methods#friends_timeline}
220
+ */
221
+ friendsTimeline(params) {
222
+ return this.call("friends_timeline", params);
223
+ },
224
+ };
@@ -1,22 +1,18 @@
1
1
  import JsSHA from "jssha/dist/sha256";
2
- import { Base } from "./base";
3
2
 
4
- export function applyMixins(derivedCtor: any, baseCtors: any[]) {
5
- baseCtors.forEach((baseCtor) => {
6
- Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
7
- Object.defineProperty(
8
- derivedCtor.prototype,
9
- name,
10
- Object.getOwnPropertyDescriptor(baseCtor.prototype, name),
11
- );
12
- });
13
- });
14
- }
15
-
16
- export function encryptPassword(password: string, time: number) {
3
+ /**
4
+ * @param {string} password
5
+ * @param {number} time
6
+ * @returns {string}
7
+ */
8
+ export function encryptPassword(password, time) {
17
9
  let key = getSHA256(password);
18
10
  return getSHA256(time + key);
19
11
 
12
+ /**
13
+ * @param {string} text
14
+ * @returns {string}
15
+ */
20
16
  function getSHA256(text) {
21
17
  let shaObj = new JsSHA("SHA-256", "TEXT", { encoding: "UTF8" });
22
18
  shaObj.update(text);
@@ -25,7 +21,11 @@ export function encryptPassword(password: string, time: number) {
25
21
  }
26
22
  }
27
23
 
28
- export function outputDebugURL(url: string, config: Base) {
24
+ /**
25
+ * @param {string} url
26
+ * @param {{ useBearerToken?: boolean, sessionKey?: string|null }} config
27
+ */
28
+ export function outputDebugURL(url, config) {
29
29
  let label = "javascript-ampache query URL";
30
30
 
31
31
  if (config.useBearerToken) {
@@ -37,4 +37,4 @@ export function outputDebugURL(url: string, config: Base) {
37
37
  label + " %c" + url,
38
38
  "color: black; font-style: italic; background-color: orange;padding: 2px",
39
39
  );
40
- }
40
+ }
package/src/videos.js ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @typedef {Object} VideoResponse
3
+ * @property {import("./base.js").UID} id
4
+ * @property {string} title
5
+ * @property {string} mime
6
+ * @property {string} resolution
7
+ * @property {number} size
8
+ * @property {import("./genres.js").GenreSummary[]} genre
9
+ * @property {number} time
10
+ * @property {string} url
11
+ * @property {string} art
12
+ * @property {boolean} has_art
13
+ * @property {boolean} flag
14
+ * @property {number|null} rating
15
+ * @property {number|null} averagerating
16
+ * @property {number} playcount
17
+ */
18
+
19
+ /**
20
+ * @typedef {Object} VideosResponse
21
+ * @property {number} total_count
22
+ * @property {string} md5
23
+ * @property {VideoResponse[]} video
24
+ */
25
+
26
+ /**
27
+ * @typedef {Object} DeletedVideoResponse
28
+ * @property {import("./base.js").UID} id
29
+ * @property {number} addition_time
30
+ * @property {number} delete_time
31
+ * @property {string} title
32
+ * @property {string} file
33
+ * @property {import("./base.js").UID} catalog
34
+ * @property {number} total_count
35
+ * @property {number} total_skip
36
+ */
37
+
38
+ /**
39
+ * @typedef {Object} DeletedVideosResponse
40
+ * @property {number} total_count
41
+ * @property {string} md5
42
+ * @property {DeletedVideoResponse[]} deleted_video
43
+ */
44
+
45
+ export const videosMethods = {
46
+ /**
47
+ * Get videos
48
+ * @remarks MINIMUM_API_VERSION=380001
49
+ * @param {Object} [params]
50
+ * @param {string} [params.filter] Filter results to match this string
51
+ * @param {import("./base.js").BinaryBoolean} [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
52
+ * @param {number} [params.offset]
53
+ * @param {number} [params.limit]
54
+ * @returns {Promise<VideosResponse>}
55
+ * @see {@link https://ampache.org/api/api-json-methods#videos}
56
+ */
57
+ videos(params) {
58
+ return this.call("videos", params);
59
+ },
60
+
61
+ /**
62
+ * This returns a single video
63
+ * @remarks MINIMUM_API_VERSION=380001
64
+ * @param {Object} params
65
+ * @param {import("./base.js").UID} params.filter UID to find
66
+ * @returns {Promise<VideoResponse>}
67
+ * @see {@link https://ampache.org/api/api-json-methods#video}
68
+ */
69
+ video(params) {
70
+ return this.call("video", params);
71
+ },
72
+
73
+ /**
74
+ * This returns video objects that have been deleted
75
+ * @param {Object} [params]
76
+ * @param {number} [params.offset]
77
+ * @param {number} [params.limit]
78
+ * @returns {Promise<DeletedVideosResponse>}
79
+ * @see {@link https://ampache.org/api/api-json-methods#deleted_videos}
80
+ */
81
+ deletedVideos(params) {
82
+ return this.call("deleted_videos", params);
83
+ },
84
+ };
@@ -1,64 +0,0 @@
1
- import { AlbumResponse, AlbumsResponse } from "./types";
2
- import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
3
- export declare class Albums extends Base {
4
- /**
5
- * This returns albums based on the provided search filters
6
- * @remarks MINIMUM_API_VERSION=380001
7
- * @param [params.filter] UID to find
8
- * @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
9
- * @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
10
- * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
11
- * @param [params.include] albums, songs (include child objects in the response)
12
- * @param [params.offset]
13
- * @param [params.limit]
14
- * @param [params.cond]
15
- * @param [params.sort]
16
- * @see {@link https://ampache.org/api/api-json-methods#albums}
17
- */
18
- albums(params?: {
19
- filter?: number;
20
- exact?: BinaryBoolean;
21
- add?: Date;
22
- update?: Date;
23
- include?: "albums" | "songs";
24
- } & ExtendedPagination): Promise<AlbumsResponse>;
25
- /**
26
- * This returns a single album based on the UID provided
27
- * @remarks MINIMUM_API_VERSION=380001
28
- * @param params.filter UID to find
29
- * @param [params.include] songs (include child objects in the response)
30
- * @see {@link https://ampache.org/api/api-json-methods#album}
31
- */
32
- album(params: {
33
- filter: UID;
34
- include?: "songs";
35
- }): Promise<AlbumResponse>;
36
- /**
37
- * This returns the albums of an artist
38
- * @remarks MINIMUM_API_VERSION=380001
39
- * @param params.filter UID to find
40
- * @param [params.album_artist] 0, 1 (if true filter for album artists only)
41
- * @param [params.offset]
42
- * @param [params.limit]
43
- * @param [params.cond]
44
- * @param [params.sort]
45
- * @see {@link https://ampache.org/api/api-json-methods#artist_albums}
46
- */
47
- artistAlbums(params: {
48
- filter: UID;
49
- album_artist?: BinaryBoolean;
50
- } & ExtendedPagination): Promise<AlbumsResponse>;
51
- /**
52
- * This returns the albums associated with the genre in question
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_albums}
60
- */
61
- genreAlbums(params?: {
62
- filter: UID;
63
- } & ExtendedPagination): Promise<AlbumsResponse>;
64
- }
@@ -1,37 +0,0 @@
1
- import { UID } from "../base";
2
- import { GenreSummary } from "../genres/types";
3
- import { ArtistSummary } from "../artists/types";
4
- import { SongResponse } from "../songs/types";
5
- export type AlbumSummary = {
6
- id: UID;
7
- name: string;
8
- prefix: string | null;
9
- basename: string;
10
- };
11
- export type AlbumResponse = {
12
- id: UID;
13
- name: string;
14
- prefix: string | null;
15
- basename: string;
16
- artist: ArtistSummary;
17
- artists: ArtistSummary[];
18
- songartists: 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
- export type AlbumsResponse = {
34
- total_count: number;
35
- md5: string;
36
- album: AlbumResponse[];
37
- };
@@ -1,64 +0,0 @@
1
- import { ArtistResponse, ArtistsResponse } from "./types";
2
- import { Base, BinaryBoolean, ExtendedPagination, UID } from "../base";
3
- export declare class Artists extends Base {
4
- /**
5
- * This takes a collection of inputs and returns artist objects
6
- * @remarks MINIMUM_API_VERSION=380001
7
- * @param [params.filter] Filter results to match this string
8
- * @param [params.exact] 0, 1 (if true filter is exact = rather than fuzzy LIKE)
9
- * @param [params.add] ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date
10
- * @param [params.update] ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date
11
- * @param [params.include] (albums | songs) include child objects in the response
12
- * @param [params.album_artist] 0, 1 (if true filter for album artists only)
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#artists}
18
- */
19
- artists(params?: {
20
- filter?: string;
21
- exact?: BinaryBoolean;
22
- add?: Date;
23
- update?: Date;
24
- include?: "albums" | "songs";
25
- album_artist?: BinaryBoolean;
26
- } & ExtendedPagination): Promise<ArtistsResponse>;
27
- /**
28
- * This returns a single artist based on the UID of said artist
29
- * @remarks MINIMUM_API_VERSION=380001
30
- * @param params.filter UID to find
31
- * @param [params.include] (albums | songs) include child objects in the response
32
- * @see {@link https://ampache.org/api/api-json-methods#artist}
33
- */
34
- artist(params: {
35
- filter: UID;
36
- include?: "albums" | "songs";
37
- }): Promise<ArtistResponse>;
38
- /**
39
- * This returns the artists associated with the genre in question as defined by the UID
40
- * @remarks MINIMUM_API_VERSION=380001
41
- * @param params.filter UID to find
42
- * @param [params.offset]
43
- * @param [params.limit]
44
- * @param [params.cond]
45
- * @param [params.sort]
46
- * @see {@link https://ampache.org/api/api-json-methods#genre_artists}
47
- */
48
- genreArtists(params: {
49
- filter: UID;
50
- } & ExtendedPagination): Promise<ArtistsResponse>;
51
- /**
52
- * This returns the artists associated with the label in question as defined by the UID
53
- * @remarks MINIMUM_API_VERSION=420000
54
- * @param params.filter UID of 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#label_artists}
60
- */
61
- labelArtists(params: {
62
- filter: UID;
63
- } & ExtendedPagination): Promise<ArtistsResponse>;
64
- }
@@ -1,35 +0,0 @@
1
- import { AlbumResponse } from "../albums/types";
2
- import { SongsResponse } from "../songs/types";
3
- import { GenreResponse } from "../genres/types";
4
- export type ArtistSummary = {
5
- id: string;
6
- name: string;
7
- prefix: string | null;
8
- basename: string;
9
- };
10
- export type ArtistResponse = {
11
- id: string;
12
- name: string;
13
- prefix: string | null;
14
- basename: string;
15
- albums: AlbumResponse[];
16
- albumcount: number;
17
- songs: SongsResponse[];
18
- songcount: number;
19
- genre: GenreResponse[];
20
- art: string;
21
- has_art: boolean;
22
- flag: boolean;
23
- rating: number | null;
24
- averagerating: number | null;
25
- mbid: string | null;
26
- summary: string;
27
- time: number;
28
- yearformed: number;
29
- placeformed: string;
30
- };
31
- export type ArtistsResponse = {
32
- total_count: number;
33
- md5: string;
34
- artist: ArtistResponse[];
35
- };
@@ -1,56 +0,0 @@
1
- import { Base, Success } from "../base";
2
- import { AuthResponse } from "./types";
3
- export declare class Auth extends Base {
4
- /**
5
- * Handles verifying a new handshake
6
- * @remarks MINIMUM_API_VERSION=380001
7
- * @param params.auth encrypted apikey OR password if using password auth
8
- * @param [params.user] username
9
- * @param [params.timestamp] UNIXTIME()
10
- * @param [params.version] version of Ampache API to establish connection with
11
- * @see {@link https://ampache.org/api/api-json-methods#handshake}
12
- */
13
- handshake(params: {
14
- auth: string;
15
- user?: string;
16
- timestamp?: number;
17
- version?: string;
18
- }): Promise<AuthResponse>;
19
- /**
20
- * This can be called without being authenticated, it is useful for determining if what the status
21
- * of the server is, and what version it is running/compatible with
22
- * @remarks MINIMUM_API_VERSION=380001
23
- * @param [params.auth] (Session ID) returns version information and extends the session if passed
24
- * @param [params.version] API Version that the application understands
25
- * @see {@link https://ampache.org/api/api-json-methods#ping}
26
- */
27
- ping(params?: {
28
- auth?: string;
29
- version?: string;
30
- }): Promise<AuthResponse>;
31
- /**
32
- * Destroy a session using the session auth parameter
33
- * @remarks MINIMUM_API_VERSION=400001
34
- * @param params.auth Session ID to destroy
35
- * @see {@link https://ampache.org/api/api-json-methods#goodbye}
36
- */
37
- goodbye(params: {
38
- auth: string;
39
- }): Promise<Success>;
40
- /**
41
- * Email a new password to the user (if allowed) using a reset token.
42
- * @remarks MINIMUM_API_VERSION=6.1.0
43
- * @param params.auth Password reset token
44
- * @see {@link https://ampache.org/api/api-json-methods#lost_password}
45
- */
46
- lostPassword(params: {
47
- auth: string;
48
- }): Promise<Success>;
49
- /**
50
- * Encrypt your password into the accepted format.
51
- */
52
- encryptPassword(params: {
53
- password: string;
54
- time: number;
55
- }): string;
56
- }
@@ -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
- };