/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Snapshot, Snapshot$inboundSchema, Snapshot$Outbound, Snapshot$outboundSchema, } from "./snapshot.js"; /** * Returns the requested snapshots. */ export type ListSnapshotsResponse = { /** * The token for retrieving the next page of snapshots. This is only returned where total_size is greater than page_size. */ nextPageToken?: string | undefined; /** * The returned snapshots, with pagination and filtering applied. */ snapshots?: Array | undefined; /** * The total number of snapshots matching the request criteria. All available snapshots may not be contained in a single response. If this number is greater than the page_size in the request, pagination will need to be applied to retrieve all snapshots. */ totalSize?: string | undefined; }; /** @internal */ export const ListSnapshotsResponse$inboundSchema: z.ZodType< ListSnapshotsResponse, z.ZodTypeDef, unknown > = z.object({ next_page_token: z.string().optional(), snapshots: z.array(Snapshot$inboundSchema).optional(), total_size: z.string().optional(), }).transform((v) => { return remap$(v, { "next_page_token": "nextPageToken", "total_size": "totalSize", }); }); /** @internal */ export type ListSnapshotsResponse$Outbound = { next_page_token?: string | undefined; snapshots?: Array | undefined; total_size?: string | undefined; }; /** @internal */ export const ListSnapshotsResponse$outboundSchema: z.ZodType< ListSnapshotsResponse$Outbound, z.ZodTypeDef, ListSnapshotsResponse > = z.object({ nextPageToken: z.string().optional(), snapshots: z.array(Snapshot$outboundSchema).optional(), totalSize: z.string().optional(), }).transform((v) => { return remap$(v, { nextPageToken: "next_page_token", totalSize: "total_size", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListSnapshotsResponse$ { /** @deprecated use `ListSnapshotsResponse$inboundSchema` instead. */ export const inboundSchema = ListSnapshotsResponse$inboundSchema; /** @deprecated use `ListSnapshotsResponse$outboundSchema` instead. */ export const outboundSchema = ListSnapshotsResponse$outboundSchema; /** @deprecated use `ListSnapshotsResponse$Outbound` instead. */ export type Outbound = ListSnapshotsResponse$Outbound; } export function listSnapshotsResponseToJSON( listSnapshotsResponse: ListSnapshotsResponse, ): string { return JSON.stringify( ListSnapshotsResponse$outboundSchema.parse(listSnapshotsResponse), ); } export function listSnapshotsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListSnapshotsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListSnapshotsResponse' from JSON`, ); }