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