1 | import { XhrModule, ApiResponse } from "./xhr";
|
2 | export interface IUserConfigsSettingItem {
|
3 | settingItem: {
|
4 | key: string;
|
5 | links: {
|
6 | self: string;
|
7 | };
|
8 | source: string;
|
9 | value: string;
|
10 | };
|
11 | }
|
12 | export interface IUserConfigsResponse {
|
13 | settings: {
|
14 | items: IUserConfigsSettingItem[];
|
15 | };
|
16 | }
|
17 | export declare class UserModule {
|
18 | private xhr;
|
19 | constructor(xhr: XhrModule);
|
20 | /**
|
21 | * Find out whether a user is logged in
|
22 | *
|
23 | * @return {Promise} resolves with true if user logged in, false otherwise
|
24 | * isLoggedIn
|
25 | */
|
26 | isLoggedIn(): Promise<boolean>;
|
27 | /**
|
28 | * Find out whether a specified project is available to a currently logged user
|
29 | *
|
30 | * @method isLoggedInProject
|
31 | * @param {String} projectId A project identifier
|
32 | * @return {Promise} Resolves with true if user logged in and project available,
|
33 | * resolves with false if user logged in and project not available,
|
34 | * rejects if user not logged in
|
35 | */
|
36 | isLoggedInProject(projectId: string): Promise<{}>;
|
37 | /**
|
38 | * This function provides an authentication entry point to the GD API. It is needed to authenticate
|
39 | * by calling this function prior any other API calls. After providing valid credentials
|
40 | * every subsequent API call in a current session will be authenticated.
|
41 | *
|
42 | * @method login
|
43 | * @param {String} username
|
44 | * @param {String} password
|
45 | */
|
46 | login(username: string, password: string): Promise<any>;
|
47 | /**
|
48 | * This function provides an authentication entry point to the GD API via SSO
|
49 | * https://help.gooddata.com/display/developer/GoodData+PGP+Single+Sign-On
|
50 | *
|
51 | * @method loginSso
|
52 | * @param {String} encryptedClaims PGP message
|
53 | * @param {String} ssoProvider
|
54 | * @param {String} targetUrl
|
55 | */
|
56 | loginSso(encryptedClaims: string, ssoProvider: string, targetUrl: string): Promise<ApiResponse>;
|
57 | /**
|
58 | * Logs out current user
|
59 | * @method logout
|
60 | */
|
61 | logout(): Promise<ApiResponse | void>;
|
62 | /**
|
63 | * Gets current user's profile
|
64 | * @method getCurrentProfile
|
65 | * @return {Promise} Resolves with account setting object
|
66 | */
|
67 | getCurrentProfile(): Promise<any>;
|
68 | /**
|
69 | * Updates user's profile settings
|
70 | * @method updateProfileSettings
|
71 | * @param {String} profileId - User profile identifier
|
72 | * @param {Object} profileSetting
|
73 | */
|
74 | updateProfileSettings(profileId: string, profileSetting: any): Promise<ApiResponse>;
|
75 | /**
|
76 | * Returns info about currently logged in user from bootstrap resource
|
77 | * @method getAccountInfo
|
78 | */
|
79 | getAccountInfo(): Promise<{
|
80 | login: any;
|
81 | loginMD5: any;
|
82 | firstName: any;
|
83 | lastName: any;
|
84 | organizationName: any;
|
85 | profileUri: any;
|
86 | }>;
|
87 | /**
|
88 | * Returns current user info from bootstrapData
|
89 | * @method getAccountInfoInBootstrap
|
90 | * @param bootstrapData - data was got from bootstrap resource
|
91 | */
|
92 | getAccountInfoInBootstrap(bootstrapData: any): {
|
93 | login: any;
|
94 | loginMD5: any;
|
95 | firstName: any;
|
96 | lastName: any;
|
97 | organizationName: any;
|
98 | profileUri: any;
|
99 | };
|
100 | /**
|
101 | * Gets user configs including user specific feature flags
|
102 | *
|
103 | * @param {String} userId - A user identifier
|
104 | * @return {IUserConfigsSettingItem[]} An array of user configs setting item
|
105 | */
|
106 | getUserConfigs(userId: string): Promise<IUserConfigsSettingItem[]>;
|
107 | /**
|
108 | * Returns the feature flags valid for the currently logged in user.
|
109 | * @method getFeatureFlags
|
110 | */
|
111 | getFeatureFlags(): Promise<any>;
|
112 | /**
|
113 | * Initiates SPI SAML SSO
|
114 | * @param relayState URL of the page where the user is redirected after a successful login
|
115 | */
|
116 | initiateSamlSso(relayState: string): void;
|
117 | }
|