generatearchiveop.ts•6.59 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { ApiError, ApiError$zodSchema } from "./apierror.js";
import {
ArchiveResourceType,
ArchiveResourceType$zodSchema,
} from "./archiveresourcetype.js";
import {
ArchiveStorageType,
ArchiveStorageType$zodSchema,
} from "./archivestoragetype.js";
export type GenerateArchiveGlobals = { cloud_name?: string | undefined };
export const GenerateArchiveGlobals$zodSchema: z.ZodType<
GenerateArchiveGlobals,
z.ZodTypeDef,
unknown
> = z.object({
cloud_name: z.string().describe("The cloud name of your product environment.")
.optional(),
});
/**
* The method for generating and delivering the archive. Options:
*
* @remarks
* download - Generates and delivers the archive file without storing it
* create - Creates and stores the archive as a raw asset, returning URLs in the response
* create_and_download - Creates, stores, and delivers the archive file
*/
export const Mode$zodSchema = z.enum([
"download",
"create",
"create_and_download",
]).describe(
"The method for generating and delivering the archive. Options:\n"
+ "download - Generates and delivers the archive file without storing it\n"
+ "create - Creates and stores the archive as a raw asset, returning URLs in the response\n"
+ "create_and_download - Creates, stores, and delivers the archive file\n"
+ "",
);
export type Mode = z.infer<typeof Mode$zodSchema>;
/**
* The format of the generated archive.
*/
export const TargetFormat$zodSchema = z.enum([
"zip",
"tgz",
]).describe("The format of the generated archive.");
export type TargetFormat = z.infer<typeof TargetFormat$zodSchema>;
export type GenerateArchiveRequestBody = {
api_key?: string | undefined;
timestamp?: number | undefined;
signature?: string | undefined;
public_ids?: Array<string> | undefined;
tags?: Array<string> | undefined;
prefixes?: Array<string> | undefined;
type?: ArchiveStorageType | undefined;
transformations?: string | undefined;
mode?: Mode | undefined;
target_format?: TargetFormat | undefined;
target_public_id?: string | undefined;
target_asset_folder?: string | undefined;
flatten_folders?: boolean | undefined;
flatten_transformations?: boolean | undefined;
skip_transformation_name?: boolean | undefined;
allow_missing?: boolean | undefined;
expires_at?: number | undefined;
use_original_filename?: boolean | undefined;
async?: boolean | undefined;
notification_url?: string | undefined;
target_tags?: Array<string> | undefined;
keep_derived?: boolean | undefined;
};
export const GenerateArchiveRequestBody$zodSchema: z.ZodType<
GenerateArchiveRequestBody,
z.ZodTypeDef,
unknown
> = z.object({
allow_missing: z.boolean().default(false),
api_key: z.string().optional(),
async: z.boolean().default(false),
expires_at: z.number().int().optional(),
flatten_folders: z.boolean().default(false),
flatten_transformations: z.boolean().default(false),
keep_derived: z.boolean().default(false),
mode: Mode$zodSchema.default("create"),
notification_url: z.string().optional(),
prefixes: z.array(z.string()).optional(),
public_ids: z.array(z.string()).optional(),
signature: z.string().optional(),
skip_transformation_name: z.boolean().default(false),
tags: z.array(z.string()).optional(),
target_asset_folder: z.string().optional(),
target_format: TargetFormat$zodSchema.default("zip"),
target_public_id: z.string().optional(),
target_tags: z.array(z.string()).optional(),
timestamp: z.number().int().optional(),
transformations: z.string().optional(),
type: ArchiveStorageType$zodSchema.optional(),
use_original_filename: z.boolean().default(false),
});
export type GenerateArchiveRequest = {
resource_type: ArchiveResourceType;
RequestBody: GenerateArchiveRequestBody;
};
export const GenerateArchiveRequest$zodSchema: z.ZodType<
GenerateArchiveRequest,
z.ZodTypeDef,
unknown
> = z.object({
RequestBody: z.lazy(() => GenerateArchiveRequestBody$zodSchema),
resource_type: ArchiveResourceType$zodSchema,
});
/**
* Archive successfully generated or downloaded
*/
export type GenerateArchiveResponseBody = {
asset_id?: string | undefined;
public_id?: string | undefined;
version?: number | undefined;
version_id?: string | undefined;
resource_type?: string | undefined;
created_at?: string | undefined;
tags?: Array<string> | undefined;
bytes?: number | undefined;
type?: string | undefined;
url?: string | undefined;
secure_url?: string | undefined;
folder?: string | undefined;
resource_count?: number | undefined;
file_count?: number | undefined;
asset_folder?: string | undefined;
display_name?: string | undefined;
missing_public_ids?: Array<string> | undefined;
empty_tags?: Array<string> | undefined;
empty_prefixes?: Array<string> | undefined;
};
export const GenerateArchiveResponseBody$zodSchema: z.ZodType<
GenerateArchiveResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
asset_folder: z.string().optional(),
asset_id: z.string().optional(),
bytes: z.number().int().optional(),
created_at: z.string().datetime({ offset: true }).optional(),
display_name: z.string().optional(),
empty_prefixes: z.array(z.string()).optional(),
empty_tags: z.array(z.string()).optional(),
file_count: z.number().int().optional(),
folder: z.string().optional(),
missing_public_ids: z.array(z.string()).optional(),
public_id: z.string().optional(),
resource_count: z.number().int().optional(),
resource_type: z.string().optional(),
secure_url: z.string().optional(),
tags: z.array(z.string()).optional(),
type: z.string().optional(),
url: z.string().optional(),
version: z.number().int().optional(),
version_id: z.string().optional(),
}).describe("Archive successfully generated or downloaded");
export type GenerateArchiveResponse = {
ContentType: string;
StatusCode: number;
RawResponse: Response;
bytes?: Uint8Array | string | undefined;
object?: GenerateArchiveResponseBody | undefined;
api_error?: ApiError | undefined;
};
export const GenerateArchiveResponse$zodSchema: z.ZodType<
GenerateArchiveResponse,
z.ZodTypeDef,
unknown
> = z.object({
ContentType: z.string(),
RawResponse: z.instanceof(Response),
StatusCode: z.number().int(),
api_error: ApiError$zodSchema.optional(),
bytes: z.string().base64().describe(
"Archive successfully generated or downloaded",
).optional(),
object: z.lazy(() => GenerateArchiveResponseBody$zodSchema).optional(),
});