magic-hour 0.48.0 → 0.49.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.
- package/README.md +0 -5
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +1 -1
- package/dist/resources/v1/index.d.ts +0 -1
- package/dist/resources/v1/index.js +1 -2
- package/dist/resources/v1/resource-client.d.ts +0 -3
- package/dist/resources/v1/resource-client.js +0 -6
- package/dist/types/index.d.ts +0 -4
- package/package.json +1 -1
- package/dist/resources/v1/ai-photo-editor/index.d.ts +0 -2
- package/dist/resources/v1/ai-photo-editor/index.js +0 -5
- package/dist/resources/v1/ai-photo-editor/request-types.d.ts +0 -41
- package/dist/resources/v1/ai-photo-editor/request-types.js +0 -85
- package/dist/resources/v1/ai-photo-editor/resource-client.d.ts +0 -65
- package/dist/resources/v1/ai-photo-editor/resource-client.js +0 -111
- package/dist/types/v1-ai-photo-editor-create-body-assets.d.ts +0 -27
- package/dist/types/v1-ai-photo-editor-create-body-assets.js +0 -67
- package/dist/types/v1-ai-photo-editor-create-body-style.d.ts +0 -57
- package/dist/types/v1-ai-photo-editor-create-body-style.js +0 -95
- package/dist/types/v1-ai-photo-editor-create-body.d.ts +0 -41
- package/dist/types/v1-ai-photo-editor-create-body.js +0 -85
- package/dist/types/v1-ai-photo-editor-create-response.d.ts +0 -34
- package/dist/types/v1-ai-photo-editor-create-response.js +0 -75
package/README.md
CHANGED
|
@@ -241,11 +241,6 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
|
|
|
241
241
|
- [create](src/resources/v1/ai-meme-generator/README.md#create) - AI Meme Generator
|
|
242
242
|
- [generate](src/resources/v1/ai-meme-generator/README.md#generate) - AI Meme Generator Generate Workflow
|
|
243
243
|
|
|
244
|
-
### [v1.aiPhotoEditor](src/resources/v1/ai-photo-editor/README.md)
|
|
245
|
-
|
|
246
|
-
- [create](src/resources/v1/ai-photo-editor/README.md#create) - AI Photo Editor
|
|
247
|
-
- [generate](src/resources/v1/ai-photo-editor/README.md#generate) - AI Photo Editor Generate Workflow
|
|
248
|
-
|
|
249
244
|
### [v1.aiQrCodeGenerator](src/resources/v1/ai-qr-code-generator/README.md)
|
|
250
245
|
|
|
251
246
|
- [create](src/resources/v1/ai-qr-code-generator/README.md#create) - AI QR Code Generator
|
package/dist/environment.d.ts
CHANGED
package/dist/environment.js
CHANGED
|
@@ -4,5 +4,5 @@ exports.Environment = void 0;
|
|
|
4
4
|
var Environment;
|
|
5
5
|
(function (Environment) {
|
|
6
6
|
Environment["Environment"] = "https://api.magichour.ai";
|
|
7
|
-
Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.
|
|
7
|
+
Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.50.0";
|
|
8
8
|
})(Environment || (exports.Environment = Environment = {}));
|
|
@@ -6,7 +6,6 @@ export * as aiImageEditor from "./ai-image-editor";
|
|
|
6
6
|
export * as aiImageGenerator from "./ai-image-generator";
|
|
7
7
|
export * as aiImageUpscaler from "./ai-image-upscaler";
|
|
8
8
|
export * as aiMemeGenerator from "./ai-meme-generator";
|
|
9
|
-
export * as aiPhotoEditor from "./ai-photo-editor";
|
|
10
9
|
export * as aiQrCodeGenerator from "./ai-qr-code-generator";
|
|
11
10
|
export * as aiTalkingPhoto from "./ai-talking-photo";
|
|
12
11
|
export * as aiVoiceCloner from "./ai-voice-cloner";
|
|
@@ -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.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.
|
|
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.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"));
|
|
@@ -42,7 +42,6 @@ exports.aiImageEditor = __importStar(require("./ai-image-editor"));
|
|
|
42
42
|
exports.aiImageGenerator = __importStar(require("./ai-image-generator"));
|
|
43
43
|
exports.aiImageUpscaler = __importStar(require("./ai-image-upscaler"));
|
|
44
44
|
exports.aiMemeGenerator = __importStar(require("./ai-meme-generator"));
|
|
45
|
-
exports.aiPhotoEditor = __importStar(require("./ai-photo-editor"));
|
|
46
45
|
exports.aiQrCodeGenerator = __importStar(require("./ai-qr-code-generator"));
|
|
47
46
|
exports.aiTalkingPhoto = __importStar(require("./ai-talking-photo"));
|
|
48
47
|
exports.aiVoiceCloner = __importStar(require("./ai-voice-cloner"));
|
|
@@ -7,7 +7,6 @@ import { AiImageEditorClient } from "../../resources/v1/ai-image-editor";
|
|
|
7
7
|
import { AiImageGeneratorClient } from "../../resources/v1/ai-image-generator";
|
|
8
8
|
import { AiImageUpscalerClient } from "../../resources/v1/ai-image-upscaler";
|
|
9
9
|
import { AiMemeGeneratorClient } from "../../resources/v1/ai-meme-generator";
|
|
10
|
-
import { AiPhotoEditorClient } from "../../resources/v1/ai-photo-editor";
|
|
11
10
|
import { AiQrCodeGeneratorClient } from "../../resources/v1/ai-qr-code-generator";
|
|
12
11
|
import { AiTalkingPhotoClient } from "../../resources/v1/ai-talking-photo";
|
|
13
12
|
import { AiVoiceClonerClient } from "../../resources/v1/ai-voice-cloner";
|
|
@@ -42,7 +41,6 @@ export declare class V1Client extends CoreResourceClient {
|
|
|
42
41
|
private _aiImageGeneratorLazy?;
|
|
43
42
|
private _aiImageUpscalerLazy?;
|
|
44
43
|
private _aiMemeGeneratorLazy?;
|
|
45
|
-
private _aiPhotoEditorLazy?;
|
|
46
44
|
private _aiQrCodeGeneratorLazy?;
|
|
47
45
|
private _aiTalkingPhotoLazy?;
|
|
48
46
|
private _animationLazy?;
|
|
@@ -68,7 +66,6 @@ export declare class V1Client extends CoreResourceClient {
|
|
|
68
66
|
get aiImageGenerator(): AiImageGeneratorClient;
|
|
69
67
|
get aiImageUpscaler(): AiImageUpscalerClient;
|
|
70
68
|
get aiMemeGenerator(): AiMemeGeneratorClient;
|
|
71
|
-
get aiPhotoEditor(): AiPhotoEditorClient;
|
|
72
69
|
get aiQrCodeGenerator(): AiQrCodeGeneratorClient;
|
|
73
70
|
get aiTalkingPhoto(): AiTalkingPhotoClient;
|
|
74
71
|
get animation(): AnimationClient;
|
|
@@ -14,7 +14,6 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
|
|
|
14
14
|
this.aiImageGenerator;
|
|
15
15
|
this.aiImageUpscaler;
|
|
16
16
|
this.aiMemeGenerator;
|
|
17
|
-
this.aiPhotoEditor;
|
|
18
17
|
this.aiQrCodeGenerator;
|
|
19
18
|
this.aiTalkingPhoto;
|
|
20
19
|
this.aiVoiceCloner;
|
|
@@ -91,11 +90,6 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
|
|
|
91
90
|
return ((_a = this._aiMemeGeneratorLazy) !== null && _a !== void 0 ? _a : (this._aiMemeGeneratorLazy =
|
|
92
91
|
new (require("./ai-meme-generator").AiMemeGeneratorClient)(this._client, this._opts)));
|
|
93
92
|
}
|
|
94
|
-
get aiPhotoEditor() {
|
|
95
|
-
var _a;
|
|
96
|
-
return ((_a = this._aiPhotoEditorLazy) !== null && _a !== void 0 ? _a : (this._aiPhotoEditorLazy =
|
|
97
|
-
new (require("./ai-photo-editor").AiPhotoEditorClient)(this._client, this._opts)));
|
|
98
|
-
}
|
|
99
93
|
get aiQrCodeGenerator() {
|
|
100
94
|
var _a;
|
|
101
95
|
return ((_a = this._aiQrCodeGeneratorLazy) !== null && _a !== void 0 ? _a : (this._aiQrCodeGeneratorLazy =
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,10 +37,6 @@ export { V1AiMemeGeneratorCreateBody } from "./v1-ai-meme-generator-create-body"
|
|
|
37
37
|
export { V1AiMemeGeneratorCreateBodyStyle } from "./v1-ai-meme-generator-create-body-style";
|
|
38
38
|
export { V1AiMemeGeneratorCreateBodyStyleTemplateEnum } from "./v1-ai-meme-generator-create-body-style-template-enum";
|
|
39
39
|
export { V1AiMemeGeneratorCreateResponse } from "./v1-ai-meme-generator-create-response";
|
|
40
|
-
export { V1AiPhotoEditorCreateBody } from "./v1-ai-photo-editor-create-body";
|
|
41
|
-
export { V1AiPhotoEditorCreateBodyAssets } from "./v1-ai-photo-editor-create-body-assets";
|
|
42
|
-
export { V1AiPhotoEditorCreateBodyStyle } from "./v1-ai-photo-editor-create-body-style";
|
|
43
|
-
export { V1AiPhotoEditorCreateResponse } from "./v1-ai-photo-editor-create-response";
|
|
44
40
|
export { V1AiQrCodeGeneratorCreateBody } from "./v1-ai-qr-code-generator-create-body";
|
|
45
41
|
export { V1AiQrCodeGeneratorCreateBodyStyle } from "./v1-ai-qr-code-generator-create-body-style";
|
|
46
42
|
export { V1AiQrCodeGeneratorCreateResponse } from "./v1-ai-qr-code-generator-create-response";
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AiPhotoEditorClient = void 0;
|
|
4
|
-
var resource_client_1 = require("./resource-client");
|
|
5
|
-
Object.defineProperty(exports, "AiPhotoEditorClient", { enumerable: true, get: function () { return resource_client_1.AiPhotoEditorClient; } });
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { External$V1AiPhotoEditorCreateBodyAssets, V1AiPhotoEditorCreateBodyAssets } from "../../../types/v1-ai-photo-editor-create-body-assets";
|
|
3
|
-
import { External$V1AiPhotoEditorCreateBodyStyle, V1AiPhotoEditorCreateBodyStyle } from "../../../types/v1-ai-photo-editor-create-body-style";
|
|
4
|
-
/**
|
|
5
|
-
* CreateRequest
|
|
6
|
-
*/
|
|
7
|
-
export type CreateRequest = {
|
|
8
|
-
/**
|
|
9
|
-
* Provide the assets for photo editor
|
|
10
|
-
*/
|
|
11
|
-
assets: V1AiPhotoEditorCreateBodyAssets;
|
|
12
|
-
/**
|
|
13
|
-
* Give your image a custom name for easy identification.
|
|
14
|
-
*/
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* The resolution of the final output image. The allowed value is based on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details
|
|
18
|
-
*/
|
|
19
|
-
resolution: number;
|
|
20
|
-
/**
|
|
21
|
-
* Deprecated: Please use `.style.steps` instead. Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time.
|
|
22
|
-
*/
|
|
23
|
-
steps?: number | undefined;
|
|
24
|
-
style: V1AiPhotoEditorCreateBodyStyle;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
* CreateRequest without any key transformation, this is what
|
|
29
|
-
* we expect to come in as network data
|
|
30
|
-
*/
|
|
31
|
-
export type External$CreateRequest = {
|
|
32
|
-
assets: External$V1AiPhotoEditorCreateBodyAssets;
|
|
33
|
-
name?: string | undefined;
|
|
34
|
-
resolution: number;
|
|
35
|
-
steps?: number | undefined;
|
|
36
|
-
style: External$V1AiPhotoEditorCreateBodyStyle;
|
|
37
|
-
};
|
|
38
|
-
export declare const Schemas$CreateRequest: {
|
|
39
|
-
in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
|
|
40
|
-
out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
|
|
41
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
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_photo_editor_create_body_assets_1 = require("../../../types/v1-ai-photo-editor-create-body-assets");
|
|
40
|
-
const v1_ai_photo_editor_create_body_style_1 = require("../../../types/v1-ai-photo-editor-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_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.in,
|
|
47
|
-
name: z.string().optional(),
|
|
48
|
-
resolution: z.number().int(),
|
|
49
|
-
steps: z.number().int().optional(),
|
|
50
|
-
style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.in,
|
|
51
|
-
})
|
|
52
|
-
.transform((obj) => {
|
|
53
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
54
|
-
assets: "assets",
|
|
55
|
-
name: "name",
|
|
56
|
-
resolution: "resolution",
|
|
57
|
-
steps: "steps",
|
|
58
|
-
style: "style",
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
* Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
|
|
64
|
-
*/
|
|
65
|
-
const SchemaOut$CreateRequest = z
|
|
66
|
-
.object({
|
|
67
|
-
assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.out,
|
|
68
|
-
name: z.string().optional(),
|
|
69
|
-
resolution: z.number().int(),
|
|
70
|
-
steps: z.number().int().optional(),
|
|
71
|
-
style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.out,
|
|
72
|
-
})
|
|
73
|
-
.transform((obj) => {
|
|
74
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
75
|
-
assets: "assets",
|
|
76
|
-
name: "name",
|
|
77
|
-
resolution: "resolution",
|
|
78
|
-
steps: "steps",
|
|
79
|
-
style: "style",
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
exports.Schemas$CreateRequest = {
|
|
83
|
-
in: SchemaIn$CreateRequest,
|
|
84
|
-
out: SchemaOut$CreateRequest,
|
|
85
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
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-photo-editor/request-types";
|
|
5
|
-
type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
|
|
6
|
-
/**
|
|
7
|
-
* The image used to generate the output. This value is either
|
|
8
|
-
* - a direct URL to the image 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
|
-
imageFilePath: string;
|
|
14
|
-
}>;
|
|
15
|
-
export declare class AiPhotoEditorClient extends CoreResourceClient {
|
|
16
|
-
constructor(coreClient: CoreClient, opts: ResourceClientOptions);
|
|
17
|
-
/**
|
|
18
|
-
* AI Photo Editor
|
|
19
|
-
*
|
|
20
|
-
* > **NOTE**: this API is still in early development stages, and should be avoided
|
|
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.aiPhotoEditor.generate(
|
|
30
|
-
* {
|
|
31
|
-
* assets: { imageFilePath: "/path/to/1234.png" },
|
|
32
|
-
* name: "Photo Editor image",
|
|
33
|
-
* resolution: 768,
|
|
34
|
-
* style: {
|
|
35
|
-
* imageDescription: "A photo of a person",
|
|
36
|
-
* likenessStrength: 5.2,
|
|
37
|
-
* negativePrompt: "painting, cartoon, sketch",
|
|
38
|
-
* prompt: "A photo portrait of a person wearing a hat",
|
|
39
|
-
* promptStrength: 3.75,
|
|
40
|
-
* steps: 4,
|
|
41
|
-
* upscaleFactor: 2,
|
|
42
|
-
* upscaleFidelity: 0.5,
|
|
43
|
-
* },
|
|
44
|
-
* },
|
|
45
|
-
* {
|
|
46
|
-
* waitForCompletion: true,
|
|
47
|
-
* downloadOutputs: true,
|
|
48
|
-
* downloadDirectory: "outputs",
|
|
49
|
-
* },
|
|
50
|
-
* );
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
|
|
54
|
-
/**
|
|
55
|
-
* AI Photo Editor
|
|
56
|
-
*
|
|
57
|
-
* > **NOTE**: this API is still in early development stages, and should be avoided. Please reach out to us if you're interested in this API.
|
|
58
|
-
*
|
|
59
|
-
* Edit photo using AI. Each photo costs 10 credits.
|
|
60
|
-
*
|
|
61
|
-
* POST /v1/ai-photo-editor
|
|
62
|
-
*/
|
|
63
|
-
create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiPhotoEditorCreateResponse>;
|
|
64
|
-
}
|
|
65
|
-
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
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.AiPhotoEditorClient = 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_photo_editor_create_body_1 = require("../../../types/v1-ai-photo-editor-create-body");
|
|
29
|
-
const v1_ai_photo_editor_create_response_1 = require("../../../types/v1-ai-photo-editor-create-response");
|
|
30
|
-
class AiPhotoEditorClient extends make_api_request_js_1.CoreResourceClient {
|
|
31
|
-
constructor(coreClient, opts) {
|
|
32
|
-
super(coreClient, opts);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* AI Photo Editor
|
|
36
|
-
*
|
|
37
|
-
* > **NOTE**: this API is still in early development stages, and should be avoided
|
|
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.aiPhotoEditor.generate(
|
|
47
|
-
* {
|
|
48
|
-
* assets: { imageFilePath: "/path/to/1234.png" },
|
|
49
|
-
* name: "Photo Editor image",
|
|
50
|
-
* resolution: 768,
|
|
51
|
-
* style: {
|
|
52
|
-
* imageDescription: "A photo of a person",
|
|
53
|
-
* likenessStrength: 5.2,
|
|
54
|
-
* negativePrompt: "painting, cartoon, sketch",
|
|
55
|
-
* prompt: "A photo portrait of a person wearing a hat",
|
|
56
|
-
* promptStrength: 3.75,
|
|
57
|
-
* steps: 4,
|
|
58
|
-
* upscaleFactor: 2,
|
|
59
|
-
* upscaleFidelity: 0.5,
|
|
60
|
-
* },
|
|
61
|
-
* },
|
|
62
|
-
* {
|
|
63
|
-
* waitForCompletion: true,
|
|
64
|
-
* downloadOutputs: true,
|
|
65
|
-
* downloadDirectory: "outputs",
|
|
66
|
-
* },
|
|
67
|
-
* );
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
generate(request_1) {
|
|
71
|
-
return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
|
|
72
|
-
const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
|
|
73
|
-
const fileClient = new files_1.FilesClient(this._client, this._opts);
|
|
74
|
-
const _a = request.assets, { imageFilePath } = _a, restAssets = __rest(_a, ["imageFilePath"]);
|
|
75
|
-
(0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
|
|
76
|
-
const [uploadedImageFilePath] = yield Promise.all([
|
|
77
|
-
fileClient.uploadFile(imageFilePath),
|
|
78
|
-
]);
|
|
79
|
-
(0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
|
|
80
|
-
const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { imageFilePath: uploadedImageFilePath }) }), createOpts);
|
|
81
|
-
(0, logger_1.getLogger)().info(`Created AiPhotoEditorClient project ${createResponse.id}`);
|
|
82
|
-
const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
|
|
83
|
-
(0, logger_1.getLogger)().debug(`Checking result for AiPhotoEditorClient project ${createResponse.id}`);
|
|
84
|
-
const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
|
|
85
|
-
downloadOutputs,
|
|
86
|
-
downloadDirectory }, createOpts));
|
|
87
|
-
return result;
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* AI Photo Editor
|
|
92
|
-
*
|
|
93
|
-
* > **NOTE**: this API is still in early development stages, and should be avoided. Please reach out to us if you're interested in this API.
|
|
94
|
-
*
|
|
95
|
-
* Edit photo using AI. Each photo costs 10 credits.
|
|
96
|
-
*
|
|
97
|
-
* POST /v1/ai-photo-editor
|
|
98
|
-
*/
|
|
99
|
-
create(request, opts) {
|
|
100
|
-
return this._client.makeRequest({
|
|
101
|
-
method: "post",
|
|
102
|
-
path: "/v1/ai-photo-editor",
|
|
103
|
-
auth: ["bearerAuth"],
|
|
104
|
-
contentType: "application/json",
|
|
105
|
-
body: v1_ai_photo_editor_create_body_1.Schemas$V1AiPhotoEditorCreateBody.out.parse(request),
|
|
106
|
-
responseSchema: v1_ai_photo_editor_create_response_1.Schemas$V1AiPhotoEditorCreateResponse.in,
|
|
107
|
-
opts,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.AiPhotoEditorClient = AiPhotoEditorClient;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Provide the assets for photo editor
|
|
4
|
-
*/
|
|
5
|
-
export type V1AiPhotoEditorCreateBodyAssets = {
|
|
6
|
-
/**
|
|
7
|
-
* The image used to generate the output. 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
|
-
imageFilePath: string;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
* V1AiPhotoEditorCreateBodyAssets without any key transformation, this is what
|
|
19
|
-
* we expect to come in as network data
|
|
20
|
-
*/
|
|
21
|
-
export type External$V1AiPhotoEditorCreateBodyAssets = {
|
|
22
|
-
image_file_path: string;
|
|
23
|
-
};
|
|
24
|
-
export declare const Schemas$V1AiPhotoEditorCreateBodyAssets: {
|
|
25
|
-
in: z.ZodType<V1AiPhotoEditorCreateBodyAssets, z.ZodTypeDef, unknown>;
|
|
26
|
-
out: z.ZodType<External$V1AiPhotoEditorCreateBodyAssets, z.ZodTypeDef, V1AiPhotoEditorCreateBodyAssets>;
|
|
27
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
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$V1AiPhotoEditorCreateBodyAssets = 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 V1AiPhotoEditorCreateBodyAssets
|
|
41
|
-
*/
|
|
42
|
-
const SchemaIn$V1AiPhotoEditorCreateBodyAssets = z
|
|
43
|
-
.object({
|
|
44
|
-
image_file_path: z.string(),
|
|
45
|
-
})
|
|
46
|
-
.transform((obj) => {
|
|
47
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
48
|
-
image_file_path: "imageFilePath",
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* @internal
|
|
53
|
-
* Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateBodyAssets
|
|
54
|
-
*/
|
|
55
|
-
const SchemaOut$V1AiPhotoEditorCreateBodyAssets = z
|
|
56
|
-
.object({
|
|
57
|
-
imageFilePath: z.string(),
|
|
58
|
-
})
|
|
59
|
-
.transform((obj) => {
|
|
60
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
61
|
-
imageFilePath: "image_file_path",
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
exports.Schemas$V1AiPhotoEditorCreateBodyAssets = {
|
|
65
|
-
in: SchemaIn$V1AiPhotoEditorCreateBodyAssets,
|
|
66
|
-
out: SchemaOut$V1AiPhotoEditorCreateBodyAssets,
|
|
67
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* V1AiPhotoEditorCreateBodyStyle
|
|
4
|
-
*/
|
|
5
|
-
export type V1AiPhotoEditorCreateBodyStyle = {
|
|
6
|
-
/**
|
|
7
|
-
* Use this to describe what your input image is. This helps maintain aspects of the image you don't want to change.
|
|
8
|
-
*/
|
|
9
|
-
imageDescription: string;
|
|
10
|
-
/**
|
|
11
|
-
* Determines the input image's influence. Higher values align the output more with the initial image.
|
|
12
|
-
*/
|
|
13
|
-
likenessStrength: number;
|
|
14
|
-
/**
|
|
15
|
-
* What you want to avoid seeing in the final output; has a minor effect.
|
|
16
|
-
*/
|
|
17
|
-
negativePrompt?: string | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* What you want your final output to look like. We recommend starting with the image description and making minor edits for best results.
|
|
20
|
-
*/
|
|
21
|
-
prompt: string;
|
|
22
|
-
/**
|
|
23
|
-
* Determines the prompt's influence. Higher values align the output more with the prompt.
|
|
24
|
-
*/
|
|
25
|
-
promptStrength: number;
|
|
26
|
-
/**
|
|
27
|
-
* Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time.
|
|
28
|
-
*/
|
|
29
|
-
steps?: number | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* The multiplier applied to an image's original dimensions during the upscaling process. For example, a scale of 2 doubles the width and height (e.g., from 512x512 to 1024x1024).
|
|
32
|
-
*/
|
|
33
|
-
upscaleFactor?: number | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Upscale fidelity refers to the level of quality desired in the generated image. Fidelity value of 1 means more details.
|
|
36
|
-
*/
|
|
37
|
-
upscaleFidelity?: number | undefined;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
* V1AiPhotoEditorCreateBodyStyle without any key transformation, this is what
|
|
42
|
-
* we expect to come in as network data
|
|
43
|
-
*/
|
|
44
|
-
export type External$V1AiPhotoEditorCreateBodyStyle = {
|
|
45
|
-
image_description: string;
|
|
46
|
-
likeness_strength: number;
|
|
47
|
-
negative_prompt?: string | undefined;
|
|
48
|
-
prompt: string;
|
|
49
|
-
prompt_strength: number;
|
|
50
|
-
steps?: number | undefined;
|
|
51
|
-
upscale_factor?: number | undefined;
|
|
52
|
-
upscale_fidelity?: number | undefined;
|
|
53
|
-
};
|
|
54
|
-
export declare const Schemas$V1AiPhotoEditorCreateBodyStyle: {
|
|
55
|
-
in: z.ZodType<V1AiPhotoEditorCreateBodyStyle, z.ZodTypeDef, unknown>;
|
|
56
|
-
out: z.ZodType<External$V1AiPhotoEditorCreateBodyStyle, z.ZodTypeDef, V1AiPhotoEditorCreateBodyStyle>;
|
|
57
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
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$V1AiPhotoEditorCreateBodyStyle = 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 V1AiPhotoEditorCreateBodyStyle
|
|
41
|
-
*/
|
|
42
|
-
const SchemaIn$V1AiPhotoEditorCreateBodyStyle = z
|
|
43
|
-
.object({
|
|
44
|
-
image_description: z.string(),
|
|
45
|
-
likeness_strength: z.number(),
|
|
46
|
-
negative_prompt: z.string().optional(),
|
|
47
|
-
prompt: z.string(),
|
|
48
|
-
prompt_strength: z.number(),
|
|
49
|
-
steps: z.number().int().optional(),
|
|
50
|
-
upscale_factor: z.number().int().optional(),
|
|
51
|
-
upscale_fidelity: z.number().optional(),
|
|
52
|
-
})
|
|
53
|
-
.transform((obj) => {
|
|
54
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
55
|
-
image_description: "imageDescription",
|
|
56
|
-
likeness_strength: "likenessStrength",
|
|
57
|
-
negative_prompt: "negativePrompt",
|
|
58
|
-
prompt: "prompt",
|
|
59
|
-
prompt_strength: "promptStrength",
|
|
60
|
-
steps: "steps",
|
|
61
|
-
upscale_factor: "upscaleFactor",
|
|
62
|
-
upscale_fidelity: "upscaleFidelity",
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
* Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateBodyStyle
|
|
68
|
-
*/
|
|
69
|
-
const SchemaOut$V1AiPhotoEditorCreateBodyStyle = z
|
|
70
|
-
.object({
|
|
71
|
-
imageDescription: z.string(),
|
|
72
|
-
likenessStrength: z.number(),
|
|
73
|
-
negativePrompt: z.string().optional(),
|
|
74
|
-
prompt: z.string(),
|
|
75
|
-
promptStrength: z.number(),
|
|
76
|
-
steps: z.number().int().optional(),
|
|
77
|
-
upscaleFactor: z.number().int().optional(),
|
|
78
|
-
upscaleFidelity: z.number().optional(),
|
|
79
|
-
})
|
|
80
|
-
.transform((obj) => {
|
|
81
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
82
|
-
imageDescription: "image_description",
|
|
83
|
-
likenessStrength: "likeness_strength",
|
|
84
|
-
negativePrompt: "negative_prompt",
|
|
85
|
-
prompt: "prompt",
|
|
86
|
-
promptStrength: "prompt_strength",
|
|
87
|
-
steps: "steps",
|
|
88
|
-
upscaleFactor: "upscale_factor",
|
|
89
|
-
upscaleFidelity: "upscale_fidelity",
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
exports.Schemas$V1AiPhotoEditorCreateBodyStyle = {
|
|
93
|
-
in: SchemaIn$V1AiPhotoEditorCreateBodyStyle,
|
|
94
|
-
out: SchemaOut$V1AiPhotoEditorCreateBodyStyle,
|
|
95
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { External$V1AiPhotoEditorCreateBodyAssets, V1AiPhotoEditorCreateBodyAssets } from "./v1-ai-photo-editor-create-body-assets";
|
|
3
|
-
import { External$V1AiPhotoEditorCreateBodyStyle, V1AiPhotoEditorCreateBodyStyle } from "./v1-ai-photo-editor-create-body-style";
|
|
4
|
-
/**
|
|
5
|
-
* V1AiPhotoEditorCreateBody
|
|
6
|
-
*/
|
|
7
|
-
export type V1AiPhotoEditorCreateBody = {
|
|
8
|
-
/**
|
|
9
|
-
* Provide the assets for photo editor
|
|
10
|
-
*/
|
|
11
|
-
assets: V1AiPhotoEditorCreateBodyAssets;
|
|
12
|
-
/**
|
|
13
|
-
* Give your image a custom name for easy identification.
|
|
14
|
-
*/
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* The resolution of the final output image. The allowed value is based on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details
|
|
18
|
-
*/
|
|
19
|
-
resolution: number;
|
|
20
|
-
/**
|
|
21
|
-
* Deprecated: Please use `.style.steps` instead. Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time.
|
|
22
|
-
*/
|
|
23
|
-
steps?: number | undefined;
|
|
24
|
-
style: V1AiPhotoEditorCreateBodyStyle;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
* V1AiPhotoEditorCreateBody without any key transformation, this is what
|
|
29
|
-
* we expect to come in as network data
|
|
30
|
-
*/
|
|
31
|
-
export type External$V1AiPhotoEditorCreateBody = {
|
|
32
|
-
assets: External$V1AiPhotoEditorCreateBodyAssets;
|
|
33
|
-
name?: string | undefined;
|
|
34
|
-
resolution: number;
|
|
35
|
-
steps?: number | undefined;
|
|
36
|
-
style: External$V1AiPhotoEditorCreateBodyStyle;
|
|
37
|
-
};
|
|
38
|
-
export declare const Schemas$V1AiPhotoEditorCreateBody: {
|
|
39
|
-
in: z.ZodType<V1AiPhotoEditorCreateBody, z.ZodTypeDef, unknown>;
|
|
40
|
-
out: z.ZodType<External$V1AiPhotoEditorCreateBody, z.ZodTypeDef, V1AiPhotoEditorCreateBody>;
|
|
41
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
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$V1AiPhotoEditorCreateBody = void 0;
|
|
37
|
-
const make_api_request_js_1 = require("make-api-request-js");
|
|
38
|
-
const z = __importStar(require("zod"));
|
|
39
|
-
const v1_ai_photo_editor_create_body_assets_1 = require("./v1-ai-photo-editor-create-body-assets");
|
|
40
|
-
const v1_ai_photo_editor_create_body_style_1 = require("./v1-ai-photo-editor-create-body-style");
|
|
41
|
-
/**
|
|
42
|
-
* Takes network data, validates it, and transforms keys to match typescript object V1AiPhotoEditorCreateBody
|
|
43
|
-
*/
|
|
44
|
-
const SchemaIn$V1AiPhotoEditorCreateBody = z
|
|
45
|
-
.object({
|
|
46
|
-
assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.in,
|
|
47
|
-
name: z.string().optional(),
|
|
48
|
-
resolution: z.number().int(),
|
|
49
|
-
steps: z.number().int().optional(),
|
|
50
|
-
style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.in,
|
|
51
|
-
})
|
|
52
|
-
.transform((obj) => {
|
|
53
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
54
|
-
assets: "assets",
|
|
55
|
-
name: "name",
|
|
56
|
-
resolution: "resolution",
|
|
57
|
-
steps: "steps",
|
|
58
|
-
style: "style",
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
* Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateBody
|
|
64
|
-
*/
|
|
65
|
-
const SchemaOut$V1AiPhotoEditorCreateBody = z
|
|
66
|
-
.object({
|
|
67
|
-
assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.out,
|
|
68
|
-
name: z.string().optional(),
|
|
69
|
-
resolution: z.number().int(),
|
|
70
|
-
steps: z.number().int().optional(),
|
|
71
|
-
style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.out,
|
|
72
|
-
})
|
|
73
|
-
.transform((obj) => {
|
|
74
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
75
|
-
assets: "assets",
|
|
76
|
-
name: "name",
|
|
77
|
-
resolution: "resolution",
|
|
78
|
-
steps: "steps",
|
|
79
|
-
style: "style",
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
exports.Schemas$V1AiPhotoEditorCreateBody = {
|
|
83
|
-
in: SchemaIn$V1AiPhotoEditorCreateBody,
|
|
84
|
-
out: SchemaOut$V1AiPhotoEditorCreateBody,
|
|
85
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Success
|
|
4
|
-
*/
|
|
5
|
-
export type V1AiPhotoEditorCreateResponse = {
|
|
6
|
-
/**
|
|
7
|
-
* The amount of credits deducted from your account to generate the image. We charge credits right when the request is made.
|
|
8
|
-
*
|
|
9
|
-
* If an error occurred while generating the image(s), 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 image generation. Use 'credits_charged' instead.
|
|
14
|
-
*/
|
|
15
|
-
frameCost: number;
|
|
16
|
-
/**
|
|
17
|
-
* Unique ID of the image. Use it with the [Get image Project API](https://docs.magichour.ai/api-reference/image-projects/get-image-details) to fetch status and downloads.
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* @internal
|
|
23
|
-
* V1AiPhotoEditorCreateResponse without any key transformation, this is what
|
|
24
|
-
* we expect to come in as network data
|
|
25
|
-
*/
|
|
26
|
-
export type External$V1AiPhotoEditorCreateResponse = {
|
|
27
|
-
credits_charged: number;
|
|
28
|
-
frame_cost: number;
|
|
29
|
-
id: string;
|
|
30
|
-
};
|
|
31
|
-
export declare const Schemas$V1AiPhotoEditorCreateResponse: {
|
|
32
|
-
in: z.ZodType<V1AiPhotoEditorCreateResponse, z.ZodTypeDef, unknown>;
|
|
33
|
-
out: z.ZodType<External$V1AiPhotoEditorCreateResponse, z.ZodTypeDef, V1AiPhotoEditorCreateResponse>;
|
|
34
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
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$V1AiPhotoEditorCreateResponse = 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 V1AiPhotoEditorCreateResponse
|
|
41
|
-
*/
|
|
42
|
-
const SchemaIn$V1AiPhotoEditorCreateResponse = z
|
|
43
|
-
.object({
|
|
44
|
-
credits_charged: z.number().int(),
|
|
45
|
-
frame_cost: z.number().int(),
|
|
46
|
-
id: z.string(),
|
|
47
|
-
})
|
|
48
|
-
.transform((obj) => {
|
|
49
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
50
|
-
credits_charged: "creditsCharged",
|
|
51
|
-
frame_cost: "frameCost",
|
|
52
|
-
id: "id",
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* @internal
|
|
57
|
-
* Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateResponse
|
|
58
|
-
*/
|
|
59
|
-
const SchemaOut$V1AiPhotoEditorCreateResponse = z
|
|
60
|
-
.object({
|
|
61
|
-
creditsCharged: z.number().int(),
|
|
62
|
-
frameCost: z.number().int(),
|
|
63
|
-
id: z.string(),
|
|
64
|
-
})
|
|
65
|
-
.transform((obj) => {
|
|
66
|
-
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
67
|
-
creditsCharged: "credits_charged",
|
|
68
|
-
frameCost: "frame_cost",
|
|
69
|
-
id: "id",
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
exports.Schemas$V1AiPhotoEditorCreateResponse = {
|
|
73
|
-
in: SchemaIn$V1AiPhotoEditorCreateResponse,
|
|
74
|
-
out: SchemaOut$V1AiPhotoEditorCreateResponse,
|
|
75
|
-
};
|