@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>
77 lines (68 loc) • 2.06 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
import { Snapshot, Snapshot$inboundSchema } from "./snapshot.js";
export type GetSessionSnapshotRequest = {
/**
* The unique identifier of the snapshot to retrieve.
*/
snapshotId: string;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
};
export type GetSessionSnapshotResponseBody = {
/**
* This object contains information related to a Snapshot of a Vercel Sandbox session (v2 API).
*/
snapshot: Snapshot;
};
/** @internal */
export type GetSessionSnapshotRequest$Outbound = {
snapshotId: string;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetSessionSnapshotRequest$outboundSchema: z.ZodType<
GetSessionSnapshotRequest$Outbound,
z.ZodTypeDef,
GetSessionSnapshotRequest
> = z.object({
snapshotId: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getSessionSnapshotRequestToJSON(
getSessionSnapshotRequest: GetSessionSnapshotRequest,
): string {
return JSON.stringify(
GetSessionSnapshotRequest$outboundSchema.parse(getSessionSnapshotRequest),
);
}
/** @internal */
export const GetSessionSnapshotResponseBody$inboundSchema: z.ZodType<
GetSessionSnapshotResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
snapshot: Snapshot$inboundSchema,
});
export function getSessionSnapshotResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetSessionSnapshotResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetSessionSnapshotResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetSessionSnapshotResponseBody' from JSON`,
);
}