getvideoviewsop.ts•3.88 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { ApiError, ApiError$zodSchema } from "./apierror.js";
export type GetVideoViewsGlobals = { cloud_name?: string | undefined };
export const GetVideoViewsGlobals$zodSchema: z.ZodType<
GetVideoViewsGlobals,
z.ZodTypeDef,
unknown
> = z.object({
cloud_name: z.string().describe("The cloud name of your product environment.")
.optional(),
});
/**
* Specifies the expression field by which to sort the results. Prepend values with a '-' to reverse the order.
*/
export const SortBy$zodSchema = z.enum([
"view_ended_at",
"video_duration",
"view_watch_time",
"-view_ended_at",
"-video_duration",
"-view_watch_time",
]).describe(
"Specifies the expression field by which to sort the results. Prepend values with a '-' to reverse the order.",
);
export type SortBy = z.infer<typeof SortBy$zodSchema>;
export type GetVideoViewsRequest = {
expression?: string | undefined;
max_results?: number | undefined;
sort_by?: SortBy | undefined;
next_cursor?: string | undefined;
};
export const GetVideoViewsRequest$zodSchema: z.ZodType<
GetVideoViewsRequest,
z.ZodTypeDef,
unknown
> = z.object({
expression: z.string().describe(
"A set of conditions used to limit the results to rows that match those conditions. For example: `?expression=video_public_id=skate`",
).optional(),
max_results: z.number().int().default(10).describe(
"The maximum number of results to return. Default is 10.",
),
next_cursor: z.string().describe(
"The cursor for pagination. Use the next_cursor value from a previous response to get the next page of results.",
).optional(),
sort_by: SortBy$zodSchema.default("-view_ended_at"),
});
export type Data = {
video_public_id?: string | undefined;
video_duration?: number | null | undefined;
video_transformation?: string | null | undefined;
video_extension?: string | null | undefined;
viewer_application_name?: string | null | undefined;
viewer_location_country_code?: string | null | undefined;
viewer_os_identifier?: string | null | undefined;
view_watch_time?: number | null | undefined;
view_ended_at?: string | undefined;
};
export const Data$zodSchema: z.ZodType<Data, z.ZodTypeDef, unknown> = z.object({
video_duration: z.number().nullable().optional(),
video_extension: z.string().nullable().optional(),
video_public_id: z.string().optional(),
video_transformation: z.string().nullable().optional(),
view_ended_at: z.string().datetime({ offset: true }).optional(),
view_watch_time: z.number().nullable().optional(),
viewer_application_name: z.string().nullable().optional(),
viewer_location_country_code: z.string().nullable().optional(),
viewer_os_identifier: z.string().nullable().optional(),
});
/**
* List of video views retrieved
*/
export type GetVideoViewsResponseBody = {
request_id?: string | undefined;
next_cursor?: string | undefined;
data?: Array<Data> | undefined;
};
export const GetVideoViewsResponseBody$zodSchema: z.ZodType<
GetVideoViewsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
data: z.array(z.lazy(() => Data$zodSchema)).optional(),
next_cursor: z.string().optional(),
request_id: z.string().optional(),
}).describe("List of video views retrieved");
export type GetVideoViewsResponse = {
ContentType: string;
StatusCode: number;
RawResponse: Response;
object?: GetVideoViewsResponseBody | undefined;
api_error?: ApiError | undefined;
};
export const GetVideoViewsResponse$zodSchema: z.ZodType<
GetVideoViewsResponse,
z.ZodTypeDef,
unknown
> = z.object({
ContentType: z.string(),
RawResponse: z.instanceof(Response),
StatusCode: z.number().int(),
api_error: ApiError$zodSchema.optional(),
object: z.lazy(() => GetVideoViewsResponseBody$zodSchema).optional(),
});