/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { CommandTrigger, CommandTrigger$inboundSchema, CommandTrigger$outboundSchema, } from "./commandtrigger.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type CommandInput = { sendUpdatesToClient?: boolean | undefined; lastExecutionTime?: Date | null | undefined; lastStartTime?: Date | null | undefined; trigger?: CommandTrigger | undefined; suppressMessages?: boolean | undefined; clientUserAgent?: string | null | undefined; }; /** @internal */ export const CommandInput$inboundSchema: z.ZodType< CommandInput, z.ZodTypeDef, unknown > = z.object({ sendUpdatesToClient: z.boolean().optional(), lastExecutionTime: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), lastStartTime: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), trigger: CommandTrigger$inboundSchema.optional(), suppressMessages: z.boolean().optional(), clientUserAgent: z.nullable(z.string()).optional(), }); /** @internal */ export type CommandInput$Outbound = { sendUpdatesToClient?: boolean | undefined; lastExecutionTime?: string | null | undefined; lastStartTime?: string | null | undefined; trigger?: string | undefined; suppressMessages?: boolean | undefined; clientUserAgent?: string | null | undefined; }; /** @internal */ export const CommandInput$outboundSchema: z.ZodType< CommandInput$Outbound, z.ZodTypeDef, CommandInput > = z.object({ sendUpdatesToClient: z.boolean().optional(), lastExecutionTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), lastStartTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), trigger: CommandTrigger$outboundSchema.optional(), suppressMessages: z.boolean().optional(), clientUserAgent: z.nullable(z.string()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CommandInput$ { /** @deprecated use `CommandInput$inboundSchema` instead. */ export const inboundSchema = CommandInput$inboundSchema; /** @deprecated use `CommandInput$outboundSchema` instead. */ export const outboundSchema = CommandInput$outboundSchema; /** @deprecated use `CommandInput$Outbound` instead. */ export type Outbound = CommandInput$Outbound; } export function commandInputToJSON(commandInput: CommandInput): string { return JSON.stringify(CommandInput$outboundSchema.parse(commandInput)); } export function commandInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CommandInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CommandInput' from JSON`, ); }