@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
60 lines • 2.74 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
import { Session$inboundSchema } from "./session.js";
/**
* Sort direction for results by creation time.
*/
export const ListSessionsQueryParamSortOrder = {
Asc: "asc",
Desc: "desc",
};
/** @internal */
export const ListSessionsQueryParamSortOrder$outboundSchema = z.nativeEnum(ListSessionsQueryParamSortOrder);
/** @internal */
export const ListSessionsRequest$outboundSchema = z.object({
project: z.string().optional(),
name: z.string().optional(),
limit: z.number().default(20),
cursor: z.string().optional(),
sortOrder: ListSessionsQueryParamSortOrder$outboundSchema.default("desc"),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function listSessionsRequestToJSON(listSessionsRequest) {
return JSON.stringify(ListSessionsRequest$outboundSchema.parse(listSessionsRequest));
}
/** @internal */
export const ListSessionsResponseBodyPagination$inboundSchema = z.object({
count: types.number(),
next: types.nullable(types.string()),
});
export function listSessionsResponseBodyPaginationFromJSON(jsonString) {
return safeParse(jsonString, (x) => ListSessionsResponseBodyPagination$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListSessionsResponseBodyPagination' from JSON`);
}
/** @internal */
export const ListSessionsResponseBody2$inboundSchema = z.object({
sessions: z.array(Session$inboundSchema),
pagination: z.lazy(() => ListSessionsResponseBodyPagination$inboundSchema),
});
export function listSessionsResponseBody2FromJSON(jsonString) {
return safeParse(jsonString, (x) => ListSessionsResponseBody2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListSessionsResponseBody2' from JSON`);
}
/** @internal */
export const ListSessionsResponseBody1$inboundSchema = z.object({});
export function listSessionsResponseBody1FromJSON(jsonString) {
return safeParse(jsonString, (x) => ListSessionsResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListSessionsResponseBody1' from JSON`);
}
/** @internal */
export const ListSessionsResponseBody$inboundSchema = smartUnion([
z.lazy(() => ListSessionsResponseBody2$inboundSchema),
z.lazy(() => ListSessionsResponseBody1$inboundSchema),
]);
export function listSessionsResponseBodyFromJSON(jsonString) {
return safeParse(jsonString, (x) => ListSessionsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListSessionsResponseBody' from JSON`);
}
//# sourceMappingURL=listsessionsop.js.map