/* * 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 ListReportsGlobals = { merchantAccountId?: string | undefined; }; export type ListReportsRequest = { /** * 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 reports by the type of schedule at which they run. */ schedule?: Array | null | undefined; /** * Filters the reports by wether their schedule is enabled. */ scheduleEnabled?: boolean | null | undefined; /** * Filters the reports by searching their name for (partial) matches. */ name?: string | null | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; export type ListReportsResponse = { result: components.Reports; }; /** @internal */ export type ListReportsRequest$Outbound = { cursor?: string | null | undefined; limit: number; schedule?: Array | null | undefined; schedule_enabled?: boolean | null | undefined; name?: string | null | undefined; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListReportsRequest$outboundSchema: z.ZodType< ListReportsRequest$Outbound, z.ZodTypeDef, ListReportsRequest > = z.object({ cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), schedule: z.nullable(z.array(components.ReportSchedule$outboundSchema)) .optional(), scheduleEnabled: z.nullable(z.boolean()).optional(), name: z.nullable(z.string()).optional(), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { scheduleEnabled: "schedule_enabled", }); }); export function listReportsRequestToJSON( listReportsRequest: ListReportsRequest, ): string { return JSON.stringify( ListReportsRequest$outboundSchema.parse(listReportsRequest), ); } /** @internal */ export const ListReportsResponse$inboundSchema: z.ZodType< ListReportsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.Reports$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listReportsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListReportsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListReportsResponse' from JSON`, ); }