magic-hour 0.67.0 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +10 -0
  2. package/dist/environment.d.ts +1 -1
  3. package/dist/environment.js +1 -1
  4. package/dist/resources/v1/ai-video-editor/index.d.ts +2 -0
  5. package/dist/resources/v1/ai-video-editor/index.js +5 -0
  6. package/dist/resources/v1/ai-video-editor/request-types.d.ts +41 -0
  7. package/dist/resources/v1/ai-video-editor/request-types.js +85 -0
  8. package/dist/resources/v1/ai-video-editor/resource-client.d.ts +76 -0
  9. package/dist/resources/v1/ai-video-editor/resource-client.js +120 -0
  10. package/dist/resources/v1/body-swap/resource-client.d.ts +1 -1
  11. package/dist/resources/v1/body-swap/resource-client.js +1 -1
  12. package/dist/resources/v1/character-replace/index.d.ts +2 -0
  13. package/dist/resources/v1/character-replace/index.js +5 -0
  14. package/dist/resources/v1/character-replace/request-types.d.ts +49 -0
  15. package/dist/resources/v1/character-replace/request-types.js +89 -0
  16. package/dist/resources/v1/character-replace/resource-client.d.ts +88 -0
  17. package/dist/resources/v1/character-replace/resource-client.js +129 -0
  18. package/dist/resources/v1/index.d.ts +2 -0
  19. package/dist/resources/v1/index.js +3 -1
  20. package/dist/resources/v1/resource-client.d.ts +6 -0
  21. package/dist/resources/v1/resource-client.js +12 -0
  22. package/dist/types/index.d.ts +12 -0
  23. package/dist/types/v1-ai-video-editor-create-body-assets.d.ts +27 -0
  24. package/dist/types/v1-ai-video-editor-create-body-assets.js +67 -0
  25. package/dist/types/v1-ai-video-editor-create-body-style.d.ts +22 -0
  26. package/dist/types/v1-ai-video-editor-create-body-style.js +67 -0
  27. package/dist/types/v1-ai-video-editor-create-body.d.ts +41 -0
  28. package/dist/types/v1-ai-video-editor-create-body.js +85 -0
  29. package/dist/types/v1-ai-video-editor-create-response.d.ts +36 -0
  30. package/dist/types/v1-ai-video-editor-create-response.js +75 -0
  31. package/dist/types/v1-character-replace-create-body-assets.d.ts +37 -0
  32. package/dist/types/v1-character-replace-create-body-assets.js +71 -0
  33. package/dist/types/v1-character-replace-create-body-resolution-enum.d.ts +4 -0
  34. package/dist/types/v1-character-replace-create-body-resolution-enum.js +2 -0
  35. package/dist/types/v1-character-replace-create-body-style-mode-enum.d.ts +4 -0
  36. package/dist/types/v1-character-replace-create-body-style-mode-enum.js +2 -0
  37. package/dist/types/v1-character-replace-create-body-style-points-item.d.ts +32 -0
  38. package/dist/types/v1-character-replace-create-body-style-points-item.js +75 -0
  39. package/dist/types/v1-character-replace-create-body-style-selection-mode-enum.d.ts +4 -0
  40. package/dist/types/v1-character-replace-create-body-style-selection-mode-enum.js +2 -0
  41. package/dist/types/v1-character-replace-create-body-style.d.ts +33 -0
  42. package/dist/types/v1-character-replace-create-body-style.js +80 -0
  43. package/dist/types/v1-character-replace-create-body.d.ts +49 -0
  44. package/dist/types/v1-character-replace-create-body.js +89 -0
  45. package/dist/types/v1-character-replace-create-response.d.ts +36 -0
  46. package/dist/types/v1-character-replace-create-response.js +75 -0
  47. package/package.json +1 -1
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.CharacterReplaceClient = void 0;
24
+ const make_api_request_js_1 = require("make-api-request-js");
25
+ const logger_1 = require("../../../logger");
26
+ const files_1 = require("../../../resources/v1/files");
27
+ const video_projects_1 = require("../../../resources/v1/video-projects");
28
+ const v1_character_replace_create_body_1 = require("../../../types/v1-character-replace-create-body");
29
+ const v1_character_replace_create_response_1 = require("../../../types/v1-character-replace-create-response");
30
+ class CharacterReplaceClient extends make_api_request_js_1.CoreResourceClient {
31
+ constructor(coreClient, opts) {
32
+ super(coreClient, opts);
33
+ }
34
+ /**
35
+ * Character Replace
36
+ *
37
+ * Create a Character Replace video
38
+ *
39
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import { Client } from "../../../index.js";
44
+ *
45
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
46
+ * const res = await client.v1.characterReplace.generate(
47
+ * {
48
+ * assets: {
49
+ * imageFilePath: "/path/to/5678.png",
50
+ * videoFilePath: "/path/to/1234.mp4",
51
+ * },
52
+ * endSeconds: 15.0,
53
+ * name: "My Character Replace video",
54
+ * resolution: "720p",
55
+ * startSeconds: 0.0,
56
+ * style: { mode: "replace", selectionMode: "auto" },
57
+ * },
58
+ * {
59
+ * waitForCompletion: true,
60
+ * downloadOutputs: true,
61
+ * downloadDirectory: ".",
62
+ * },
63
+ * );
64
+ * ```
65
+ */
66
+ generate(request_1) {
67
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
68
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
69
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
70
+ const _a = request.assets, { imageFilePath, videoFilePath } = _a, restAssets = __rest(_a, ["imageFilePath", "videoFilePath"]);
71
+ (0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
72
+ (0, logger_1.getLogger)().debug(`Uploading file ${videoFilePath} to Magic Hour's storage`);
73
+ const [uploadedImageFilePath, uploadedVideoFilePath] = yield Promise.all([
74
+ fileClient.uploadFile(imageFilePath),
75
+ fileClient.uploadFile(videoFilePath),
76
+ ]);
77
+ (0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
78
+ (0, logger_1.getLogger)().info(`Uploaded file ${videoFilePath} to Magic Hour's storage as ${uploadedVideoFilePath}`);
79
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { imageFilePath: uploadedImageFilePath, videoFilePath: uploadedVideoFilePath }) }), createOpts);
80
+ (0, logger_1.getLogger)().info(`Created CharacterReplaceClient project ${createResponse.id}`);
81
+ const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
82
+ (0, logger_1.getLogger)().debug(`Checking result for CharacterReplaceClient project ${createResponse.id}`);
83
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
84
+ downloadOutputs,
85
+ downloadDirectory }, createOpts));
86
+ return result;
87
+ });
88
+ }
89
+ /**
90
+ * Character Replace
91
+ *
92
+ * **What this API does**
93
+ *
94
+ * Create the same Character Replace you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
95
+ *
96
+ * **Good for**
97
+ * - Automation and batch processing
98
+ * - Adding character replace into apps, pipelines, or tools
99
+ *
100
+ * **How it works (3 steps)**
101
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
102
+ * 2) Send a request to create a character replace job with the basic fields.
103
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
104
+ *
105
+ * **Key options**
106
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
107
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
108
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
109
+ *
110
+ * **Cost**
111
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
112
+ *
113
+ * For detailed examples, see the [product page](https://magichour.ai/products/character-replace).
114
+ *
115
+ * POST /v1/character-replace
116
+ */
117
+ create(request, opts) {
118
+ return this._client.makeRequest({
119
+ method: "post",
120
+ path: "/v1/character-replace",
121
+ auth: ["bearerAuth"],
122
+ contentType: "application/json",
123
+ body: v1_character_replace_create_body_1.Schemas$V1CharacterReplaceCreateBody.out.parse(request),
124
+ responseSchema: v1_character_replace_create_response_1.Schemas$V1CharacterReplaceCreateResponse.in,
125
+ opts,
126
+ });
127
+ }
128
+ }
129
+ exports.CharacterReplaceClient = CharacterReplaceClient;
@@ -8,6 +8,7 @@ export * as aiImageUpscaler from "./ai-image-upscaler";
8
8
  export * as aiMemeGenerator from "./ai-meme-generator";
