aiconfigsmetriceventdefaultrep.ts•2.58 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";
export type AiConfigsMetricEventDefaultRep = {
/**
* Whether to disable defaulting missing unit events when calculating results. Defaults to false
*/
disabled?: boolean | undefined;
/**
* The default value applied to missing unit events. Set to 0 when <code>disabled</code> is false. No other values are currently supported.
*/
value?: number | undefined;
};
/** @internal */
export const AiConfigsMetricEventDefaultRep$inboundSchema: z.ZodType<
AiConfigsMetricEventDefaultRep,
z.ZodTypeDef,
unknown
> = z.object({
disabled: z.boolean().optional(),
value: z.number().optional(),
});
/** @internal */
export type AiConfigsMetricEventDefaultRep$Outbound = {
disabled?: boolean | undefined;
value?: number | undefined;
};
/** @internal */
export const AiConfigsMetricEventDefaultRep$outboundSchema: z.ZodType<
AiConfigsMetricEventDefaultRep$Outbound,
z.ZodTypeDef,
AiConfigsMetricEventDefaultRep
> = z.object({
disabled: z.boolean().optional(),
value: z.number().optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AiConfigsMetricEventDefaultRep$ {
/** @deprecated use `AiConfigsMetricEventDefaultRep$inboundSchema` instead. */
export const inboundSchema = AiConfigsMetricEventDefaultRep$inboundSchema;
/** @deprecated use `AiConfigsMetricEventDefaultRep$outboundSchema` instead. */
export const outboundSchema = AiConfigsMetricEventDefaultRep$outboundSchema;
/** @deprecated use `AiConfigsMetricEventDefaultRep$Outbound` instead. */
export type Outbound = AiConfigsMetricEventDefaultRep$Outbound;
}
export function aiConfigsMetricEventDefaultRepToJSON(
aiConfigsMetricEventDefaultRep: AiConfigsMetricEventDefaultRep,
): string {
return JSON.stringify(
AiConfigsMetricEventDefaultRep$outboundSchema.parse(
aiConfigsMetricEventDefaultRep,
),
);
}
export function aiConfigsMetricEventDefaultRepFromJSON(
jsonString: string,
): SafeParseResult<AiConfigsMetricEventDefaultRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => AiConfigsMetricEventDefaultRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AiConfigsMetricEventDefaultRep' from JSON`,
);
}