whio-api-sdk 1.0.7 → 1.0.9

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/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { ApiSDK } from "./src/sdk";
2
2
  export * from "./src/sdk/types";
3
+ export { main } from "./src/sdk/exampleuse";
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { ApiSDK } from "./src/sdk";
2
2
  export * from "./src/sdk/types";
3
+ export { main } from "./src/sdk/exampleuse";
@@ -1 +1 @@
1
- export {};
1
+ export declare function main(): Promise<void>;
@@ -33,7 +33,7 @@ const loginCredentials = {
33
33
  password: "",
34
34
  };
35
35
  const sdk = new ApiSDK(config);
36
- function main() {
36
+ export function main() {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  yield sdk.login(loginCredentials);
39
39
  const user = sdk.getCurrentUser();
@@ -49,6 +49,11 @@ function main() {
49
49
  //console.log("Updated User Template", updatedUserTemplate);
50
50
  const templates = yield sdk.getTemplates();
51
51
  const userTemplates = yield sdk.getUserTemplates();
52
+ const filepath = "/Users/rimu/Downloads/combined_1749168962192.m4a"; // Replace with your actual file path
53
+ const formData = new FormData();
54
+ formData.append('file', new Blob([filepath]), 'audio.m4a'); // Adjust the Blob as necessary
55
+ const transcriptionSummary = yield sdk.uploadAudioFile(formData);
56
+ console.log("Transcription Summary:", transcriptionSummary);
52
57
  });
53
58
  }
