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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-ampache",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "A JS library for the Ampache API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.m.js",
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
  }