magic-hour 0.43.0 → 0.44.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 (51) hide show
  1. package/README.md +82 -77
  2. package/dist/core/api-error.d.ts +6 -0
  3. package/dist/core/api-error.js +11 -0
  4. package/dist/core/api-promise.d.ts +28 -0
  5. package/dist/core/api-promise.js +252 -0
  6. package/dist/core/auth.d.ts +76 -0
  7. package/dist/core/auth.js +232 -0
  8. package/dist/core/binary-response.d.ts +6 -0
  9. package/dist/core/binary-response.js +10 -0
  10. package/dist/core/content-type.d.ts +4 -0
  11. package/dist/core/content-type.js +12 -0
  12. package/dist/core/core-client.d.ts +58 -0
  13. package/dist/core/core-client.js +168 -0
  14. package/dist/core/form-data.d.ts +26 -0
  15. package/dist/core/form-data.js +83 -0
  16. package/dist/core/index.d.ts +9 -0
  17. package/dist/core/index.js +28 -0
  18. package/dist/core/logger.d.ts +48 -0
  19. package/dist/core/logger.js +82 -0
  20. package/dist/core/query.d.ts +8 -0
  21. package/dist/core/query.js +77 -0
  22. package/dist/core/runtime.d.ts +4 -0
  23. package/dist/core/runtime.js +20 -0
  24. package/dist/core/zod.d.ts +13 -0
  25. package/dist/core/zod.js +60 -0
  26. package/dist/environment.d.ts +1 -1
  27. package/dist/environment.js +1 -1
  28. package/dist/examples/logging-example.d.ts +10 -0
  29. package/dist/examples/logging-example.js +137 -0
  30. package/dist/logging-client.d.ts +39 -0
  31. package/dist/logging-client.js +116 -0
  32. package/dist/resources/v1/ai-voice-cloner/index.d.ts +2 -0
  33. package/dist/resources/v1/ai-voice-cloner/index.js +5 -0
  34. package/dist/resources/v1/ai-voice-cloner/request-types.d.ts +31 -0
  35. package/dist/resources/v1/ai-voice-cloner/request-types.js +77 -0
  36. package/dist/resources/v1/ai-voice-cloner/resource-client.d.ts +55 -0
  37. package/dist/resources/v1/ai-voice-cloner/resource-client.js +99 -0
  38. package/dist/resources/v1/index.d.ts +1 -0
  39. package/dist/resources/v1/index.js +2 -1
  40. package/dist/resources/v1/resource-client.d.ts +3 -0
  41. package/dist/resources/v1/resource-client.js +6 -0
  42. package/dist/types/index.d.ts +4 -0
  43. package/dist/types/v1-ai-voice-cloner-create-body-assets.d.ts +27 -0
  44. package/dist/types/v1-ai-voice-cloner-create-body-assets.js +67 -0
  45. package/dist/types/v1-ai-voice-cloner-create-body-style.d.ts +22 -0
  46. package/dist/types/v1-ai-voice-cloner-create-body-style.js +67 -0
  47. package/dist/types/v1-ai-voice-cloner-create-body.d.ts +31 -0
  48. package/dist/types/v1-ai-voice-cloner-create-body.js +77 -0
  49. package/dist/types/v1-ai-voice-cloner-create-response.d.ts +29 -0
  50. package/dist/types/v1-ai-voice-cloner-create-response.js +71 -0
  51. package/package.json +1 -1
