/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; /** * The type of asset being evaluated in cost calculations */ export enum RetrieveQuoteRequestCreateAssetType { FixedIncome = "FIXED_INCOME", } /** * The type of asset being evaluated in cost calculations */ export type RetrieveQuoteRequestCreateAssetTypeOpen = OpenEnum< typeof RetrieveQuoteRequestCreateAssetType >; /** * Capacity used in determining bid and ask prices. Defaults to "AGENCY" if no value specified. */ export enum RetrieveQuoteRequestCreateBrokerCapacity { BrokerCapacityUnspecified = "BROKER_CAPACITY_UNSPECIFIED", Agency = "AGENCY", Principal = "PRINCIPAL", } /** * Capacity used in determining bid and ask prices. Defaults to "AGENCY" if no value specified. */ export type RetrieveQuoteRequestCreateBrokerCapacityOpen = OpenEnum< typeof RetrieveQuoteRequestCreateBrokerCapacity >; /** * The identifier type of the asset being sought */ export enum RetrieveQuoteRequestCreateIdentifierType { AssetId = "ASSET_ID", Cusip = "CUSIP", Isin = "ISIN", } /** * The identifier type of the asset being sought */ export type RetrieveQuoteRequestCreateIdentifierTypeOpen = OpenEnum< typeof RetrieveQuoteRequestCreateIdentifierType >; /** * Request object for retrieving fixed income quotes */ export type RetrieveQuoteRequestCreate = { /** * The type of asset being evaluated in cost calculations */ assetType: RetrieveQuoteRequestCreateAssetTypeOpen; /** * Capacity used in determining bid and ask prices. Defaults to "AGENCY" if no value specified. */ brokerCapacity?: RetrieveQuoteRequestCreateBrokerCapacityOpen | undefined; /** * Identifier of the asset (of the type specified in `identifier_type`). */ identifier: string; /** * The identifier type of the asset being sought */ identifierType: RetrieveQuoteRequestCreateIdentifierTypeOpen; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ minimumQuantity?: DecimalCreate | undefined; /** * The parent resource where this order will be created. Format: accounts/{account_id} */ parent: string; }; /** @internal */ export const RetrieveQuoteRequestCreateAssetType$inboundSchema: z.ZodType< RetrieveQuoteRequestCreateAssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(RetrieveQuoteRequestCreateAssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const RetrieveQuoteRequestCreateAssetType$outboundSchema: z.ZodType< RetrieveQuoteRequestCreateAssetTypeOpen, z.ZodTypeDef, RetrieveQuoteRequestCreateAssetTypeOpen > = z.union([ z.nativeEnum(RetrieveQuoteRequestCreateAssetType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RetrieveQuoteRequestCreateAssetType$ { /** @deprecated use `RetrieveQuoteRequestCreateAssetType$inboundSchema` instead. */ export const inboundSchema = RetrieveQuoteRequestCreateAssetType$inboundSchema; /** @deprecated use `RetrieveQuoteRequestCreateAssetType$outboundSchema` instead. */ export const outboundSchema = RetrieveQuoteRequestCreateAssetType$outboundSchema; } /** @internal */ export const RetrieveQuoteRequestCreateBrokerCapacity$inboundSchema: z.ZodType< RetrieveQuoteRequestCreateBrokerCapacityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(RetrieveQuoteRequestCreateBrokerCapacity), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const RetrieveQuoteRequestCreateBrokerCapacity$outboundSchema: z.ZodType< RetrieveQuoteRequestCreateBrokerCapacityOpen, z.ZodTypeDef, RetrieveQuoteRequestCreateBrokerCapacityOpen > = z.union([ z.nativeEnum(RetrieveQuoteRequestCreateBrokerCapacity), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RetrieveQuoteRequestCreateBrokerCapacity$ { /** @deprecated use `RetrieveQuoteRequestCreateBrokerCapacity$inboundSchema` instead. */ export const inboundSchema = RetrieveQuoteRequestCreateBrokerCapacity$inboundSchema; /** @deprecated use `RetrieveQuoteRequestCreateBrokerCapacity$outboundSchema` instead. */ export const outboundSchema = RetrieveQuoteRequestCreateBrokerCapacity$outboundSchema; } /** @internal */ export const RetrieveQuoteRequestCreateIdentifierType$inboundSchema: z.ZodType< RetrieveQuoteRequestCreateIdentifierTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(RetrieveQuoteRequestCreateIdentifierType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const RetrieveQuoteRequestCreateIdentifierType$outboundSchema: z.ZodType< RetrieveQuoteRequestCreateIdentifierTypeOpen, z.ZodTypeDef, RetrieveQuoteRequestCreateIdentifierTypeOpen > = z.union([ z.nativeEnum(RetrieveQuoteRequestCreateIdentifierType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RetrieveQuoteRequestCreateIdentifierType$ { /** @deprecated use `RetrieveQuoteRequestCreateIdentifierType$inboundSchema` instead. */ export const inboundSchema = RetrieveQuoteRequestCreateIdentifierType$inboundSchema; /** @deprecated use `RetrieveQuoteRequestCreateIdentifierType$outboundSchema` instead. */ export const outboundSchema = RetrieveQuoteRequestCreateIdentifierType$outboundSchema; } /** @internal */ export const RetrieveQuoteRequestCreate$inboundSchema: z.ZodType< RetrieveQuoteRequestCreate, z.ZodTypeDef, unknown > = z.object({ asset_type: RetrieveQuoteRequestCreateAssetType$inboundSchema, broker_capacity: RetrieveQuoteRequestCreateBrokerCapacity$inboundSchema .optional(), identifier: z.string(), identifier_type: RetrieveQuoteRequestCreateIdentifierType$inboundSchema, minimum_quantity: DecimalCreate$inboundSchema.optional(), parent: z.string(), }).transform((v) => { return remap$(v, { "asset_type": "assetType", "broker_capacity": "brokerCapacity", "identifier_type": "identifierType", "minimum_quantity": "minimumQuantity", }); }); /** @internal */ export type RetrieveQuoteRequestCreate$Outbound = { asset_type: string; broker_capacity?: string | undefined; identifier: string; identifier_type: string; minimum_quantity?: DecimalCreate$Outbound | undefined; parent: string; }; /** @internal */ export const RetrieveQuoteRequestCreate$outboundSchema: z.ZodType< RetrieveQuoteRequestCreate$Outbound, z.ZodTypeDef, RetrieveQuoteRequestCreate > = z.object({ assetType: RetrieveQuoteRequestCreateAssetType$outboundSchema, brokerCapacity: RetrieveQuoteRequestCreateBrokerCapacity$outboundSchema .optional(), identifier: z.string(), identifierType: RetrieveQuoteRequestCreateIdentifierType$outboundSchema, minimumQuantity: DecimalCreate$outboundSchema.optional(), parent: z.string(), }).transform((v) => { return remap$(v, { assetType: "asset_type", brokerCapacity: "broker_capacity", identifierType: "identifier_type", minimumQuantity: "minimum_quantity", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RetrieveQuoteRequestCreate$ { /** @deprecated use `RetrieveQuoteRequestCreate$inboundSchema` instead. */ export const inboundSchema = RetrieveQuoteRequestCreate$inboundSchema; /** @deprecated use `RetrieveQuoteRequestCreate$outboundSchema` instead. */ export const outboundSchema = RetrieveQuoteRequestCreate$outboundSchema; /** @deprecated use `RetrieveQuoteRequestCreate$Outbound` instead. */ export type Outbound = RetrieveQuoteRequestCreate$Outbound; } export function retrieveQuoteRequestCreateToJSON( retrieveQuoteRequestCreate: RetrieveQuoteRequestCreate, ): string { return JSON.stringify( RetrieveQuoteRequestCreate$outboundSchema.parse(retrieveQuoteRequestCreate), ); } export function retrieveQuoteRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RetrieveQuoteRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RetrieveQuoteRequestCreate' from JSON`, ); }