videos.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.Videos = void 0;
  5. const resource_1 = require("../core/resource.js");
  6. const pagination_1 = require("../core/pagination.js");
  7. const headers_1 = require("../internal/headers.js");
  8. const uploads_1 = require("../internal/uploads.js");
  9. const path_1 = require("../internal/utils/path.js");
  10. class Videos extends resource_1.APIResource {
  11. /**
  12. * Create a video
  13. */
  14. create(body, options) {
  15. return this._client.post('/videos', (0, uploads_1.maybeMultipartFormRequestOptions)({ body, ...options }, this._client));
  16. }
  17. /**
  18. * Retrieve a video
  19. */
  20. retrieve(videoID, options) {
  21. return this._client.get((0, path_1.path) `/videos/${videoID}`, options);
  22. }
  23. /**
  24. * List videos
  25. */
  26. list(query = {}, options) {
  27. return this._client.getAPIList('/videos', (pagination_1.ConversationCursorPage), { query, ...options });
  28. }
  29. /**
  30. * Delete a video
  31. */
  32. delete(videoID, options) {
  33. return this._client.delete((0, path_1.path) `/videos/${videoID}`, options);
  34. }
  35. /**
  36. * Download video content
  37. */
  38. downloadContent(videoID, query = {}, options) {
  39. return this._client.get((0, path_1.path) `/videos/${videoID}/content`, {
  40. query,
  41. ...options,
  42. headers: (0, headers_1.buildHeaders)([{ Accept: 'application/binary' }, options?.headers]),
  43. __binaryResponse: true,
  44. });
  45. }
  46. /**
  47. * Create a video remix
  48. */
  49. remix(videoID, body, options) {
  50. return this._client.post((0, path_1.path) `/videos/${videoID}/remix`, (0, uploads_1.maybeMultipartFormRequestOptions)({ body, ...options }, this._client));
  51. }
  52. }
  53. exports.Videos = Videos;
  54. //# sourceMappingURL=videos.js.map