import type { User } from "../_internal/types.gen"; import type { RequestOptions } from "../base-client"; import { RequestBuilder } from "../request-builder"; /** Attributes for admin-level user updates (platform admin flags, password reset). */ export type AdminUpdateUserAttributes = { is_platform_admin?: boolean; password?: string; password_confirmation?: string; }; /** * Attributes accepted when a user updates their own preferences via PATCH /admin/users/:id. * Mirrors the `:update` action's `accept` list. Self-scoped — non-admin callers * can only update their own record. */ export type UpdateUserAttributes = { theme_preference?: string | null; }; export declare function createUsersNamespace(rb: RequestBuilder): { /** * List all users (paginated). * @param options - Optional page and pageSize along with request options * @returns Array of users * @example * ```typescript * const users = await admin.users.list({ page: 1, pageSize: 50 }); * ``` */ list: (options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; /** * List all users (fetches all pages automatically). * @param options - Optional request options. * @returns Complete array of all users * @example * ```typescript * const users = await admin.users.listAll(); * ``` */ listAll: (options?: RequestOptions) => Promise; /** * Get a user by ID. * @param id - User ID * @returns User object * @example * ```typescript * const user = await admin.users.get("user_123"); * ``` */ get: (id: string, options?: RequestOptions) => Promise; /** * Look up a user by email address. * @param email - Email address to search * @returns User object * @example * ```typescript * const user = await admin.users.getByEmail("ada@example.com"); * ``` */ getByEmail: (email: string, options?: RequestOptions) => Promise; /** * Update a user's own preferences (currently `theme_preference`). * Self-scoped via policy: non-admin callers can only update their own record. * @param id - User ID * @param attributes - User preference attributes to update * @returns Updated user * @example * ```typescript * await admin.users.update("user_123", { theme_preference: "dark" }); * ``` */ update: (id: string, attributes: UpdateUserAttributes, options?: RequestOptions) => Promise; /** * Update a user's admin-level attributes (is_platform_admin, is_app_admin). * @param id - User ID * @param attributes - Admin attributes to update * @returns Updated user * @example * ```typescript * await admin.users.adminUpdate("user_123", { is_platform_admin: true }); * ``` */ adminUpdate: (id: string, attributes: AdminUpdateUserAttributes, options?: RequestOptions) => Promise; /** * Change a user's email address (admin action). * @param id - User ID * @param email - New email address * @returns Updated user * @example * ```typescript * await admin.users.adminUpdateEmail("user_123", "new@example.com"); * ``` */ adminUpdateEmail: (id: string, email: string, options?: RequestOptions) => Promise; /** * Confirm a user's email address (admin bypass). * @param id - User ID * @returns Updated user * @example * ```typescript * await admin.users.confirmEmail("user_123"); * ``` */ confirmEmail: (id: string, options?: RequestOptions) => Promise; /** * Trigger a password reset email for a user (admin action). * @param id - User ID * @returns Updated user * @example * ```typescript * await admin.users.triggerPasswordReset("user_123"); * ``` */ triggerPasswordReset: (id: string, options?: RequestOptions) => Promise; /** * Register a new user via invitation token — skips personal tenant creation, * accepts the invitation, and creates the appropriate AccessGrant. * @param email - Email address (must match the invitation) * @param password - Password (min 8 characters) * @param passwordConfirmation - Must match password * @param invitationToken - Raw invitation token from the invitation email * @param attrs - Optional extra attributes (first_name, last_name) * @returns Created user with JWT token * @example * ```typescript * const user = await admin.users.registerViaInvitation( * "ada@example.com", * "correct horse battery staple", * "correct horse battery staple", * "invitation-token", * { first_name: "Ada", last_name: "Lovelace" }, * ); * ``` */ registerViaInvitation: (email: string, password: string, passwordConfirmation: string, invitationToken: string, attrs?: { first_name?: string; last_name?: string; }, options?: RequestOptions) => Promise; /** * Delete a user and all associated data. * @param id - User ID * @param options - Optional request options. * @returns `true` when deletion succeeds. * @example * ```typescript * await admin.users.delete("user_123"); * ``` */ delete: (id: string, options?: RequestOptions) => Promise; }; //# sourceMappingURL=users.d.ts.map