/* * 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 AccountsAddPartyRequest = { /** * The account id. */ accountId: string; addPartyRequestCreate: components.AddPartyRequestCreate; }; export type AccountsAddPartyResponse = { httpMeta: components.HTTPMetadata; /** * OK */ party?: components.Party | undefined; /** * INVALID_ARGUMENT: The request is not valid, additional information may be present in the BadRequest details. */ status?: components.Status | undefined; }; /** @internal */ export const AccountsAddPartyRequest$inboundSchema: z.ZodType< AccountsAddPartyRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), AddPartyRequestCreate: components.AddPartyRequestCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "AddPartyRequestCreate": "addPartyRequestCreate", }); }); /** @internal */ export type AccountsAddPartyRequest$Outbound = { account_id: string; AddPartyRequestCreate: components.AddPartyRequestCreate$Outbound; }; /** @internal */ export const AccountsAddPartyRequest$outboundSchema: z.ZodType< AccountsAddPartyRequest$Outbound, z.ZodTypeDef, AccountsAddPartyRequest > = z.object({ accountId: z.string(), addPartyRequestCreate: components.AddPartyRequestCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", addPartyRequestCreate: "AddPartyRequestCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountsAddPartyRequest$ { /** @deprecated use `AccountsAddPartyRequest$inboundSchema` instead. */ export const inboundSchema = AccountsAddPartyRequest$inboundSchema; /** @deprecated use `AccountsAddPartyRequest$outboundSchema` instead. */ export const outboundSchema = AccountsAddPartyRequest$outboundSchema; /** @deprecated use `AccountsAddPartyRequest$Outbound` instead. */ export type Outbound = AccountsAddPartyRequest$Outbound; } export function accountsAddPartyRequestToJSON( accountsAddPartyRequest: AccountsAddPartyRequest, ): string { return JSON.stringify( AccountsAddPartyRequest$outboundSchema.parse(accountsAddPartyRequest), ); } export function accountsAddPartyRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountsAddPartyRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountsAddPartyRequest' from JSON`, ); } /** @internal */ export const AccountsAddPartyResponse$inboundSchema: z.ZodType< AccountsAddPartyResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, Party: components.Party$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Party": "party", "Status": "status", }); }); /** @internal */ export type AccountsAddPartyResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; Party?: components.Party$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const AccountsAddPartyResponse$outboundSchema: z.ZodType< AccountsAddPartyResponse$Outbound, z.ZodTypeDef, AccountsAddPartyResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, party: components.Party$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", party: "Party", 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 AccountsAddPartyResponse$ { /** @deprecated use `AccountsAddPartyResponse$inboundSchema` instead. */ export const inboundSchema = AccountsAddPartyResponse$inboundSchema; /** @deprecated use `AccountsAddPartyResponse$outboundSchema` instead. */ export const outboundSchema = AccountsAddPartyResponse$outboundSchema; /** @deprecated use `AccountsAddPartyResponse$Outbound` instead. */ export type Outbound = AccountsAddPartyResponse$Outbound; } export function accountsAddPartyResponseToJSON( accountsAddPartyResponse: AccountsAddPartyResponse, ): string { return JSON.stringify( AccountsAddPartyResponse$outboundSchema.parse(accountsAddPartyResponse), ); } export function accountsAddPartyResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountsAddPartyResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountsAddPartyResponse' from JSON`, ); }