Skip to content

Commit 7256f55

Browse files
magic-hour-sdk-bot[bot]sdk-github-actions[bot]
andauthored
feat: allow different output formats in ai-gif-generator (#117)
Co-authored-by: sdk-github-actions[bot] <sdk-github-actions[bot]@users.noreply.github.com>
1 parent f0c011d commit 7256f55

File tree

8 files changed

+36
-5
lines changed

8 files changed

+36
-5
lines changed

.sdk.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "91492d51-1540-4af9-8b6d-0f588c81d791",
2+
"id": "9196a167-76dd-4823-bd31-2f487937133a",
33
"tracked_paths": [
44
{
55
"editable": true,
@@ -513,6 +513,10 @@
513513
"editable": false,
514514
"path": "src/types/v1-ai-face-editor-create-response.ts"
515515
},
516+
{
517+
"editable": false,
518+
"path": "src/types/v1-ai-gif-generator-create-body-output-format-enum.ts"
519+
},
516520
{
517521
"editable": false,
518522
"path": "src/types/v1-ai-gif-generator-create-body-style.ts"

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "magic-hour",
3-
"version": "0.38.0",
3+
"version": "0.39.0",
44
"main": "./dist/index.js",
55
"types": "./dist/index.d.ts",
66
"exports": {
@@ -40,7 +40,9 @@
4040
"ts-morph": "^26.0.0",
4141
"ts-node": "^10.9.2",
4242
"tsc-alias": "^1.8.10",
43-
"typescript": "^5.2.0"
43+
"typescript": "^5.2.0",
44+
"@types/qs": "6.9.8",
45+
"@types/url-join": "4.0.1"
4446
},
4547
"bugs": "https://github.com/magichourhq/magic-hour-node/issues",
4648
"description": "Node SDK for Magic Hour API",
@@ -56,4 +58,4 @@
5658
"type": "git",
5759
"url": "git://github.com/magichourhq/magic-hour-node.git"
5860
}
59-
}
61+
}

src/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export enum Environment {
22
Environment = "https://api.magichour.ai",
3-
MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.37.0",
3+
MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.38.0",
44
}

src/resources/v1/ai-gif-generator/request-types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export type CreateRequest = {
1515
* The name of gif. This value is mainly used for your own identification of the gif.
1616
*/
1717
name?: string | undefined;
18+
/**
19+
* The output file format for the generated animation.
20+
*/
21+
outputFormat?: ("gif" | "mp4" | "webm") | undefined;
1822
style: V1AiGifGeneratorCreateBodyStyle;
1923
};
2024

@@ -25,6 +29,7 @@ export type CreateRequest = {
2529
*/
2630
export type External$CreateRequest = {
2731
name?: string | undefined;
32+
output_format?: ("gif" | "mp4" | "webm") | undefined;
2833
style: External$V1AiGifGeneratorCreateBodyStyle;
2934
};
3035

@@ -38,11 +43,13 @@ const SchemaIn$CreateRequest: z.ZodType<
3843
> = z
3944
.object({
4045
name: z.string().optional(),
46+
output_format: z.enum(["gif", "mp4", "webm"]).optional(),
4147
style: Schemas$V1AiGifGeneratorCreateBodyStyle.in,
4248
})
4349
.transform((obj) => {
4450
return zodTransform(obj, {
4551
name: "name",
52+
output_format: "outputFormat",
4653
style: "style",
4754
});
4855
});
@@ -58,11 +65,13 @@ const SchemaOut$CreateRequest: z.ZodType<
5865
> = z
5966
.object({
6067
name: z.string().optional(),
68+
outputFormat: z.enum(["gif", "mp4", "webm"]).optional(),
6169
style: Schemas$V1AiGifGeneratorCreateBodyStyle.out,
6270
})
6371
.transform((obj) => {
6472
return zodTransform(obj, {
6573
name: "name",
74+
outputFormat: "output_format",
6675
style: "style",
6776
});
6877
});

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export { V1AiFaceEditorCreateBodyAssets } from "./v1-ai-face-editor-create-body-
77
export { V1AiFaceEditorCreateBodyStyle } from "./v1-ai-face-editor-create-body-style";
88
export { V1AiFaceEditorCreateResponse } from "./v1-ai-face-editor-create-response";
99
export { V1AiGifGeneratorCreateBody } from "./v1-ai-gif-generator-create-body";
10+
export { V1AiGifGeneratorCreateBodyOutputFormatEnum } from "./v1-ai-gif-generator-create-body-output-format-enum";
1011
export { V1AiGifGeneratorCreateBodyStyle } from "./v1-ai-gif-generator-create-body-style";
1112
export { V1AiGifGeneratorCreateResponse } from "./v1-ai-gif-generator-create-response";
1213
export { V1AiHeadshotGeneratorCreateBody } from "./v1-ai-headshot-generator-create-body";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* The output file format for the generated animation.
3+
*/
4+
export type V1AiGifGeneratorCreateBodyOutputFormatEnum = "gif" | "mp4" | "webm";

src/types/v1-ai-gif-generator-create-body.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export type V1AiGifGeneratorCreateBody = {
1515
* The name of gif. This value is mainly used for your own identification of the gif.
1616
*/
1717
name?: string | undefined;
18+
/**
19+
* The output file format for the generated animation.
20+
*/
21+
outputFormat?: ("gif" | "mp4" | "webm") | undefined;
1822
style: V1AiGifGeneratorCreateBodyStyle;
1923
};
2024

@@ -25,6 +29,7 @@ export type V1AiGifGeneratorCreateBody = {
2529
*/
2630
export type External$V1AiGifGeneratorCreateBody = {
2731
name?: string | undefined;
32+
output_format?: ("gif" | "mp4" | "webm") | undefined;
2833
style: External$V1AiGifGeneratorCreateBodyStyle;
2934
};
3035

@@ -38,11 +43,13 @@ const SchemaIn$V1AiGifGeneratorCreateBody: z.ZodType<
3843
> = z
3944
.object({
4045
name: z.string().optional(),
46+
output_format: z.enum(["gif", "mp4", "webm"]).optional(),
4147
style: Schemas$V1AiGifGeneratorCreateBodyStyle.in,
4248
})
4349
.transform((obj) => {
4450
return zodTransform(obj, {
4551
name: "name",
52+
output_format: "outputFormat",
4653
style: "style",
4754
});
4855
});
@@ -58,11 +65,13 @@ const SchemaOut$V1AiGifGeneratorCreateBody: z.ZodType<
5865
> = z
5966
.object({
6067
name: z.string().optional(),
68+
outputFormat: z.enum(["gif", "mp4", "webm"]).optional(),
6169
style: Schemas$V1AiGifGeneratorCreateBodyStyle.out,
6270
})
6371
.transform((obj) => {
6472
return zodTransform(obj, {
6573
name: "name",
74+
outputFormat: "output_format",
6675
style: "style",
6776
});
6877
});

test/v1-ai-gif-generator.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ describe("tests client.v1.aiGifGenerator.create", () => {
1313
client.v1.aiGifGenerator
1414
.create({
1515
name: "Ai Gif gif",
16+
outputFormat: "gif",
1617
style: { prompt: "Cute dancing cat, pixel art" },
1718
})
1819
.asResponse(),
1920
client.v1.aiGifGenerator.create({
2021
name: "Ai Gif gif",
22+
outputFormat: "gif",
2123
style: { prompt: "Cute dancing cat, pixel art" },
2224
}),
2325
]);

0 commit comments

Comments
 (0)