@@ -0,0 +1,31 @@
1
+ import * as z from "zod";
2
+ import { External$V1AiVoiceClonerCreateBodyAssets, V1AiVoiceClonerCreateBodyAssets } from "../../../types/v1-ai-voice-cloner-create-body-assets";
3
+ import { External$V1AiVoiceClonerCreateBodyStyle, V1AiVoiceClonerCreateBodyStyle } from "../../../types/v1-ai-voice-cloner-create-body-style";
4
+ /**
5
+ * CreateRequest
6
+ */
7
+ export type CreateRequest = {
8
+ /**
9
+ * Provide the assets for voice cloning.
10
+ */
11
+ assets: V1AiVoiceClonerCreateBodyAssets;
12
+ /**
13
+ * The name of audio. This value is mainly used for your own identification of the audio.
14
+ */
15
+ name?: string | undefined;
16
+ style: V1AiVoiceClonerCreateBodyStyle;
17
+ };
18
+ /**
19
+ * @internal
20
+ * CreateRequest without any key transformation, this is what
21
+ * we expect to come in as network data
22
+ */
23
+ export type External$CreateRequest = {
24
+ assets: External$V1AiVoiceClonerCreateBodyAssets;
25
+ name?: string | undefined;
26
+ style: External$V1AiVoiceClonerCreateBodyStyle;
27
+ };
28
+ export declare const Schemas$CreateRequest: {
29
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
30
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
31
+ };
@@ -0,0 +1,77 @@
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$CreateRequest = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ const v1_ai_voice_cloner_create_body_assets_1 = require("../../../types/v1-ai-voice-cloner-create-body-assets");
40
+ const v1_ai_voice_cloner_create_body_style_1 = require("../../../types/v1-ai-voice-cloner-create-body-style");
41
+ /**
42
+ * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
43
+ */
44
+ const SchemaIn$CreateRequest = z
45
+ .object({
46
+ assets: v1_ai_voice_cloner_create_body_assets_1.Schemas$V1AiVoiceClonerCreateBodyAssets.in,
47
+ name: z.string().optional(),
48
+ style: v1_ai_voice_cloner_create_body_style_1.Schemas$V1AiVoiceClonerCreateBodyStyle.in,
49
+ })
50
+ .transform((obj) => {
51
+ return (0, make_api_request_js_1.zodTransform)(obj, {
52
+ assets: "assets",
53
+ name: "name",
54
+ style: "style",
55
+ });
56
+ });
57
+ /**
58
+ * @internal
59
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
60
+ */
61
+ const SchemaOut$CreateRequest = z
62
+ .object({
63
+ assets: v1_ai_voice_cloner_create_body_assets_1.Schemas$V1AiVoiceClonerCreateBodyAssets.out,
64
+ name: z.string().optional(),
65
+ style: v1_ai_voice_cloner_create_body_style_1.Schemas$V1AiVoiceClonerCreateBodyStyle.out,
66
+ })
67
+ .transform((obj) => {
68
+ return (0, make_api_request_js_1.zodTransform)(obj, {
69
+ assets: "assets",
70
+ name: "name",
71
+ style: "style",
72
+ });
73
+ });
74
+ exports.Schemas$CreateRequest = {
75
+ in: SchemaIn$CreateRequest,
76
+ out: SchemaOut$CreateRequest,
77
+ };
@@ -0,0 +1,55 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { types } from "../../../index.js";
3
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
4
+ import * as requests from "../../../resources/v1/ai-voice-cloner/request-types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * The audio used to clone the voice. This value is either
8
+ * - a direct URL to the audio file
9
+ * - a path to a local file
10
+ *
11
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
12
+ */
13
+ audioFilePath: string;
14
+ }>;
15
+ export declare class AiVoiceClonerClient extends CoreResourceClient {
16
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
17
+ /**
18
+ * AI Voice Cloner
19
+ *
20
+ * Clone a voice from an audio sample and generate speech.
21
+ *
22
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import Client from "../../../index.js";
27
+ *
28
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
29
+ * const res = await client.v1.aiVoiceCloner.generate(
30
+ * {
31
+ * assets: { audioFilePath: "/path/to/audio.mp3" },
32
+ * name: "Voice Cloner audio",
33
+ * style: { prompt: "Hello, how are you?" },
34
+ * },
35
+ * {
36
+ * waitForCompletion: true,
37
+ * downloadOutputs: true,
38
+ * downloadDirectory: "outputs",
39
+ * },
40
+ * );
41
+ * ```
42
+ */
43
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
44
+ /**
45
+ * AI Voice Cloner
46
+ *
47
+ * Clone a voice from an audio sample and generate speech.
48
+ * * Each character costs 0.05 credits.
49
+ * * The cost is rounded up to the nearest whole number
50
+ *
51
+ * POST /v1/ai-voice-cloner
52
+ */
53
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiVoiceClonerCreateResponse>;
54
+ }
55
+ export {};
@@ -0,0 +1,99 @@
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.AiVoiceClonerClient = 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 image_projects_1 = require("../../../resources/v1/image-projects");
28
+ const v1_ai_voice_cloner_create_body_1 = require("../../../types/v1-ai-voice-cloner-create-body");
29
+ const v1_ai_voice_cloner_create_response_1 = require("../../../types/v1-ai-voice-cloner-create-response");
30
+ class AiVoiceClonerClient extends make_api_request_js_1.CoreResourceClient {
31
+ constructor(coreClient, opts) {
32
+ super(coreClient, opts);
33
+ }
34
+ /**
35
+ * AI Voice Cloner
36
+ *
37
+ * Clone a voice from an audio sample and generate speech.
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.aiVoiceCloner.generate(
47
+ * {
48
+ * assets: { audioFilePath: "/path/to/audio.mp3" },
49
+ * name: "Voice Cloner audio",
50
+ * style: { prompt: "Hello, how are you?" },
51
+ * },
52
+ * {
53
+ * waitForCompletion: true,
54
+ * downloadOutputs: true,
55
+ * downloadDirectory: "outputs",
56
+ * },
57
+ * );
58
+ * ```
59
+ */
60
+ generate(request_1) {
61
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
62
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
63
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
64
+ const _a = request.assets, { audioFilePath } = _a, restAssets = __rest(_a, ["audioFilePath"]);
65
+ (0, logger_1.getLogger)().debug(`Uploading file ${audioFilePath} to Magic Hour's storage`);
66
+ const uploadedAudioFilePath = yield fileClient.uploadFile(audioFilePath);
67
+ (0, logger_1.getLogger)().info(`Uploaded file ${audioFilePath} to Magic Hour's storage as ${uploadedAudioFilePath}`);
68
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { audioFilePath: uploadedAudioFilePath }) }), createOpts);
69
+ (0, logger_1.getLogger)().info(`Created AiVoiceClonerClient project ${createResponse.id}`);
70
+ const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
71
+ (0, logger_1.getLogger)().debug(`Checking result for AiVoiceClonerClient project ${createResponse.id}`);
72
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
73
+ downloadOutputs,
74
+ downloadDirectory }, createOpts));
75
+ return result;
76
+ });
77
+ }
78
+ /**
79
+ * AI Voice Cloner
80
+ *
81
+ * Clone a voice from an audio sample and generate speech.
82
+ * * Each character costs 0.05 credits.
83
+ * * The cost is rounded up to the nearest whole number
84
+ *
85
+ * POST /v1/ai-voice-cloner
86
+ */
87
+ create(request, opts) {
88
+ return this._client.makeRequest({
89
+ method: "post",
90
+ path: "/v1/ai-voice-cloner",
91
+ auth: ["bearerAuth"],
92
+ contentType: "application/json",
93
+ body: v1_ai_voice_cloner_create_body_1.Schemas$V1AiVoiceClonerCreateBody.out.parse(request),
94
+ responseSchema: v1_ai_voice_cloner_create_response_1.Schemas$V1AiVoiceClonerCreateResponse.in,
95
+ opts,
96
+ });
97
+ }
98
+ }
99
+ exports.AiVoiceClonerClient = AiVoiceClonerClient;
@@ -9,6 +9,7 @@ export * as aiMemeGenerator from "./ai-meme-generator";
9
9
  export * as aiPhotoEditor from "./ai-photo-editor";
