/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: f9d2518a97b8 */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { UserRole, UserRole$inboundSchema } from "./userrole.js"; /** * Authenticated user subject with workspace-scoped permissions */ export type UserSubject = { /** * Subject type identifier */ kind: "user"; /** * Unique user identifier */ id: string; /** * User's email address */ email: string; /** * ID of the workspace the user is authenticated within */ workspaceId: string; /** * Name of the workspace the user is authenticated within */ workspaceName?: string | undefined; /** * User's role within the workspace */ role: UserRole; }; /** @internal */ export const UserSubject$inboundSchema: z.ZodType = z .object({ kind: z.literal("user"), id: z.string(), email: z.string(), workspaceId: z.string(), workspaceName: z.string().optional(), role: UserRole$inboundSchema, }); export function userSubjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UserSubject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserSubject' from JSON`, ); }