/* * 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 ContextsControllerGetContextRequest = { /** * Context ID */ id: string; /** * Context type */ type: string; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type ContextsControllerGetContextResponse = { headers: { [k: string]: Array }; result: components.GetContextResponseDto; }; /** @internal */ export type ContextsControllerGetContextRequest$Outbound = { id: string; type: string; "idempotency-key"?: string | undefined; }; /** @internal */ export const ContextsControllerGetContextRequest$outboundSchema: z.ZodType< ContextsControllerGetContextRequest$Outbound, z.ZodTypeDef, ContextsControllerGetContextRequest > = z.object({ id: z.string(), type: z.string(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function contextsControllerGetContextRequestToJSON( contextsControllerGetContextRequest: ContextsControllerGetContextRequest, ): string { return JSON.stringify( ContextsControllerGetContextRequest$outboundSchema.parse( contextsControllerGetContextRequest, ), ); } /** @internal */ export const ContextsControllerGetContextResponse$inboundSchema: z.ZodType< ContextsControllerGetContextResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.GetContextResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function contextsControllerGetContextResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContextsControllerGetContextResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContextsControllerGetContextResponse' from JSON`, ); }