whio-api-sdk 1.0.156 → 1.0.157
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/sdk.d.ts +3 -1
- package/dist/src/sdk/sdk.js +18 -0
- package/dist/src/sdk/types.d.ts +11 -0
- package/dist/src/sdk/urls.d.ts +2 -0
- package/dist/src/sdk/urls.js +2 -0
- package/package.json +1 -1
- package/src/sdk/sdk.ts +19 -0
- package/src/sdk/types.ts +15 -0
- package/src/sdk/urls.ts +2 -0
- package/test-password-change.ts +34 -0
package/dist/src/sdk/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse } from './types';
|
|
1
|
+
import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse } from './types';
|
|
2
2
|
export declare class ApiSDK {
|
|
3
3
|
private baseUrl;
|
|
4
4
|
private storage;
|
|
@@ -44,6 +44,8 @@ export declare class ApiSDK {
|
|
|
44
44
|
uploadAudioFile(formData: FormData): Promise<TranscriptionAudioUploadResponse | null>;
|
|
45
45
|
transcribeBase64Audio(base64String: string): Promise<string>;
|
|
46
46
|
getProfile(): Promise<User>;
|
|
47
|
+
changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
48
|
+
adminChangePassword(userId: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
47
49
|
createOrganization(name: string, description?: string): Promise<Organization>;
|
|
48
50
|
getOrganizations(): Promise<Organization[]>;
|
|
49
51
|
getOrganization(id: string): Promise<Organization>;
|
package/dist/src/sdk/sdk.js
CHANGED
|
@@ -378,6 +378,24 @@ export class ApiSDK {
|
|
|
378
378
|
return this.request(urls.profile, 'GET');
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
|
+
changePassword(currentPassword, newPassword) {
|
|
382
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
383
|
+
const dto = {
|
|
384
|
+
currentPassword,
|
|
385
|
+
newPassword,
|
|
386
|
+
};
|
|
387
|
+
return this.request(urls.changePassword, 'PATCH', dto);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
adminChangePassword(userId, newPassword) {
|
|
391
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
392
|
+
const dto = {
|
|
393
|
+
userId,
|
|
394
|
+
newPassword,
|
|
395
|
+
};
|
|
396
|
+
return this.request(urls.adminChangePassword, 'PATCH', dto);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
381
399
|
// ======================
|
|
382
400
|
// ORGANIZATION METHODS
|
|
383
401
|
// ======================
|
package/dist/src/sdk/types.d.ts
CHANGED
|
@@ -254,3 +254,14 @@ export declare enum RoleType {
|
|
|
254
254
|
TRIAL = "TRIAL",
|
|
255
255
|
PAID = "PAID"
|
|
256
256
|
}
|
|
257
|
+
export interface ChangePasswordDto {
|
|
258
|
+
currentPassword: string;
|
|
259
|
+
newPassword: string;
|
|
260
|
+
}
|
|
261
|
+
export interface AdminChangePasswordDto {
|
|
262
|
+
userId: string;
|
|
263
|
+
newPassword: string;
|
|
264
|
+
}
|
|
265
|
+
export interface PasswordChangeResponse {
|
|
266
|
+
message: string;
|
|
267
|
+
}
|
package/dist/src/sdk/urls.d.ts
CHANGED
package/dist/src/sdk/urls.js
CHANGED
package/package.json
CHANGED
package/src/sdk/sdk.ts
CHANGED
|
@@ -31,6 +31,9 @@ import {
|
|
|
31
31
|
UserTemplate,
|
|
32
32
|
TranscriptionSummary,
|
|
33
33
|
TranscriptionAudioUploadResponse,
|
|
34
|
+
ChangePasswordDto,
|
|
35
|
+
AdminChangePasswordDto,
|
|
36
|
+
PasswordChangeResponse,
|
|
34
37
|
} from './types';
|
|
35
38
|
import urls from './urls';
|
|
36
39
|
import jwtDecode from 'jwt-decode';
|
|
@@ -467,6 +470,22 @@ export class ApiSDK {
|
|
|
467
470
|
return this.request<User>(urls.profile, 'GET');
|
|
468
471
|
}
|
|
469
472
|
|
|
473
|
+
public async changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse> {
|
|
474
|
+
const dto: ChangePasswordDto = {
|
|
475
|
+
currentPassword,
|
|
476
|
+
newPassword,
|
|
477
|
+
};
|
|
478
|
+
return this.request<PasswordChangeResponse>(urls.changePassword, 'PATCH', dto);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
public async adminChangePassword(userId: string, newPassword: string): Promise<PasswordChangeResponse> {
|
|
482
|
+
const dto: AdminChangePasswordDto = {
|
|
483
|
+
userId,
|
|
484
|
+
newPassword,
|
|
485
|
+
};
|
|
486
|
+
return this.request<PasswordChangeResponse>(urls.adminChangePassword, 'PATCH', dto);
|
|
487
|
+
}
|
|
488
|
+
|
|
470
489
|
// ======================
|
|
471
490
|
// ORGANIZATION METHODS
|
|
472
491
|
// ======================
|
package/src/sdk/types.ts
CHANGED
|
@@ -323,3 +323,18 @@ export enum RoleType {
|
|
|
323
323
|
TRIAL = 'TRIAL',
|
|
324
324
|
PAID = 'PAID',
|
|
325
325
|
}
|
|
326
|
+
|
|
327
|
+
// Password change DTOs
|
|
328
|
+
export interface ChangePasswordDto {
|
|
329
|
+
currentPassword: string;
|
|
330
|
+
newPassword: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface AdminChangePasswordDto {
|
|
334
|
+
userId: string;
|
|
335
|
+
newPassword: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export interface PasswordChangeResponse {
|
|
339
|
+
message: string;
|
|
340
|
+
}
|
package/src/sdk/urls.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Test file for new password change functionality
|
|
2
|
+
import { ApiSDK, ChangePasswordDto, AdminChangePasswordDto, PasswordChangeResponse } from './index';
|
|
3
|
+
|
|
4
|
+
// Test function to verify the new methods compile correctly
|
|
5
|
+
async function testPasswordChangeMethods() {
|
|
6
|
+
const sdk = new ApiSDK({
|
|
7
|
+
baseUrl: 'http://localhost:3000/api'
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
// Test user password change
|
|
12
|
+
const changeResponse: PasswordChangeResponse = await sdk.changePassword(
|
|
13
|
+
'currentPassword123',
|
|
14
|
+
'newPassword456'
|
|
15
|
+
);
|
|
16
|
+
console.log('Change password response:', changeResponse);
|
|
17
|
+
|
|
18
|
+
// Test admin password change
|
|
19
|
+
const adminChangeResponse: PasswordChangeResponse = await sdk.adminChangePassword(
|
|
20
|
+
'user-uuid-here',
|
|
21
|
+
'newPassword789'
|
|
22
|
+
);
|
|
23
|
+
console.log('Admin change password response:', adminChangeResponse);
|
|
24
|
+
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Password change error:', error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Export for potential testing
|
|
31
|
+
export { testPasswordChangeMethods };
|
|
32
|
+
|
|
33
|
+
console.log('Password change methods are available on SDK');
|
|
34
|
+
console.log('Methods: changePassword(), adminChangePassword()');
|