batches.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.Batches = void 0;
  5. const resource_1 = require("../core/resource.js");
  6. const pagination_1 = require("../core/pagination.js");
  7. const path_1 = require("../internal/utils/path.js");
  8. class Batches extends resource_1.APIResource {
  9. /**
  10. * Creates and executes a batch from an uploaded file of requests
  11. */
  12. create(body, options) {
  13. return this._client.post('/batches', { body, ...options });
  14. }
  15. /**
  16. * Retrieves a batch.
  17. */
  18. retrieve(batchID, options) {
  19. return this._client.get((0, path_1.path) `/batches/${batchID}`, options);
  20. }
  21. /**
  22. * List your organization's batches.
  23. */
  24. list(query = {}, options) {
  25. return this._client.getAPIList('/batches', (pagination_1.CursorPage), { query, ...options });
  26. }
  27. /**
  28. * Cancels an in-progress batch. The batch will be in status `cancelling` for up to
  29. * 10 minutes, before changing to `cancelled`, where it will have partial results
  30. * (if any) available in the output file.
  31. */
  32. cancel(batchID, options) {
  33. return this._client.post((0, path_1.path) `/batches/${batchID}/cancel`, options);
  34. }
  35. }
  36. exports.Batches = Batches;
  37. //# sourceMappingURL=batches.js.map