/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetOrgRateLimitRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** * OK */ export type GetOrgRateLimitResponseBody = { id: string; rateLimitEnabled: boolean; rateLimitTimeWindow: number | null; rateLimitMax: number | null; }; /** @internal */ export const GetOrgRateLimitRequest$inboundSchema: z.ZodType< GetOrgRateLimitRequest, 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 GetOrgRateLimitRequest$Outbound = { orgId: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const GetOrgRateLimitRequest$outboundSchema: z.ZodType< GetOrgRateLimitRequest$Outbound, z.ZodTypeDef, GetOrgRateLimitRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function getOrgRateLimitRequestToJSON( getOrgRateLimitRequest: GetOrgRateLimitRequest, ): string { return JSON.stringify( GetOrgRateLimitRequest$outboundSchema.parse(getOrgRateLimitRequest), ); } export function getOrgRateLimitRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetOrgRateLimitRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetOrgRateLimitRequest' from JSON`, ); } /** @internal */ export const GetOrgRateLimitResponseBody$inboundSchema: z.ZodType< GetOrgRateLimitResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), rateLimitEnabled: z.boolean(), rateLimitTimeWindow: z.nullable(z.number()), rateLimitMax: z.nullable(z.number()), }); /** @internal */ export type GetOrgRateLimitResponseBody$Outbound = { id: string; rateLimitEnabled: boolean; rateLimitTimeWindow: number | null; rateLimitMax: number | null; }; /** @internal */ export const GetOrgRateLimitResponseBody$outboundSchema: z.ZodType< GetOrgRateLimitResponseBody$Outbound, z.ZodTypeDef, GetOrgRateLimitResponseBody > = z.object({ id: z.string(), rateLimitEnabled: z.boolean(), rateLimitTimeWindow: z.nullable(z.number()), rateLimitMax: z.nullable(z.number()), }); export function getOrgRateLimitResponseBodyToJSON( getOrgRateLimitResponseBody: GetOrgRateLimitResponseBody, ): string { return JSON.stringify( GetOrgRateLimitResponseBody$outboundSchema.parse( getOrgRateLimitResponseBody, ), ); } export function getOrgRateLimitResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetOrgRateLimitResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetOrgRateLimitResponseBody' from JSON`, ); }