apify-client 3.0.0-beta.14 → 3.0.0-beta.16

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.
Files changed (73) hide show
  1. package/dist/apify_api_error.js +23 -7
  2. package/dist/apify_client.d.ts +22 -3
  3. package/dist/apify_client.js +35 -29
  4. package/dist/base/api_client.d.ts +6 -6
  5. package/dist/base/api_client.js +24 -16
  6. package/dist/base/resource_client.d.ts +13 -8
  7. package/dist/base/resource_client.js +35 -19
  8. package/dist/base/resource_collection_client.d.ts +6 -4
  9. package/dist/base/resource_collection_client.js +17 -11
  10. package/dist/bundle.js +13 -13
  11. package/dist/bundle.js.map +1 -1
  12. package/dist/http_client.d.ts +34 -13
  13. package/dist/http_client.js +58 -28
  14. package/dist/index.d.ts +1 -0
  15. package/dist/resource_clients/actor.d.ts +26 -11
  16. package/dist/resource_clients/actor.js +62 -33
  17. package/dist/resource_clients/actor_collection.d.ts +6 -2
  18. package/dist/resource_clients/actor_collection.js +9 -3
  19. package/dist/resource_clients/actor_env_var.d.ts +10 -3
  20. package/dist/resource_clients/actor_env_var.js +16 -6
  21. package/dist/resource_clients/actor_env_var_collection.d.ts +7 -2
  22. package/dist/resource_clients/actor_env_var_collection.js +11 -4
  23. package/dist/resource_clients/actor_version.d.ts +10 -3
  24. package/dist/resource_clients/actor_version.js +18 -8
  25. package/dist/resource_clients/actor_version_collection.d.ts +7 -2
  26. package/dist/resource_clients/actor_version_collection.js +11 -4
  27. package/dist/resource_clients/build.d.ts +16 -6
  28. package/dist/resource_clients/build.js +30 -15
  29. package/dist/resource_clients/build_collection.d.ts +3 -1
  30. package/dist/resource_clients/build_collection.js +4 -1
  31. package/dist/resource_clients/dataset.d.ts +21 -7
  32. package/dist/resource_clients/dataset.js +65 -37
  33. package/dist/resource_clients/dataset_collection.d.ts +6 -2
  34. package/dist/resource_clients/dataset_collection.js +12 -2
  35. package/dist/resource_clients/key_value_store.d.ts +31 -11
  36. package/dist/resource_clients/key_value_store.js +58 -34
  37. package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
  38. package/dist/resource_clients/key_value_store_collection.js +12 -2
  39. package/dist/resource_clients/log.d.ts +4 -1
  40. package/dist/resource_clients/log.js +15 -6
  41. package/dist/resource_clients/request_queue.d.ts +52 -18
  42. package/dist/resource_clients/request_queue.js +114 -60
  43. package/dist/resource_clients/request_queue_collection.d.ts +6 -2
  44. package/dist/resource_clients/request_queue_collection.js +9 -3
  45. package/dist/resource_clients/run.d.ts +33 -13
  46. package/dist/resource_clients/run.js +65 -35
  47. package/dist/resource_clients/run_collection.d.ts +3 -1
  48. package/dist/resource_clients/run_collection.js +4 -1
  49. package/dist/resource_clients/schedule.d.ts +13 -4
  50. package/dist/resource_clients/schedule.js +23 -9
  51. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  52. package/dist/resource_clients/schedule_collection.js +9 -3
  53. package/dist/resource_clients/store_collection.d.ts +3 -1
  54. package/dist/resource_clients/store_collection.js +4 -1
  55. package/dist/resource_clients/task.d.ts +27 -9
  56. package/dist/resource_clients/task.js +60 -31
  57. package/dist/resource_clients/task_collection.d.ts +6 -2
  58. package/dist/resource_clients/task_collection.js +9 -3
  59. package/dist/resource_clients/user.d.ts +14 -5
  60. package/dist/resource_clients/user.js +30 -14
  61. package/dist/resource_clients/webhook.d.ts +13 -4
  62. package/dist/resource_clients/webhook.js +24 -10
  63. package/dist/resource_clients/webhook_collection.d.ts +6 -2
  64. package/dist/resource_clients/webhook_collection.js +9 -3
  65. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  66. package/dist/resource_clients/webhook_dispatch.js +7 -2
  67. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  68. package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
  69. package/dist/timeouts.d.ts +72 -0
  70. package/dist/timeouts.js +31 -0
  71. package/dist/utils.d.ts +10 -0
  72. package/dist/utils.js +10 -0
  73. package/package.json +1 -1
@@ -8,35 +8,41 @@ export class ResourceCollectionClient extends ApiClient {
8
8
  /**
9
9
  * @private
10
10
  */
11
- async _list(schema, options = {}) {
11
+ async listResources(schema, options, timeoutSecs) {
12
12
  const response = await this.httpClient.call({
13
- url: this._url(),
13
+ url: this.buildUrl(),
14
14
  method: 'GET',
15
- params: this._params(options),
15
+ params: this.buildParams(options),
16
+ timeoutSecs,
16
17
  });
17
18
  return parseResponse(response, schema);
18
19
  }
19
20
  /**
20
21
  * Returns async iterator to iterate through all items and Promise that can be awaited to get first page of results.
22
+ * `defaultTimeoutSecs` applies to every page request unless `options.timeoutSecs` overrides it.
21
23
  */
22
- _listPaginated(schema, options = {}) {
23
- return this._listPaginatedFromCallback(async (listOptions) => this._list(schema, listOptions), options);
24
+ listResourcesPaginated(schema, options, defaultTimeoutSecs) {
25
+ // `timeoutSecs` only times the page requests; it is not an API parameter, so it must not reach the query string.
26
+ const { timeoutSecs = defaultTimeoutSecs, ...listOptions } = options;
27
+ return this.listPaginatedFromCallback(async (pageOptions) => this.listResources(schema, pageOptions, timeoutSecs), listOptions);
24
28
  }
25
- async _create(schema, resource) {
29
+ async createResource(schema, resource, timeoutSecs) {
26
30
  const response = await this.httpClient.call({
27
- url: this._url(),
31
+ url: this.buildUrl(),
28
32
  method: 'POST',
29
- params: this._params(),
33
+ params: this.buildParams(),
30
34
  data: resource,
35
+ timeoutSecs,
31
36
  });
32
37
  return parseResponse(response, schema);
33
38
  }
34
- async _getOrCreate(schema, name, resource) {
39
+ async getOrCreateResource(schema, name, resource, timeoutSecs) {
35
40
  const response = await this.httpClient.call({
36
- url: this._url(),
41
+ url: this.buildUrl(),
37
42
  method: 'POST',
38
- params: this._params({ name }),
43
+ params: this.buildParams({ name }),
39
44
  data: resource,
45
+ timeoutSecs,
40
46
  });
41
47
  return parseResponse(response, schema);
42
48
  }