/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 0c28b0f5b136 */ import * as z from "zod"; import * as b64$ from "../lib/base64.js"; import { ClosedEnum } from "../types/enums.js"; import { ApiError, ApiError$zodSchema } from "./apierror.js"; import { ArchiveResourceType, ArchiveResourceType$zodSchema, } from "./archiveresourcetype.js"; import { DeliveryTypeAll, DeliveryTypeAll$zodSchema, } from "./deliverytypeall.js"; import { GenerateArchiveResponse, GenerateArchiveResponse$zodSchema, } from "./generatearchiveresponse.js"; export type GenerateArchiveGlobals = { cloud_name?: string | undefined }; export const GenerateArchiveGlobals$zodSchema: z.ZodType< GenerateArchiveGlobals > = 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 = { Download: "download", Create: "create", CreateAndDownload: "create_and_download", } as const; /** * 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 type Mode = ClosedEnum; export const Mode$zodSchema = z.enum([ "download", "create", "create_and_download", ]).describe( "The method for generating and delivering the archive. Options:\ndownload - Generates and delivers the archive file without storing it\ncreate - Creates and stores the archive as a raw asset, returning URLs in the response\ncreate_and_download - Creates, stores, and delivers the archive file\n", ); /** * The format of the generated archive. */ export const TargetFormat = { Zip: "zip", Tgz: "tgz", } as const; /** * The format of the generated archive. */ export type TargetFormat = ClosedEnum; export const TargetFormat$zodSchema = z.enum([ "zip", "tgz", ]).describe("The format of the generated archive."); /** * A list of asset folder paths to include in the archive, or a single folder path string. Only available when asset folders are enabled for your account. */ export type AssetFolders = Array | string; export const AssetFolders$zodSchema: z.ZodType = z.union([ z.array(z.string()), z.string(), ]).describe( "A list of asset folder paths to include in the archive, or a single folder path string. Only available when asset folders are enabled for your account.", ); /** * The archive generation parameters. */ export type GenerateArchiveRequestBody = { public_ids?: Array | undefined; tags?: Array | undefined; prefixes?: Array | undefined; type?: DeliveryTypeAll | 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 | undefined; keep_derived?: boolean | undefined; fully_qualified_public_ids?: Array | undefined; search_expression?: string | undefined; target_filename?: string | undefined; asset_folders?: Array | string | undefined; }; export const GenerateArchiveRequestBody$zodSchema: z.ZodType< GenerateArchiveRequestBody > = z.object({ allow_missing: z.boolean().default(false).describe( "Whether to allow missing assets in the archive. If false, the operation will fail if any asset is not found.", ), asset_folders: z.union([ z.array(z.string()), z.string(), ]).optional().describe( "A list of asset folder paths to include in the archive, or a single folder path string. Only available when asset folders are enabled for your account.", ), async: z.boolean().default(false).describe( "(\"create\" mode only), specifies whether to generate the archive asynchronously.", ), expires_at: z.int().optional().describe( "(\"download\" mode only) Unix timestamp indicating when the generated archive URL should expire.", ), flatten_folders: z.boolean().default(false).describe( "Whether to flatten all files to be in the root of the archive file.", ), flatten_transformations: z.boolean().default(false).describe( "Whether to flatten the folder structure of the derived assets.", ), fully_qualified_public_ids: z.array(z.string()).optional().describe( "A list of fully qualified public IDs (resource_type/type/public_id) to include in the archive.", ), keep_derived: z.boolean().default(false).describe( "Whether to keep the derived assets used for generating the archive.", ), mode: Mode$zodSchema.default("create").describe( "The method for generating and delivering the archive. Options:\ndownload - Generates and delivers the archive file without storing it\ncreate - Creates and stores the archive as a raw asset, returning URLs in the response\ncreate_and_download - Creates, stores, and delivers the archive file\n", ), notification_url: z.string().optional().describe( "(\"create\" mode only), specifies the URL to notify when the archive generation is complete.", ), prefixes: z.array(z.string()).optional().describe( "Select all assets where the public ID starts with this prefix.", ), public_ids: z.array(z.string()).optional().describe( "The list of public IDs to include in the archive.", ), search_expression: z.string().optional().describe( "A search expression to select assets to include in the archive.", ), skip_transformation_name: z.boolean().default(false).describe( "Whether to skip adding the transformation details to the file names in the archive.", ), tags: z.array(z.string()).optional().describe( "Tags to filter which assets to include in the archive. Assets matching any of the specified tags are included.", ), target_asset_folder: z.string().optional().describe( "The folder in your product environment where the generated archive should be stored.", ), target_filename: z.string().optional().describe( "The filename for the downloaded archive file. Extension must match target_format (zip or tgz).", ), target_format: TargetFormat$zodSchema.default("zip").describe( "The format of the generated archive.", ), target_public_id: z.string().optional().describe( "The public ID to assign to the generated archive, or the filename of the downloaded archive file.", ), target_tags: z.array(z.string()).optional().describe( "A list of tag names to assign to the generated archive.", ), transformations: z.string().optional().describe( "The transformations to apply to the assets before including them in the archive (separated by \"|\").", ), type: DeliveryTypeAll$zodSchema.optional().describe( "All supported delivery types.", ), use_original_filename: z.boolean().default(false).describe( "Whether to use the original filenames of the assets in the archive instead of public IDs (when available).", ), }).describe("The archive generation parameters."); export type GenerateArchiveRequest = { resource_type: ArchiveResourceType; RequestBody: GenerateArchiveRequestBody; }; export const GenerateArchiveRequest$zodSchema: z.ZodType< GenerateArchiveRequest > = z.object({ RequestBody: z.lazy(() => GenerateArchiveRequestBody$zodSchema).describe( "The archive generation parameters.", ), resource_type: ArchiveResourceType$zodSchema.describe( "The type of resource for archive generation (image, video, or raw).", ), }); export type GenerateArchiveResponseResponse = | ApiError | Uint8Array | string | GenerateArchiveResponse; export const GenerateArchiveResponseResponse$zodSchema: z.ZodType< GenerateArchiveResponseResponse > = z.union([ ApiError$zodSchema, z.string().describe("Base64-encoded binary content").transform( b64$.bytesFromBase64, ), GenerateArchiveResponse$zodSchema, ]);