/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { PositionCreate, PositionCreate$inboundSchema, PositionCreate$Outbound, PositionCreate$outboundSchema, } from "./positioncreate.js"; /** * The asset identifier type */ export enum AssetCreateType { IdentifierTypeUnspecified = "IDENTIFIER_TYPE_UNSPECIFIED", CurrencyCode = "CURRENCY_CODE", Cusip = "CUSIP", Symbol = "SYMBOL", Isin = "ISIN", AssetId = "ASSET_ID", } /** * The asset identifier type */ export type AssetCreateTypeOpen = OpenEnum; /** * The asset being transferred If cash, the asset_id is the currency code (e.g. USD) and the position is the amount */ export type AssetCreate = { /** * The asset identifier */ identifier: string; /** * The position or amount of the asset */ position: PositionCreate; /** * The asset identifier type */ type: AssetCreateTypeOpen; }; /** @internal */ export const AssetCreateType$inboundSchema: z.ZodType< AssetCreateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AssetCreateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AssetCreateType$outboundSchema: z.ZodType< AssetCreateTypeOpen, z.ZodTypeDef, AssetCreateTypeOpen > = z.union([ z.nativeEnum(AssetCreateType), 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 AssetCreateType$ { /** @deprecated use `AssetCreateType$inboundSchema` instead. */ export const inboundSchema = AssetCreateType$inboundSchema; /** @deprecated use `AssetCreateType$outboundSchema` instead. */ export const outboundSchema = AssetCreateType$outboundSchema; } /** @internal */ export const AssetCreate$inboundSchema: z.ZodType< AssetCreate, z.ZodTypeDef, unknown > = z.object({ identifier: z.string(), position: PositionCreate$inboundSchema, type: AssetCreateType$inboundSchema, }); /** @internal */ export type AssetCreate$Outbound = { identifier: string; position: PositionCreate$Outbound; type: string; }; /** @internal */ export const AssetCreate$outboundSchema: z.ZodType< AssetCreate$Outbound, z.ZodTypeDef, AssetCreate > = z.object({ identifier: z.string(), position: PositionCreate$outboundSchema, type: AssetCreateType$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AssetCreate$ { /** @deprecated use `AssetCreate$inboundSchema` instead. */ export const inboundSchema = AssetCreate$inboundSchema; /** @deprecated use `AssetCreate$outboundSchema` instead. */ export const outboundSchema = AssetCreate$outboundSchema; /** @deprecated use `AssetCreate$Outbound` instead. */ export type Outbound = AssetCreate$Outbound; } export function assetCreateToJSON(assetCreate: AssetCreate): string { return JSON.stringify(AssetCreate$outboundSchema.parse(assetCreate)); } export function assetCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AssetCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssetCreate' from JSON`, ); }