10
10
  export * as aiQrCodeGenerator from "./ai-qr-code-generator";
11
11
  export * as aiTalkingPhoto from "./ai-talking-photo";
12
+ export * as aiVoiceCloner from "./ai-voice-cloner";
12
13
  export * as aiVoiceGenerator from "./ai-voice-generator";
13
14
  export * as animation from "./animation";
14
15
  export * as audioProjects from "./audio-projects";
@@ -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.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiPhotoEditor = 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.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiPhotoEditor = 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"));
@@ -45,6 +45,7 @@ exports.aiMemeGenerator = __importStar(require("./ai-meme-generator"));
45
45
  exports.aiPhotoEditor = __importStar(require("./ai-photo-editor"));
46
46
  exports.aiQrCodeGenerator = __importStar(require("./ai-qr-code-generator"));
47
47
  exports.aiTalkingPhoto = __importStar(require("./ai-talking-photo"));
48
+ exports.aiVoiceCloner = __importStar(require("./ai-voice-cloner"));
48
49
  exports.aiVoiceGenerator = __importStar(require("./ai-voice-generator"));
49
50
  exports.animation = __importStar(require("./animation"));
50
51
  exports.audioProjects = __importStar(require("./audio-projects"));
@@ -10,6 +10,7 @@ import { AiMemeGeneratorClient } from "../../resources/v1/ai-meme-generator";
10
10
  import { AiPhotoEditorClient } from "../../resources/v1/ai-photo-editor";
