/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../lib/schemas.js"; import * as openEnums from "../types/enums.js"; import { OpenEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./errors/sdk-validation-error.js"; export const Role = { Owner: "owner", Admin: "admin", Viewer: "viewer", Member: "member", Disabled: "disabled", Pending: "pending", } as const; export type Role = OpenEnum; export type User = { id: string; username: string; displayName: string; thumbUrl: string | null; avatarUrl: string | null; role: Role; /** * 0-100 */ trustScore: number; totalViolations: number; serverId: string; serverName: string; lastActivityAt: Date | null; sessionCount: number; createdAt: Date; }; /** @internal */ export const Role$inboundSchema: z.ZodMiniType = openEnums .inboundSchema(Role); /** @internal */ export const User$inboundSchema: z.ZodMiniType = z.object({ id: types.string(), username: types.string(), displayName: types.string(), thumbUrl: types.nullable(types.string()), avatarUrl: types.nullable(types.string()), role: Role$inboundSchema, trustScore: types.number(), totalViolations: types.number(), serverId: types.string(), serverName: types.string(), lastActivityAt: types.nullable(types.date()), sessionCount: types.number(), createdAt: types.date(), }); export function userFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => User$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'User' from JSON`, ); }