/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: bbcd43bc9f51 */ import * as z from "zod"; import { ClosedEnum } from "../types/enums.js"; import { AccessControlItem, AccessControlItem$zodSchema, } from "./accesscontrolitem.js"; import { DeliveryTypeAll, DeliveryTypeAll$zodSchema, } from "./deliverytypeall.js"; /** * The type of resource. */ export const SearchResponseResourceType = { Image: "image", Video: "video", Raw: "raw", } as const; /** * The type of resource. */ export type SearchResponseResourceType = ClosedEnum< typeof SearchResponseResourceType >; export const SearchResponseResourceType$zodSchema = z.enum([ "image", "video", "raw", ]).describe("The type of resource."); /** * The current status of the asset. */ export const SearchResponseStatus = { Active: "active", Inactive: "inactive", Deleted: "deleted", Pending: "pending", } as const; /** * The current status of the asset. */ export type SearchResponseStatus = ClosedEnum; export const SearchResponseStatus$zodSchema = z.enum([ "active", "inactive", "deleted", "pending", ]).describe("The current status of the asset."); /** * The access mode of the asset. */ export const SearchResponseAccessMode = { Public: "public", Authenticated: "authenticated", } as const; /** * The access mode of the asset. */ export type SearchResponseAccessMode = ClosedEnum< typeof SearchResponseAccessMode >; export const SearchResponseAccessMode$zodSchema = z.enum([ "public", "authenticated", ]).describe("The access mode of the asset."); /** * Information about who created the asset. */ export type CreatedBy = { access_key?: string | undefined }; export const CreatedBy$zodSchema: z.ZodType = z.object({ access_key: z.string().optional().describe( "The access key of the user who created the asset.", ), }).describe("Information about who created the asset."); /** * Information about who uploaded the asset. */ export type UploadedBy = { access_key?: string | undefined }; export const UploadedBy$zodSchema: z.ZodType = z.object({ access_key: z.string().optional().describe( "The access key of the user who uploaded the asset.", ), }).describe("Information about who uploaded the asset."); /** * Technical metadata extracted from the image. */ export type SearchResponseImageMetadata = {}; export const SearchResponseImageMetadata$zodSchema: z.ZodType< SearchResponseImageMetadata > = z.object({}).describe("Technical metadata extracted from the image."); /** * Results of image analysis. */ export type ImageAnalysis = {}; export const ImageAnalysis$zodSchema: z.ZodType = z.object({}) .describe("Results of image analysis."); /** * Structured metadata associated with the asset. */ export type Metadata = {}; export const Metadata$zodSchema: z.ZodType = z.object({}).describe( "Structured metadata associated with the asset.", ); /** * Results of quality analysis. */ export type QualityAnalysis = {}; export const QualityAnalysis$zodSchema: z.ZodType = z.object( {}, ).describe("Results of quality analysis."); /** * Results of accessibility analysis. */ export type AccessibilityAnalysis = {}; export const AccessibilityAnalysis$zodSchema: z.ZodType = z.object({}).describe("Results of accessibility analysis."); /** * Resource fields that can be returned. All fields are optional and can be filtered using the fields parameter. */ export type Resource = { asset_id?: string | undefined; public_id?: string | undefined; asset_folder?: string | undefined; filename?: string | undefined; display_name?: string | undefined; format?: string | undefined; version?: number | undefined; resource_type?: SearchResponseResourceType | undefined; type?: DeliveryTypeAll | undefined; created_at?: string | undefined; uploaded_at?: string | undefined; bytes?: number | undefined; backup_bytes?: number | undefined; width?: number | undefined; height?: number | undefined; aspect_ratio?: number | undefined; pixels?: number | undefined; url?: string | undefined; secure_url?: string | undefined; status?: SearchResponseStatus | undefined; access_mode?: SearchResponseAccessMode | undefined; access_control?: Array | null | undefined; etag?: string | undefined; created_by?: CreatedBy | null | undefined; uploaded_by?: UploadedBy | null | undefined; context?: { [k: string]: string } | null | undefined; tags?: Array | null | undefined; image_metadata?: SearchResponseImageMetadata | null | undefined; image_analysis?: ImageAnalysis | null | undefined; metadata?: Metadata | null | undefined; quality_analysis?: QualityAnalysis | null | undefined; accessibility_analysis?: AccessibilityAnalysis | null | undefined; }; export const Resource$zodSchema: z.ZodType = z.object({ access_control: z.array(AccessControlItem$zodSchema).nullable().optional() .describe("The access control settings for the asset."), access_mode: SearchResponseAccessMode$zodSchema.optional().describe( "The access mode of the asset.", ), accessibility_analysis: z.lazy(() => AccessibilityAnalysis$zodSchema) .nullable().optional().describe("Results of accessibility analysis."), aspect_ratio: z.number().optional().describe( "The aspect ratio of the asset (width/height).", ), asset_folder: z.string().optional().describe( "The folder where the asset is stored.", ), asset_id: z.string().optional().describe( "The unique identifier of the asset.", ), backup_bytes: z.int().optional().describe( "The size of the backup asset in bytes.", ), bytes: z.int().optional().describe("The size of the asset in bytes."), context: z.record(z.string(), z.string()).nullable().optional().describe( "Custom context metadata associated with the asset.", ), created_at: z.iso.datetime({ offset: true }).optional().describe( "The timestamp when the asset was created.", ), created_by: z.lazy(() => CreatedBy$zodSchema).nullable().optional().describe( "Information about who created the asset.", ), display_name: z.string().optional().describe( "The display name of the asset.", ), etag: z.string().optional().describe("The ETag of the asset."), filename: z.string().optional().describe( "The original filename of the asset.", ), format: z.string().optional().describe("The format of the asset."), height: z.int().optional().describe("The height of the asset in pixels."), image_analysis: z.lazy(() => ImageAnalysis$zodSchema).nullable().optional() .describe("Results of image analysis."), image_metadata: z.lazy(() => SearchResponseImageMetadata$zodSchema).nullable() .optional().describe("Technical metadata extracted from the image."), metadata: z.lazy(() => Metadata$zodSchema).nullable().optional().describe( "Structured metadata associated with the asset.", ), pixels: z.int().optional().describe( "The total number of pixels in the asset.", ), public_id: z.string().optional().describe( "The public identifier that is used to build the URL.", ), quality_analysis: z.lazy(() => QualityAnalysis$zodSchema).nullable() .optional().describe("Results of quality analysis."), resource_type: SearchResponseResourceType$zodSchema.optional().describe( "The type of resource.", ), secure_url: z.string().optional().describe( "The HTTPS URL for accessing the asset.", ), status: SearchResponseStatus$zodSchema.optional().describe( "The current status of the asset.", ), tags: z.array(z.string()).nullable().optional().describe( "Tags associated with the asset.", ), type: DeliveryTypeAll$zodSchema.optional().describe( "All supported delivery types.", ), uploaded_at: z.iso.datetime({ offset: true }).optional().describe( "The timestamp when the asset was uploaded.", ), uploaded_by: z.lazy(() => UploadedBy$zodSchema).nullable().optional() .describe("Information about who uploaded the asset."), url: z.string().optional().describe("The HTTP URL for accessing the asset."), version: z.int().optional().describe("The version number of the asset."), width: z.int().optional().describe("The width of the asset in pixels."), }).describe( "Resource fields that can be returned. All fields are optional and can be filtered using the fields parameter.", ); export type Value = { value?: string | undefined; count?: number | undefined }; export const Value$zodSchema: z.ZodType = z.object({ count: z.int().optional().describe("The count of resources with this value"), value: z.string().optional().describe("The value being aggregated"), }); export type SearchResponseRange = { from?: number | undefined; to?: number | undefined; count?: number | undefined; }; export const SearchResponseRange$zodSchema: z.ZodType = z .object({ count: z.int().optional().describe( "The count of resources within this range", ), from: z.number().optional().describe("Start of the range (inclusive)"), to: z.number().optional().describe("End of the range (exclusive)"), }); /** * Aggregation results when the aggregate parameter is used in the request. Only included when aggregations are requested. */ export type Aggregations = { values?: Array | undefined; ranges?: Array | undefined; }; export const Aggregations$zodSchema: z.ZodType = z.object({ ranges: z.array(z.lazy(() => SearchResponseRange$zodSchema)).optional() .describe( "Array of range-based aggregation results when using range aggregation (e.g., bytes, width, height, etc.)", ), values: z.array(z.lazy(() => Value$zodSchema)).optional().describe( "Array of aggregation values when using simple aggregation (e.g., by format, resource_type, etc.)", ), }).describe( "Aggregation results when the aggregate parameter is used in the request. Only included when aggregations are requested.", ); /** * The response object returned by search operations. */ export type SearchResponse = { total_count?: number | undefined; time?: number | undefined; resources?: Array | undefined; next_cursor?: string | null | undefined; aggregations?: Aggregations | undefined; }; export const SearchResponse$zodSchema: z.ZodType = z.object({ aggregations: z.lazy(() => Aggregations$zodSchema).optional().describe( "Aggregation results when the aggregate parameter is used in the request. Only included when aggregations are requested.", ), next_cursor: z.string().nullable().optional().describe( "A cursor for pagination. Only included when there are more results available.", ), resources: z.array(z.lazy(() => Resource$zodSchema)).optional().describe( "The list of resources matching the search criteria. Can be empty if no results found.", ), time: z.int().optional().describe( "The time taken to execute the search query in milliseconds.", ), total_count: z.int().optional().describe( "The total number of resources matching the search criteria.", ), }).describe("The response object returned by search operations.");