/* * 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 CrmUsersUpdateGlobals = { /** * 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 CrmUsersUpdateRequest = { /** * ID of the record you are acting upon. */ id: string; /** * 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; /** * Include raw response. Mostly used for debugging purposes */ raw?: boolean | undefined; user: components.UserInput; }; export type CrmUsersUpdateResponse = { httpMeta: components.HTTPMetadata; /** * User updated */ updateUserResponse?: components.UpdateUserResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const CrmUsersUpdateGlobals$inboundSchema: z.ZodType< CrmUsersUpdateGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type CrmUsersUpdateGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const CrmUsersUpdateGlobals$outboundSchema: z.ZodType< CrmUsersUpdateGlobals$Outbound, z.ZodTypeDef, CrmUsersUpdateGlobals > = 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 CrmUsersUpdateGlobals$ { /** @deprecated use `CrmUsersUpdateGlobals$inboundSchema` instead. */ export const inboundSchema = CrmUsersUpdateGlobals$inboundSchema; /** @deprecated use `CrmUsersUpdateGlobals$outboundSchema` instead. */ export const outboundSchema = CrmUsersUpdateGlobals$outboundSchema; /** @deprecated use `CrmUsersUpdateGlobals$Outbound` instead. */ export type Outbound = CrmUsersUpdateGlobals$Outbound; } export function crmUsersUpdateGlobalsToJSON( crmUsersUpdateGlobals: CrmUsersUpdateGlobals, ): string { return JSON.stringify( CrmUsersUpdateGlobals$outboundSchema.parse(crmUsersUpdateGlobals), ); } export function crmUsersUpdateGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CrmUsersUpdateGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CrmUsersUpdateGlobals' from JSON`, ); } /** @internal */ export const CrmUsersUpdateRequest$inboundSchema: z.ZodType< CrmUsersUpdateRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), User: components.UserInput$inboundSchema, }).transform((v) => { return remap$(v, { "User": "user", }); }); /** @internal */ export type CrmUsersUpdateRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; User: components.UserInput$Outbound; }; /** @internal */ export const CrmUsersUpdateRequest$outboundSchema: z.ZodType< CrmUsersUpdateRequest$Outbound, z.ZodTypeDef, CrmUsersUpdateRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), user: components.UserInput$outboundSchema, }).transform((v) => { return remap$(v, { user: "User", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CrmUsersUpdateRequest$ { /** @deprecated use `CrmUsersUpdateRequest$inboundSchema` instead. */ export const inboundSchema = CrmUsersUpdateRequest$inboundSchema; /** @deprecated use `CrmUsersUpdateRequest$outboundSchema` instead. */ export const outboundSchema = CrmUsersUpdateRequest$outboundSchema; /** @deprecated use `CrmUsersUpdateRequest$Outbound` instead. */ export type Outbound = CrmUsersUpdateRequest$Outbound; } export function crmUsersUpdateRequestToJSON( crmUsersUpdateRequest: CrmUsersUpdateRequest, ): string { return JSON.stringify( CrmUsersUpdateRequest$outboundSchema.parse(crmUsersUpdateRequest), ); } export function crmUsersUpdateRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CrmUsersUpdateRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CrmUsersUpdateRequest' from JSON`, ); } /** @internal */ export const CrmUsersUpdateResponse$inboundSchema: z.ZodType< CrmUsersUpdateResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdateUserResponse: components.UpdateUserResponse$inboundSchema.optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdateUserResponse": "updateUserResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type CrmUsersUpdateResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; UpdateUserResponse?: components.UpdateUserResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const CrmUsersUpdateResponse$outboundSchema: z.ZodType< CrmUsersUpdateResponse$Outbound, z.ZodTypeDef, CrmUsersUpdateResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, updateUserResponse: components.UpdateUserResponse$outboundSchema.optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", updateUserResponse: "UpdateUserResponse", 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 CrmUsersUpdateResponse$ { /** @deprecated use `CrmUsersUpdateResponse$inboundSchema` instead. */ export const inboundSchema = CrmUsersUpdateResponse$inboundSchema; /** @deprecated use `CrmUsersUpdateResponse$outboundSchema` instead. */ export const outboundSchema = CrmUsersUpdateResponse$outboundSchema; /** @deprecated use `CrmUsersUpdateResponse$Outbound` instead. */ export type Outbound = CrmUsersUpdateResponse$Outbound; } export function crmUsersUpdateResponseToJSON( crmUsersUpdateResponse: CrmUsersUpdateResponse, ): string { return JSON.stringify( CrmUsersUpdateResponse$outboundSchema.parse(crmUsersUpdateResponse), ); } export function crmUsersUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CrmUsersUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CrmUsersUpdateResponse' from JSON`, ); }