9
9
  export * as aiQrCodeGenerator from "./ai-qr-code-generator";
10
10
  export * as aiTalkingPhoto from "./ai-talking-photo";
11
+ export * as aiVideoEditor from "./ai-video-editor";
11
12
  export * as aiVoiceCloner from "./ai-voice-cloner";
12
13
  export * as aiVoiceGenerator from "./ai-voice-generator";
13
14
  export * as animation from "./animation";
@@ -15,6 +16,7 @@ export * as audioProjects from "./audio-projects";
15
16
  export * as audioToVideo from "./audio-to-video";
16
17
  export * as autoSubtitleGenerator from "./auto-subtitle-generator";
17
18
  export * as bodySwap from "./body-swap";
19
+ export * as characterReplace from "./character-replace";
18
20
  export * as faceDetection from "./face-detection";
19
21
  export * as faceSwap from "./face-swap";
20
22
  export * as faceSwapPhoto from "./face-swap-photo";
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioToVideo = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = void 0;
36
+ exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.characterReplace = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioToVideo = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiVideoEditor = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = void 0;
37
37
  exports.aiClothesChanger = __importStar(require("./ai-clothes-changer"));
38
38
  exports.aiFaceEditor = __importStar(require("./ai-face-editor"));
39
39
  exports.aiGifGenerator = __importStar(require("./ai-gif-generator"));
