fetchfox-sdk 1.0.22 → 1.0.24
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 +1 -1
- package/src/api.js +7 -1
- package/src/jobs.js +10 -10
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -30,7 +30,13 @@ export const call = async (method, path, params) => {
|
|
|
30
30
|
|
|
31
31
|
let url = endpoint(path, params);
|
|
32
32
|
if (method == 'GET') {
|
|
33
|
-
|
|
33
|
+
const clean = {};
|
|
34
|
+
for (const key of Object.keys(params || {})) {
|
|
35
|
+
if (params[key] !== undefined && params[key] !== null) {
|
|
36
|
+
clean[key] = params[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
url += '?' + new URLSearchParams(clean).toString();
|
|
34
40
|
} else {
|
|
35
41
|
args.body = JSON.stringify(params);
|
|
36
42
|
}
|
package/src/jobs.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { call } from './api.js';
|
|
2
2
|
|
|
3
3
|
export const jobs = {
|
|
4
|
-
get:
|
|
4
|
+
get: (id) => {
|
|
5
5
|
return call('GET', `/api/jobs/${id}`);
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
stop: (id) => {
|
|
8
|
+
return call('POST', `/api/jobs/${id}/stop`);
|
|
9
|
+
},
|
|
10
|
+
list: (args) => {
|
|
11
|
+
const params = { ...args };
|
|
11
12
|
|
|
12
|
-
if (
|
|
13
|
-
if (Array.isArray(
|
|
14
|
-
params.types =
|
|
13
|
+
if (parms?.types) {
|
|
14
|
+
if (Array.isArray(params.types)) {
|
|
15
|
+
params.types = params.types.join(',');
|
|
15
16
|
} else {
|
|
16
|
-
params.types =
|
|
17
|
+
params.types = params.types;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
const types = args?.types ?? 0;
|
|
20
20
|
return call('GET', '/api/jobs', params);
|
|
21
21
|
},
|
|
22
22
|
};
|