textop.ts•6.13 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { ApiError, ApiError$zodSchema } from "./apierror.js";
export type TextGlobals = { cloud_name?: string | undefined };
export const TextGlobals$zodSchema: z.ZodType<
TextGlobals,
z.ZodTypeDef,
unknown
> = z.object({
cloud_name: z.string().describe("The cloud name of your product environment.")
.optional(),
});
/**
* The type of resource to create. Must be "image" for text generation.
*/
export const TextResourceType$zodSchema = z.enum([
"image",
]).describe(
"The type of resource to create. Must be \"image\" for text generation.",
);
export type TextResourceType = z.infer<typeof TextResourceType$zodSchema>;
/**
* Text alignment (left, center, right, justify).
*/
export const TextAlign$zodSchema = z.enum([
"left",
"center",
"right",
"justify",
]).describe("Text alignment (left, center, right, justify).");
export type TextAlign = z.infer<typeof TextAlign$zodSchema>;
/**
* Whether to use a normal or bold font.
*/
export const FontWeight$zodSchema = z.enum([
"normal",
"bold",
]).describe("Whether to use a normal or bold font.");
export type FontWeight = z.infer<typeof FontWeight$zodSchema>;
/**
* Whether to use a normal or italic font.
*/
export const FontStyle$zodSchema = z.enum([
"normal",
"italic",
]).describe("Whether to use a normal or italic font.");
export type FontStyle = z.infer<typeof FontStyle$zodSchema>;
/**
* Text decoration style.
*/
export const TextDecoration$zodSchema = z.enum([
"none",
"underline",
]).describe("Text decoration style.");
export type TextDecoration = z.infer<typeof TextDecoration$zodSchema>;
export type TextRequestBody = {
text: string;
public_id?: string | undefined;
font_family?: string | undefined;
font_size?: number | undefined;
font_color?: string | undefined;
text_align?: TextAlign | undefined;
font_weight?: FontWeight | undefined;
font_style?: FontStyle | undefined;
background?: string | undefined;
opacity?: number | undefined;
text_decoration?: TextDecoration | undefined;
line_spacing?: number | undefined;
};
export const TextRequestBody$zodSchema: z.ZodType<
TextRequestBody,
z.ZodTypeDef,
unknown
> = z.object({
background: z.string().default("transparent"),
font_color: z.string().default("black"),
font_family: z.string().optional(),
font_size: z.number().int().default(12),
font_style: FontStyle$zodSchema.default("normal"),
font_weight: FontWeight$zodSchema.default("normal"),
line_spacing: z.number().int().optional(),
opacity: z.number().int().default(100),
public_id: z.string().optional(),
text: z.string(),
text_align: TextAlign$zodSchema.optional(),
text_decoration: TextDecoration$zodSchema.default("none"),
});
export type TextRequest = {
resource_type: TextResourceType;
RequestBody: TextRequestBody;
};
export const TextRequest$zodSchema: z.ZodType<
TextRequest,
z.ZodTypeDef,
unknown
> = z.object({
RequestBody: z.lazy(() => TextRequestBody$zodSchema),
resource_type: TextResourceType$zodSchema,
});
export type TextAccessControl = {};
export const TextAccessControl$zodSchema: z.ZodType<
TextAccessControl,
z.ZodTypeDef,
unknown
> = z.object({});
export type Region = {};
export const Region$zodSchema: z.ZodType<Region, z.ZodTypeDef, unknown> = z
.object({});
/**
* Moderation information for the asset.
*/
export type TextModeration = {};
export const TextModeration$zodSchema: z.ZodType<
TextModeration,
z.ZodTypeDef,
unknown
> = z.object({}).describe("Moderation information for the asset.");
/**
* Additional information about the asset.
*/
export type TextInfo = {};
export const TextInfo$zodSchema: z.ZodType<TextInfo, z.ZodTypeDef, unknown> = z
.object({}).describe("Additional information about the asset.");
/**
* Text image created successfully
*/
export type TextResponseBody = {
asset_id: string;
public_id: string;
version: number;
version_id: string;
signature: string;
width: number;
height: number;
format: string;
resource_type: string;
created_at: string;
tags?: Array<string> | undefined;
pages?: number | undefined;
bytes: number;
type: string;
etag?: string | undefined;
placeholder?: boolean | undefined;
url: string;
secure_url: string;
display_name?: string | undefined;
access_mode?: string | undefined;
access_control?: Array<TextAccessControl> | undefined;
regions?: Array<Region> | undefined;
moderation?: TextModeration | undefined;
info?: TextInfo | undefined;
};
export const TextResponseBody$zodSchema: z.ZodType<
TextResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
access_control: z.array(z.lazy(() => TextAccessControl$zodSchema)).optional(),
access_mode: z.string().optional(),
asset_id: z.string(),
bytes: z.number().int(),
created_at: z.string().datetime({ offset: true }),
display_name: z.string().optional(),
etag: z.string().optional(),
format: z.string(),
height: z.number().int(),
info: z.lazy(() => TextInfo$zodSchema).optional(),
moderation: z.lazy(() => TextModeration$zodSchema).optional(),
pages: z.number().int().optional(),
placeholder: z.boolean().optional(),
public_id: z.string(),
regions: z.array(z.lazy(() => Region$zodSchema)).optional(),
resource_type: z.string(),
secure_url: z.string(),
signature: z.string(),
tags: z.array(z.string()).optional(),
type: z.string(),
url: z.string(),
version: z.number().int(),
version_id: z.string(),
width: z.number().int(),
}).describe("Text image created successfully");
export type TextResponse = {
ContentType: string;
StatusCode: number;
RawResponse: Response;
object?: TextResponseBody | undefined;
api_error?: ApiError | undefined;
};
export const TextResponse$zodSchema: z.ZodType<
TextResponse,
z.ZodTypeDef,
unknown
> = z.object({
ContentType: z.string(),
RawResponse: z.instanceof(Response),
StatusCode: z.number().int(),
api_error: ApiError$zodSchema.optional(),
object: z.lazy(() => TextResponseBody$zodSchema).optional(),
});