/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; 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"; /** * Information about the authenticated portal user. */ export type PortalAuthenticatedUser = { /** * Type of authenticated user: 'customer' or 'member' */ type: string; /** * User's name, if available. */ name: string | null; /** * User's email address. */ email: string; /** * Associated customer ID. */ customerId: string; /** * Member ID. Only set for members. */ memberId?: string | null | undefined; /** * Member role (owner, billing_manager, member). Only set for members. */ role?: string | null | undefined; }; /** @internal */ export const PortalAuthenticatedUser$inboundSchema: z.ZodMiniType< PortalAuthenticatedUser, unknown > = z.pipe( z.object({ type: z.string(), name: z.nullable(z.string()), email: z.string(), customer_id: z.string(), member_id: z.optional(z.nullable(z.string())), role: z.optional(z.nullable(z.string())), }), z.transform((v) => { return remap$(v, { "customer_id": "customerId", "member_id": "memberId", }); }), ); export function portalAuthenticatedUserFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PortalAuthenticatedUser$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PortalAuthenticatedUser' from JSON`, ); }