UNPKG

@ztimson/momentum

Version:

Client library for momentum

70 lines 2.23 kB
import { PromiseProgress } from '@ztimson/utils'; import { AssetController } from './asset-controller'; import { Alert, Meta } from './core'; import { Momentum } from './momentum'; import { Socket } from './sockets'; export type User = Meta & { /** Username */ readonly _id: string; /** Full name */ name: string; /** Contact email */ email: string | null; /** Contact phone number */ phone: string | null; /** Full primary address */ address: string | null; /** Disable account */ disabled: boolean; /** Group membership */ groups: string[]; /** UI dashboard page */ dashboardUrl: string | null; /** Redirect user to URL on login */ loginRedirect: string | null; /** Subscribed alerts */ alerts: Alert[]; /** User permissions */ permissions: string[]; /** User notes, not available without update permission */ notes: string; /** Custom data, overrides group custom data */ custom: { [key: string]: any; }; /** Account balance */ readonly balance?: number; /** Profile image URL */ readonly image?: string; /** Last login timestamp */ readonly lastLogin?: null | { from: Date; to: Date | null; }; /** Locked from useful login attempts */ readonly locked?: null | { from: Date; to: Date | null; }; /** Product subscriptions */ readonly subscriptions?: any[]; /** 2FA method */ readonly totp?: string; }; /** System users */ export declare class Users extends AssetController<User> { protected momentum: Momentum; protected socket?: Socket | undefined; constructor(momentum: Momentum, socket?: Socket | undefined); protected afterRead(user: any): any; protected beforeWrite(user: any): any; profileImage(username: string, token?: boolean): string; /** * Upload new profile image for user * @param {string} username Target user * @param {File} file File from form input * @return {PromiseProgress<void>} Returns once upload is complete, provides progress callback */ uploadImage(username: string, file: File): PromiseProgress<void>; } //# sourceMappingURL=users.d.ts.map