/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type VaultCustomFieldsAllGlobals = { /** * ID of the consumer which you want to get or push data from */ consumerId?: string | undefined; /** * The ID of your Unify application */ appId?: string | undefined; }; export type VaultCustomFieldsAllRequest = { /** * ID of the consumer which you want to get or push data from */ consumerId?: string | undefined; /** * The ID of your Unify application */ appId?: string | undefined; /** * Unified API */ unifiedApi: string; /** * Service ID of the resource to return */ serviceId: string; /** * Name of the resource (plural) */ resource: string; /** * This is the id of the resource you want to fetch when listing custom fields. For example, if you want to fetch custom fields for a specific contact, you would use the contact id. */ resourceId?: string | undefined; }; export type VaultCustomFieldsAllResponse = { httpMeta: components.HTTPMetadata; /** * Custom mapping */ getCustomFieldsResponse?: components.GetCustomFieldsResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export type VaultCustomFieldsAllRequest$Outbound = { consumerId?: string | undefined; appId?: string | undefined; unified_api: string; service_id: string; resource: string; resource_id?: string | undefined; }; /** @internal */ export const VaultCustomFieldsAllRequest$outboundSchema: z.ZodType< VaultCustomFieldsAllRequest$Outbound, z.ZodTypeDef, VaultCustomFieldsAllRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ consumerId: z.string().optional(), appId: z.string().optional(), unifiedApi: z.string(), serviceId: z.string(), resource: z.string(), resourceId: z.string().optional(), }).transform((v) => { return remap$(v, { unifiedApi: "unified_api", serviceId: "service_id", resourceId: "resource_id", }); }) ); export function vaultCustomFieldsAllRequestToJSON( vaultCustomFieldsAllRequest: VaultCustomFieldsAllRequest, ): string { return JSON.stringify( VaultCustomFieldsAllRequest$outboundSchema.parse( vaultCustomFieldsAllRequest, ), ); } /** @internal */ export const VaultCustomFieldsAllResponse$inboundSchema: z.ZodType< VaultCustomFieldsAllResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, GetCustomFieldsResponse: types.optional( components.GetCustomFieldsResponse$inboundSchema, ), UnexpectedErrorResponse: types.optional( components.UnexpectedErrorResponse$inboundSchema, ), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "GetCustomFieldsResponse": "getCustomFieldsResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }) ); export function vaultCustomFieldsAllResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VaultCustomFieldsAllResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VaultCustomFieldsAllResponse' from JSON`, ); }