/* * 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 GetOrgQuotaRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export const GetOrgQuotaQuotaPeriod = { Day: "day", Month: "month", } as const; export type GetOrgQuotaQuotaPeriod = ClosedEnum; /** * OK */ export type GetOrgQuotaResponseBody = { id: string; quotaEnabled: boolean; quotaPeriod: GetOrgQuotaQuotaPeriod | null; quotaMax: number | null; }; /** @internal */ export const GetOrgQuotaRequest$inboundSchema: z.ZodType< GetOrgQuotaRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type GetOrgQuotaRequest$Outbound = { orgId: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const GetOrgQuotaRequest$outboundSchema: z.ZodType< GetOrgQuotaRequest$Outbound, z.ZodTypeDef, GetOrgQuotaRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function getOrgQuotaRequestToJSON( getOrgQuotaRequest: GetOrgQuotaRequest, ): string { return JSON.stringify( GetOrgQuotaRequest$outboundSchema.parse(getOrgQuotaRequest), ); } export function getOrgQuotaRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetOrgQuotaRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetOrgQuotaRequest' from JSON`, ); } /** @internal */ export const GetOrgQuotaQuotaPeriod$inboundSchema: z.ZodNativeEnum< typeof GetOrgQuotaQuotaPeriod > = z.nativeEnum(GetOrgQuotaQuotaPeriod); /** @internal */ export const GetOrgQuotaQuotaPeriod$outboundSchema: z.ZodNativeEnum< typeof GetOrgQuotaQuotaPeriod > = GetOrgQuotaQuotaPeriod$inboundSchema; /** @internal */ export const GetOrgQuotaResponseBody$inboundSchema: z.ZodType< GetOrgQuotaResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), quotaEnabled: z.boolean(), quotaPeriod: z.nullable(GetOrgQuotaQuotaPeriod$inboundSchema), quotaMax: z.nullable(z.number()), }); /** @internal */ export type GetOrgQuotaResponseBody$Outbound = { id: string; quotaEnabled: boolean; quotaPeriod: string | null; quotaMax: number | null; }; /** @internal */ export const GetOrgQuotaResponseBody$outboundSchema: z.ZodType< GetOrgQuotaResponseBody$Outbound, z.ZodTypeDef, GetOrgQuotaResponseBody > = z.object({ id: z.string(), quotaEnabled: z.boolean(), quotaPeriod: z.nullable(GetOrgQuotaQuotaPeriod$outboundSchema), quotaMax: z.nullable(z.number()), }); export function getOrgQuotaResponseBodyToJSON( getOrgQuotaResponseBody: GetOrgQuotaResponseBody, ): string { return JSON.stringify( GetOrgQuotaResponseBody$outboundSchema.parse(getOrgQuotaResponseBody), ); } export function getOrgQuotaResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetOrgQuotaResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetOrgQuotaResponseBody' from JSON`, ); }