/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type OptionOrderServiceCancelOptionOrderRequest = { /** * The account id. */ accountId: string; /** * The optionOrder id. */ optionOrderId: string; cancelOptionOrderRequestCreate: components.CancelOptionOrderRequestCreate; }; export type OptionOrderServiceCancelOptionOrderResponse = { httpMeta: components.HTTPMetadata; /** * OK */ optionOrder?: components.OptionOrder | undefined; /** * INVALID_ARGUMENT: The account_id or the option_order_id could not be determined for the request. * * @remarks * FAILED_PRECONDITION: The order is not in a cancelable state */ status?: components.Status | undefined; }; /** @internal */ export const OptionOrderServiceCancelOptionOrderRequest$inboundSchema: z.ZodType = z.object({ account_id: z.string(), optionOrder_id: z.string(), CancelOptionOrderRequestCreate: components.CancelOptionOrderRequestCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "optionOrder_id": "optionOrderId", "CancelOptionOrderRequestCreate": "cancelOptionOrderRequestCreate", }); }); /** @internal */ export type OptionOrderServiceCancelOptionOrderRequest$Outbound = { account_id: string; optionOrder_id: string; CancelOptionOrderRequestCreate: components.CancelOptionOrderRequestCreate$Outbound; }; /** @internal */ export const OptionOrderServiceCancelOptionOrderRequest$outboundSchema: z.ZodType< OptionOrderServiceCancelOptionOrderRequest$Outbound, z.ZodTypeDef, OptionOrderServiceCancelOptionOrderRequest > = z.object({ accountId: z.string(), optionOrderId: z.string(), cancelOptionOrderRequestCreate: components.CancelOptionOrderRequestCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", optionOrderId: "optionOrder_id", cancelOptionOrderRequestCreate: "CancelOptionOrderRequestCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OptionOrderServiceCancelOptionOrderRequest$ { /** @deprecated use `OptionOrderServiceCancelOptionOrderRequest$inboundSchema` instead. */ export const inboundSchema = OptionOrderServiceCancelOptionOrderRequest$inboundSchema; /** @deprecated use `OptionOrderServiceCancelOptionOrderRequest$outboundSchema` instead. */ export const outboundSchema = OptionOrderServiceCancelOptionOrderRequest$outboundSchema; /** @deprecated use `OptionOrderServiceCancelOptionOrderRequest$Outbound` instead. */ export type Outbound = OptionOrderServiceCancelOptionOrderRequest$Outbound; } export function optionOrderServiceCancelOptionOrderRequestToJSON( optionOrderServiceCancelOptionOrderRequest: OptionOrderServiceCancelOptionOrderRequest, ): string { return JSON.stringify( OptionOrderServiceCancelOptionOrderRequest$outboundSchema.parse( optionOrderServiceCancelOptionOrderRequest, ), ); } export function optionOrderServiceCancelOptionOrderRequestFromJSON( jsonString: string, ): SafeParseResult< OptionOrderServiceCancelOptionOrderRequest, SDKValidationError > { return safeParse( jsonString, (x) => OptionOrderServiceCancelOptionOrderRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'OptionOrderServiceCancelOptionOrderRequest' from JSON`, ); } /** @internal */ export const OptionOrderServiceCancelOptionOrderResponse$inboundSchema: z.ZodType< OptionOrderServiceCancelOptionOrderResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, OptionOrder: components.OptionOrder$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "OptionOrder": "optionOrder", "Status": "status", }); }); /** @internal */ export type OptionOrderServiceCancelOptionOrderResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; OptionOrder?: components.OptionOrder$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const OptionOrderServiceCancelOptionOrderResponse$outboundSchema: z.ZodType< OptionOrderServiceCancelOptionOrderResponse$Outbound, z.ZodTypeDef, OptionOrderServiceCancelOptionOrderResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, optionOrder: components.OptionOrder$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", optionOrder: "OptionOrder", status: "Status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OptionOrderServiceCancelOptionOrderResponse$ { /** @deprecated use `OptionOrderServiceCancelOptionOrderResponse$inboundSchema` instead. */ export const inboundSchema = OptionOrderServiceCancelOptionOrderResponse$inboundSchema; /** @deprecated use `OptionOrderServiceCancelOptionOrderResponse$outboundSchema` instead. */ export const outboundSchema = OptionOrderServiceCancelOptionOrderResponse$outboundSchema; /** @deprecated use `OptionOrderServiceCancelOptionOrderResponse$Outbound` instead. */ export type Outbound = OptionOrderServiceCancelOptionOrderResponse$Outbound; } export function optionOrderServiceCancelOptionOrderResponseToJSON( optionOrderServiceCancelOptionOrderResponse: OptionOrderServiceCancelOptionOrderResponse, ): string { return JSON.stringify( OptionOrderServiceCancelOptionOrderResponse$outboundSchema.parse( optionOrderServiceCancelOptionOrderResponse, ), ); } export function optionOrderServiceCancelOptionOrderResponseFromJSON( jsonString: string, ): SafeParseResult< OptionOrderServiceCancelOptionOrderResponse, SDKValidationError > { return safeParse( jsonString, (x) => OptionOrderServiceCancelOptionOrderResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'OptionOrderServiceCancelOptionOrderResponse' from JSON`, ); }