/* * 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 RegenerateServiceAccountApiKeyRequest = { orgId: string; saId: string; keyId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** * Rotated (new plaintext returned once) */ export type RegenerateServiceAccountApiKeyResponseBody = { id: string; key: string; start: string; }; /** @internal */ export const RegenerateServiceAccountApiKeyRequest$inboundSchema: z.ZodType< RegenerateServiceAccountApiKeyRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), saId: z.string(), keyId: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type RegenerateServiceAccountApiKeyRequest$Outbound = { orgId: string; saId: string; keyId: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const RegenerateServiceAccountApiKeyRequest$outboundSchema: z.ZodType< RegenerateServiceAccountApiKeyRequest$Outbound, z.ZodTypeDef, RegenerateServiceAccountApiKeyRequest > = z.object({ orgId: z.string(), saId: z.string(), keyId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function regenerateServiceAccountApiKeyRequestToJSON( regenerateServiceAccountApiKeyRequest: RegenerateServiceAccountApiKeyRequest, ): string { return JSON.stringify( RegenerateServiceAccountApiKeyRequest$outboundSchema.parse( regenerateServiceAccountApiKeyRequest, ), ); } export function regenerateServiceAccountApiKeyRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RegenerateServiceAccountApiKeyRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RegenerateServiceAccountApiKeyRequest' from JSON`, ); } /** @internal */ export const RegenerateServiceAccountApiKeyResponseBody$inboundSchema: z.ZodType = z.object({ id: z.string(), key: z.string(), start: z.string(), }); /** @internal */ export type RegenerateServiceAccountApiKeyResponseBody$Outbound = { id: string; key: string; start: string; }; /** @internal */ export const RegenerateServiceAccountApiKeyResponseBody$outboundSchema: z.ZodType< RegenerateServiceAccountApiKeyResponseBody$Outbound, z.ZodTypeDef, RegenerateServiceAccountApiKeyResponseBody > = z.object({ id: z.string(), key: z.string(), start: z.string(), }); export function regenerateServiceAccountApiKeyResponseBodyToJSON( regenerateServiceAccountApiKeyResponseBody: RegenerateServiceAccountApiKeyResponseBody, ): string { return JSON.stringify( RegenerateServiceAccountApiKeyResponseBody$outboundSchema.parse( regenerateServiceAccountApiKeyResponseBody, ), ); } export function regenerateServiceAccountApiKeyResponseBodyFromJSON( jsonString: string, ): SafeParseResult< RegenerateServiceAccountApiKeyResponseBody, SDKValidationError > { return safeParse( jsonString, (x) => RegenerateServiceAccountApiKeyResponseBody$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'RegenerateServiceAccountApiKeyResponseBody' from JSON`, ); }