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/README.md
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
# javascript-ampache
|
|
2
|
-
|
|
3
|
-
A JS client for the Ampache API written in Typescript.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install javascript-ampache
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
Import `javascript-ampache` module in your project and initialize it with the URL to your server e.g. http://music.com.au
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import AmpacheAPI from
|
|
17
|
-
|
|
18
|
-
const API = new AmpacheAPI({
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
# javascript-ampache
|
|
2
|
+
|
|
3
|
+
A JS client for the Ampache API written in Typescript.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install javascript-ampache
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Import `javascript-ampache` module in your project and initialize it with the URL to your server e.g. http://music.com.au
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import AmpacheAPI from "javascript-ampache";
|
|
17
|
+
|
|
18
|
+
const API = new AmpacheAPI({
|
|
19
|
+
url: "http://pathToYourAmpacheServer",
|
|
20
|
+
sessionKey: yourSessionAuthKey,
|
|
21
|
+
}); // debug: true - will log the final GET to console
|
|
22
|
+
|
|
23
|
+
// either set the session key at time of instantiation or set/update with:
|
|
24
|
+
API.setSessionKey(yourSessionAuthKey);
|
|
25
|
+
|
|
26
|
+
let allUsers = API.users();
|
|
27
|
+
|
|
28
|
+
let thisAlbum = API.album({ filter: 123 });
|
|
29
|
+
|
|
30
|
+
let results = API.advancedSearch({
|
|
31
|
+
type: "album",
|
|
32
|
+
operator: "and",
|
|
33
|
+
random: 1,
|
|
34
|
+
limit: 20,
|
|
35
|
+
rules: [
|
|
36
|
+
["title", 0, "monkey"], // Title contains 'monkey'
|
|
37
|
+
["myrating", 2, 4], // Rating is 4 stars
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Build
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Special thanks
|
|
49
|
+
|
|
50
|
+
https://lyamkin.com/blog/how-to-build-api-client-library-in-js/ & https://github.com/ilyamkin/dev-to-js
|
package/dist/base.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export declare abstract class Base {
|
|
|
35
35
|
protected request<T>(endpoint: string): Promise<T>;
|
|
36
36
|
protected binary<T>(endpoint: string): Promise<Blob>;
|
|
37
37
|
setSessionKey(sessionKey: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Construct and return a URL
|
|
40
|
+
* @param endpoint
|
|
41
|
+
* @param [params]
|
|
42
|
+
*/
|
|
38
43
|
rawURL(endpoint: string, params?: {}): string;
|
|
39
44
|
}
|
|
40
45
|
export {};
|