/* * 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 GetServiceAccountRequest = { orgId: string; saId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type GetServiceAccountServiceAccount = { id: string; orgId: string; name: string; createdAt: string; }; export type GetServiceAccountTeams = { id: string; teamId: string; }; /** * OK */ export type GetServiceAccountResponseBody = { serviceAccount: GetServiceAccountServiceAccount; teams: Array; }; /** @internal */ export const GetServiceAccountRequest$inboundSchema: z.ZodType< GetServiceAccountRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), saId: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type GetServiceAccountRequest$Outbound = { orgId: string; saId: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const GetServiceAccountRequest$outboundSchema: z.ZodType< GetServiceAccountRequest$Outbound, z.ZodTypeDef, GetServiceAccountRequest > = z.object({ orgId: z.string(), saId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function getServiceAccountRequestToJSON( getServiceAccountRequest: GetServiceAccountRequest, ): string { return JSON.stringify( GetServiceAccountRequest$outboundSchema.parse(getServiceAccountRequest), ); } export function getServiceAccountRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetServiceAccountRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetServiceAccountRequest' from JSON`, ); } /** @internal */ export const GetServiceAccountServiceAccount$inboundSchema: z.ZodType< GetServiceAccountServiceAccount, z.ZodTypeDef, unknown > = z.object({ id: z.string(), orgId: z.string(), name: z.string(), createdAt: z.string(), }); /** @internal */ export type GetServiceAccountServiceAccount$Outbound = { id: string; orgId: string; name: string; createdAt: string; }; /** @internal */ export const GetServiceAccountServiceAccount$outboundSchema: z.ZodType< GetServiceAccountServiceAccount$Outbound, z.ZodTypeDef, GetServiceAccountServiceAccount > = z.object({ id: z.string(), orgId: z.string(), name: z.string(), createdAt: z.string(), }); export function getServiceAccountServiceAccountToJSON( getServiceAccountServiceAccount: GetServiceAccountServiceAccount, ): string { return JSON.stringify( GetServiceAccountServiceAccount$outboundSchema.parse( getServiceAccountServiceAccount, ), ); } export function getServiceAccountServiceAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetServiceAccountServiceAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetServiceAccountServiceAccount' from JSON`, ); } /** @internal */ export const GetServiceAccountTeams$inboundSchema: z.ZodType< GetServiceAccountTeams, z.ZodTypeDef, unknown > = z.object({ id: z.string(), teamId: z.string(), }); /** @internal */ export type GetServiceAccountTeams$Outbound = { id: string; teamId: string; }; /** @internal */ export const GetServiceAccountTeams$outboundSchema: z.ZodType< GetServiceAccountTeams$Outbound, z.ZodTypeDef, GetServiceAccountTeams > = z.object({ id: z.string(), teamId: z.string(), }); export function getServiceAccountTeamsToJSON( getServiceAccountTeams: GetServiceAccountTeams, ): string { return JSON.stringify( GetServiceAccountTeams$outboundSchema.parse(getServiceAccountTeams), ); } export function getServiceAccountTeamsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetServiceAccountTeams$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetServiceAccountTeams' from JSON`, ); } /** @internal */ export const GetServiceAccountResponseBody$inboundSchema: z.ZodType< GetServiceAccountResponseBody, z.ZodTypeDef, unknown > = z.object({ serviceAccount: z.lazy(() => GetServiceAccountServiceAccount$inboundSchema), teams: z.array(z.lazy(() => GetServiceAccountTeams$inboundSchema)), }); /** @internal */ export type GetServiceAccountResponseBody$Outbound = { serviceAccount: GetServiceAccountServiceAccount$Outbound; teams: Array; }; /** @internal */ export const GetServiceAccountResponseBody$outboundSchema: z.ZodType< GetServiceAccountResponseBody$Outbound, z.ZodTypeDef, GetServiceAccountResponseBody > = z.object({ serviceAccount: z.lazy(() => GetServiceAccountServiceAccount$outboundSchema), teams: z.array(z.lazy(() => GetServiceAccountTeams$outboundSchema)), }); export function getServiceAccountResponseBodyToJSON( getServiceAccountResponseBody: GetServiceAccountResponseBody, ): string { return JSON.stringify( GetServiceAccountResponseBody$outboundSchema.parse( getServiceAccountResponseBody, ), ); } export function getServiceAccountResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetServiceAccountResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetServiceAccountResponseBody' from JSON`, ); }