11
11
  import { AiQrCodeGeneratorClient } from "../../resources/v1/ai-qr-code-generator";
12
12
  import { AiTalkingPhotoClient } from "../../resources/v1/ai-talking-photo";
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";
15
16
  import { AudioProjectsClient } from "../../resources/v1/audio-projects";
@@ -27,6 +28,7 @@ import { TextToVideoClient } from "../../resources/v1/text-to-video";
27
28
  import { VideoProjectsClient } from "../../resources/v1/video-projects";
28
29
  import { VideoToVideoClient } from "../../resources/v1/video-to-video";
29
30
  export declare class V1Client extends CoreResourceClient {
31
+ private _aiVoiceClonerLazy?;
30
32
  private _audioProjectsLazy?;
31
33
  private _aiVoiceGeneratorLazy?;
32
34
  private _imageProjectsLazy?;
@@ -82,4 +84,5 @@ export declare class V1Client extends CoreResourceClient {
82
84
  get videoToVideo(): VideoToVideoClient;
83
85
  get aiVoiceGenerator(): AiVoiceGeneratorClient;
84
86
  get audioProjects(): AudioProjectsClient;
87
+ get aiVoiceCloner(): AiVoiceClonerClient;
85
88
  }
@@ -17,6 +17,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
17
17
  this.aiPhotoEditor;
18
18
  this.aiQrCodeGenerator;
19
19
  this.aiTalkingPhoto;
20
+ this.aiVoiceCloner;
20
21
  this.aiVoiceGenerator;
21
22
  this.animation;
22
23
  this.audioProjects;
@@ -166,5 +167,10 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
166
167
  return ((_a = this._audioProjectsLazy) !== null && _a !== void 0 ? _a : (this._audioProjectsLazy =
167
168
  new (require("./audio-projects").AudioProjectsClient)(this._client, this._opts)));
168
169
  }
170
+ get aiVoiceCloner() {
171
+ var _a;
172
+ return ((_a = this._aiVoiceClonerLazy) !== null && _a !== void 0 ? _a : (this._aiVoiceClonerLazy =
173
+ new (require("./ai-voice-cloner").AiVoiceClonerClient)(this._client, this._opts)));
174
+ }
169
175
  }
170
176
  exports.V1Client = V1Client;
@@ -46,6 +46,10 @@ export { V1AiTalkingPhotoCreateBodyAssets } from "./v1-ai-talking-photo-create-b
46
46
  export { V1AiTalkingPhotoCreateBodyStyle } from "./v1-ai-talking-photo-create-body-style";
47
47
  export { V1AiTalkingPhotoCreateBodyStyleGenerationModeEnum } from "./v1-ai-talking-photo-create-body-style-generation-mode-enum";
48
48
  export { V1AiTalkingPhotoCreateResponse } from "./v1-ai-talking-photo-create-response";
49
+ export { V1AiVoiceClonerCreateBody } from "./v1-ai-voice-cloner-create-body";
50
+ export { V1AiVoiceClonerCreateBodyAssets } from "./v1-ai-voice-cloner-create-body-assets";
51
+ export { V1AiVoiceClonerCreateBodyStyle } from "./v1-ai-voice-cloner-create-body-style";
52
+ export { V1AiVoiceClonerCreateResponse } from "./v1-ai-voice-cloner-create-response";
49
53
  export { V1AiVoiceGeneratorCreateBody } from "./v1-ai-voice-generator-create-body";