@@ -44,6 +44,7 @@ exports.aiImageUpscaler = __importStar(require("./ai-image-upscaler"));
44
44
  exports.aiMemeGenerator = __importStar(require("./ai-meme-generator"));
45
45
  exports.aiQrCodeGenerator = __importStar(require("./ai-qr-code-generator"));
46
46
  exports.aiTalkingPhoto = __importStar(require("./ai-talking-photo"));
47
+ exports.aiVideoEditor = __importStar(require("./ai-video-editor"));
47
48
  exports.aiVoiceCloner = __importStar(require("./ai-voice-cloner"));
48
49
  exports.aiVoiceGenerator = __importStar(require("./ai-voice-generator"));
49
50
  exports.animation = __importStar(require("./animation"));
@@ -51,6 +52,7 @@ exports.audioProjects = __importStar(require("./audio-projects"));
51
52
  exports.audioToVideo = __importStar(require("./audio-to-video"));
52
53
  exports.autoSubtitleGenerator = __importStar(require("./auto-subtitle-generator"));
53
54
  exports.bodySwap = __importStar(require("./body-swap"));
55
+ exports.characterReplace = __importStar(require("./character-replace"));
54
56
  exports.faceDetection = __importStar(require("./face-detection"));
55
57
  exports.faceSwap = __importStar(require("./face-swap"));
56
58
  exports.faceSwapPhoto = __importStar(require("./face-swap-photo"));
@@ -9,6 +9,7 @@ import { AiImageUpscalerClient } from "../../resources/v1/ai-image-upscaler";
9
9
  import { AiMemeGeneratorClient } from "../../resources/v1/ai-meme-generator";
10
10
  import { AiQrCodeGeneratorClient } from "../../resources/v1/ai-qr-code-generator";
11
11
  import { AiTalkingPhotoClient } from "../../resources/v1/ai-talking-photo";
12
+ import { AiVideoEditorClient } from "../../resources/v1/ai-video-editor";
12
13
  import { AiVoiceClonerClient } from "../../resources/v1/ai-voice-cloner";
13
14
  import { AiVoiceGeneratorClient } from "../../resources/v1/ai-voice-generator";
14
15
  import { AnimationClient } from "../../resources/v1/animation";
@@ -16,6 +17,7 @@ import { AudioProjectsClient } from "../../resources/v1/audio-projects";
16
17
  import { AudioToVideoClient } from "../../resources/v1/audio-to-video";
17
18
  import { AutoSubtitleGeneratorClient } from "../../resources/v1/auto-subtitle-generator";
18
19
  import { BodySwapClient } from "../../resources/v1/body-swap";
20
+ import { CharacterReplaceClient } from "../../resources/v1/character-replace";
19
21
  import { FaceDetectionClient } from "../../resources/v1/face-detection";
20
22
  import { FaceSwapClient } from "../../resources/v1/face-swap";
