all-debrid-api 1.3.1 → 1.3.3
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/lib/AllDebridClient.js +14 -7
- package/package.json +1 -1
package/lib/AllDebridClient.js
CHANGED
|
@@ -24,7 +24,7 @@ class AllDebridClient {
|
|
|
24
24
|
_request (endpoint, o = {}) {
|
|
25
25
|
const url = this.base_url + endpoint
|
|
26
26
|
|
|
27
|
-
const options = { ...this.defaultOptions }
|
|
27
|
+
const options = { ...this.defaultOptions, ...o }
|
|
28
28
|
options.url = url
|
|
29
29
|
options.json = true
|
|
30
30
|
options.params = o.params || {}
|
|
@@ -33,13 +33,13 @@ class AllDebridClient {
|
|
|
33
33
|
options.headers = options.headers || {}
|
|
34
34
|
options.headers['Authorization'] = 'Bearer ' + this.token
|
|
35
35
|
|
|
36
|
-
for (let i in o) {
|
|
37
|
-
options[i] = o[i]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
36
|
return axios.request(options)
|
|
41
|
-
.then(response =>
|
|
42
|
-
|
|
37
|
+
.then(response => {
|
|
38
|
+
if (response.data?.status === 'error') {
|
|
39
|
+
return Promise.reject(response.data.error)
|
|
40
|
+
}
|
|
41
|
+
return response.data
|
|
42
|
+
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
_get (endpoint, options = {}) {
|
|
@@ -192,6 +192,13 @@ class AllDebridClient {
|
|
|
192
192
|
}
|
|
193
193
|
})
|
|
194
194
|
},
|
|
195
|
+
files: (id) => {
|
|
196
|
+
return this._get('/v4/magnet/files', {
|
|
197
|
+
params: {
|
|
198
|
+
id: [id]
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
},
|
|
195
202
|
delete: (id) => {
|
|
196
203
|
return this._get('/v4/magnet/delete', {
|
|
197
204
|
params: {
|