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