/* * 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"; export type CustomMapping = { /** * Target Field ID */ id?: string | undefined; /** * Target Field name to use as a label */ label?: string | undefined; /** * Target Field description */ description?: string | null | undefined; /** * Target Field Mapping value */ value?: string | undefined; /** * Target Field Key */ key?: string | undefined; /** * Target Field Mapping is required */ required?: boolean | undefined; /** * This mapping represents a finder for a custom field */ customField?: boolean | undefined; /** * Consumer ID */ consumerId?: string | null | undefined; /** * Target Field Mapping example value from downstream */ example?: string | null | undefined; }; /** @internal */ export const CustomMapping$inboundSchema: z.ZodType< CustomMapping, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), label: z.string().optional(), description: z.nullable(z.string()).optional(), value: z.string().optional(), key: z.string().optional(), required: z.boolean().optional(), custom_field: z.boolean().optional(), consumer_id: z.nullable(z.string()).optional(), example: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "custom_field": "customField", "consumer_id": "consumerId", }); }); /** @internal */ export type CustomMapping$Outbound = { id?: string | undefined; label?: string | undefined; description?: string | null | undefined; value?: string | undefined; key?: string | undefined; required?: boolean | undefined; custom_field?: boolean | undefined; consumer_id?: string | null | undefined; example?: string | null | undefined; }; /** @internal */ export const CustomMapping$outboundSchema: z.ZodType< CustomMapping$Outbound, z.ZodTypeDef, CustomMapping > = z.object({ id: z.string().optional(), label: z.string().optional(), description: z.nullable(z.string()).optional(), value: z.string().optional(), key: z.string().optional(), required: z.boolean().optional(), customField: z.boolean().optional(), consumerId: z.nullable(z.string()).optional(), example: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { customField: "custom_field", consumerId: "consumer_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CustomMapping$ { /** @deprecated use `CustomMapping$inboundSchema` instead. */ export const inboundSchema = CustomMapping$inboundSchema; /** @deprecated use `CustomMapping$outboundSchema` instead. */ export const outboundSchema = CustomMapping$outboundSchema; /** @deprecated use `CustomMapping$Outbound` instead. */ export type Outbound = CustomMapping$Outbound; } export function customMappingToJSON(customMapping: CustomMapping): string { return JSON.stringify(CustomMapping$outboundSchema.parse(customMapping)); } export function customMappingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomMapping$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomMapping' from JSON`, ); }