/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 * as shared from "../shared/index.js"; export type CreateBatchSourceAccountRequestBody = | Array | Array; export type CreateBatchSourceAccountRequest = { /** * Unique identifier for a company. */ companyId: string; /** * Unique identifier for a connection. */ connectionId: string; requestBody?: | Array | Array | undefined; }; export type CreateBatchSourceAccountResponseBody = | shared.SourceAccountV2BatchCreateResponse | shared.SourceAccountBatchCreateResponse | shared.SourceAccountBatchErrorResponse; export type ResponseBody = | shared.SourceAccountV2BatchCreateResponse | shared.SourceAccountBatchCreateResponse; export type CreateBatchSourceAccountResponse = | Array< | shared.SourceAccountV2BatchCreateResponse | shared.SourceAccountBatchCreateResponse > | Array< | shared.SourceAccountV2BatchCreateResponse | shared.SourceAccountBatchCreateResponse | shared.SourceAccountBatchErrorResponse >; /** @internal */ export type CreateBatchSourceAccountRequestBody$Outbound = | Array | Array; /** @internal */ export const CreateBatchSourceAccountRequestBody$outboundSchema: z.ZodType< CreateBatchSourceAccountRequestBody$Outbound, z.ZodTypeDef, CreateBatchSourceAccountRequestBody > = z.union([ z.array(shared.SourceAccountV2Prototype$outboundSchema), z.array(shared.SourceAccountPrototype$outboundSchema), ]); export function createBatchSourceAccountRequestBodyToJSON( createBatchSourceAccountRequestBody: CreateBatchSourceAccountRequestBody, ): string { return JSON.stringify( CreateBatchSourceAccountRequestBody$outboundSchema.parse( createBatchSourceAccountRequestBody, ), ); } /** @internal */ export type CreateBatchSourceAccountRequest$Outbound = { companyId: string; connectionId: string; RequestBody?: | Array | Array | undefined; }; /** @internal */ export const CreateBatchSourceAccountRequest$outboundSchema: z.ZodType< CreateBatchSourceAccountRequest$Outbound, z.ZodTypeDef, CreateBatchSourceAccountRequest > = z.object({ companyId: z.string(), connectionId: z.string(), requestBody: z.union([ z.array(shared.SourceAccountV2Prototype$outboundSchema), z.array(shared.SourceAccountPrototype$outboundSchema), ]).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function createBatchSourceAccountRequestToJSON( createBatchSourceAccountRequest: CreateBatchSourceAccountRequest, ): string { return JSON.stringify( CreateBatchSourceAccountRequest$outboundSchema.parse( createBatchSourceAccountRequest, ), ); } /** @internal */ export const CreateBatchSourceAccountResponseBody$inboundSchema: z.ZodType< CreateBatchSourceAccountResponseBody, z.ZodTypeDef, unknown > = z.union([ shared.SourceAccountV2BatchCreateResponse$inboundSchema, shared.SourceAccountBatchCreateResponse$inboundSchema, shared.SourceAccountBatchErrorResponse$inboundSchema, ]); export function createBatchSourceAccountResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBatchSourceAccountResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBatchSourceAccountResponseBody' from JSON`, ); } /** @internal */ export const ResponseBody$inboundSchema: z.ZodType< ResponseBody, z.ZodTypeDef, unknown > = z.union([ shared.SourceAccountV2BatchCreateResponse$inboundSchema, shared.SourceAccountBatchCreateResponse$inboundSchema, ]); export function responseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBody' from JSON`, ); } /** @internal */ export const CreateBatchSourceAccountResponse$inboundSchema: z.ZodType< CreateBatchSourceAccountResponse, z.ZodTypeDef, unknown > = z.union([ z.array( z.union([ shared.SourceAccountV2BatchCreateResponse$inboundSchema, shared.SourceAccountBatchCreateResponse$inboundSchema, ]), ), z.array( z.union([ shared.SourceAccountV2BatchCreateResponse$inboundSchema, shared.SourceAccountBatchCreateResponse$inboundSchema, shared.SourceAccountBatchErrorResponse$inboundSchema, ]), ), ]); export function createBatchSourceAccountResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBatchSourceAccountResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBatchSourceAccountResponse' from JSON`, ); }