/* * 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 ListTransfersGlobals = { /** * 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 ListTransfersRequest = { /** * Optional, comma-separated account IDs by which the response is filtered based on whether the account ID is the source or destination. */ accountIDs?: Array | undefined; /** * Optional parameter for filtering transfers by status. */ status?: components.TransferStatus | undefined; /** * Optional date-time which inclusively filters all transfers created after this date-time. */ startDateTime?: Date | undefined; /** * Optional date-time which exclusively filters all transfers created before this date-time. */ endDateTime?: Date | undefined; /** * Optional ID to filter for transfers in the same group. */ groupID?: string | undefined; /** * Optional ID to filter for transfer occurrences belonging to the same schedule. */ scheduleID?: string | undefined; /** * Optional code to filter for transfers associated with the payment link. */ paymentLinkCode?: string | undefined; /** * Optional parameter to only return refunded transfers. */ refunded?: boolean | undefined; /** * Optional parameter to only return disputed transfers. */ disputed?: boolean | undefined; /** * Optional alias from a foreign/external system which can be used to reference this resource. */ foreignID?: string | undefined; skip?: number | undefined; count?: number | undefined; accountID: string; }; export type ListTransfersResponse = { headers: { [k: string]: Array }; result: Array; }; /** @internal */ export const ListTransfersGlobals$inboundSchema: z.ZodType< ListTransfersGlobals, z.ZodTypeDef, unknown > = z.object({ "X-Moov-Version": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Moov-Version": "xMoovVersion", }); }); /** @internal */ export type ListTransfersGlobals$Outbound = { "X-Moov-Version"?: string | undefined; }; /** @internal */ export const ListTransfersGlobals$outboundSchema: z.ZodType< ListTransfersGlobals$Outbound, z.ZodTypeDef, ListTransfersGlobals > = z.object({ xMoovVersion: z.string().optional(), }).transform((v) => { return remap$(v, { xMoovVersion: "X-Moov-Version", }); }); export function listTransfersGlobalsToJSON( listTransfersGlobals: ListTransfersGlobals, ): string { return JSON.stringify( ListTransfersGlobals$outboundSchema.parse(listTransfersGlobals), ); } export function listTransfersGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTransfersGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTransfersGlobals' from JSON`, ); } /** @internal */ export const ListTransfersRequest$inboundSchema: z.ZodType< ListTransfersRequest, z.ZodTypeDef, unknown > = z.object({ accountIDs: z.array(z.string()).optional(), status: components.TransferStatus$inboundSchema.optional(), startDateTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), endDateTime: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), groupID: z.string().optional(), scheduleID: z.string().optional(), paymentLinkCode: z.string().optional(), refunded: z.boolean().optional(), disputed: z.boolean().optional(), foreignID: z.string().optional(), skip: z.number().int().optional(), count: z.number().int().optional(), accountID: z.string(), }); /** @internal */ export type ListTransfersRequest$Outbound = { accountIDs?: Array | undefined; status?: string | undefined; startDateTime?: string | undefined; endDateTime?: string | undefined; groupID?: string | undefined; scheduleID?: string | undefined; paymentLinkCode?: string | undefined; refunded?: boolean | undefined; disputed?: boolean | undefined; foreignID?: string | undefined; skip?: number | undefined; count?: number | undefined; accountID: string; }; /** @internal */ export const ListTransfersRequest$outboundSchema: z.ZodType< ListTransfersRequest$Outbound, z.ZodTypeDef, ListTransfersRequest > = z.object({ accountIDs: z.array(z.string()).optional(), status: components.TransferStatus$outboundSchema.optional(), startDateTime: z.date().transform(v => v.toISOString()).optional(), endDateTime: z.date().transform(v => v.toISOString()).optional(), groupID: z.string().optional(), scheduleID: z.string().optional(), paymentLinkCode: z.string().optional(), refunded: z.boolean().optional(), disputed: z.boolean().optional(), foreignID: z.string().optional(), skip: z.number().int().optional(), count: z.number().int().optional(), accountID: z.string(), }); export function listTransfersRequestToJSON( listTransfersRequest: ListTransfersRequest, ): string { return JSON.stringify( ListTransfersRequest$outboundSchema.parse(listTransfersRequest), ); } export function listTransfersRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTransfersRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTransfersRequest' from JSON`, ); } /** @internal */ export const ListTransfersResponse$inboundSchema: z.ZodType< ListTransfersResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: z.array(components.Transfer$inboundSchema), }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type ListTransfersResponse$Outbound = { Headers: { [k: string]: Array }; Result: Array; }; /** @internal */ export const ListTransfersResponse$outboundSchema: z.ZodType< ListTransfersResponse$Outbound, z.ZodTypeDef, ListTransfersResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.array(components.Transfer$outboundSchema), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function listTransfersResponseToJSON( listTransfersResponse: ListTransfersResponse, ): string { return JSON.stringify( ListTransfersResponse$outboundSchema.parse(listTransfersResponse), ); } export function listTransfersResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTransfersResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTransfersResponse' from JSON`, ); }