videos.mjs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from "../core/resource.mjs";
  3. import { ConversationCursorPage } from "../core/pagination.mjs";
  4. import { buildHeaders } from "../internal/headers.mjs";
  5. import { maybeMultipartFormRequestOptions } from "../internal/uploads.mjs";
  6. import { path } from "../internal/utils/path.mjs";
  7. export class Videos extends APIResource {
  8. /**
  9. * Create a video
  10. */
  11. create(body, options) {
  12. return this._client.post('/videos', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
  13. }
  14. /**
  15. * Retrieve a video
  16. */
  17. retrieve(videoID, options) {
  18. return this._client.get(path `/videos/${videoID}`, options);
  19. }
  20. /**
  21. * List videos
  22. */
  23. list(query = {}, options) {
  24. return this._client.getAPIList('/videos', (ConversationCursorPage), { query, ...options });
  25. }
  26. /**
  27. * Delete a video
  28. */
  29. delete(videoID, options) {
  30. return this._client.delete(path `/videos/${videoID}`, options);
  31. }
  32. /**
  33. * Download video content
  34. */
  35. downloadContent(videoID, query = {}, options) {
  36. return this._client.get(path `/videos/${videoID}/content`, {
  37. query,
  38. ...options,
  39. headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
  40. __binaryResponse: true,
  41. });
  42. }
  43. /**
  44. * Create a video remix
  45. */
  46. remix(videoID, body, options) {
  47. return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
  48. }
  49. }
  50. //# sourceMappingURL=videos.mjs.map