/*
* 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 * as components from "../components/index.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type ListAccountsGlobals = {
/**
* Specify an API version.
*
* @remarks
*
* API versioning follows the format `vYYYY.QQ.BB`, where
* - `YYYY` is the year
* - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
* - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
* - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
*
* The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
* When no version is specified, the API defaults to `v2024.01.00`.
*/
xMoovVersion?: string | undefined;
};
export type ListAccountsRequest = {
/**
* Filter connected accounts by name.
*
* @remarks
*
* If provided, this query will attempt to find matches against the following Account and Profile fields:
*
* - Account `displayName`
* - Individual Profile `firstName`, `middleName`, and `lastName`
* - Business Profile `legalBusinessName`
*
*
* Filtering by Guest Profile `name` is not currently supported.
*/
name?: string | undefined;
/**
* Filter connected accounts by email address.
*
* @remarks
*
* Provide the full email address to filter by email.
*/
email?: string | undefined;
/**
* Filter connected accounts by AccountType.
*
* @remarks
*
* If the `type` parameter is used in combination with `name`, only the corresponding type's name fields will
* be searched. For example, if `type=business` and `name=moov`, the search will attempt to find matches against
* the display name and Business Profile name fields (`legalBusinessName`, and `doingBusinessAs`).
*
* Filtering by `type=guest` is not currently supported.
*/
type?: components.CreateAccountType | undefined;
/**
* Serves as an optional alias from a foreign/external system which can be used to reference this resource.
*/
foreignID?: string | undefined;
/**
* Filter disconnected accounts.
*
* @remarks
*
* If true, the response will include disconnected accounts.
*/
includeDisconnected?: boolean | undefined;
/**
* Filter connected accounts by the capability.
*/
capability?: components.CapabilityID | undefined;
/**
* Filter connected accounts by the capability.
*/
capabilityStatus?: components.CapabilityStatus | undefined;
skip?: number | undefined;
count?: number | undefined;
};
export type ListAccountsResponse = {
headers: { [k: string]: Array };
result: Array;
};
/** @internal */
export const ListAccountsGlobals$inboundSchema: z.ZodType<
ListAccountsGlobals,
z.ZodTypeDef,
unknown
> = z.object({
"X-Moov-Version": z.string().optional(),
}).transform((v) => {
return remap$(v, {
"X-Moov-Version": "xMoovVersion",
});
});
/** @internal */
export type ListAccountsGlobals$Outbound = {
"X-Moov-Version"?: string | undefined;
};
/** @internal */
export const ListAccountsGlobals$outboundSchema: z.ZodType<
ListAccountsGlobals$Outbound,
z.ZodTypeDef,
ListAccountsGlobals
> = z.object({
xMoovVersion: z.string().optional(),
}).transform((v) => {
return remap$(v, {
xMoovVersion: "X-Moov-Version",
});
});
export function listAccountsGlobalsToJSON(
listAccountsGlobals: ListAccountsGlobals,
): string {
return JSON.stringify(
ListAccountsGlobals$outboundSchema.parse(listAccountsGlobals),
);
}
export function listAccountsGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => ListAccountsGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListAccountsGlobals' from JSON`,
);
}
/** @internal */
export const ListAccountsRequest$inboundSchema: z.ZodType<
ListAccountsRequest,
z.ZodTypeDef,
unknown
> = z.object({
name: z.string().optional(),
email: z.string().optional(),
type: components.CreateAccountType$inboundSchema.optional(),
foreignID: z.string().optional(),
includeDisconnected: z.boolean().optional(),
capability: components.CapabilityID$inboundSchema.optional(),
capabilityStatus: components.CapabilityStatus$inboundSchema.optional(),
skip: z.number().int().optional(),
count: z.number().int().optional(),
});
/** @internal */
export type ListAccountsRequest$Outbound = {
name?: string | undefined;
email?: string | undefined;
type?: string | undefined;
foreignID?: string | undefined;
includeDisconnected?: boolean | undefined;
capability?: string | undefined;
capabilityStatus?: string | undefined;
skip?: number | undefined;
count?: number | undefined;
};
/** @internal */
export const ListAccountsRequest$outboundSchema: z.ZodType<
ListAccountsRequest$Outbound,
z.ZodTypeDef,
ListAccountsRequest
> = z.object({
name: z.string().optional(),
email: z.string().optional(),
type: components.CreateAccountType$outboundSchema.optional(),
foreignID: z.string().optional(),
includeDisconnected: z.boolean().optional(),
capability: components.CapabilityID$outboundSchema.optional(),
capabilityStatus: components.CapabilityStatus$outboundSchema.optional(),
skip: z.number().int().optional(),
count: z.number().int().optional(),
});
export function listAccountsRequestToJSON(
listAccountsRequest: ListAccountsRequest,
): string {
return JSON.stringify(
ListAccountsRequest$outboundSchema.parse(listAccountsRequest),
);
}
export function listAccountsRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => ListAccountsRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListAccountsRequest' from JSON`,
);
}
/** @internal */
export const ListAccountsResponse$inboundSchema: z.ZodType<
ListAccountsResponse,
z.ZodTypeDef,
unknown
> = z.object({
Headers: z.record(z.array(z.string())).default({}),
Result: z.array(components.Account$inboundSchema),
}).transform((v) => {
return remap$(v, {
"Headers": "headers",
"Result": "result",
});
});
/** @internal */
export type ListAccountsResponse$Outbound = {
Headers: { [k: string]: Array };
Result: Array;
};
/** @internal */
export const ListAccountsResponse$outboundSchema: z.ZodType<
ListAccountsResponse$Outbound,
z.ZodTypeDef,
ListAccountsResponse
> = z.object({
headers: z.record(z.array(z.string())),
result: z.array(components.Account$outboundSchema),
}).transform((v) => {
return remap$(v, {
headers: "Headers",
result: "Result",
});
});
export function listAccountsResponseToJSON(
listAccountsResponse: ListAccountsResponse,
): string {
return JSON.stringify(
ListAccountsResponse$outboundSchema.parse(listAccountsResponse),
);
}
export function listAccountsResponseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => ListAccountsResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListAccountsResponse' from JSON`,
);
}