/* * 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 ListDisputesGlobals = { /** * 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 ListDisputesRequest = { accountID: string; skip?: number | undefined; count?: number | undefined; /** * Optional date-time parameter to filter all disputes created on and after the provided date and time. */ startDateTime?: Date | undefined; /** * Optional date-time parameter to filter all disputes created on and before the provided date and time. */ endDateTime?: Date | undefined; /** * Optional date-time which exclusively filters all disputes with respond by before this date-time. */ respondStartDateTime?: Date | undefined; /** * Optional date-time which exclusively filters all disputes with respond by before this date-time. */ respondEndDateTime?: Date | undefined; /** * Optional dispute status by which to filter the disputes. */ status?: components.DisputeStatus | undefined; /** * Optional parameter to filter by merchant account ID. */ merchantAccountID?: string | undefined; /** * Optional parameter to filter by cardholder account ID. */ cardholderAccountID?: string | undefined; /** * Optional parameter to filter by a comma separated list of dispute IDs. */ disputeIDs?: Array | undefined; /** * Optional parameter to filter by a comma separated list of transfer IDs. */ transferIDs?: Array | undefined; orderBy?: string | undefined; }; export type ListDisputesResponse = { headers: { [k: string]: Array }; result: Array; }; /** @internal */ export const ListDisputesGlobals$inboundSchema: z.ZodType< ListDisputesGlobals, z.ZodTypeDef, unknown > = z.object({ "X-Moov-Version": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Moov-Version": "xMoovVersion", }); }); /** @internal */ export type ListDisputesGlobals$Outbound = { "X-Moov-Version"?: string | undefined; }; /** @internal */ export const ListDisputesGlobals$outboundSchema: z.ZodType< ListDisputesGlobals$Outbound, z.ZodTypeDef, ListDisputesGlobals > = z.object({ xMoovVersion: z.string().optional(), }).transform((v) => { return remap$(v, { xMoovVersion: "X-Moov-Version", }); }); export function listDisputesGlobalsToJSON( listDisputesGlobals: ListDisputesGlobals, ): string { return JSON.stringify( ListDisputesGlobals$outboundSchema.parse(listDisputesGlobals), ); } export function listDisputesGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDisputesGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDisputesGlobals' from JSON`, ); } /** @internal */ export const ListDisputesRequest$inboundSchema: z.ZodType< ListDisputesRequest, z.ZodTypeDef, unknown > = z.object({ accountID: z.string(), skip: z.number().int().optional(), count: z.number().int().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(), respondStartDateTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), respondEndDateTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), status: components.DisputeStatus$inboundSchema.optional(), merchantAccountID: z.string().optional(), cardholderAccountID: z.string().optional(), disputeIDs: z.array(z.string()).optional(), transferIDs: z.array(z.string()).optional(), orderBy: z.string().optional(), }); /** @internal */ export type ListDisputesRequest$Outbound = { accountID: string; skip?: number | undefined; count?: number | undefined; startDateTime?: string | undefined; endDateTime?: string | undefined; respondStartDateTime?: string | undefined; respondEndDateTime?: string | undefined; status?: string | undefined; merchantAccountID?: string | undefined; cardholderAccountID?: string | undefined; disputeIDs?: Array | undefined; transferIDs?: Array | undefined; orderBy?: string | undefined; }; /** @internal */ export const ListDisputesRequest$outboundSchema: z.ZodType< ListDisputesRequest$Outbound, z.ZodTypeDef, ListDisputesRequest > = z.object({ accountID: z.string(), skip: z.number().int().optional(), count: z.number().int().optional(), startDateTime: z.date().transform(v => v.toISOString()).optional(), endDateTime: z.date().transform(v => v.toISOString()).optional(), respondStartDateTime: z.date().transform(v => v.toISOString()).optional(), respondEndDateTime: z.date().transform(v => v.toISOString()).optional(), status: components.DisputeStatus$outboundSchema.optional(), merchantAccountID: z.string().optional(), cardholderAccountID: z.string().optional(), disputeIDs: z.array(z.string()).optional(), transferIDs: z.array(z.string()).optional(), orderBy: z.string().optional(), }); export function listDisputesRequestToJSON( listDisputesRequest: ListDisputesRequest, ): string { return JSON.stringify( ListDisputesRequest$outboundSchema.parse(listDisputesRequest), ); } export function listDisputesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDisputesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDisputesRequest' from JSON`, ); } /** @internal */ export const ListDisputesResponse$inboundSchema: z.ZodType< ListDisputesResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: z.array(components.Dispute$inboundSchema), }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type ListDisputesResponse$Outbound = { Headers: { [k: string]: Array }; Result: Array; }; /** @internal */ export const ListDisputesResponse$outboundSchema: z.ZodType< ListDisputesResponse$Outbound, z.ZodTypeDef, ListDisputesResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.array(components.Dispute$outboundSchema), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function listDisputesResponseToJSON( listDisputesResponse: ListDisputesResponse, ): string { return JSON.stringify( ListDisputesResponse$outboundSchema.parse(listDisputesResponse), ); } export function listDisputesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDisputesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDisputesResponse' from JSON`, ); }