/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The process date of the batch associated with the report. */ export type ProcessDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * The ICT program associated with the report. */ export enum LocateIctReportResponseProgram { IctProgramUnspecified = "ICT_PROGRAM_UNSPECIFIED", BrokerPartner = "BROKER_PARTNER", DepositOnly = "DEPOSIT_ONLY", BankingPartner = "BANKING_PARTNER", MoneyTransmitter = "MONEY_TRANSMITTER", WithdrawalOnly = "WITHDRAWAL_ONLY", DigitalPartner = "DIGITAL_PARTNER", } /** * The ICT program associated with the report. */ export type LocateIctReportResponseProgramOpen = OpenEnum< typeof LocateIctReportResponseProgram >; /** * A response containing recon report descriptors and a file download link for the report. */ export type LocateIctReportResponse = { /** * The id of the batch associated with the report. */ batchId?: string | undefined; /** * The timestamp when the report was created. */ createTime?: Date | null | undefined; /** * The signed file download uri. The link will expire after a set period of time. */ downloadUri?: string | undefined; /** * The process date of the batch associated with the report. */ processDate?: ProcessDate | null | undefined; /** * The ICT program associated with the report. */ program?: LocateIctReportResponseProgramOpen | undefined; }; /** @internal */ export const ProcessDate$inboundSchema: z.ZodType< ProcessDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type ProcessDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const ProcessDate$outboundSchema: z.ZodType< ProcessDate$Outbound, z.ZodTypeDef, ProcessDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ProcessDate$ { /** @deprecated use `ProcessDate$inboundSchema` instead. */ export const inboundSchema = ProcessDate$inboundSchema; /** @deprecated use `ProcessDate$outboundSchema` instead. */ export const outboundSchema = ProcessDate$outboundSchema; /** @deprecated use `ProcessDate$Outbound` instead. */ export type Outbound = ProcessDate$Outbound; } export function processDateToJSON(processDate: ProcessDate): string { return JSON.stringify(ProcessDate$outboundSchema.parse(processDate)); } export function processDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProcessDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProcessDate' from JSON`, ); } /** @internal */ export const LocateIctReportResponseProgram$inboundSchema: z.ZodType< LocateIctReportResponseProgramOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(LocateIctReportResponseProgram), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const LocateIctReportResponseProgram$outboundSchema: z.ZodType< LocateIctReportResponseProgramOpen, z.ZodTypeDef, LocateIctReportResponseProgramOpen > = z.union([ z.nativeEnum(LocateIctReportResponseProgram), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LocateIctReportResponseProgram$ { /** @deprecated use `LocateIctReportResponseProgram$inboundSchema` instead. */ export const inboundSchema = LocateIctReportResponseProgram$inboundSchema; /** @deprecated use `LocateIctReportResponseProgram$outboundSchema` instead. */ export const outboundSchema = LocateIctReportResponseProgram$outboundSchema; } /** @internal */ export const LocateIctReportResponse$inboundSchema: z.ZodType< LocateIctReportResponse, z.ZodTypeDef, unknown > = z.object({ batch_id: z.string().optional(), create_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), download_uri: z.string().optional(), process_date: z.nullable(z.lazy(() => ProcessDate$inboundSchema)).optional(), program: LocateIctReportResponseProgram$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "batch_id": "batchId", "create_time": "createTime", "download_uri": "downloadUri", "process_date": "processDate", }); }); /** @internal */ export type LocateIctReportResponse$Outbound = { batch_id?: string | undefined; create_time?: string | null | undefined; download_uri?: string | undefined; process_date?: ProcessDate$Outbound | null | undefined; program?: string | undefined; }; /** @internal */ export const LocateIctReportResponse$outboundSchema: z.ZodType< LocateIctReportResponse$Outbound, z.ZodTypeDef, LocateIctReportResponse > = z.object({ batchId: z.string().optional(), createTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), downloadUri: z.string().optional(), processDate: z.nullable(z.lazy(() => ProcessDate$outboundSchema)).optional(), program: LocateIctReportResponseProgram$outboundSchema.optional(), }).transform((v) => { return remap$(v, { batchId: "batch_id", createTime: "create_time", downloadUri: "download_uri", processDate: "process_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LocateIctReportResponse$ { /** @deprecated use `LocateIctReportResponse$inboundSchema` instead. */ export const inboundSchema = LocateIctReportResponse$inboundSchema; /** @deprecated use `LocateIctReportResponse$outboundSchema` instead. */ export const outboundSchema = LocateIctReportResponse$outboundSchema; /** @deprecated use `LocateIctReportResponse$Outbound` instead. */ export type Outbound = LocateIctReportResponse$Outbound; } export function locateIctReportResponseToJSON( locateIctReportResponse: LocateIctReportResponse, ): string { return JSON.stringify( LocateIctReportResponse$outboundSchema.parse(locateIctReportResponse), ); } export function locateIctReportResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LocateIctReportResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LocateIctReportResponse' from JSON`, ); }