/* * 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 ListPayoutsGlobals = { merchantAccountId?: string | undefined; }; export type ListPayoutsRequest = { /** * A pointer to the page of results to return. */ cursor?: string | null | undefined; /** * The maximum number of items that are at returned. */ limit?: number | undefined; /** * Filters the results to only payouts created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ createdAtLte?: Date | null | undefined; /** * Filters the results to only payouts created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ createdAtGte?: Date | null | undefined; /** * Filters the results to only payouts updated before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ updatedAtLte?: Date | null | undefined; /** * Filters the results to only payouts updated after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ updatedAtGte?: Date | null | undefined; /** * Filters the results to only the payouts that have an `external_identifier` that exactly matches this value. */ externalIdentifier?: string | null | undefined; /** * Filters the results to only the payouts that have a `payment_service_payout_id` that exactly matches this value. */ paymentServicePayoutId?: string | null | undefined; /** * Filters the results to only the payouts that have a `status` that matches with any of the provided status values. */ status?: Array | null | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; export type ListPayoutsResponse = { result: components.PayoutSummaries; }; /** @internal */ export type ListPayoutsRequest$Outbound = { cursor?: string | null | undefined; limit: number; created_at_lte?: string | null | undefined; created_at_gte?: string | null | undefined; updated_at_lte?: string | null | undefined; updated_at_gte?: string | null | undefined; external_identifier?: string | null | undefined; payment_service_payout_id?: string | null | undefined; status?: Array | null | undefined; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListPayoutsRequest$outboundSchema: z.ZodType< ListPayoutsRequest$Outbound, z.ZodTypeDef, ListPayoutsRequest > = z.object({ cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), createdAtLte: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdAtGte: z.nullable(z.date().transform(v => v.toISOString())).optional(), updatedAtLte: z.nullable(z.date().transform(v => v.toISOString())).optional(), updatedAtGte: z.nullable(z.date().transform(v => v.toISOString())).optional(), externalIdentifier: z.nullable(z.string()).optional(), paymentServicePayoutId: z.nullable(z.string()).optional(), status: z.nullable(z.array(components.PayoutStatus$outboundSchema)) .optional(), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { createdAtLte: "created_at_lte", createdAtGte: "created_at_gte", updatedAtLte: "updated_at_lte", updatedAtGte: "updated_at_gte", externalIdentifier: "external_identifier", paymentServicePayoutId: "payment_service_payout_id", }); }); export function listPayoutsRequestToJSON( listPayoutsRequest: ListPayoutsRequest, ): string { return JSON.stringify( ListPayoutsRequest$outboundSchema.parse(listPayoutsRequest), ); } /** @internal */ export const ListPayoutsResponse$inboundSchema: z.ZodType< ListPayoutsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.PayoutSummaries$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listPayoutsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListPayoutsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListPayoutsResponse' from JSON`, ); }