fetchfox-sdk 1.0.10 → 1.0.12

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": "fetchfox-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "AI scraper",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/credits.js ADDED
@@ -0,0 +1,7 @@
1
+ import { call } from './api.js';
2
+
3
+ export const credits = {
4
+ balance: {
5
+ get: async () => call('GET', '/api/credits/balance'),
6
+ },
7
+ };
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './crawl.js';
3
3
  export * from './extract.js';
4
4
  export * from './jobs.js';
5
5
  export * from './user.js';
6
+ export * from './credits.js';
6
7
  export * from './proxy.js';
7
8
  export * from './urls.js';
8
9
  export { Job } from './detach.js';
package/src/jobs.js CHANGED
@@ -5,8 +5,18 @@ export const jobs = {
5
5
  return call('GET', `/api/jobs/${id}`);
6
6
  },
7
7
  list: async (args) => {
8
- const limit = args?.limit ?? 100;
9
- const offset = args?.offset ?? 0;
10
- return call('GET', '/api/jobs', { limit, offset });
8
+ const params = {};
9
+ params.limit = args?.limit ?? 100;
10
+ params.offset = args?.offset ?? 0;
11
+
12
+ if (args?.types) {
13
+ if (Array.isArray(args.types)) {
14
+ params.types = args.types.join(',');
15
+ } else {
16
+ params.types = args.types;
17
+ }
18
+ }
19
+ const types = args?.types ?? 0;
20
+ return call('GET', '/api/jobs', params);
11
21
  },
12
22
  };