/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The declared data type of the custom field. Only returned by connectors that can read the field's definition; omitted otherwise. */ export const CustomFieldFinderType = { Text: "text", Checkbox: "checkbox", Tel: "tel", Email: "email", Url: "url", Textarea: "textarea", Select: "select", FilteredSelect: "filtered-select", MultiSelect: "multi-select", Datetime: "datetime", Date: "date", Time: "time", Number: "number", Password: "password", } as const; /** * The declared data type of the custom field. Only returned by connectors that can read the field's definition; omitted otherwise. */ export type CustomFieldFinderType = OpenEnum; export type CustomFieldFinder = { /** * Custom Field ID */ id?: string | undefined; /** * Custom Field name to use as a label if provided */ name?: string | null | undefined; /** * More information about the custom field */ description?: string | null | undefined; /** * Custom Field value */ value?: any | undefined; /** * The declared data type of the custom field. Only returned by connectors that can read the field's definition; omitted otherwise. */ type?: CustomFieldFinderType | undefined; /** * JSONPath finder for retrieving this value when mapping a response payload from downstream */ finder?: string | undefined; }; /** @internal */ export const CustomFieldFinderType$inboundSchema: z.ZodType< CustomFieldFinderType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(CustomFieldFinderType) ); /** @internal */ export const CustomFieldFinder$inboundSchema: z.ZodType< CustomFieldFinder, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), value: types.optional(z.any()), type: types.optional(CustomFieldFinderType$inboundSchema), finder: types.optional(types.string()), }) ); export function customFieldFinderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomFieldFinder$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomFieldFinder' from JSON`, ); }