/* * 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"; import { CustomMappings, CustomMappings$inboundSchema, CustomMappings$Outbound, CustomMappings$outboundSchema, } from "./custommappings.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export type Note = { /** * The unique identifier of the note */ id?: string | undefined; /** * The title of the note */ title?: string | null | undefined; /** * The content of the note. */ content?: string | null | undefined; /** * The user that owns the note. */ ownerId?: string | null | undefined; /** * The contact that is related to the note. */ contactId?: string | null | undefined; /** * The company that is related to the note. */ companyId?: string | null | undefined; /** * The opportunity that is related to the note. */ opportunityId?: string | null | undefined; /** * The lead that is related to the note. */ leadId?: string | null | undefined; /** * Whether the Note is active or not. */ active?: boolean | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: CustomMappings | null | undefined; /** * The user that last updated the note. */ updatedBy?: string | null | undefined; /** * The user that created the note. */ createdBy?: string | null | undefined; /** * The timestamp when the note was last updated */ updatedAt?: string | null | undefined; /** * The timestamp when the note was created */ createdAt?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const Note$inboundSchema: z.ZodType = z .object({ id: z.string().optional(), title: z.nullable(z.string()).optional(), content: z.nullable(z.string()).optional(), owner_id: z.nullable(z.string()).optional(), contact_id: z.nullable(z.string()).optional(), company_id: z.nullable(z.string()).optional(), opportunity_id: z.nullable(z.string()).optional(), lead_id: z.nullable(z.string()).optional(), active: z.nullable(z.boolean()).optional(), custom_mappings: z.nullable(CustomMappings$inboundSchema).optional(), updated_by: z.nullable(z.string()).optional(), created_by: z.nullable(z.string()).optional(), updated_at: z.nullable(z.string()).optional(), created_at: z.nullable(z.string()).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "owner_id": "ownerId", "contact_id": "contactId", "company_id": "companyId", "opportunity_id": "opportunityId", "lead_id": "leadId", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }); /** @internal */ export type Note$Outbound = { id?: string | undefined; title?: string | null | undefined; content?: string | null | undefined; owner_id?: string | null | undefined; contact_id?: string | null | undefined; company_id?: string | null | undefined; opportunity_id?: string | null | undefined; lead_id?: string | null | undefined; active?: boolean | null | undefined; custom_mappings?: CustomMappings$Outbound | null | undefined; updated_by?: string | null | undefined; created_by?: string | null | undefined; updated_at?: string | null | undefined; created_at?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const Note$outboundSchema: z.ZodType = z.object({ id: z.string().optional(), title: z.nullable(z.string()).optional(), content: z.nullable(z.string()).optional(), ownerId: z.nullable(z.string()).optional(), contactId: z.nullable(z.string()).optional(), companyId: z.nullable(z.string()).optional(), opportunityId: z.nullable(z.string()).optional(), leadId: z.nullable(z.string()).optional(), active: z.nullable(z.boolean()).optional(), customMappings: z.nullable(CustomMappings$outboundSchema).optional(), updatedBy: z.nullable(z.string()).optional(), createdBy: z.nullable(z.string()).optional(), updatedAt: z.nullable(z.string()).optional(), createdAt: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { ownerId: "owner_id", contactId: "contact_id", companyId: "company_id", opportunityId: "opportunity_id", leadId: "lead_id", customMappings: "custom_mappings", updatedBy: "updated_by", createdBy: "created_by", updatedAt: "updated_at", createdAt: "created_at", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Note$ { /** @deprecated use `Note$inboundSchema` instead. */ export const inboundSchema = Note$inboundSchema; /** @deprecated use `Note$outboundSchema` instead. */ export const outboundSchema = Note$outboundSchema; /** @deprecated use `Note$Outbound` instead. */ export type Outbound = Note$Outbound; } export function noteToJSON(note: Note): string { return JSON.stringify(Note$outboundSchema.parse(note)); } export function noteFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Note$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Note' from JSON`, ); }