whio-api-sdk 1.0.194-beta-staging → 1.0.196-beta-staging
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/sdk/modules/auth.module.d.ts +4 -0
- package/dist/src/sdk/modules/auth.module.js +23 -0
- package/dist/src/sdk/modules/organization.module.d.ts +2 -0
- package/dist/src/sdk/modules/organization.module.js +10 -0
- package/dist/src/sdk/sdk.d.ts +6 -0
- package/dist/src/sdk/sdk.js +20 -0
- package/package.json +1 -1
- package/src/sdk/modules/auth.module.ts +34 -0
- package/src/sdk/modules/organization.module.ts +8 -0
- package/src/sdk/sdk.ts +16 -0
|
@@ -2,6 +2,10 @@ import { BaseClient } from './base-client';
|
|
|
2
2
|
import { LoginCredentials, LoginResponse, PasswordChangeResponse, User } from '../types';
|
|
3
3
|
export declare class AuthModule extends BaseClient {
|
|
4
4
|
login(credentials: LoginCredentials): Promise<LoginResponse>;
|
|
5
|
+
requestLoginCode(email: string): Promise<{
|
|
6
|
+
message: string;
|
|
7
|
+
}>;
|
|
8
|
+
loginWithCode(email: string, code: string): Promise<LoginResponse>;
|
|
5
9
|
logout(): Promise<void>;
|
|
6
10
|
getProfile(): Promise<User>;
|
|
7
11
|
changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
@@ -28,6 +28,29 @@ export class AuthModule extends BaseClient {
|
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
requestLoginCode(email) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return this.request('/auth/request-login-code', 'POST', { email }, {}, true);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
loginWithCode(email, code) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
try {
|
|
39
|
+
const response = yield this.request('/auth/login-with-code', 'POST', { email, code }, {}, true);
|
|
40
|
+
this.accessToken = response.access_token;
|
|
41
|
+
this.refreshToken = response.refresh_token;
|
|
42
|
+
this.user = response.user;
|
|
43
|
+
yield this.storage.setItem('access_token', JSON.stringify(response.access_token));
|
|
44
|
+
yield this.storage.setItem('refresh_token', JSON.stringify(response.refresh_token));
|
|
45
|
+
yield this.storage.setItem('user', JSON.stringify(response.user));
|
|
46
|
+
return response;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
yield this.clearAuth();
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
31
54
|
logout() {
|
|
32
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
56
|
yield this.clearAuth();
|
|
@@ -8,4 +8,6 @@ export declare class OrganizationModule extends BaseClient {
|
|
|
8
8
|
deleteOrganization(id: string): Promise<void>;
|
|
9
9
|
addUserToOrganization(organizationId: string, userId: string): Promise<void>;
|
|
10
10
|
removeUserFromOrganization(organizationId: string, userId: string): Promise<void>;
|
|
11
|
+
linkExternalIntegration(organizationId: string, integrationId: string): Promise<Organization>;
|
|
12
|
+
unlinkExternalIntegration(organizationId: string): Promise<Organization>;
|
|
11
13
|
}
|
|
@@ -47,4 +47,14 @@ export class OrganizationModule extends BaseClient {
|
|
|
47
47
|
yield this.request(`${urls.organizations}/${organizationId}/users/${userId}`, 'DELETE');
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
linkExternalIntegration(organizationId, integrationId) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return this.request(`${urls.organizations}/${organizationId}/external-integration/${integrationId}`, 'POST');
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
unlinkExternalIntegration(organizationId) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return this.request(`${urls.organizations}/${organizationId}/external-integration`, 'DELETE');
|
|
58
|
+
});
|
|
59
|
+
}
|
|
50
60
|
}
|
package/dist/src/sdk/sdk.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export declare class ApiSDK extends BaseClient {
|
|
|
34
34
|
getProfile(...args: Parameters<AuthModule['getProfile']>): Promise<import("./types").User>;
|
|
35
35
|
changePassword(...args: Parameters<AuthModule['changePassword']>): Promise<import("./types").PasswordChangeResponse>;
|
|
36
36
|
adminChangePassword(...args: Parameters<AuthModule['adminChangePassword']>): Promise<import("./types").PasswordChangeResponse>;
|
|
37
|
+
requestLoginCode(...args: Parameters<AuthModule['requestLoginCode']>): Promise<{
|
|
38
|
+
message: string;
|
|
39
|
+
}>;
|
|
40
|
+
loginWithCode(...args: Parameters<AuthModule['loginWithCode']>): Promise<import("./types").LoginResponse>;
|
|
37
41
|
createUser(...args: Parameters<UserModule['createUser']>): Promise<import("./types").User>;
|
|
38
42
|
assignEditorToRoleToUser(...args: Parameters<UserModule['assignEditorToRoleToUser']>): Promise<import("./types").User>;
|
|
39
43
|
assignAdminToRoleToUser(...args: Parameters<UserModule['assignAdminToRoleToUser']>): Promise<import("./types").User>;
|
|
@@ -53,6 +57,8 @@ export declare class ApiSDK extends BaseClient {
|
|
|
53
57
|
deleteOrganization(...args: Parameters<OrganizationModule['deleteOrganization']>): Promise<void>;
|
|
54
58
|
addUserToOrganization(...args: Parameters<OrganizationModule['addUserToOrganization']>): Promise<void>;
|
|
55
59
|
removeUserFromOrganization(...args: Parameters<OrganizationModule['removeUserFromOrganization']>): Promise<void>;
|
|
60
|
+
linkExternalIntegration(...args: Parameters<OrganizationModule['linkExternalIntegration']>): Promise<import("./types").Organization>;
|
|
61
|
+
unlinkExternalIntegration(...args: Parameters<OrganizationModule['unlinkExternalIntegration']>): Promise<import("./types").Organization>;
|
|
56
62
|
createTeam(...args: Parameters<TeamModule['createTeam']>): Promise<import("./types").Team>;
|
|
57
63
|
updateTeam(...args: Parameters<TeamModule['updateTeam']>): Promise<import("./types").Team>;
|
|
58
64
|
addUserToTeam(...args: Parameters<TeamModule['addUserToTeam']>): Promise<any>;
|
package/dist/src/sdk/sdk.js
CHANGED
|
@@ -70,6 +70,16 @@ export class ApiSDK extends BaseClient {
|
|
|
70
70
|
return this.auth.adminChangePassword(...args);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
requestLoginCode(...args) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
return this.auth.requestLoginCode(...args);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
loginWithCode(...args) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
return this.auth.loginWithCode(...args);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
73
83
|
// User methods
|
|
74
84
|
createUser(...args) {
|
|
75
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -167,6 +177,16 @@ export class ApiSDK extends BaseClient {
|
|
|
167
177
|
return this.organizations.removeUserFromOrganization(...args);
|
|
168
178
|
});
|
|
169
179
|
}
|
|
180
|
+
linkExternalIntegration(...args) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
return this.organizations.linkExternalIntegration(...args);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
unlinkExternalIntegration(...args) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return this.organizations.unlinkExternalIntegration(...args);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
170
190
|
// Team methods
|
|
171
191
|
createTeam(...args) {
|
|
172
192
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -27,6 +27,40 @@ export class AuthModule extends BaseClient {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
public async requestLoginCode(email: string): Promise<{ message: string }> {
|
|
31
|
+
return this.request<{ message: string }>(
|
|
32
|
+
'/auth/request-login-code',
|
|
33
|
+
'POST',
|
|
34
|
+
{ email },
|
|
35
|
+
{},
|
|
36
|
+
true
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async loginWithCode(email: string, code: string): Promise<LoginResponse> {
|
|
41
|
+
try {
|
|
42
|
+
const response = await this.request<LoginResponse>(
|
|
43
|
+
'/auth/login-with-code',
|
|
44
|
+
'POST',
|
|
45
|
+
{ email, code },
|
|
46
|
+
{},
|
|
47
|
+
true
|
|
48
|
+
);
|
|
49
|
+
this.accessToken = response.access_token;
|
|
50
|
+
this.refreshToken = response.refresh_token;
|
|
51
|
+
this.user = response.user;
|
|
52
|
+
|
|
53
|
+
await this.storage!.setItem('access_token', JSON.stringify(response.access_token));
|
|
54
|
+
await this.storage!.setItem('refresh_token', JSON.stringify(response.refresh_token));
|
|
55
|
+
await this.storage!.setItem('user', JSON.stringify(response.user));
|
|
56
|
+
|
|
57
|
+
return response;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
await this.clearAuth();
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
30
64
|
public async logout(): Promise<void> {
|
|
31
65
|
await this.clearAuth();
|
|
32
66
|
}
|
|
@@ -32,4 +32,12 @@ export class OrganizationModule extends BaseClient {
|
|
|
32
32
|
public async removeUserFromOrganization(organizationId: string, userId: string): Promise<void> {
|
|
33
33
|
await this.request(`${urls.organizations}/${organizationId}/users/${userId}`, 'DELETE');
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
public async linkExternalIntegration(organizationId: string, integrationId: string): Promise<Organization> {
|
|
37
|
+
return this.request<Organization>(`${urls.organizations}/${organizationId}/external-integration/${integrationId}`, 'POST');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async unlinkExternalIntegration(organizationId: string): Promise<Organization> {
|
|
41
|
+
return this.request<Organization>(`${urls.organizations}/${organizationId}/external-integration`, 'DELETE');
|
|
42
|
+
}
|
|
35
43
|
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -75,6 +75,14 @@ export class ApiSDK extends BaseClient {
|
|
|
75
75
|
return this.auth.adminChangePassword(...args);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
public async requestLoginCode(...args: Parameters<AuthModule['requestLoginCode']>) {
|
|
79
|
+
return this.auth.requestLoginCode(...args);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public async loginWithCode(...args: Parameters<AuthModule['loginWithCode']>) {
|
|
83
|
+
return this.auth.loginWithCode(...args);
|
|
84
|
+
}
|
|
85
|
+
|
|
78
86
|
// User methods
|
|
79
87
|
public async createUser(...args: Parameters<UserModule['createUser']>) {
|
|
80
88
|
return this.users.createUser(...args);
|
|
@@ -153,6 +161,14 @@ export class ApiSDK extends BaseClient {
|
|
|
153
161
|
return this.organizations.removeUserFromOrganization(...args);
|
|
154
162
|
}
|
|
155
163
|
|
|
164
|
+
public async linkExternalIntegration(...args: Parameters<OrganizationModule['linkExternalIntegration']>) {
|
|
165
|
+
return this.organizations.linkExternalIntegration(...args);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public async unlinkExternalIntegration(...args: Parameters<OrganizationModule['unlinkExternalIntegration']>) {
|
|
169
|
+
return this.organizations.unlinkExternalIntegration(...args);
|
|
170
|
+
}
|
|
171
|
+
|
|
156
172
|
// Team methods
|
|
157
173
|
public async createTeam(...args: Parameters<TeamModule['createTeam']>) {
|
|
158
174
|
return this.teams.createTeam(...args);
|