/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; 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 type GetTeamDefaultBudgetsRequest = { orgId?: string | undefined; }; export const GetTeamDefaultBudgetsScope = { Org: "org", Apikey: "apikey", User: "user", Team: "team", ExternalUser: "external_user", UserDefault: "user_default", TeamDefault: "team_default", ExternalUserDefault: "external_user_default", } as const; export type GetTeamDefaultBudgetsScope = ClosedEnum< typeof GetTeamDefaultBudgetsScope >; export const GetTeamDefaultBudgetsOwner = { Cluster: "cluster", Org: "org", } as const; export type GetTeamDefaultBudgetsOwner = ClosedEnum< typeof GetTeamDefaultBudgetsOwner >; export const GetTeamDefaultBudgetsPeriod = { Daily: "daily", Weekly: "weekly", Monthly: "monthly", } as const; export type GetTeamDefaultBudgetsPeriod = ClosedEnum< typeof GetTeamDefaultBudgetsPeriod >; export const GetTeamDefaultBudgetsAction = { Alert: "alert", Block: "block", } as const; export type GetTeamDefaultBudgetsAction = ClosedEnum< typeof GetTeamDefaultBudgetsAction >; export type GetTeamDefaultBudgetsThresholds = { pct: number; action: GetTeamDefaultBudgetsAction; }; export type GetTeamDefaultBudgetsData = { id: string; scope: GetTeamDefaultBudgetsScope; scopeId: string; scopeOrgId: string | null; owner: GetTeamDefaultBudgetsOwner; period: GetTeamDefaultBudgetsPeriod; limit: number; thresholds: Array; alertWebhookUrl: string | null; }; /** * OK */ export type GetTeamDefaultBudgetsResponseBody = { object: "list"; data: Array; }; /** @internal */ export const GetTeamDefaultBudgetsRequest$inboundSchema: z.ZodType< GetTeamDefaultBudgetsRequest, z.ZodTypeDef, unknown > = z.object({ org_id: z.string().optional(), }).transform((v) => { return remap$(v, { "org_id": "orgId", }); }); /** @internal */ export type GetTeamDefaultBudgetsRequest$Outbound = { org_id?: string | undefined; }; /** @internal */ export const GetTeamDefaultBudgetsRequest$outboundSchema: z.ZodType< GetTeamDefaultBudgetsRequest$Outbound, z.ZodTypeDef, GetTeamDefaultBudgetsRequest > = z.object({ orgId: z.string().optional(), }).transform((v) => { return remap$(v, { orgId: "org_id", }); }); export function getTeamDefaultBudgetsRequestToJSON( getTeamDefaultBudgetsRequest: GetTeamDefaultBudgetsRequest, ): string { return JSON.stringify( GetTeamDefaultBudgetsRequest$outboundSchema.parse( getTeamDefaultBudgetsRequest, ), ); } export function getTeamDefaultBudgetsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetTeamDefaultBudgetsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTeamDefaultBudgetsRequest' from JSON`, ); } /** @internal */ export const GetTeamDefaultBudgetsScope$inboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsScope > = z.nativeEnum(GetTeamDefaultBudgetsScope); /** @internal */ export const GetTeamDefaultBudgetsScope$outboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsScope > = GetTeamDefaultBudgetsScope$inboundSchema; /** @internal */ export const GetTeamDefaultBudgetsOwner$inboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsOwner > = z.nativeEnum(GetTeamDefaultBudgetsOwner); /** @internal */ export const GetTeamDefaultBudgetsOwner$outboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsOwner > = GetTeamDefaultBudgetsOwner$inboundSchema; /** @internal */ export const GetTeamDefaultBudgetsPeriod$inboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsPeriod > = z.nativeEnum(GetTeamDefaultBudgetsPeriod); /** @internal */ export const GetTeamDefaultBudgetsPeriod$outboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsPeriod > = GetTeamDefaultBudgetsPeriod$inboundSchema; /** @internal */ export const GetTeamDefaultBudgetsAction$inboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsAction > = z.nativeEnum(GetTeamDefaultBudgetsAction); /** @internal */ export const GetTeamDefaultBudgetsAction$outboundSchema: z.ZodNativeEnum< typeof GetTeamDefaultBudgetsAction > = GetTeamDefaultBudgetsAction$inboundSchema; /** @internal */ export const GetTeamDefaultBudgetsThresholds$inboundSchema: z.ZodType< GetTeamDefaultBudgetsThresholds, z.ZodTypeDef, unknown > = z.object({ pct: z.number().int(), action: GetTeamDefaultBudgetsAction$inboundSchema, }); /** @internal */ export type GetTeamDefaultBudgetsThresholds$Outbound = { pct: number; action: string; }; /** @internal */ export const GetTeamDefaultBudgetsThresholds$outboundSchema: z.ZodType< GetTeamDefaultBudgetsThresholds$Outbound, z.ZodTypeDef, GetTeamDefaultBudgetsThresholds > = z.object({ pct: z.number().int(), action: GetTeamDefaultBudgetsAction$outboundSchema, }); export function getTeamDefaultBudgetsThresholdsToJSON( getTeamDefaultBudgetsThresholds: GetTeamDefaultBudgetsThresholds, ): string { return JSON.stringify( GetTeamDefaultBudgetsThresholds$outboundSchema.parse( getTeamDefaultBudgetsThresholds, ), ); } export function getTeamDefaultBudgetsThresholdsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetTeamDefaultBudgetsThresholds$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTeamDefaultBudgetsThresholds' from JSON`, ); } /** @internal */ export const GetTeamDefaultBudgetsData$inboundSchema: z.ZodType< GetTeamDefaultBudgetsData, z.ZodTypeDef, unknown > = z.object({ id: z.string(), scope: GetTeamDefaultBudgetsScope$inboundSchema, scope_id: z.string(), scope_org_id: z.nullable(z.string()), owner: GetTeamDefaultBudgetsOwner$inboundSchema, period: GetTeamDefaultBudgetsPeriod$inboundSchema, limit: z.number(), thresholds: z.array( z.lazy(() => GetTeamDefaultBudgetsThresholds$inboundSchema), ), alert_webhook_url: z.nullable(z.string()), }).transform((v) => { return remap$(v, { "scope_id": "scopeId", "scope_org_id": "scopeOrgId", "alert_webhook_url": "alertWebhookUrl", }); }); /** @internal */ export type GetTeamDefaultBudgetsData$Outbound = { id: string; scope: string; scope_id: string; scope_org_id: string | null; owner: string; period: string; limit: number; thresholds: Array; alert_webhook_url: string | null; }; /** @internal */ export const GetTeamDefaultBudgetsData$outboundSchema: z.ZodType< GetTeamDefaultBudgetsData$Outbound, z.ZodTypeDef, GetTeamDefaultBudgetsData > = z.object({ id: z.string(), scope: GetTeamDefaultBudgetsScope$outboundSchema, scopeId: z.string(), scopeOrgId: z.nullable(z.string()), owner: GetTeamDefaultBudgetsOwner$outboundSchema, period: GetTeamDefaultBudgetsPeriod$outboundSchema, limit: z.number(), thresholds: z.array( z.lazy(() => GetTeamDefaultBudgetsThresholds$outboundSchema), ), alertWebhookUrl: z.nullable(z.string()), }).transform((v) => { return remap$(v, { scopeId: "scope_id", scopeOrgId: "scope_org_id", alertWebhookUrl: "alert_webhook_url", }); }); export function getTeamDefaultBudgetsDataToJSON( getTeamDefaultBudgetsData: GetTeamDefaultBudgetsData, ): string { return JSON.stringify( GetTeamDefaultBudgetsData$outboundSchema.parse(getTeamDefaultBudgetsData), ); } export function getTeamDefaultBudgetsDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetTeamDefaultBudgetsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTeamDefaultBudgetsData' from JSON`, ); } /** @internal */ export const GetTeamDefaultBudgetsResponseBody$inboundSchema: z.ZodType< GetTeamDefaultBudgetsResponseBody, z.ZodTypeDef, unknown > = z.object({ object: z.literal("list"), data: z.array(z.lazy(() => GetTeamDefaultBudgetsData$inboundSchema)), }); /** @internal */ export type GetTeamDefaultBudgetsResponseBody$Outbound = { object: "list"; data: Array; }; /** @internal */ export const GetTeamDefaultBudgetsResponseBody$outboundSchema: z.ZodType< GetTeamDefaultBudgetsResponseBody$Outbound, z.ZodTypeDef, GetTeamDefaultBudgetsResponseBody > = z.object({ object: z.literal("list"), data: z.array(z.lazy(() => GetTeamDefaultBudgetsData$outboundSchema)), }); export function getTeamDefaultBudgetsResponseBodyToJSON( getTeamDefaultBudgetsResponseBody: GetTeamDefaultBudgetsResponseBody, ): string { return JSON.stringify( GetTeamDefaultBudgetsResponseBody$outboundSchema.parse( getTeamDefaultBudgetsResponseBody, ), ); } export function getTeamDefaultBudgetsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetTeamDefaultBudgetsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTeamDefaultBudgetsResponseBody' from JSON`, ); }