/* * 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 UpdateServiceAccountApiKeyRequestBody = { scopes: Array; name?: string | undefined; rateLimitEnabled?: boolean | undefined; rateLimitTimeWindow?: number | undefined; rateLimitMax?: number | undefined; }; export type UpdateServiceAccountApiKeyRequest = { orgId: string; saId: string; keyId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; requestBody?: UpdateServiceAccountApiKeyRequestBody | undefined; }; /** * OK */ export type UpdateServiceAccountApiKeyResponseBody = { id: string; updated: boolean; }; /** @internal */ export const UpdateServiceAccountApiKeyRequestBody$inboundSchema: z.ZodType< UpdateServiceAccountApiKeyRequestBody, z.ZodTypeDef, unknown > = z.object({ scopes: z.array(z.string()), name: z.string().optional(), rateLimitEnabled: z.boolean().optional(), rateLimitTimeWindow: z.number().optional(), rateLimitMax: z.number().optional(), }); /** @internal */ export type UpdateServiceAccountApiKeyRequestBody$Outbound = { scopes: Array; name?: string | undefined; rateLimitEnabled?: boolean | undefined; rateLimitTimeWindow?: number | undefined; rateLimitMax?: number | undefined; }; /** @internal */ export const UpdateServiceAccountApiKeyRequestBody$outboundSchema: z.ZodType< UpdateServiceAccountApiKeyRequestBody$Outbound, z.ZodTypeDef, UpdateServiceAccountApiKeyRequestBody > = z.object({ scopes: z.array(z.string()), name: z.string().optional(), rateLimitEnabled: z.boolean().optional(), rateLimitTimeWindow: z.number().optional(), rateLimitMax: z.number().optional(), }); export function updateServiceAccountApiKeyRequestBodyToJSON( updateServiceAccountApiKeyRequestBody: UpdateServiceAccountApiKeyRequestBody, ): string { return JSON.stringify( UpdateServiceAccountApiKeyRequestBody$outboundSchema.parse( updateServiceAccountApiKeyRequestBody, ), ); } export function updateServiceAccountApiKeyRequestBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateServiceAccountApiKeyRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateServiceAccountApiKeyRequestBody' from JSON`, ); } /** @internal */ export const UpdateServiceAccountApiKeyRequest$inboundSchema: z.ZodType< UpdateServiceAccountApiKeyRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), saId: z.string(), keyId: z.string(), "X-On-Behalf-Of": z.string().optional(), RequestBody: z.lazy(() => UpdateServiceAccountApiKeyRequestBody$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "RequestBody": "requestBody", }); }); /** @internal */ export type UpdateServiceAccountApiKeyRequest$Outbound = { orgId: string; saId: string; keyId: string; "X-On-Behalf-Of"?: string | undefined; RequestBody?: UpdateServiceAccountApiKeyRequestBody$Outbound | undefined; }; /** @internal */ export const UpdateServiceAccountApiKeyRequest$outboundSchema: z.ZodType< UpdateServiceAccountApiKeyRequest$Outbound, z.ZodTypeDef, UpdateServiceAccountApiKeyRequest > = z.object({ orgId: z.string(), saId: z.string(), keyId: z.string(), xOnBehalfOf: z.string().optional(), requestBody: z.lazy(() => UpdateServiceAccountApiKeyRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", requestBody: "RequestBody", }); }); export function updateServiceAccountApiKeyRequestToJSON( updateServiceAccountApiKeyRequest: UpdateServiceAccountApiKeyRequest, ): string { return JSON.stringify( UpdateServiceAccountApiKeyRequest$outboundSchema.parse( updateServiceAccountApiKeyRequest, ), ); } export function updateServiceAccountApiKeyRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateServiceAccountApiKeyRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateServiceAccountApiKeyRequest' from JSON`, ); } /** @internal */ export const UpdateServiceAccountApiKeyResponseBody$inboundSchema: z.ZodType< UpdateServiceAccountApiKeyResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), updated: z.boolean(), }); /** @internal */ export type UpdateServiceAccountApiKeyResponseBody$Outbound = { id: string; updated: boolean; }; /** @internal */ export const UpdateServiceAccountApiKeyResponseBody$outboundSchema: z.ZodType< UpdateServiceAccountApiKeyResponseBody$Outbound, z.ZodTypeDef, UpdateServiceAccountApiKeyResponseBody > = z.object({ id: z.string(), updated: z.boolean(), }); export function updateServiceAccountApiKeyResponseBodyToJSON( updateServiceAccountApiKeyResponseBody: UpdateServiceAccountApiKeyResponseBody, ): string { return JSON.stringify( UpdateServiceAccountApiKeyResponseBody$outboundSchema.parse( updateServiceAccountApiKeyResponseBody, ), ); } export function updateServiceAccountApiKeyResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateServiceAccountApiKeyResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateServiceAccountApiKeyResponseBody' from JSON`, ); }