javascript-ampache 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-ampache",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "A JS library for the Ampache API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.m.js",
@@ -48,6 +48,7 @@ export class Albums extends Base {
48
48
  * This returns the albums of an artist
49
49
  * @remarks MINIMUM_API_VERSION=380001
50
50
  * @param params.filter UID to find
51
+ * @param [params.album_artist] 0, 1 (if true filter for album artists only)
51
52
  * @param [params.offset]
52
53
  * @param [params.limit]
53
54
  * @param [params.cond]
@@ -57,6 +58,7 @@ export class Albums extends Base {
57
58
  artistAlbums(
58
59
  params: {
59
60
  filter: UID;
61
+ album_artist?: BinaryBoolean;
60
62
  } & ExtendedPagination,
61
63
  ) {
62
64
  let query = "artist_albums";
@@ -16,6 +16,8 @@ export type AlbumResponse = {
16
16
  prefix: string | null;
17
17
  basename: string;
18
18
  artist: ArtistSummary;
19
+ artists: ArtistSummary[];
20
+ songartists: ArtistSummary[];
19
21
  time: number;
20
22
  year: number | string;
21
23
  tracks?: SongResponse[];
@@ -1,5 +1,5 @@
1
1
  import { AlbumResponse } from "../albums/types";
2
- import { Song } from "../songs/types";
2
+ import { SongsResponse } from "../songs/types";
3
3
  import { GenreResponse } from "../genres/types";
4
4
 
5
5
  export type ArtistSummary = {
@@ -16,7 +16,7 @@ export type ArtistResponse = {
16
16
  basename: string;
17
17
  albums: AlbumResponse[];
18
18
  albumcount: number;
19
- songs: Song[];
19
+ songs: SongsResponse[];
20
20
  songcount: number;
21
21
  genre: GenreResponse[];
22
22
  art: string;
package/src/auth/types.ts CHANGED
@@ -20,6 +20,13 @@ export type AuthResponse = {
20
20
  songs: number;
21
21
  update: string;
22
22
  user: number;
23
+ username: string;
23
24
  version: string;
24
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;
25
32
  };
package/src/base.ts CHANGED
@@ -38,7 +38,7 @@ export type UID = string | number;
38
38
  export abstract class Base {
39
39
  sessionKey: string;
40
40
  url: string;
41
- version: string = "6.6.8"; // default to latest version
41
+ version: string = "6.6.8";
42
42
  debug: boolean;
43
43
 
44
44
  constructor(config: Config) {
@@ -1,116 +1,116 @@
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
+ 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,130 +1,130 @@
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
+ 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
+ }