54
59
  main().catch((error) => {
@@ -1,4 +1,4 @@
1
- import { LoginResponse, LoginCredentials, SDKConfig, User, Template, Team, UserTemplate, TranscriptionSummary } from './types';
1
+ import { LoginResponse, LoginCredentials, SDKConfig, User, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse } from './types';
2
2
  export declare class ApiSDK {
3
3
  private baseUrl;
4
4
  private storage;
@@ -36,6 +36,6 @@ export declare class ApiSDK {
36
36
  generateTranscriptionSummary(transcript: string, templateId: string): Promise<TranscriptionSummary>;
37
37
  generateTranscriptionSummaryFromUserTemplate(transcript: string, userTemplateId: string): Promise<TranscriptionSummary>;
38
38
  updateTranscriptionSummary(id: string, content: string): Promise<TranscriptionSummary>;
39
- uploadLargeAudioFile(file: Blob): Promise<string>;
40
- uploadAudioFile(file: Blob): Promise<string>;
39
+ uploadLargeAudioFile(formData: FormData): Promise<string>;
40
+ uploadAudioFile(formData: FormData): Promise<TranscriptionAudioUploadResponse | null>;
41
41
  }
@@ -287,10 +287,8 @@ export class ApiSDK {
287
287
  return this.request(`${urls.transcriptionSummary}/${id}`, 'PATCH', updateSummaryDto);
288
288
  });
289
289
  }
290
- uploadLargeAudioFile(file) {
290
+ uploadLargeAudioFile(formData) {
291
291
  return __awaiter(this, void 0, void 0, function* () {
292
- const formData = new FormData();
293
- formData.append('file', file); // key must match the one in FileInterceptor('file')
294
292
  const uploadId = yield this.request(urls.uploadAudioLarge, 'POST', formData, { 'Content-Type': 'multipart/form-data' });
295
293
  const uploadIds = (yield this.storage.getItem('uploadIds')) || '[]';
296
294
  const uploadIdsArray = JSON.parse(uploadIds);
@@ -298,15 +296,10 @@ export class ApiSDK {
298
296
  return uploadId;
299
297
  });
300
298
  }
301
- uploadAudioFile(file) {
299
+ uploadAudioFile(formData) {
302
300
  return __awaiter(this, void 0, void 0, function* () {
303
- const formData = new FormData();
304
- formData.append('file', file); // key must match the one in FileInterceptor('file')
305
- const uploadId = yield this.request(urls.uploadAudioLarge, 'POST', formData, { 'Content-Type': 'multipart/form-data' });
306
- const uploadIds = (yield this.storage.getItem('uploadIds')) || '[]';
307
- const uploadIdsArray = JSON.parse(uploadIds);
308
- yield this.storage.setItem('uploadIds', JSON.stringify([...uploadIdsArray, uploadId]));
309
- return uploadId;
301
+ const data = yield this.request(urls.uploadAudio, 'POST', formData, { 'Content-Type': 'multipart/form-data' });
302
+ return data;
310
303
  });
311
304
  }
312
305
  }
@@ -215,3 +215,11 @@ export interface Team {
215
215
  teamRoles?: TeamRole[];
216
216
  teamTemplates?: TeamTemplate[];
217
217
  }
218
+ export interface TranscriptionAudioUploadResponse {
219
+ success: Boolean;
220
+ transcription: string;
221
+ model_version: string;
222
+ metadata: any[];
223
+ duration: number;
224
+ log: string;
225
+ }
package/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { ApiSDK } from "./src/sdk";
2
- export * from "./src/sdk/types";
2
+ export * from "./src/sdk/types";
3
+ export { main } from "./src/sdk/exampleuse";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whio-api-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -35,7 +35,7 @@ const loginCredentials: LoginCredentials = {
35
35
  }
36
36
 
37
37
  const sdk = new ApiSDK(config);
38
- async function main() {
38
+ export async function main() {
39
39
  await sdk.login(loginCredentials);
40
40
  const user: User | null = sdk.getCurrentUser();
41
41
  const newUser: User = await sdk.createEditorUser(
@@ -83,7 +83,11 @@ async function main() {
83
83
  const templates = await sdk.getTemplates();
84
84
  const userTemplates = await sdk.getUserTemplates();
85
85
 
86
-
86
+ const filepath = "/Users/rimu/Downloads/combined_1749168962192.m4a"; // Replace with your actual file path
87
+ const formData = new FormData();
88
+ formData.append('file', new Blob([filepath]), 'audio.m4a'); // Adjust the Blob as necessary
89
+ const transcriptionSummary = await sdk.uploadAudioFile(formData);
90
+ console.log("Transcription Summary:", transcriptionSummary);
87
91
 
88
92
  }
89
93
 
package/src/sdk/sdk.ts CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  Team,
24
24
  UserTemplate,
25
25
  TranscriptionSummary,
26
+ TranscriptionAudioUploadResponse,
26
27
  } from './types';
27
28
  import urls from './urls';
28
29
  import jwtDecode from 'jwt-decode';
@@ -347,9 +348,7 @@ export class ApiSDK {
347
348
  );
348
349
  }
349
350
 
350
- public async uploadLargeAudioFile(file: Blob): Promise<string> {
351
- const formData = new FormData();
352
- formData.append('file', file); // key must match the one in FileInterceptor('file')
351
+ public async uploadLargeAudioFile(formData: FormData): Promise<string> {
353
352
  const uploadId: string = await this.request(
354
353
  urls.uploadAudioLarge,
355
354
  'POST',
@@ -362,19 +361,14 @@ export class ApiSDK {
362
361
  return uploadId;
363
362
  }
364
363
 
365
- public async uploadAudioFile(file: Blob): Promise<string> {
366
- const formData = new FormData();
367
- formData.append('file', file); // key must match the one in FileInterceptor('file')
368
- const uploadId: string = await this.request(
369
- urls.uploadAudioLarge,
364
+ public async uploadAudioFile(formData: FormData): Promise<TranscriptionAudioUploadResponse | null> {
365
+ const data: TranscriptionAudioUploadResponse = await this.request(
366
+ urls.uploadAudio,
370
367
  'POST',
371
368
  formData,
372
369
  { 'Content-Type': 'multipart/form-data' }
373
370
  );
374
- const uploadIds: string = await this.storage!.getItem('uploadIds') || '[]';
375
- const uploadIdsArray = JSON.parse(uploadIds);
376
- await this.storage!.setItem('uploadIds', JSON.stringify([...uploadIdsArray, uploadId]));
377
- return uploadId;
371
+ return data;
378
372
  }
379
373
 
380
374
 
package/src/sdk/types.ts CHANGED
@@ -275,4 +275,13 @@ export interface Team {
275
275
  teamTemplates?: TeamTemplate[];
276
276
  }
277
277
 
278
+ export interface TranscriptionAudioUploadResponse {
279
+ success: Boolean,
280
+ transcription: string,
281
+ model_version: string,
282
+ metadata: any[],
283
+ duration: number,
284
+ log: string,
285
+ }
286
+
278
287