searchparameters.ts•2.52 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
export const SearchParametersType$zodSchema = z.enum([
"bytes",
"image_pixels",
"video_pixels",
"duration",
]);
export type SearchParametersType = z.infer<
typeof SearchParametersType$zodSchema
>;
export type SearchParametersRange = {
from?: number | undefined;
to?: number | undefined;
};
export const SearchParametersRange$zodSchema: z.ZodType<
SearchParametersRange,
z.ZodTypeDef,
unknown
> = z.object({
from: z.number().optional(),
to: z.number().optional(),
});
export type Aggregate = {
type: SearchParametersType;
ranges: Array<SearchParametersRange>;
};
export const Aggregate$zodSchema: z.ZodType<Aggregate, z.ZodTypeDef, unknown> =
z.object({
ranges: z.array(z.lazy(() => SearchParametersRange$zodSchema)),
type: SearchParametersType$zodSchema,
});
export const AggregateEnum$zodSchema = z.enum([
"format",
"resource_type",
"type",
]);
export type AggregateEnum = z.infer<typeof AggregateEnum$zodSchema>;
export type AggregateUnion = Array<AggregateEnum> | Array<Aggregate>;
export const AggregateUnion$zodSchema: z.ZodType<
AggregateUnion,
z.ZodTypeDef,
unknown
> = z.union([
z.array(AggregateEnum$zodSchema),
z.array(z.lazy(() => Aggregate$zodSchema)),
]);
export const WithField$zodSchema = z.enum([
"context",
"tags",
"image_metadata",
"image_analysis",
"metadata",
"quality_analysis",
"accessibility_analysis",
]);
export type WithField = z.infer<typeof WithField$zodSchema>;
/**
* Common parameters for resource search operations.
*/
export type SearchParameters = {
expression?: string | undefined;
sort_by?: Array<string> | undefined;
max_results?: number | undefined;
next_cursor?: string | undefined;
aggregate?: Array<AggregateEnum> | Array<Aggregate> | undefined;
with_field?: Array<WithField> | undefined;
fields?: string | undefined;
};
export const SearchParameters$zodSchema: z.ZodType<
SearchParameters,
z.ZodTypeDef,
unknown
> = z.object({
aggregate: z.union([
z.array(AggregateEnum$zodSchema),
z.array(z.lazy(() => Aggregate$zodSchema)),
]).optional(),
expression: z.string().optional(),
fields: z.string().optional(),
max_results: z.number().int().optional(),
next_cursor: z.string().optional(),
sort_by: z.array(z.string()).optional(),
with_field: z.array(WithField$zodSchema).optional(),
}).describe("Common parameters for resource search operations.");