21
23
  import { FaceSwapPhotoClient } from "../../resources/v1/face-swap-photo";
@@ -30,6 +32,8 @@ import { TextToVideoClient } from "../../resources/v1/text-to-video";
30
32
  import { VideoProjectsClient } from "../../resources/v1/video-projects";
31
33
  import { VideoToVideoClient } from "../../resources/v1/video-to-video";
32
34
  export declare class V1Client extends CoreResourceClient {
35
+ private _characterReplaceLazy?;
36
+ private _aiVideoEditorLazy?;
33
37
  private _audioToVideoLazy?;
34
38
  private _bodySwapLazy?;
35
39
  private _headSwapLazy?;
@@ -91,4 +95,6 @@ export declare class V1Client extends CoreResourceClient {
91
95
  get headSwap(): HeadSwapClient;
92
96
  get bodySwap(): BodySwapClient;
93
97
  get audioToVideo(): AudioToVideoClient;
98
+ get aiVideoEditor(): AiVideoEditorClient;
99
+ get characterReplace(): CharacterReplaceClient;
94
100
  }
@@ -16,6 +16,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
16
16
  this.aiMemeGenerator;
17
17
  this.aiQrCodeGenerator;
18
18
  this.aiTalkingPhoto;
19
+ this.aiVideoEditor;
19
20
  this.aiVoiceCloner;
20
21
  this.aiVoiceGenerator;
21
22
  this.animation;
@@ -23,6 +24,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
23
24
  this.audioToVideo;
24
25
  this.autoSubtitleGenerator;
25
26
  this.bodySwap;
27
+ this.characterReplace;
26
28
  this.faceDetection;
27
29
  this.faceSwap;
28
30
  this.faceSwapPhoto;
@@ -182,5 +184,15 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
182
184
  return ((_a = this._audioToVideoLazy) !== null && _a !== void 0 ? _a : (this._audioToVideoLazy =
183
185
  new (require("./audio-to-video").AudioToVideoClient)(this._client, this._opts)));
184
186
  }
187
+ get aiVideoEditor() {
188
+ var _a;
189
+ return ((_a = this._aiVideoEditorLazy) !== null && _a !== void 0 ? _a : (this._aiVideoEditorLazy =
190
+ new (require("./ai-video-editor").AiVideoEditorClient)(this._client, this._opts)));
191
+ }
192
+ get characterReplace() {
193
+ var _a;
194
+ return ((_a = this._characterReplaceLazy) !== null && _a !== void 0 ? _a : (this._characterReplaceLazy =
195
+ new (require("./character-replace").CharacterReplaceClient)(this._client, this._opts)));
196
+ }
185
197
  }
186
198
  exports.V1Client = V1Client;
@@ -49,6 +49,10 @@ export { V1AiTalkingPhotoCreateBodyAssets } from "./v1-ai-talking-photo-create-b
49
49
  export { V1AiTalkingPhotoCreateBodyStyle } from "./v1-ai-talking-photo-create-body-style";
50
50
  export { V1AiTalkingPhotoCreateBodyStyleGenerationModeEnum } from "./v1-ai-talking-photo-create-body-style-generation-mode-enum";
51
51
  export { V1AiTalkingPhotoCreateResponse } from "./v1-ai-talking-photo-create-response";
52
+ export { V1AiVideoEditorCreateBody } from "./v1-ai-video-editor-create-body";
53
+ export { V1AiVideoEditorCreateBodyAssets } from "./v1-ai-video-editor-create-body-assets";
54
+ export { V1AiVideoEditorCreateBodyStyle } from "./v1-ai-video-editor-create-body-style";
55
+ export { V1AiVideoEditorCreateResponse } from "./v1-ai-video-editor-create-response";
52
56
  export { V1AiVoiceClonerCreateBody } from "./v1-ai-voice-cloner-create-body";
53
57
  export { V1AiVoiceClonerCreateBodyAssets } from "./v1-ai-voice-cloner-create-body-assets";
54
58
  export { V1AiVoiceClonerCreateBodyStyle } from "./v1-ai-voice-cloner-create-body-style";
