/*
* 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 ListConnectedAccountsForAccountGlobals = {
/**
* 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 ListConnectedAccountsForAccountRequest = {
accountID: string;
/**
* 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 ListConnectedAccountsForAccountResponse = {
headers: { [k: string]: Array };
result: Array;
};
/** @internal */
export const ListConnectedAccountsForAccountGlobals$inboundSchema: z.ZodType<
ListConnectedAccountsForAccountGlobals,
z.ZodTypeDef,
unknown
> = z.object({
"X-Moov-Version": z.string().optional(),
}).transform((v) => {
return remap$(v, {
"X-Moov-Version": "xMoovVersion",
});
});
/** @internal */
export type ListConnectedAccountsForAccountGlobals$Outbound = {
"X-Moov-Version"?: string | undefined;
};
/** @internal */
export const ListConnectedAccountsForAccountGlobals$outboundSchema: z.ZodType<
ListConnectedAccountsForAccountGlobals$Outbound,
z.ZodTypeDef,
ListConnectedAccountsForAccountGlobals
> = z.object({
xMoovVersion: z.string().optional(),
}).transform((v) => {
return remap$(v, {
xMoovVersion: "X-Moov-Version",
});
});
export function listConnectedAccountsForAccountGlobalsToJSON(
listConnectedAccountsForAccountGlobals:
ListConnectedAccountsForAccountGlobals,
): string {
return JSON.stringify(
ListConnectedAccountsForAccountGlobals$outboundSchema.parse(
listConnectedAccountsForAccountGlobals,
),
);
}
export function listConnectedAccountsForAccountGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) =>
ListConnectedAccountsForAccountGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListConnectedAccountsForAccountGlobals' from JSON`,
);
}
/** @internal */
export const ListConnectedAccountsForAccountRequest$inboundSchema: z.ZodType<
ListConnectedAccountsForAccountRequest,
z.ZodTypeDef,
unknown
> = z.object({
accountID: z.string(),
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 ListConnectedAccountsForAccountRequest$Outbound = {
accountID: string;
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 ListConnectedAccountsForAccountRequest$outboundSchema: z.ZodType<
ListConnectedAccountsForAccountRequest$Outbound,
z.ZodTypeDef,
ListConnectedAccountsForAccountRequest
> = z.object({
accountID: z.string(),
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 listConnectedAccountsForAccountRequestToJSON(
listConnectedAccountsForAccountRequest:
ListConnectedAccountsForAccountRequest,
): string {
return JSON.stringify(
ListConnectedAccountsForAccountRequest$outboundSchema.parse(
listConnectedAccountsForAccountRequest,
),
);
}
export function listConnectedAccountsForAccountRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) =>
ListConnectedAccountsForAccountRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListConnectedAccountsForAccountRequest' from JSON`,
);
}
/** @internal */
export const ListConnectedAccountsForAccountResponse$inboundSchema: z.ZodType<
ListConnectedAccountsForAccountResponse,
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 ListConnectedAccountsForAccountResponse$Outbound = {
Headers: { [k: string]: Array };
Result: Array;
};
/** @internal */
export const ListConnectedAccountsForAccountResponse$outboundSchema: z.ZodType<
ListConnectedAccountsForAccountResponse$Outbound,
z.ZodTypeDef,
ListConnectedAccountsForAccountResponse
> = 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 listConnectedAccountsForAccountResponseToJSON(
listConnectedAccountsForAccountResponse:
ListConnectedAccountsForAccountResponse,
): string {
return JSON.stringify(
ListConnectedAccountsForAccountResponse$outboundSchema.parse(
listConnectedAccountsForAccountResponse,
),
);
}
export function listConnectedAccountsForAccountResponseFromJSON(
jsonString: string,
): SafeParseResult<
ListConnectedAccountsForAccountResponse,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
ListConnectedAccountsForAccountResponse$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'ListConnectedAccountsForAccountResponse' from JSON`,
);
}