/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type InvoicesFilter = { updatedSince?: Date | undefined; createdSince?: Date | undefined; /** * Invoice number to search for */ number?: string | undefined; }; /** @internal */ export const InvoicesFilter$inboundSchema: z.ZodType< InvoicesFilter, z.ZodTypeDef, unknown > = z.object({ updated_since: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), created_since: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), number: z.string().optional(), }).transform((v) => { return remap$(v, { "updated_since": "updatedSince", "created_since": "createdSince", }); }); /** @internal */ export type InvoicesFilter$Outbound = { updated_since?: string | undefined; created_since?: string | undefined; number?: string | undefined; }; /** @internal */ export const InvoicesFilter$outboundSchema: z.ZodType< InvoicesFilter$Outbound, z.ZodTypeDef, InvoicesFilter > = z.object({ updatedSince: z.date().transform(v => v.toISOString()).optional(), createdSince: z.date().transform(v => v.toISOString()).optional(), number: z.string().optional(), }).transform((v) => { return remap$(v, { updatedSince: "updated_since", createdSince: "created_since", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InvoicesFilter$ { /** @deprecated use `InvoicesFilter$inboundSchema` instead. */ export const inboundSchema = InvoicesFilter$inboundSchema; /** @deprecated use `InvoicesFilter$outboundSchema` instead. */ export const outboundSchema = InvoicesFilter$outboundSchema; /** @deprecated use `InvoicesFilter$Outbound` instead. */ export type Outbound = InvoicesFilter$Outbound; } export function invoicesFilterToJSON(invoicesFilter: InvoicesFilter): string { return JSON.stringify(InvoicesFilter$outboundSchema.parse(invoicesFilter)); } export function invoicesFilterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InvoicesFilter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvoicesFilter' from JSON`, ); }