aiconfigsaccessdenied.ts•2.32 kB
/*
* 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
AiConfigsAccessDeniedReason,
AiConfigsAccessDeniedReason$inboundSchema,
AiConfigsAccessDeniedReason$Outbound,
AiConfigsAccessDeniedReason$outboundSchema,
} from "./aiconfigsaccessdeniedreason.js";
export type AiConfigsAccessDenied = {
action: string;
reason: AiConfigsAccessDeniedReason;
};
/** @internal */
export const AiConfigsAccessDenied$inboundSchema: z.ZodType<
AiConfigsAccessDenied,
z.ZodTypeDef,
unknown
> = z.object({
action: z.string(),
reason: AiConfigsAccessDeniedReason$inboundSchema,
});
/** @internal */
export type AiConfigsAccessDenied$Outbound = {
action: string;
reason: AiConfigsAccessDeniedReason$Outbound;
};
/** @internal */
export const AiConfigsAccessDenied$outboundSchema: z.ZodType<
AiConfigsAccessDenied$Outbound,
z.ZodTypeDef,
AiConfigsAccessDenied
> = z.object({
action: z.string(),
reason: AiConfigsAccessDeniedReason$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AiConfigsAccessDenied$ {
/** @deprecated use `AiConfigsAccessDenied$inboundSchema` instead. */
export const inboundSchema = AiConfigsAccessDenied$inboundSchema;
/** @deprecated use `AiConfigsAccessDenied$outboundSchema` instead. */
export const outboundSchema = AiConfigsAccessDenied$outboundSchema;
/** @deprecated use `AiConfigsAccessDenied$Outbound` instead. */
export type Outbound = AiConfigsAccessDenied$Outbound;
}
export function aiConfigsAccessDeniedToJSON(
aiConfigsAccessDenied: AiConfigsAccessDenied,
): string {
return JSON.stringify(
AiConfigsAccessDenied$outboundSchema.parse(aiConfigsAccessDenied),
);
}
export function aiConfigsAccessDeniedFromJSON(
jsonString: string,
): SafeParseResult<AiConfigsAccessDenied, SDKValidationError> {
return safeParse(
jsonString,
(x) => AiConfigsAccessDenied$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AiConfigsAccessDenied' from JSON`,
);
}