/* * 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 SuppliersFilter = { /** * Company Name of supplier to search for */ companyName?: string | undefined; /** * Display Name of supplier to search for */ displayName?: string | undefined; /** * First name of supplier to search for */ firstName?: string | undefined; /** * Last name of supplier to search for */ lastName?: string | undefined; /** * Email of supplier to search for */ email?: string | undefined; updatedSince?: Date | undefined; }; /** @internal */ export const SuppliersFilter$inboundSchema: z.ZodType< SuppliersFilter, z.ZodTypeDef, unknown > = z.object({ company_name: z.string().optional(), display_name: z.string().optional(), first_name: z.string().optional(), last_name: z.string().optional(), email: z.string().optional(), updated_since: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), }).transform((v) => { return remap$(v, { "company_name": "companyName", "display_name": "displayName", "first_name": "firstName", "last_name": "lastName", "updated_since": "updatedSince", }); }); /** @internal */ export type SuppliersFilter$Outbound = { company_name?: string | undefined; display_name?: string | undefined; first_name?: string | undefined; last_name?: string | undefined; email?: string | undefined; updated_since?: string | undefined; }; /** @internal */ export const SuppliersFilter$outboundSchema: z.ZodType< SuppliersFilter$Outbound, z.ZodTypeDef, SuppliersFilter > = z.object({ companyName: z.string().optional(), displayName: z.string().optional(), firstName: z.string().optional(), lastName: z.string().optional(), email: z.string().optional(), updatedSince: z.date().transform(v => v.toISOString()).optional(), }).transform((v) => { return remap$(v, { companyName: "company_name", displayName: "display_name", firstName: "first_name", lastName: "last_name", updatedSince: "updated_since", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SuppliersFilter$ { /** @deprecated use `SuppliersFilter$inboundSchema` instead. */ export const inboundSchema = SuppliersFilter$inboundSchema; /** @deprecated use `SuppliersFilter$outboundSchema` instead. */ export const outboundSchema = SuppliersFilter$outboundSchema; /** @deprecated use `SuppliersFilter$Outbound` instead. */ export type Outbound = SuppliersFilter$Outbound; } export function suppliersFilterToJSON( suppliersFilter: SuppliersFilter, ): string { return JSON.stringify(SuppliersFilter$outboundSchema.parse(suppliersFilter)); } export function suppliersFilterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SuppliersFilter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SuppliersFilter' from JSON`, ); }