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