/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateSessionRequest = { /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; createSessionRequest: components.CreateSessionRequest; }; /** @internal */ export const CreateSessionRequest$inboundSchema: z.ZodType< CreateSessionRequest, z.ZodTypeDef, unknown > = z.object({ "X-On-Behalf-Of": z.string().optional(), CreateSessionRequest: components.CreateSessionRequest$inboundSchema, }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "CreateSessionRequest": "createSessionRequest", }); }); /** @internal */ export type CreateSessionRequest$Outbound = { "X-On-Behalf-Of"?: string | undefined; CreateSessionRequest: components.CreateSessionRequest$Outbound; }; /** @internal */ export const CreateSessionRequest$outboundSchema: z.ZodType< CreateSessionRequest$Outbound, z.ZodTypeDef, CreateSessionRequest > = z.object({ xOnBehalfOf: z.string().optional(), createSessionRequest: components.CreateSessionRequest$outboundSchema, }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", createSessionRequest: "CreateSessionRequest", }); }); export function createSessionRequestToJSON( createSessionRequest: CreateSessionRequest, ): string { return JSON.stringify( CreateSessionRequest$outboundSchema.parse(createSessionRequest), ); } export function createSessionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateSessionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSessionRequest' from JSON`, ); }