50
54
  export { V1AiVoiceGeneratorCreateBodyStyle } from "./v1-ai-voice-generator-create-body-style";
51
55
  export { V1AiVoiceGeneratorCreateBodyStyleVoiceNameEnum } from "./v1-ai-voice-generator-create-body-style-voice-name-enum";
@@ -0,0 +1,27 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Provide the assets for voice cloning.
4
+ */
5
+ export type V1AiVoiceClonerCreateBodyAssets = {
6
+ /**
7
+ * The audio used to clone the voice. 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
+ * Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
12
+ *
13
+ */
14
+ audioFilePath: string;
15
+ };
16
+ /**
17
+ * @internal
18
+ * V1AiVoiceClonerCreateBodyAssets without any key transformation, this is what
19
+ * we expect to come in as network data
20
+ */
21
+ export type External$V1AiVoiceClonerCreateBodyAssets = {
22
+ audio_file_path: string;
23
+ };
24
+ export declare const Schemas$V1AiVoiceClonerCreateBodyAssets: {
25
+ in: z.ZodType<V1AiVoiceClonerCreateBodyAssets, z.ZodTypeDef, unknown>;
26
+ out: z.ZodType<External$V1AiVoiceClonerCreateBodyAssets, z.ZodTypeDef, V1AiVoiceClonerCreateBodyAssets>;
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$V1AiVoiceClonerCreateBodyAssets = 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 V1AiVoiceClonerCreateBodyAssets
41
+ */
42
+ const SchemaIn$V1AiVoiceClonerCreateBodyAssets = z
43
+ .object({
44
+ audio_file_path: z.string(),
45
+ })
46
+ .transform((obj) => {
47
+ return (0, make_api_request_js_1.zodTransform)(obj, {
48
+ audio_file_path: "audioFilePath",
49
+ });
50
+ });
51
+ /**
52
+ * @internal
53
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiVoiceClonerCreateBodyAssets
54
+ */
55
+ const SchemaOut$V1AiVoiceClonerCreateBodyAssets = z
56
+ .object({
57
+ audioFilePath: z.string(),
58
+ })
59
+ .transform((obj) => {
60
+ return (0, make_api_request_js_1.zodTransform)(obj, {
61
+ audioFilePath: "audio_file_path",
62
+ });
63
+ });
64
+ exports.Schemas$V1AiVoiceClonerCreateBodyAssets = {
65
+ in: SchemaIn$V1AiVoiceClonerCreateBodyAssets,
66
+ out: SchemaOut$V1AiVoiceClonerCreateBodyAssets,
67
+ };
@@ -0,0 +1,22 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * V1AiVoiceClonerCreateBodyStyle
4
+ */
5
+ export type V1AiVoiceClonerCreateBodyStyle = {
6
+ /**
7
+ * Text used to generate speech from the cloned voice. The character limit is 1000 characters.
8
+ */
9
+ prompt: string;
10
+ };
11
+ /**
12
+ * @internal
13
+ * V1AiVoiceClonerCreateBodyStyle without any key transformation, this is what
14
+ * we expect to come in as network data
15
+ */
16
+ export type External$V1AiVoiceClonerCreateBodyStyle = {
17
+ prompt: string;
18
+ };
19
+ export declare const Schemas$V1AiVoiceClonerCreateBodyStyle: {
20
+ in: z.ZodType<V1AiVoiceClonerCreateBodyStyle, z.ZodTypeDef, unknown>;
21
+ out: z.ZodType<External$V1AiVoiceClonerCreateBodyStyle, z.ZodTypeDef, V1AiVoiceClonerCreateBodyStyle>;
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$V1AiVoiceClonerCreateBodyStyle = 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 V1AiVoiceClonerCreateBodyStyle
41
+ */
42
+ const SchemaIn$V1AiVoiceClonerCreateBodyStyle = 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$V1AiVoiceClonerCreateBodyStyle
54
+ */
55
+ const SchemaOut$V1AiVoiceClonerCreateBodyStyle = 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$V1AiVoiceClonerCreateBodyStyle = {
65
+ in: SchemaIn$V1AiVoiceClonerCreateBodyStyle,
66
+ out: SchemaOut$V1AiVoiceClonerCreateBodyStyle,
67
+ };
@@ -0,0 +1,31 @@
1
+ import * as z from "zod";
2
+ import { External$V1AiVoiceClonerCreateBodyAssets, V1AiVoiceClonerCreateBodyAssets } from "./v1-ai-voice-cloner-create-body-assets";
3
+ import { External$V1AiVoiceClonerCreateBodyStyle, V1AiVoiceClonerCreateBodyStyle } from "./v1-ai-voice-cloner-create-body-style";
4
+ /**
5
+ * V1AiVoiceClonerCreateBody
6
+ */
7
+ export type V1AiVoiceClonerCreateBody = {
8
+ /**
9
+ * Provide the assets for voice cloning.
10
+ */
11
+ assets: V1AiVoiceClonerCreateBodyAssets;
12
+ /**
13
+ * The name of audio. This value is mainly used for your own identification of the audio.
14
+ */
15
+ name?: string | undefined;
16
+ style: V1AiVoiceClonerCreateBodyStyle;
17
+ };
18
+ /**
19
+ * @internal
20
+ * V1AiVoiceClonerCreateBody without any key transformation, this is what
21
+ * we expect to come in as network data
22
+ */
23
+ export type External$V1AiVoiceClonerCreateBody = {
24
+ assets: External$V1AiVoiceClonerCreateBodyAssets;
25
+ name?: string | undefined;
26
+ style: External$V1AiVoiceClonerCreateBodyStyle;
27
+ };
28
+ export declare const Schemas$V1AiVoiceClonerCreateBody: {
29
+ in: z.ZodType<V1AiVoiceClonerCreateBody, z.ZodTypeDef, unknown>;
30
+ out: z.ZodType<External$V1AiVoiceClonerCreateBody, z.ZodTypeDef, V1AiVoiceClonerCreateBody>;
31
+ };
@@ -0,0 +1,77 @@
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$V1AiVoiceClonerCreateBody = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ const v1_ai_voice_cloner_create_body_assets_1 = require("./v1-ai-voice-cloner-create-body-assets");
40
+ const v1_ai_voice_cloner_create_body_style_1 = require("./v1-ai-voice-cloner-create-body-style");
41
+ /**
42
+ * Takes network data, validates it, and transforms keys to match typescript object V1AiVoiceClonerCreateBody
43
+ */
44
+ const SchemaIn$V1AiVoiceClonerCreateBody = z
45
+ .object({
46
+ assets: v1_ai_voice_cloner_create_body_assets_1.Schemas$V1AiVoiceClonerCreateBodyAssets.in,
47
+ name: z.string().optional(),
48
+ style: v1_ai_voice_cloner_create_body_style_1.Schemas$V1AiVoiceClonerCreateBodyStyle.in,
49
+ })
50
+ .transform((obj) => {
51
+ return (0, make_api_request_js_1.zodTransform)(obj, {
52
+ assets: "assets",
53
+ name: "name",
54
+ style: "style",
55
+ });
56
+ });
57
+ /**
58
+ * @internal
59
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiVoiceClonerCreateBody
60
+ */
61
+ const SchemaOut$V1AiVoiceClonerCreateBody = z
62
+ .object({
63
+ assets: v1_ai_voice_cloner_create_body_assets_1.Schemas$V1AiVoiceClonerCreateBodyAssets.out,
64
+ name: z.string().optional(),
65
+ style: v1_ai_voice_cloner_create_body_style_1.Schemas$V1AiVoiceClonerCreateBodyStyle.out,
66
+ })
67
+ .transform((obj) => {
68
+ return (0, make_api_request_js_1.zodTransform)(obj, {
69
+ assets: "assets",
70
+ name: "name",
71
+ style: "style",
72
+ });
73
+ });
74
+ exports.Schemas$V1AiVoiceClonerCreateBody = {
75
+ in: SchemaIn$V1AiVoiceClonerCreateBody,
76
+ out: SchemaOut$V1AiVoiceClonerCreateBody,
77
+ };