aiconfigpost.ts•3.5 kB
/*
* 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";
export const AIConfigPostMode = {
Agent: "agent",
Completion: "completion",
} as const;
export type AIConfigPostMode = ClosedEnum<typeof AIConfigPostMode>;
export type AIConfigPost = {
description?: string | undefined;
key: string;
maintainerId?: string | undefined;
maintainerTeamKey?: string | undefined;
mode?: AIConfigPostMode | undefined;
name: string;
tags?: Array<string> | undefined;
};
/** @internal */
export const AIConfigPostMode$inboundSchema: z.ZodNativeEnum<
typeof AIConfigPostMode
> = z.nativeEnum(AIConfigPostMode);
/** @internal */
export const AIConfigPostMode$outboundSchema: z.ZodNativeEnum<
typeof AIConfigPostMode
> = AIConfigPostMode$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AIConfigPostMode$ {
/** @deprecated use `AIConfigPostMode$inboundSchema` instead. */
export const inboundSchema = AIConfigPostMode$inboundSchema;
/** @deprecated use `AIConfigPostMode$outboundSchema` instead. */
export const outboundSchema = AIConfigPostMode$outboundSchema;
}
/** @internal */
export const AIConfigPost$inboundSchema: z.ZodType<
AIConfigPost,
z.ZodTypeDef,
unknown
> = z.object({
description: z.string().default(""),
key: z.string(),
maintainerId: z.string().optional(),
maintainerTeamKey: z.string().optional(),
mode: AIConfigPostMode$inboundSchema.default("completion"),
name: z.string(),
tags: z.array(z.string()).optional(),
});
/** @internal */
export type AIConfigPost$Outbound = {
description: string;
key: string;
maintainerId?: string | undefined;
maintainerTeamKey?: string | undefined;
mode: string;
name: string;
tags?: Array<string> | undefined;
};
/** @internal */
export const AIConfigPost$outboundSchema: z.ZodType<
AIConfigPost$Outbound,
z.ZodTypeDef,
AIConfigPost
> = z.object({
description: z.string().default(""),
key: z.string(),
maintainerId: z.string().optional(),
maintainerTeamKey: z.string().optional(),
mode: AIConfigPostMode$outboundSchema.default("completion"),
name: z.string(),
tags: z.array(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 AIConfigPost$ {
/** @deprecated use `AIConfigPost$inboundSchema` instead. */
export const inboundSchema = AIConfigPost$inboundSchema;
/** @deprecated use `AIConfigPost$outboundSchema` instead. */
export const outboundSchema = AIConfigPost$outboundSchema;
/** @deprecated use `AIConfigPost$Outbound` instead. */
export type Outbound = AIConfigPost$Outbound;
}
export function aiConfigPostToJSON(aiConfigPost: AIConfigPost): string {
return JSON.stringify(AIConfigPost$outboundSchema.parse(aiConfigPost));
}
export function aiConfigPostFromJSON(
jsonString: string,
): SafeParseResult<AIConfigPost, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigPost$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigPost' from JSON`,
);
}