/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { SortDirection, SortDirection$inboundSchema, SortDirection$outboundSchema, } from "./sortdirection.js"; /** * The field on which to sort the Bills */ export const By = { UpdatedAt: "updated_at", CreatedAt: "created_at", } as const; /** * The field on which to sort the Bills */ export type By = ClosedEnum; export type BillsSort = { /** * The field on which to sort the Bills */ by?: By | undefined; /** * The direction in which to sort the results */ direction?: SortDirection | undefined; }; /** @internal */ export const By$inboundSchema: z.ZodNativeEnum = z.nativeEnum(By); /** @internal */ export const By$outboundSchema: z.ZodNativeEnum = By$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace By$ { /** @deprecated use `By$inboundSchema` instead. */ export const inboundSchema = By$inboundSchema; /** @deprecated use `By$outboundSchema` instead. */ export const outboundSchema = By$outboundSchema; } /** @internal */ export const BillsSort$inboundSchema: z.ZodType< BillsSort, z.ZodTypeDef, unknown > = z.object({ by: By$inboundSchema.optional(), direction: SortDirection$inboundSchema.default("asc"), }); /** @internal */ export type BillsSort$Outbound = { by?: string | undefined; direction: string; }; /** @internal */ export const BillsSort$outboundSchema: z.ZodType< BillsSort$Outbound, z.ZodTypeDef, BillsSort > = z.object({ by: By$outboundSchema.optional(), direction: SortDirection$outboundSchema.default("asc"), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BillsSort$ { /** @deprecated use `BillsSort$inboundSchema` instead. */ export const inboundSchema = BillsSort$inboundSchema; /** @deprecated use `BillsSort$outboundSchema` instead. */ export const outboundSchema = BillsSort$outboundSchema; /** @deprecated use `BillsSort$Outbound` instead. */ export type Outbound = BillsSort$Outbound; } export function billsSortToJSON(billsSort: BillsSort): string { return JSON.stringify(BillsSort$outboundSchema.parse(billsSort)); } export function billsSortFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillsSort$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillsSort' from JSON`, ); }