@jupyterlab/services
Version:
Client APIs for the Jupyter services REST APIs
88 lines (87 loc) • 2.52 kB
TypeScript
import { ReadonlyJSONObject } from '@lumino/coreutils';
import { Poll } from '@lumino/polling';
import { ISignal } from '@lumino/signaling';
import { BaseManager } from '../basemanager';
import { ServerConnection } from '../serverconnection';
import * as User from './user';
/**
* The user API service manager.
*/
export declare class UserManager extends BaseManager implements User.IManager {
/**
* Create a new user manager.
*/
constructor(options?: UserManager.IOptions);
/**
* The server settings for the manager.
*/
readonly serverSettings: ServerConnection.ISettings;
/**
* Test whether the manager is ready.
*/
get isReady(): boolean;
/**
* A promise that fulfills when the manager is ready.
*/
get ready(): Promise<void>;
/**
* Get the most recently fetched identity.
*/
get identity(): User.IIdentity | null;
/**
* Get the most recently fetched permissions.
*/
get permissions(): ReadonlyJSONObject | null;
/**
* A signal emitted when the user changes.
*/
get userChanged(): ISignal<this, User.IUser>;
/**
* A signal emitted when there is a connection failure.
*/
get connectionFailure(): ISignal<this, Error>;
/**
* Dispose of the resources used by the manager.
*/
dispose(): void;
/**
* Force a refresh of the user data from the server.
*
* @returns A promise that resolves when the user info is fetched.
*
* #### Notes
* This is intended to be called only in response to a user action,
* since the manager maintains its internal state.
*/
refreshUser(): Promise<void>;
/**
* Execute a request to the server to poll the user and update state.
*/
protected requestUser(): Promise<void>;
private _isReady;
private _ready;
private _pollUser;
private _identity;
private _permissions;
private _userChanged;
private _connectionFailure;
private _userApiClient;
}
/**
* A namespace for `UserManager` statics.
*/
export declare namespace UserManager {
/**
* The instantiation options for a user manager.
*/
interface IOptions extends BaseManager.IOptions {
/**
* When the manager stops polling the API. Defaults to `when-hidden`.
*/
standby?: Poll.Standby | (() => boolean | Poll.Standby);
/**
* The user API client.
*/
userApiClient?: User.IUserAPIClient;
}
}