@@ -84,6 +88,14 @@ export { V1BodySwapCreateBody } from "./v1-body-swap-create-body";
84
88
  export { V1BodySwapCreateBodyAssets } from "./v1-body-swap-create-body-assets";
85
89
  export { V1BodySwapCreateBodyResolutionEnum } from "./v1-body-swap-create-body-resolution-enum";
86
90
  export { V1BodySwapCreateResponse } from "./v1-body-swap-create-response";
91
+ export { V1CharacterReplaceCreateBody } from "./v1-character-replace-create-body";
92
+ export { V1CharacterReplaceCreateBodyAssets } from "./v1-character-replace-create-body-assets";
93
+ export { V1CharacterReplaceCreateBodyResolutionEnum } from "./v1-character-replace-create-body-resolution-enum";
94
+ export { V1CharacterReplaceCreateBodyStyle } from "./v1-character-replace-create-body-style";
95
+ export { V1CharacterReplaceCreateBodyStyleModeEnum } from "./v1-character-replace-create-body-style-mode-enum";
96
+ export { V1CharacterReplaceCreateBodyStylePointsItem } from "./v1-character-replace-create-body-style-points-item";
97
+ export { V1CharacterReplaceCreateBodyStyleSelectionModeEnum } from "./v1-character-replace-create-body-style-selection-mode-enum";
98
+ export { V1CharacterReplaceCreateResponse } from "./v1-character-replace-create-response";
87
99
  export { V1FaceDetectionCreateBody } from "./v1-face-detection-create-body";
88
100
  export { V1FaceDetectionCreateBodyAssets } from "./v1-face-detection-create-body-assets";
89
101
  export { V1FaceDetectionCreateResponse } from "./v1-face-detection-create-response";
