/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export type CustomObjectFields = { name?: string | undefined; value?: string | undefined; }; export type CustomObject = { /** * The unique identifier of the custom object */ id?: string | undefined; /** * The unique identifier of the owner of the custom object */ ownerId?: string | undefined; /** * The name of the custom object */ name?: string | null | undefined; fields?: Array | undefined; /** * The unique identifier of the user who last updated the custom object */ updatedBy?: string | undefined; /** * The unique identifier of the user who created the custom object */ createdBy?: string | undefined; /** * The timestamp when the custom object was last updated */ updatedAt?: string | null | undefined; /** * The timestamp when the custom object 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; }; export type CustomObjectInput = { /** * The name of the custom object */ name?: string | null | undefined; fields?: Array | 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 CustomObjectFields$inboundSchema: z.ZodType< CustomObjectFields, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ name: types.optional(types.string()), value: types.optional(types.string()), }) ); /** @internal */ export type CustomObjectFields$Outbound = { name?: string | undefined; value?: string | undefined; }; /** @internal */ export const CustomObjectFields$outboundSchema: z.ZodType< CustomObjectFields$Outbound, z.ZodTypeDef, CustomObjectFields > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.string().optional(), value: z.string().optional(), }) ); export function customObjectFieldsToJSON( customObjectFields: CustomObjectFields, ): string { return JSON.stringify( CustomObjectFields$outboundSchema.parse(customObjectFields), ); } export function customObjectFieldsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomObjectFields$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomObjectFields' from JSON`, ); } /** @internal */ export const CustomObject$inboundSchema: z.ZodType< CustomObject, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), owner_id: types.optional(types.string()), name: z.nullable(types.string()).optional(), fields: types.optional( z.array(z.lazy(() => CustomObjectFields$inboundSchema)), ), updated_by: types.optional(types.string()), created_by: types.optional(types.string()), updated_at: z.nullable(types.string()).optional(), created_at: z.nullable(types.string()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "owner_id": "ownerId", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function customObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomObject' from JSON`, ); } /** @internal */ export type CustomObjectInput$Outbound = { name?: string | null | undefined; fields?: Array | undefined; pass_through?: Array | undefined; }; /** @internal */ export const CustomObjectInput$outboundSchema: z.ZodType< CustomObjectInput$Outbound, z.ZodTypeDef, CustomObjectInput > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.nullable(z.string()).optional(), fields: z.array(z.lazy(() => CustomObjectFields$outboundSchema)).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { passThrough: "pass_through", }); }) ); export function customObjectInputToJSON( customObjectInput: CustomObjectInput, ): string { return JSON.stringify( CustomObjectInput$outboundSchema.parse(customObjectInput), ); }