searchresponse.ts•9.13 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
/**
* The type of resource.
*/
export const SearchResponseResourceType$zodSchema = z.enum([
"image",
"video",
"raw",
]).describe("The type of resource.");
export type SearchResponseResourceType = z.infer<
typeof SearchResponseResourceType$zodSchema
>;
/**
* The delivery type of the asset.
*/
export const SearchResponseType$zodSchema = z.enum([
"upload",
"private",
"authenticated",
"list",
"fetch",
]).describe("The delivery type of the asset.");
export type SearchResponseType = z.infer<typeof SearchResponseType$zodSchema>;
/**
* The current status of the asset.
*/
export const SearchResponseStatus$zodSchema = z.enum([
"active",
"inactive",
]).describe("The current status of the asset.");
export type SearchResponseStatus = z.infer<
typeof SearchResponseStatus$zodSchema
>;
/**
* The access mode of the asset.
*/
export const SearchResponseAccessMode$zodSchema = z.enum([
"public",
"authenticated",
]).describe("The access mode of the asset.");
export type SearchResponseAccessMode = z.infer<
typeof SearchResponseAccessMode$zodSchema
>;
/**
* The access control settings for the asset.
*/
export type SearchResponseAccessControl = {};
export const SearchResponseAccessControl$zodSchema: z.ZodType<
SearchResponseAccessControl,
z.ZodTypeDef,
unknown
> = z.object({}).describe("The access control settings for the asset.");
/**
* Information about who created the asset.
*/
export type CreatedBy = { access_key?: string | undefined };
export const CreatedBy$zodSchema: z.ZodType<CreatedBy, z.ZodTypeDef, unknown> =
z.object({
access_key: z.string().optional(),
}).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<
UploadedBy,
z.ZodTypeDef,
unknown
> = z.object({
access_key: z.string().optional(),
}).describe("Information about who uploaded the asset.");
/**
* Custom context metadata associated with the asset.
*/
export type SearchResponseContext = {};
export const SearchResponseContext$zodSchema: z.ZodType<
SearchResponseContext,
z.ZodTypeDef,
unknown
> = z.object({}).describe("Custom context metadata associated with the asset.");
/**
* Technical metadata extracted from the image.
*/
export type SearchResponseImageMetadata = {};
export const SearchResponseImageMetadata$zodSchema: z.ZodType<
SearchResponseImageMetadata,
z.ZodTypeDef,
unknown
> = z.object({}).describe("Technical metadata extracted from the image.");
/**
* Results of image analysis.
*/
export type ImageAnalysis = {};
export const ImageAnalysis$zodSchema: z.ZodType<
ImageAnalysis,
z.ZodTypeDef,
unknown
> = z.object({}).describe("Results of image analysis.");
/**
* Structured metadata associated with the asset.
*/
export type Metadata = {};
export const Metadata$zodSchema: z.ZodType<Metadata, z.ZodTypeDef, unknown> = z
.object({}).describe("Structured metadata associated with the asset.");
/**
* Results of quality analysis.
*/
export type QualityAnalysis = {};
export const QualityAnalysis$zodSchema: z.ZodType<
QualityAnalysis,
z.ZodTypeDef,
unknown
> = z.object({}).describe("Results of quality analysis.");
/**
* Results of accessibility analysis.
*/
export type AccessibilityAnalysis = {};
export const AccessibilityAnalysis$zodSchema: z.ZodType<
AccessibilityAnalysis,
z.ZodTypeDef,
unknown
> = 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?: SearchResponseType | 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?: SearchResponseAccessControl | null | undefined;
etag?: string | undefined;
created_by?: CreatedBy | null | undefined;
uploaded_by?: UploadedBy | null | undefined;
context?: SearchResponseContext | undefined;
tags?: Array<string> | 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<Resource, z.ZodTypeDef, unknown> = z
.object({
access_control: z.lazy(() => SearchResponseAccessControl$zodSchema)
.nullable().optional(),
access_mode: SearchResponseAccessMode$zodSchema.optional(),
accessibility_analysis: z.lazy(() => AccessibilityAnalysis$zodSchema)
.nullable().optional(),
aspect_ratio: z.number().optional(),
asset_folder: z.string().optional(),
asset_id: z.string().optional(),
backup_bytes: z.number().int().optional(),
bytes: z.number().int().optional(),
context: z.lazy(() => SearchResponseContext$zodSchema).optional(),
created_at: z.string().datetime({ offset: true }).optional(),
created_by: z.lazy(() => CreatedBy$zodSchema).nullable().optional(),
display_name: z.string().optional(),
etag: z.string().optional(),
filename: z.string().optional(),
format: z.string().optional(),
height: z.number().int().optional(),
image_analysis: z.lazy(() => ImageAnalysis$zodSchema).nullable().optional(),
image_metadata: z.lazy(() => SearchResponseImageMetadata$zodSchema)
.nullable().optional(),
metadata: z.lazy(() => Metadata$zodSchema).nullable().optional(),
pixels: z.number().int().optional(),
public_id: z.string().optional(),
quality_analysis: z.lazy(() => QualityAnalysis$zodSchema).nullable()
.optional(),
resource_type: SearchResponseResourceType$zodSchema.optional(),
secure_url: z.string().optional(),
status: SearchResponseStatus$zodSchema.optional(),
tags: z.array(z.string()).optional(),
type: SearchResponseType$zodSchema.optional(),
uploaded_at: z.string().datetime({ offset: true }).optional(),
uploaded_by: z.lazy(() => UploadedBy$zodSchema).nullable().optional(),
url: z.string().optional(),
version: z.number().int().optional(),
width: z.number().int().optional(),
}).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<Value, z.ZodTypeDef, unknown> = z
.object({
count: z.number().int().optional(),
value: z.string().optional(),
});
export type SearchResponseRange = {
from?: number | undefined;
to?: number | undefined;
count?: number | undefined;
};
export const SearchResponseRange$zodSchema: z.ZodType<
SearchResponseRange,
z.ZodTypeDef,
unknown
> = z.object({
count: z.number().int().optional(),
from: z.number().optional(),
to: z.number().optional(),
});
/**
* Aggregation results when the aggregate parameter is used in the request. Only included when aggregations are requested.
*/
export type Aggregations = {
values?: Array<Value> | undefined;
ranges?: Array<SearchResponseRange> | undefined;
};
export const Aggregations$zodSchema: z.ZodType<
Aggregations,
z.ZodTypeDef,
unknown
> = z.object({
ranges: z.array(z.lazy(() => SearchResponseRange$zodSchema)).optional(),
values: z.array(z.lazy(() => Value$zodSchema)).optional(),
}).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<Resource> | undefined;
next_cursor?: string | null | undefined;
aggregations?: Aggregations | undefined;
};
export const SearchResponse$zodSchema: z.ZodType<
SearchResponse,
z.ZodTypeDef,
unknown
> = z.object({
aggregations: z.lazy(() => Aggregations$zodSchema).optional(),
next_cursor: z.string().nullable().optional(),
resources: z.array(z.lazy(() => Resource$zodSchema)).optional(),
time: z.number().int().optional(),
total_count: z.number().int().optional(),
}).describe("The response object returned by search operations.");