@@ -0,0 +1,27 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Provide the assets for video editing.
4
+ */
5
+ export type V1AiVideoEditorCreateBodyAssets = {
6
+ /**
7
+ * The video to edit. This value is either
8
+ * - a direct URL to the video file
9
+ * - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
10
+ *
11
+ * See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
12
+ *
13
+ */
14
+ videoFilePath: string;
15
+ };
16
+ /**
17
+ * @internal
18
+ * V1AiVideoEditorCreateBodyAssets without any key transformation, this is what
19
+ * we expect to come in as network data
20
+ */
21
+ export type External$V1AiVideoEditorCreateBodyAssets = {
22
+ video_file_path: string;
23
+ };
24
+ export declare const Schemas$V1AiVideoEditorCreateBodyAssets: {
25
+ in: z.ZodType<V1AiVideoEditorCreateBodyAssets, z.ZodTypeDef, unknown>;
26
+ out: z.ZodType<External$V1AiVideoEditorCreateBodyAssets, z.ZodTypeDef, V1AiVideoEditorCreateBodyAssets>;
27
+ };
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$V1AiVideoEditorCreateBodyAssets = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1AiVideoEditorCreateBodyAssets
41
+ */
42
+ const SchemaIn$V1AiVideoEditorCreateBodyAssets = z
43
+ .object({
44
+ video_file_path: z.string(),
45
+ })
46
+ .transform((obj) => {
47
+ return (0, make_api_request_js_1.zodTransform)(obj, {
48
+ video_file_path: "videoFilePath",
49
+ });
50
+ });
51
+ /**
52
+ * @internal
53
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiVideoEditorCreateBodyAssets
54
+ */
55
+ const SchemaOut$V1AiVideoEditorCreateBodyAssets = z
56
+ .object({
57
+ videoFilePath: z.string(),
58
+ })
59
+ .transform((obj) => {
60
+ return (0, make_api_request_js_1.zodTransform)(obj, {
61
+ videoFilePath: "video_file_path",
62
+ });
63
+ });
64
+ exports.Schemas$V1AiVideoEditorCreateBodyAssets = {
65
+ in: SchemaIn$V1AiVideoEditorCreateBodyAssets,
66
+ out: SchemaOut$V1AiVideoEditorCreateBodyAssets,
67
+ };
@@ -0,0 +1,22 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * V1AiVideoEditorCreateBodyStyle
4
+ */
5
+ export type V1AiVideoEditorCreateBodyStyle = {
6
+ /**
7
+ * The prompt used to edit the video.
8
+ */
9
+ prompt: string;
10
+ };
11
+ /**
12
+ * @internal
13
+ * V1AiVideoEditorCreateBodyStyle without any key transformation, this is what
14
+ * we expect to come in as network data
15
+ */
16
+ export type External$V1AiVideoEditorCreateBodyStyle = {
17
+ prompt: string;
18
+ };
19
+ export declare const Schemas$V1AiVideoEditorCreateBodyStyle: {
20
+ in: z.ZodType<V1AiVideoEditorCreateBodyStyle, z.ZodTypeDef, unknown>;
21
+ out: z.ZodType<External$V1AiVideoEditorCreateBodyStyle, z.ZodTypeDef, V1AiVideoEditorCreateBodyStyle>;
22
+ };
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$V1AiVideoEditorCreateBodyStyle = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1AiVideoEditorCreateBodyStyle
41
+ */
42
+ const SchemaIn$V1AiVideoEditorCreateBodyStyle = z
43
+ .object({
44
+ prompt: z.string(),
45
+ })
46
+ .transform((obj) => {
47
+ return (0, make_api_request_js_1.zodTransform)(obj, {
48
+ prompt: "prompt",
49
+ });
50
+ });
51
+ /**
52
+ * @internal
53
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiVideoEditorCreateBodyStyle
54
+ */
55
+ const SchemaOut$V1AiVideoEditorCreateBodyStyle = z
56
+ .object({
57
+ prompt: z.string(),
58
+ })
59
+ .transform((obj) => {
60
+ return (0, make_api_request_js_1.zodTransform)(obj, {
61
+ prompt: "prompt",
62
+ });
63
+ });
64
+ exports.Schemas$V1AiVideoEditorCreateBodyStyle = {
65
+ in: SchemaIn$V1AiVideoEditorCreateBodyStyle,
66
+ out: SchemaOut$V1AiVideoEditorCreateBodyStyle,
67
+ };
@@ -0,0 +1,41 @@
1
+ import * as z from "zod";
2
+ import { External$V1AiVideoEditorCreateBodyAssets, V1AiVideoEditorCreateBodyAssets } from "./v1-ai-video-editor-create-body-assets";
3
+ import { External$V1AiVideoEditorCreateBodyStyle, V1AiVideoEditorCreateBodyStyle } from "./v1-ai-video-editor-create-body-style";
4
+ /**
5
+ * V1AiVideoEditorCreateBody
6
+ */
7
+ export type V1AiVideoEditorCreateBody = {
8
+ /**
9
+ * Provide the assets for video editing.
10
+ */
11
+ assets: V1AiVideoEditorCreateBodyAssets;
12
+ /**
13
+ * End time of your clip in seconds. Must be greater than `start_seconds`. Duration must be between 3 and 10 seconds.
14
+ */
15
+ endSeconds: number;
16
+ /**
17
+ * Give your video a custom name for easy identification.
18
+ */
19
+ name?: string | undefined;
20
+ /**
21
+ * Start time of your clip (seconds). Must be ≥ 0.
22
+ */
23
+ startSeconds?: number | undefined;
24
+ style: V1AiVideoEditorCreateBodyStyle;
25
+ };
26
+ /**
27
+ * @internal
28
+ * V1AiVideoEditorCreateBody without any key transformation, this is what
29
+ * we expect to come in as network data
30
+ */
31
+ export type External$V1AiVideoEditorCreateBody = {
32
+ assets: External$V1AiVideoEditorCreateBodyAssets;
33
+ end_seconds: number;
34
+ name?: string | undefined;
35
+ start_seconds?: number | undefined;
36
+ style: External$V1AiVideoEditorCreateBodyStyle;
37
+ };
38
+ export declare const Schemas$V1AiVideoEditorCreateBody: {
39
+ in: z.ZodType<V1AiVideoEditorCreateBody, z.ZodTypeDef, unknown>;
40
+ out: z.ZodType<External$V1AiVideoEditorCreateBody, z.ZodTypeDef, V1AiVideoEditorCreateBody>;
41
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$V1AiVideoEditorCreateBody = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ const v1_ai_video_editor_create_body_assets_1 = require("./v1-ai-video-editor-create-body-assets");
40
+ const v1_ai_video_editor_create_body_style_1 = require("./v1-ai-video-editor-create-body-style");
41
+ /**
42
+ * Takes network data, validates it, and transforms keys to match typescript object V1AiVideoEditorCreateBody
43
+ */
44
+ const SchemaIn$V1AiVideoEditorCreateBody = z
45
+ .object({
46
+ assets: v1_ai_video_editor_create_body_assets_1.Schemas$V1AiVideoEditorCreateBodyAssets.in,
47
+ end_seconds: z.number(),
48
+ name: z.string().optional(),
49
+ start_seconds: z.number().optional(),
50
+ style: v1_ai_video_editor_create_body_style_1.Schemas$V1AiVideoEditorCreateBodyStyle.in,
51
+ })
52
+ .transform((obj) => {
53
+ return (0, make_api_request_js_1.zodTransform)(obj, {
54
+ assets: "assets",
55
+ end_seconds: "endSeconds",
56
+ name: "name",
57
+ start_seconds: "startSeconds",
58
+ style: "style",
59
+ });
60
+ });
61
+ /**
62
+ * @internal
63
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiVideoEditorCreateBody
64
+ */
65
+ const SchemaOut$V1AiVideoEditorCreateBody = z
66
+ .object({
67
+ assets: v1_ai_video_editor_create_body_assets_1.Schemas$V1AiVideoEditorCreateBodyAssets.out,
68
+ endSeconds: z.number(),
69
+ name: z.string().optional(),
70
+ startSeconds: z.number().optional(),
71
+ style: v1_ai_video_editor_create_body_style_1.Schemas$V1AiVideoEditorCreateBodyStyle.out,
72
+ })
73
+ .transform((obj) => {
74
+ return (0, make_api_request_js_1.zodTransform)(obj, {
75
+ assets: "assets",
76
+ endSeconds: "end_seconds",
77
+ name: "name",
78
+ startSeconds: "start_seconds",
79
+ style: "style",
80
+ });
81
+ });
82
+ exports.Schemas$V1AiVideoEditorCreateBody = {
83
+ in: SchemaIn$V1AiVideoEditorCreateBody,
84
+ out: SchemaOut$V1AiVideoEditorCreateBody,
85
+ };
@@ -0,0 +1,36 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Success
4
+ */
5
+ export type V1AiVideoEditorCreateResponse = {
6
+ /**
7
+ * The amount of credits deducted from your account to generate the video. If the status is not 'complete', this value is an estimate and may be adjusted upon completion based on the actual FPS of the output video.
8
+ *
9
+ * If video generation fails, credits will be refunded, and this field will be updated to include the refund.
10
+ */
11
+ creditsCharged: number;
12
+ /**
13
+ * Deprecated: Previously represented the number of frames (original name of our credit system) used for video generation. Use 'credits_charged' instead.
14
+ *
15
+ * The amount of frames used to generate the video. If the status is not 'complete', the cost is an estimate and will be adjusted when the video completes.
16
+ */
17
+ estimatedFrameCost: number;
18
+ /**
19
+ * Unique ID of the video. Use it with the [Get video Project API](https://docs.magichour.ai/api-reference/video-projects/get-video-details) to fetch status and downloads.
20
+ */
21
+ id: string;
22
+ };
23
+ /**
24
+ * @internal
25
+ * V1AiVideoEditorCreateResponse without any key transformation, this is what
26
+ * we expect to come in as network data
27
+ */
28
+ export type External$V1AiVideoEditorCreateResponse = {
29
+ credits_charged: number;
30
+ estimated_frame_cost: number;
31
+ id: string;
32
+ };
33
+ export declare const Schemas$V1AiVideoEditorCreateResponse: {
34
+ in: z.ZodType<V1AiVideoEditorCreateResponse, z.ZodTypeDef, unknown>;
35
+ out: z.ZodType<External$V1AiVideoEditorCreateResponse, z.ZodTypeDef, V1AiVideoEditorCreateResponse>;
36
+ };