images.js 1.2 KB

1234567891011121314151617181920212223242526272829
  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.Images = void 0;
  5. const resource_1 = require("../core/resource.js");
  6. const uploads_1 = require("../internal/uploads.js");
  7. class Images extends resource_1.APIResource {
  8. /**
  9. * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
  10. *
  11. * @example
  12. * ```ts
  13. * const imagesResponse = await client.images.createVariation({
  14. * image: fs.createReadStream('otter.png'),
  15. * });
  16. * ```
  17. */
  18. createVariation(body, options) {
  19. return this._client.post('/images/variations', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
  20. }
  21. edit(body, options) {
  22. return this._client.post('/images/edits', (0, uploads_1.multipartFormRequestOptions)({ body, ...options, stream: body.stream ?? false }, this._client));
  23. }
  24. generate(body, options) {
  25. return this._client.post('/images/generations', { body, ...options, stream: body.stream ?? false });
  26. }
  27. }
  28. exports.Images = Images;
  29. //# sourceMappingURL=images.js.map