/* * 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 Customers */ export const CreditNotesSortBy = { CreatedAt: "created_at", UpdatedAt: "updated_at", } as const; /** * The field on which to sort the Customers */ export type CreditNotesSortBy = ClosedEnum; export type CreditNotesSort = { /** * The field on which to sort the Customers */ by?: CreditNotesSortBy | undefined; /** * The direction in which to sort the results */ direction?: SortDirection | undefined; }; /** @internal */ export const CreditNotesSortBy$inboundSchema: z.ZodNativeEnum< typeof CreditNotesSortBy > = z.nativeEnum(CreditNotesSortBy); /** @internal */ export const CreditNotesSortBy$outboundSchema: z.ZodNativeEnum< typeof CreditNotesSortBy > = CreditNotesSortBy$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CreditNotesSortBy$ { /** @deprecated use `CreditNotesSortBy$inboundSchema` instead. */ export const inboundSchema = CreditNotesSortBy$inboundSchema; /** @deprecated use `CreditNotesSortBy$outboundSchema` instead. */ export const outboundSchema = CreditNotesSortBy$outboundSchema; } /** @internal */ export const CreditNotesSort$inboundSchema: z.ZodType< CreditNotesSort, z.ZodTypeDef, unknown > = z.object({ by: CreditNotesSortBy$inboundSchema.optional(), direction: SortDirection$inboundSchema.default("asc"), }); /** @internal */ export type CreditNotesSort$Outbound = { by?: string | undefined; direction: string; }; /** @internal */ export const CreditNotesSort$outboundSchema: z.ZodType< CreditNotesSort$Outbound, z.ZodTypeDef, CreditNotesSort > = z.object({ by: CreditNotesSortBy$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 CreditNotesSort$ { /** @deprecated use `CreditNotesSort$inboundSchema` instead. */ export const inboundSchema = CreditNotesSort$inboundSchema; /** @deprecated use `CreditNotesSort$outboundSchema` instead. */ export const outboundSchema = CreditNotesSort$outboundSchema; /** @deprecated use `CreditNotesSort$Outbound` instead. */ export type Outbound = CreditNotesSort$Outbound; } export function creditNotesSortToJSON( creditNotesSort: CreditNotesSort, ): string { return JSON.stringify(CreditNotesSort$outboundSchema.parse(creditNotesSort)); } export function creditNotesSortFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreditNotesSort$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreditNotesSort' from JSON`, ); }