/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; export type DownloadWorkspaceFileRequest = { sessionId: string; filePath: string; sessionToken?: string | null | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** @internal */ export const DownloadWorkspaceFileRequest$inboundSchema: z.ZodType< DownloadWorkspaceFileRequest, z.ZodTypeDef, unknown > = z.object({ session_id: z.string(), file_path: z.string(), session_token: z.nullable(z.string()).optional(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "session_id": "sessionId", "file_path": "filePath", "session_token": "sessionToken", "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type DownloadWorkspaceFileRequest$Outbound = { session_id: string; file_path: string; session_token?: string | null | undefined; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const DownloadWorkspaceFileRequest$outboundSchema: z.ZodType< DownloadWorkspaceFileRequest$Outbound, z.ZodTypeDef, DownloadWorkspaceFileRequest > = z.object({ sessionId: z.string(), filePath: z.string(), sessionToken: z.nullable(z.string()).optional(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { sessionId: "session_id", filePath: "file_path", sessionToken: "session_token", xOnBehalfOf: "X-On-Behalf-Of", }); }); export function downloadWorkspaceFileRequestToJSON( downloadWorkspaceFileRequest: DownloadWorkspaceFileRequest, ): string { return JSON.stringify( DownloadWorkspaceFileRequest$outboundSchema.parse( downloadWorkspaceFileRequest, ), ); } export function downloadWorkspaceFileRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DownloadWorkspaceFileRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DownloadWorkspaceFileRequest' from JSON`, ); }