/* * 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 { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export type PipelineStages = { /** * 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; }; export type PipelineInput = { /** * 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 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 PipelineStages$inboundSchema: z.ZodType< PipelineStages, z.ZodTypeDef, unknown > = z.object({ name: z.nullable(z.string()).optional(), value: z.nullable(z.string()).optional(), win_probability: z.nullable(z.number().int()).optional(), display_order: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { "win_probability": "winProbability", "display_order": "displayOrder", }); }); /** @internal */ export type PipelineStages$Outbound = { name?: string | null | undefined; value?: string | null | undefined; win_probability?: number | null | undefined; display_order?: number | null | undefined; }; /** @internal */ export const PipelineStages$outboundSchema: z.ZodType< PipelineStages$Outbound, z.ZodTypeDef, PipelineStages > = z.object({ name: z.nullable(z.string()).optional(), value: z.nullable(z.string()).optional(), winProbability: z.nullable(z.number().int()).optional(), displayOrder: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { winProbability: "win_probability", displayOrder: "display_order", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PipelineStages$ { /** @deprecated use `PipelineStages$inboundSchema` instead. */ export const inboundSchema = PipelineStages$inboundSchema; /** @deprecated use `PipelineStages$outboundSchema` instead. */ export const outboundSchema = PipelineStages$outboundSchema; /** @deprecated use `PipelineStages$Outbound` instead. */ export type Outbound = PipelineStages$Outbound; } export function pipelineStagesToJSON(pipelineStages: PipelineStages): string { return JSON.stringify(PipelineStages$outboundSchema.parse(pipelineStages)); } export function pipelineStagesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PipelineStages$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PipelineStages' from JSON`, ); } /** @internal */ export const PipelineInput$inboundSchema: z.ZodType< PipelineInput, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string(), currency: z.nullable(Currency$inboundSchema).optional(), archived: z.boolean().optional(), active: z.boolean().optional(), display_order: z.nullable(z.number().int()).optional(), win_probability_enabled: z.boolean().optional(), stages: z.array(z.lazy(() => PipelineStages$inboundSchema)).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "display_order": "displayOrder", "win_probability_enabled": "winProbabilityEnabled", "pass_through": "passThrough", }); }); /** @internal */ export type PipelineInput$Outbound = { id?: string | undefined; name: string; currency?: string | null | undefined; archived?: boolean | undefined; active?: boolean | undefined; display_order?: number | null | undefined; win_probability_enabled?: boolean | undefined; stages?: Array | undefined; pass_through?: Array | undefined; }; /** @internal */ export const PipelineInput$outboundSchema: z.ZodType< PipelineInput$Outbound, z.ZodTypeDef, PipelineInput > = z.object({ id: z.string().optional(), name: z.string(), currency: z.nullable(Currency$outboundSchema).optional(), archived: z.boolean().optional(), active: z.boolean().optional(), displayOrder: z.nullable(z.number().int()).optional(), winProbabilityEnabled: z.boolean().optional(), stages: z.array(z.lazy(() => PipelineStages$outboundSchema)).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayOrder: "display_order", winProbabilityEnabled: "win_probability_enabled", 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 PipelineInput$ { /** @deprecated use `PipelineInput$inboundSchema` instead. */ export const inboundSchema = PipelineInput$inboundSchema; /** @deprecated use `PipelineInput$outboundSchema` instead. */ export const outboundSchema = PipelineInput$outboundSchema; /** @deprecated use `PipelineInput$Outbound` instead. */ export type Outbound = PipelineInput$Outbound; } export function pipelineInputToJSON(pipelineInput: PipelineInput): string { return JSON.stringify(PipelineInput$outboundSchema.parse(pipelineInput)); } export function pipelineInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PipelineInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PipelineInput' from JSON`, ); }