/* * 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"; /** * The state of bank relationships to filter by. Unspecified returns relationships of all states. */ export enum State { StateUnspecified = "STATE_UNSPECIFIED", Pending = "PENDING", Approved = "APPROVED", Canceled = "CANCELED", Rejected = "REJECTED", } export type BankRelationshipsListBankRelationshipsRequest = { /** * The account id. */ accountId: string; /** * The maximum number of bank relationships to return. The service may return fewer than this value. If unspecified, at most 50 bank relationships will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. */ pageSize?: number | undefined; /** * A page token, received from a previous `ListBankRelationships` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBankRelationships` must match the call that provided the page token. */ pageToken?: string | undefined; /** * The state of bank relationships to filter by. Unspecified returns relationships of all states. */ state?: State | undefined; }; export type BankRelationshipsListBankRelationshipsResponse = { httpMeta: components.HTTPMetadata; /** * OK */ listBankRelationshipsResponse?: | components.ListBankRelationshipsResponse | undefined; /** * INVALID_ARGUMENT: The request has an invalid argument. */ status?: components.Status | undefined; }; /** @internal */ export const State$inboundSchema: z.ZodNativeEnum = z.nativeEnum( State, ); /** @internal */ export const State$outboundSchema: z.ZodNativeEnum = State$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace State$ { /** @deprecated use `State$inboundSchema` instead. */ export const inboundSchema = State$inboundSchema; /** @deprecated use `State$outboundSchema` instead. */ export const outboundSchema = State$outboundSchema; } /** @internal */ export const BankRelationshipsListBankRelationshipsRequest$inboundSchema: z.ZodType< BankRelationshipsListBankRelationshipsRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), page_size: z.number().int().optional(), page_token: z.string().optional(), state: State$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "page_size": "pageSize", "page_token": "pageToken", }); }); /** @internal */ export type BankRelationshipsListBankRelationshipsRequest$Outbound = { account_id: string; page_size?: number | undefined; page_token?: string | undefined; state?: string | undefined; }; /** @internal */ export const BankRelationshipsListBankRelationshipsRequest$outboundSchema: z.ZodType< BankRelationshipsListBankRelationshipsRequest$Outbound, z.ZodTypeDef, BankRelationshipsListBankRelationshipsRequest > = z.object({ accountId: z.string(), pageSize: z.number().int().optional(), pageToken: z.string().optional(), state: State$outboundSchema.optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", pageSize: "page_size", pageToken: "page_token", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BankRelationshipsListBankRelationshipsRequest$ { /** @deprecated use `BankRelationshipsListBankRelationshipsRequest$inboundSchema` instead. */ export const inboundSchema = BankRelationshipsListBankRelationshipsRequest$inboundSchema; /** @deprecated use `BankRelationshipsListBankRelationshipsRequest$outboundSchema` instead. */ export const outboundSchema = BankRelationshipsListBankRelationshipsRequest$outboundSchema; /** @deprecated use `BankRelationshipsListBankRelationshipsRequest$Outbound` instead. */ export type Outbound = BankRelationshipsListBankRelationshipsRequest$Outbound; } export function bankRelationshipsListBankRelationshipsRequestToJSON( bankRelationshipsListBankRelationshipsRequest: BankRelationshipsListBankRelationshipsRequest, ): string { return JSON.stringify( BankRelationshipsListBankRelationshipsRequest$outboundSchema.parse( bankRelationshipsListBankRelationshipsRequest, ), ); } export function bankRelationshipsListBankRelationshipsRequestFromJSON( jsonString: string, ): SafeParseResult< BankRelationshipsListBankRelationshipsRequest, SDKValidationError > { return safeParse( jsonString, (x) => BankRelationshipsListBankRelationshipsRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'BankRelationshipsListBankRelationshipsRequest' from JSON`, ); } /** @internal */ export const BankRelationshipsListBankRelationshipsResponse$inboundSchema: z.ZodType< BankRelationshipsListBankRelationshipsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, ListBankRelationshipsResponse: components .ListBankRelationshipsResponse$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "ListBankRelationshipsResponse": "listBankRelationshipsResponse", "Status": "status", }); }); /** @internal */ export type BankRelationshipsListBankRelationshipsResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; ListBankRelationshipsResponse?: | components.ListBankRelationshipsResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BankRelationshipsListBankRelationshipsResponse$outboundSchema: z.ZodType< BankRelationshipsListBankRelationshipsResponse$Outbound, z.ZodTypeDef, BankRelationshipsListBankRelationshipsResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, listBankRelationshipsResponse: components .ListBankRelationshipsResponse$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", listBankRelationshipsResponse: "ListBankRelationshipsResponse", 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 BankRelationshipsListBankRelationshipsResponse$ { /** @deprecated use `BankRelationshipsListBankRelationshipsResponse$inboundSchema` instead. */ export const inboundSchema = BankRelationshipsListBankRelationshipsResponse$inboundSchema; /** @deprecated use `BankRelationshipsListBankRelationshipsResponse$outboundSchema` instead. */ export const outboundSchema = BankRelationshipsListBankRelationshipsResponse$outboundSchema; /** @deprecated use `BankRelationshipsListBankRelationshipsResponse$Outbound` instead. */ export type Outbound = BankRelationshipsListBankRelationshipsResponse$Outbound; } export function bankRelationshipsListBankRelationshipsResponseToJSON( bankRelationshipsListBankRelationshipsResponse: BankRelationshipsListBankRelationshipsResponse, ): string { return JSON.stringify( BankRelationshipsListBankRelationshipsResponse$outboundSchema.parse( bankRelationshipsListBankRelationshipsResponse, ), ); } export function bankRelationshipsListBankRelationshipsResponseFromJSON( jsonString: string, ): SafeParseResult< BankRelationshipsListBankRelationshipsResponse, SDKValidationError > { return safeParse( jsonString, (x) => BankRelationshipsListBankRelationshipsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'BankRelationshipsListBankRelationshipsResponse' from JSON`, ); }