/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CrmNotesAddGlobals = { /** * 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 CrmNotesAddRequest = { /** * Include raw response. Mostly used for debugging purposes */ raw?: boolean | undefined; /** * Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. */ serviceId?: string | undefined; note: components.NoteInput; }; export type CrmNotesAddResponse = { httpMeta: components.HTTPMetadata; /** * Note created */ createNoteResponse?: components.CreateNoteResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const CrmNotesAddGlobals$inboundSchema: z.ZodType< CrmNotesAddGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type CrmNotesAddGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const CrmNotesAddGlobals$outboundSchema: z.ZodType< CrmNotesAddGlobals$Outbound, z.ZodTypeDef, CrmNotesAddGlobals > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CrmNotesAddGlobals$ { /** @deprecated use `CrmNotesAddGlobals$inboundSchema` instead. */ export const inboundSchema = CrmNotesAddGlobals$inboundSchema; /** @deprecated use `CrmNotesAddGlobals$outboundSchema` instead. */ export const outboundSchema = CrmNotesAddGlobals$outboundSchema; /** @deprecated use `CrmNotesAddGlobals$Outbound` instead. */ export type Outbound = CrmNotesAddGlobals$Outbound; } export function crmNotesAddGlobalsToJSON( crmNotesAddGlobals: CrmNotesAddGlobals, ): string { return JSON.stringify( CrmNotesAddGlobals$outboundSchema.parse(crmNotesAddGlobals), ); } export function crmNotesAddGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CrmNotesAddGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CrmNotesAddGlobals' from JSON`, ); } /** @internal */ export const CrmNotesAddRequest$inboundSchema: z.ZodType< CrmNotesAddRequest, z.ZodTypeDef, unknown > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), Note: components.NoteInput$inboundSchema, }).transform((v) => { return remap$(v, { "Note": "note", }); }); /** @internal */ export type CrmNotesAddRequest$Outbound = { raw: boolean; serviceId?: string | undefined; Note: components.NoteInput$Outbound; }; /** @internal */ export const CrmNotesAddRequest$outboundSchema: z.ZodType< CrmNotesAddRequest$Outbound, z.ZodTypeDef, CrmNotesAddRequest > = z.object({ raw: z.boolean().default(false), serviceId: z.string().optional(), note: components.NoteInput$outboundSchema, }).transform((v) => { return remap$(v, { note: "Note", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CrmNotesAddRequest$ { /** @deprecated use `CrmNotesAddRequest$inboundSchema` instead. */ export const inboundSchema = CrmNotesAddRequest$inboundSchema; /** @deprecated use `CrmNotesAddRequest$outboundSchema` instead. */ export const outboundSchema = CrmNotesAddRequest$outboundSchema; /** @deprecated use `CrmNotesAddRequest$Outbound` instead. */ export type Outbound = CrmNotesAddRequest$Outbound; } export function crmNotesAddRequestToJSON( crmNotesAddRequest: CrmNotesAddRequest, ): string { return JSON.stringify( CrmNotesAddRequest$outboundSchema.parse(crmNotesAddRequest), ); } export function crmNotesAddRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CrmNotesAddRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CrmNotesAddRequest' from JSON`, ); } /** @internal */ export const CrmNotesAddResponse$inboundSchema: z.ZodType< CrmNotesAddResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateNoteResponse: components.CreateNoteResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateNoteResponse": "createNoteResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type CrmNotesAddResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CreateNoteResponse?: components.CreateNoteResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const CrmNotesAddResponse$outboundSchema: z.ZodType< CrmNotesAddResponse$Outbound, z.ZodTypeDef, CrmNotesAddResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, createNoteResponse: components.CreateNoteResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", createNoteResponse: "CreateNoteResponse", unexpectedErrorResponse: "UnexpectedErrorResponse", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CrmNotesAddResponse$ { /** @deprecated use `CrmNotesAddResponse$inboundSchema` instead. */ export const inboundSchema = CrmNotesAddResponse$inboundSchema; /** @deprecated use `CrmNotesAddResponse$outboundSchema` instead. */ export const outboundSchema = CrmNotesAddResponse$outboundSchema; /** @deprecated use `CrmNotesAddResponse$Outbound` instead. */ export type Outbound = CrmNotesAddResponse$Outbound; } export function crmNotesAddResponseToJSON( crmNotesAddResponse: CrmNotesAddResponse, ): string { return JSON.stringify( CrmNotesAddResponse$outboundSchema.parse(crmNotesAddResponse), ); } export function crmNotesAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CrmNotesAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CrmNotesAddResponse' from JSON`, ); }