UNPKG

@gooddata/gooddata-js

Version:
118 lines (117 loc) 3.89 kB
import { XhrModule, ApiResponse } from "./xhr"; export interface IUserConfigsSettingItem { settingItem: { key: string; links: { self: string; }; source: string; value: string; }; } export interface IUserConfigsResponse { settings: { items: IUserConfigsSettingItem[]; }; } export declare class UserModule { private xhr; constructor(xhr: XhrModule); /** * Find out whether a user is logged in * * @return {Promise} resolves with true if user logged in, false otherwise * @method isLoggedIn */ isLoggedIn(): Promise<boolean>; /** * Find out whether a specified project is available to a currently logged user * * @method isLoggedInProject * @param {String} projectId A project identifier * @return {Promise} Resolves with true if user logged in and project available, * resolves with false if user logged in and project not available, * rejects if user not logged in */ isLoggedInProject(projectId: string): Promise<{}>; /** * This function provides an authentication entry point to the GD API. It is needed to authenticate * by calling this function prior any other API calls. After providing valid credentials * every subsequent API call in a current session will be authenticated. * * @method login * @param {String} username * @param {String} password */ login(username: string, password: string): Promise<any>; /** * This function provides an authentication entry point to the GD API via SSO * https://help.gooddata.com/display/developer/GoodData+PGP+Single+Sign-On * * @method loginSso * @param {String} encryptedClaims PGP message * @param {String} ssoProvider * @param {String} targetUrl */ loginSso(encryptedClaims: string, ssoProvider: string, targetUrl: string): Promise<ApiResponse>; /** * Logs out current user * @method logout */ logout(): Promise<ApiResponse | void>; /** * Gets current user's profile * @method getCurrentProfile * @return {Promise} Resolves with account setting object */ getCurrentProfile(): Promise<any>; /** * Updates user's profile settings * @method updateProfileSettings * @param {String} profileId - User profile identifier * @param {Object} profileSetting */ updateProfileSettings(profileId: string, profileSetting: any): Promise<ApiResponse>; /** * Returns info about currently logged in user from bootstrap resource * @method getAccountInfo */ getAccountInfo(): Promise<{ login: any; loginMD5: any; firstName: any; lastName: any; organizationName: any; profileUri: any; }>; /** * Returns current user info from bootstrapData * @method getAccountInfoInBootstrap * @param bootstrapData - data was got from bootstrap resource */ getAccountInfoInBootstrap(bootstrapData: any): { login: any; loginMD5: any; firstName: any; lastName: any; organizationName: any; profileUri: any; }; /** * Gets user configs including user specific feature flags * * @param {String} userId - A user identifier * @return {IUserConfigsSettingItem[]} An array of user configs setting item */ getUserConfigs(userId: string): Promise<IUserConfigsSettingItem[]>; /** * Returns the feature flags valid for the currently logged in user. * @method getFeatureFlags */ getFeatureFlags(): Promise<any>; /** * Initiates SPI SAML SSO * @param relayState URL of the page where the user is redirected after a successful login */ initiateSamlSso(relayState: string): void; }