/* * 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 { Currency, Currency$inboundSchema } from "./currency.js"; import { PassThroughBody, PassThroughBody$inboundSchema, } from "./passthroughbody.js"; export type Stages = { /** * The unique identifier of the Pipeline Stage. */ id?: string | null | undefined; /** * The name of the Pipeline Stage. */ name?: string | null | undefined; /** * The value of the Pipeline Stage. */ value?: string | null | undefined; /** * The expected probability of winning an Opportunity in this Pipeline Stage. Valid values are [0-100]. */ winProbability?: number | null | undefined; /** * The order in which the Pipeline Stage is displayed in the UI. */ displayOrder?: number | null | undefined; /** * Whether the Pipeline Stage is archived or not. */ archived?: boolean | null | undefined; /** * The date and time when the Pipeline Stage was created. */ createdAt?: Date | null | undefined; /** * The date and time when the Pipeline Stage was last updated. */ updatedAt?: Date | null | undefined; }; export type Pipeline = { /** * The unique identifier of the Pipeline. */ id?: string | undefined; /** * The name of the Pipeline. */ name: string; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Whether the Pipeline is archived or not. */ archived?: boolean | undefined; /** * Whether the Pipeline is active or not. */ active?: boolean | undefined; /** * The order in which the Pipeline is displayed in the UI. */ displayOrder?: number | null | undefined; /** * Whether the Pipeline has win probability enabled or not. */ winProbabilityEnabled?: boolean | undefined; /** * The Pipeline Stages. */ stages?: Array | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | 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 Stages$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), value: z.nullable(types.string()).optional(), win_probability: z.nullable(types.number()).optional(), display_order: z.nullable(types.number()).optional(), archived: z.nullable(types.boolean()).optional(), created_at: z.nullable(types.date()).optional(), updated_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "win_probability": "winProbability", "display_order": "displayOrder", "created_at": "createdAt", "updated_at": "updatedAt", }); }) ); export function stagesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Stages$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Stages' from JSON`, ); } /** @internal */ export const Pipeline$inboundSchema: z.ZodType< Pipeline, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.string(), currency: z.nullable(Currency$inboundSchema).optional(), archived: types.optional(types.boolean()), active: types.optional(types.boolean()), display_order: z.nullable(types.number()).optional(), win_probability_enabled: types.optional(types.boolean()), stages: types.optional(z.array(z.lazy(() => Stages$inboundSchema))), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "display_order": "displayOrder", "win_probability_enabled": "winProbabilityEnabled", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function pipelineFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Pipeline$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Pipeline' from JSON`, ); }