images.mjs 1.0 KB

12345678910111213141516171819202122232425
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from "../core/resource.mjs";
  3. import { multipartFormRequestOptions } from "../internal/uploads.mjs";
  4. export class Images extends APIResource {
  5. /**
  6. * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
  7. *
  8. * @example
  9. * ```ts
  10. * const imagesResponse = await client.images.createVariation({
  11. * image: fs.createReadStream('otter.png'),
  12. * });
  13. * ```
  14. */
  15. createVariation(body, options) {
  16. return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }, this._client));
  17. }
  18. edit(body, options) {
  19. return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false }, this._client));
  20. }
  21. generate(body, options) {
  22. return this._client.post('/images/generations', { body, ...options, stream: body.stream ?? false });
  23. }
  24. }
  25. //# sourceMappingURL=images.mjs.map