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