batches.mjs 1.2 KB

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