javascript-ampache 1.0.8 → 1.0.9
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/dist/base.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/base.ts +22 -0
package/package.json
CHANGED
package/src/base.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fetch from 'isomorphic-unfetch';
|
|
2
|
+
import qs from 'querystringify';
|
|
2
3
|
|
|
3
4
|
type Config = {
|
|
4
5
|
url: string,
|
|
@@ -94,4 +95,25 @@ export abstract class Base {
|
|
|
94
95
|
public setSessionKey(sessionKey: string) {
|
|
95
96
|
this.sessionKey = sessionKey;
|
|
96
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Construct and return a URL
|
|
101
|
+
* @param endpoint
|
|
102
|
+
* @param [params]
|
|
103
|
+
*/
|
|
104
|
+
public rawURL(endpoint: string, params?: {}) {
|
|
105
|
+
let query = endpoint;
|
|
106
|
+
query += qs.stringify(params, '&');
|
|
107
|
+
|
|
108
|
+
let url = this.url + "/server/json.server.php?action=" + query + "&version=" + this.version;
|
|
109
|
+
|
|
110
|
+
if (this.debug) {
|
|
111
|
+
console.debug(
|
|
112
|
+
"javascript-ampache query URL %c" + url + "&auth=" + this.sessionKey,
|
|
113
|
+
"color: black; font-style: italic; background-color: orange;padding: 2px"
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return url;
|
|
118
|
+
}
|
|
97
119
|
}
|