/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 5e40ad9515b7 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PossibleValue, PossibleValue$inboundSchema, PossibleValue$Outbound, PossibleValue$outboundSchema, } from "./possiblevalue.js"; /** * The type of the value (e.g., integer, string, boolean, etc.) */ export const WriteActionParameterType = { Unknown: "UNKNOWN", Integer: "INTEGER", String: "STRING", Boolean: "BOOLEAN", } as const; /** * The type of the value (e.g., integer, string, boolean, etc.) */ export type WriteActionParameterType = OpenEnum< typeof WriteActionParameterType >; export type WriteActionParameter = { /** * The type of the value (e.g., integer, string, boolean, etc.) */ type?: WriteActionParameterType | undefined; /** * Human readable display name for the key. */ displayName?: string | undefined; /** * The value of the field. */ value?: string | undefined; /** * Is the parameter a required field. */ isRequired?: boolean | undefined; /** * Description of the parameter. */ description?: string | undefined; /** * Possible values that the parameter can take. */ possibleValues?: Array | undefined; }; /** @internal */ export const WriteActionParameterType$inboundSchema: z.ZodType< WriteActionParameterType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(WriteActionParameterType); /** @internal */ export const WriteActionParameterType$outboundSchema: z.ZodType< string, z.ZodTypeDef, WriteActionParameterType > = openEnums.outboundSchema(WriteActionParameterType); /** @internal */ export const WriteActionParameter$inboundSchema: z.ZodType< WriteActionParameter, z.ZodTypeDef, unknown > = z.object({ type: WriteActionParameterType$inboundSchema.optional(), displayName: z.string().optional(), value: z.string().optional(), isRequired: z.boolean().optional(), description: z.string().optional(), possibleValues: z.array(PossibleValue$inboundSchema).optional(), }); /** @internal */ export type WriteActionParameter$Outbound = { type?: string | undefined; displayName?: string | undefined; value?: string | undefined; isRequired?: boolean | undefined; description?: string | undefined; possibleValues?: Array | undefined; }; /** @internal */ export const WriteActionParameter$outboundSchema: z.ZodType< WriteActionParameter$Outbound, z.ZodTypeDef, WriteActionParameter > = z.object({ type: WriteActionParameterType$outboundSchema.optional(), displayName: z.string().optional(), value: z.string().optional(), isRequired: z.boolean().optional(), description: z.string().optional(), possibleValues: z.array(PossibleValue$outboundSchema).optional(), }); export function writeActionParameterToJSON( writeActionParameter: WriteActionParameter, ): string { return JSON.stringify( WriteActionParameter$outboundSchema.parse(writeActionParameter), ); } export function writeActionParameterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WriteActionParameter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WriteActionParameter' from JSON`, ); }