assemblyai 4.3.1 → 4.3.2

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.cjs CHANGED
@@ -52,14 +52,14 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
52
52
  class BaseService {
53
53
  /**
54
54
  * Create a new service.
55
- * @param params The parameters to use for the service.
55
+ * @param params - The parameters to use for the service.
56
56
  */
57
57
  constructor(params) {
58
58
  this.params = params;
59
59
  }
60
60
  fetch(input, init) {
61
- var _a;
62
61
  return __awaiter(this, void 0, void 0, function* () {
62
+ var _a;
63
63
  init = init !== null && init !== void 0 ? init : {};
64
64
  init.headers = (_a = init.headers) !== null && _a !== void 0 ? _a : {};
65
65
  init.headers = Object.assign({ Authorization: this.params.apiKey, "Content-Type": "application/json" }, init.headers);
@@ -120,7 +120,7 @@ class LemurService extends BaseService {
120
120
  }
121
121
  /**
122
122
  * Delete the data for a previously submitted LeMUR request.
123
- * @param id ID of the LeMUR request
123
+ * @param id - ID of the LeMUR request
124
124
  */
125
125
  purgeRequestData(id) {
126
126
  return this.fetchJson(`/lemur/v3/${id}`, {
@@ -187,8 +187,7 @@ class RealtimeTranscriber {
187
187
  this.sampleRate = (_b = params.sampleRate) !== null && _b !== void 0 ? _b : 16000;
188
188
  this.wordBoost = params.wordBoost;
189
189
  this.encoding = params.encoding;
190
- this.endUtteranceSilenceThreshold =
191
- params.endUtteranceSilenceThreshold;
190
+ this.endUtteranceSilenceThreshold = params.endUtteranceSilenceThreshold;
192
191
  if ("token" in params && params.token)
193
192
  this.token = params.token;
194
193
  if ("apiKey" in params && params.apiKey)
@@ -315,8 +314,8 @@ class RealtimeTranscriber {
315
314
  }
316
315
  /**
317
316
  * Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
318
- * @param threshold The duration of the end utterance silence threshold in milliseconds
319
- * @format integer
317
+ * @param threshold - The duration of the end utterance silence threshold in milliseconds.
318
+ * This value must be an integer between 0 and 20_000.
320
319
  */
321
320
  configureEndUtteranceSilenceThreshold(threshold) {
322
321
  this.send(`{"end_utterance_silence_threshold":${threshold}}`);
@@ -327,8 +326,8 @@ class RealtimeTranscriber {
327
326
  }
328
327
  this.socket.send(data);
329
328
  }
330
- close(waitForSessionTermination = true) {
331
- return __awaiter(this, void 0, void 0, function* () {
329
+ close() {
330
+ return __awaiter(this, arguments, void 0, function* (waitForSessionTermination = true) {
332
331
  if (this.socket) {
333
332
  if (this.socket.readyState === WebSocket.OPEN) {
334
333
  if (waitForSessionTermination) {
@@ -410,8 +409,8 @@ class TranscriptService extends BaseService {
410
409
  }
411
410
  /**
412
411
  * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
413
- * @param params The parameters to transcribe an audio file.
414
- * @param options The options to transcribe an audio file.
412
+ * @param params - The parameters to transcribe an audio file.
413
+ * @param options - The options to transcribe an audio file.
415
414
  * @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
416
415
  */
417
416
  transcribe(params, options) {
@@ -422,45 +421,52 @@ class TranscriptService extends BaseService {
422
421
  }
423
422
  /**
424
423
  * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
425
- * @param params The parameters to start the transcription of an audio file.
424
+ * @param params - The parameters to start the transcription of an audio file.
426
425
  * @returns A promise that resolves to the queued transcript.
427
426
  */
428
427
  submit(params) {
429
428
  return __awaiter(this, void 0, void 0, function* () {
430
- const { audio } = params, createParams = __rest(params, ["audio"]);
431
429
  let audioUrl;
432
- if (typeof audio === "string") {
433
- const path = getPath(audio);
434
- if (path !== null) {
435
- // audio is local path, upload local file
436
- audioUrl = yield this.files.upload(path);
430
+ let transcriptParams = undefined;
431
+ if ("audio" in params) {
432
+ const { audio } = params, audioTranscriptParams = __rest(params, ["audio"]);
433
+ if (typeof audio === "string") {
434
+ const path = getPath(audio);
435
+ if (path !== null) {
436
+ // audio is local path, upload local file
437
+ audioUrl = yield this.files.upload(path);
438
+ }
439
+ else {
440
+ // audio is not a local path, assume it's a URL
441
+ audioUrl = audio;
442
+ }
437
443
  }
438
444
  else {
439
- // audio is not a local path, assume it's a URL
440
- audioUrl = audio;
445
+ // audio is of uploadable type
446
+ audioUrl = yield this.files.upload(audio);
441
447
  }
448
+ transcriptParams = Object.assign(Object.assign({}, audioTranscriptParams), { audio_url: audioUrl });
442
449
  }
443
450
  else {
444
- // audio is of uploadable type
445
- audioUrl = yield this.files.upload(audio);
451
+ transcriptParams = params;
446
452
  }
447
453
  const data = yield this.fetchJson("/v2/transcript", {
448
454
  method: "POST",
449
- body: JSON.stringify(Object.assign(Object.assign({}, createParams), { audio_url: audioUrl })),
455
+ body: JSON.stringify(transcriptParams),
450
456
  });
451
457
  return data;
452
458
  });
453
459
  }
454
460
  /**
455
461
  * Create a transcript.
456
- * @param params The parameters to create a transcript.
457
- * @param options The options used for creating the new transcript.
462
+ * @param params - The parameters to create a transcript.
463
+ * @param options - The options used for creating the new transcript.
458
464
  * @returns A promise that resolves to the transcript.
459
465
  * @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
460
466
  */
461
467
  create(params, options) {
462
- var _a;
463
468
  return __awaiter(this, void 0, void 0, function* () {
469
+ var _a;
464
470
  const path = getPath(params.audio_url);
465
471
  if (path !== null) {
466
472
  const uploadUrl = yield this.files.upload(path);
@@ -478,13 +484,13 @@ class TranscriptService extends BaseService {
478
484
  }
479
485
  /**
480
486
  * Wait until the transcript ready, either the status is "completed" or "error".
481
- * @param transcriptId The ID of the transcript.
482
- * @param options The options to wait until the transcript is ready.
487
+ * @param transcriptId - The ID of the transcript.
488
+ * @param options - The options to wait until the transcript is ready.
483
489
  * @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
484
490
  */
485
491
  waitUntilReady(transcriptId, options) {
486
- var _a, _b;
487
492
  return __awaiter(this, void 0, void 0, function* () {
493
+ var _a, _b;
488
494
  const pollingInterval = (_a = options === null || options === void 0 ? void 0 : options.pollingInterval) !== null && _a !== void 0 ? _a : 3000;
489
495
  const pollingTimeout = (_b = options === null || options === void 0 ? void 0 : options.pollingTimeout) !== null && _b !== void 0 ? _b : -1;
490
496
  const startTime = Date.now();
@@ -506,7 +512,7 @@ class TranscriptService extends BaseService {
506
512
  }
507
513
  /**
508
514
  * Retrieve a transcript.
509
- * @param id The identifier of the transcript.
515
+ * @param id - The identifier of the transcript.
510
516
  * @returns A promise that resolves to the transcript.
511
517
  */
512
518
  get(id) {
@@ -514,20 +520,20 @@ class TranscriptService extends BaseService {
514
520
  }
515
521
  /**
516
522
  * Retrieves a page of transcript listings.
517
- * @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
523
+ * @param params - The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
518
524
  */
519
- list(parameters) {
525
+ list(params) {
520
526
  return __awaiter(this, void 0, void 0, function* () {
521
527
  let url = "/v2/transcript";
522
- if (typeof parameters === "string") {
523
- url = parameters;
528
+ if (typeof params === "string") {
529
+ url = params;
524
530
  }
525
- else if (parameters) {
526
- url = `${url}?${new URLSearchParams(Object.keys(parameters).map((key) => {
531
+ else if (params) {
532
+ url = `${url}?${new URLSearchParams(Object.keys(params).map((key) => {
527
533
  var _a;
528
534
  return [
529
535
  key,
530
- ((_a = parameters[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
536
+ ((_a = params[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
531
537
  ];
532
538
  }))}`;
533
539
  }
@@ -543,7 +549,7 @@ class TranscriptService extends BaseService {
543
549
  }
544
550
  /**
545
551
  * Delete a transcript
546
- * @param id The identifier of the transcript.
552
+ * @param id - The identifier of the transcript.
547
553
  * @returns A promise that resolves to the transcript.
548
554
  */
549
555
  delete(id) {
@@ -552,9 +558,9 @@ class TranscriptService extends BaseService {
552
558
  /**
553
559
  * Search through the transcript for a specific set of keywords.
554
560
  * You can search for individual words, numbers, or phrases containing up to five words or numbers.
555
- * @param id The identifier of the transcript.
556
- * @param words Keywords to search for.
557
- * @return A promise that resolves to the sentences.
561
+ * @param id - The identifier of the transcript.
562
+ * @param words - Keywords to search for.
563
+ * @returns A promise that resolves to the sentences.
558
564
  */
559
565
  wordSearch(id, words) {
560
566
  const params = new URLSearchParams({ words: words.join(",") });
@@ -562,29 +568,29 @@ class TranscriptService extends BaseService {
562
568
  }
563
569
  /**
564
570
  * Retrieve all sentences of a transcript.
565
- * @param id The identifier of the transcript.
566
- * @return A promise that resolves to the sentences.
571
+ * @param id - The identifier of the transcript.
572
+ * @returns A promise that resolves to the sentences.
567
573
  */
568
574
  sentences(id) {
569
575
  return this.fetchJson(`/v2/transcript/${id}/sentences`);
570
576
  }
571
577
  /**
572
578
  * Retrieve all paragraphs of a transcript.
573
- * @param id The identifier of the transcript.
574
- * @return A promise that resolves to the paragraphs.
579
+ * @param id - The identifier of the transcript.
580
+ * @returns A promise that resolves to the paragraphs.
575
581
  */
576
582
  paragraphs(id) {
577
583
  return this.fetchJson(`/v2/transcript/${id}/paragraphs`);
578
584
  }
579
585
  /**
580
586
  * Retrieve subtitles of a transcript.
581
- * @param id The identifier of the transcript.
582
- * @param format The format of the subtitles.
583
- * @param chars_per_caption The maximum number of characters per caption.
584
- * @return A promise that resolves to the subtitles text.
587
+ * @param id - The identifier of the transcript.
588
+ * @param format - The format of the subtitles.
589
+ * @param chars_per_caption - The maximum number of characters per caption.
590
+ * @returns A promise that resolves to the subtitles text.
585
591
  */
586
- subtitles(id, format = "srt", chars_per_caption) {
587
- return __awaiter(this, void 0, void 0, function* () {
592
+ subtitles(id_1) {
593
+ return __awaiter(this, arguments, void 0, function* (id, format = "srt", chars_per_caption) {
588
594
  let url = `/v2/transcript/${id}/${format}`;
589
595
  if (chars_per_caption) {
590
596
  const params = new URLSearchParams();
@@ -597,8 +603,8 @@ class TranscriptService extends BaseService {
597
603
  }
598
604
  /**
599
605
  * Retrieve redactions of a transcript.
600
- * @param id The identifier of the transcript.
601
- * @return A promise that resolves to the subtitles text.
606
+ * @param id - The identifier of the transcript.
607
+ * @returns A promise that resolves to the subtitles text.
602
608
  */
603
609
  redactions(id) {
604
610
  return this.fetchJson(`/v2/transcript/${id}/redacted-audio`);
@@ -616,8 +622,8 @@ path) {
616
622
  class FileService extends BaseService {
617
623
  /**
618
624
  * Upload a local file to AssemblyAI.
619
- * @param input The local file path to upload, or a stream or buffer of the file to upload.
620
- * @return A promise that resolves to the uploaded file URL.
625
+ * @param input - The local file path to upload, or a stream or buffer of the file to upload.
626
+ * @returns A promise that resolves to the uploaded file URL.
621
627
  */
622
628
  upload(input) {
623
629
  return __awaiter(this, void 0, void 0, function* () {
@@ -643,7 +649,7 @@ const defaultBaseUrl = "https://api.assemblyai.com";
643
649
  class AssemblyAI {
644
650
  /**
645
651
  * Create a new AssemblyAI client.
646
- * @param params The parameters for the service, including the API key and base URL, if any.
652
+ * @param params - The parameters for the service, including the API key and base URL, if any.
647
653
  */
648
654
  constructor(params) {
649
655
  params.baseUrl = params.baseUrl || defaultBaseUrl;
package/dist/index.mjs CHANGED
@@ -50,14 +50,14 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
50
50
  class BaseService {
51
51
  /**
52
52
  * Create a new service.
53
- * @param params The parameters to use for the service.
53
+ * @param params - The parameters to use for the service.
54
54
  */
55
55
  constructor(params) {
56
56
  this.params = params;
57
57
  }
58
58
  fetch(input, init) {
59
- var _a;
60
59
  return __awaiter(this, void 0, void 0, function* () {
60
+ var _a;
61
61
  init = init !== null && init !== void 0 ? init : {};
62
62
  init.headers = (_a = init.headers) !== null && _a !== void 0 ? _a : {};
63
63
  init.headers = Object.assign({ Authorization: this.params.apiKey, "Content-Type": "application/json" }, init.headers);
@@ -118,7 +118,7 @@ class LemurService extends BaseService {
118
118
  }
119
119
  /**
120
120
  * Delete the data for a previously submitted LeMUR request.
121
- * @param id ID of the LeMUR request
121
+ * @param id - ID of the LeMUR request
122
122
  */
123
123
  purgeRequestData(id) {
124
124
  return this.fetchJson(`/lemur/v3/${id}`, {
@@ -185,8 +185,7 @@ class RealtimeTranscriber {
185
185
  this.sampleRate = (_b = params.sampleRate) !== null && _b !== void 0 ? _b : 16000;
186
186
  this.wordBoost = params.wordBoost;
187
187
  this.encoding = params.encoding;
188
- this.endUtteranceSilenceThreshold =
189
- params.endUtteranceSilenceThreshold;
188
+ this.endUtteranceSilenceThreshold = params.endUtteranceSilenceThreshold;
190
189
  if ("token" in params && params.token)
191
190
  this.token = params.token;
192
191
  if ("apiKey" in params && params.apiKey)
@@ -313,8 +312,8 @@ class RealtimeTranscriber {
313
312
  }
314
313
  /**
315
314
  * Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
316
- * @param threshold The duration of the end utterance silence threshold in milliseconds
317
- * @format integer
315
+ * @param threshold - The duration of the end utterance silence threshold in milliseconds.
316
+ * This value must be an integer between 0 and 20_000.
318
317
  */
319
318
  configureEndUtteranceSilenceThreshold(threshold) {
320
319
  this.send(`{"end_utterance_silence_threshold":${threshold}}`);
@@ -325,8 +324,8 @@ class RealtimeTranscriber {
325
324
  }
326
325
  this.socket.send(data);
327
326
  }
328
- close(waitForSessionTermination = true) {
329
- return __awaiter(this, void 0, void 0, function* () {
327
+ close() {
328
+ return __awaiter(this, arguments, void 0, function* (waitForSessionTermination = true) {
330
329
  if (this.socket) {
331
330
  if (this.socket.readyState === WebSocket.OPEN) {
332
331
  if (waitForSessionTermination) {
@@ -408,8 +407,8 @@ class TranscriptService extends BaseService {
408
407
  }
409
408
  /**
410
409
  * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
411
- * @param params The parameters to transcribe an audio file.
412
- * @param options The options to transcribe an audio file.
410
+ * @param params - The parameters to transcribe an audio file.
411
+ * @param options - The options to transcribe an audio file.
413
412
  * @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
414
413
  */
415
414
  transcribe(params, options) {
@@ -420,45 +419,52 @@ class TranscriptService extends BaseService {
420
419
  }
421
420
  /**
422
421
  * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
423
- * @param params The parameters to start the transcription of an audio file.
422
+ * @param params - The parameters to start the transcription of an audio file.
424
423
  * @returns A promise that resolves to the queued transcript.
425
424
  */
426
425
  submit(params) {
427
426
  return __awaiter(this, void 0, void 0, function* () {
428
- const { audio } = params, createParams = __rest(params, ["audio"]);
429
427
  let audioUrl;
430
- if (typeof audio === "string") {
431
- const path = getPath(audio);
432
- if (path !== null) {
433
- // audio is local path, upload local file
434
- audioUrl = yield this.files.upload(path);
428
+ let transcriptParams = undefined;
429
+ if ("audio" in params) {
430
+ const { audio } = params, audioTranscriptParams = __rest(params, ["audio"]);
431
+ if (typeof audio === "string") {
432
+ const path = getPath(audio);
433
+ if (path !== null) {
434
+ // audio is local path, upload local file
435
+ audioUrl = yield this.files.upload(path);
436
+ }
437
+ else {
438
+ // audio is not a local path, assume it's a URL
439
+ audioUrl = audio;
440
+ }
435
441
  }
436
442
  else {
437
- // audio is not a local path, assume it's a URL
438
- audioUrl = audio;
443
+ // audio is of uploadable type
444
+ audioUrl = yield this.files.upload(audio);
439
445
  }
446
+ transcriptParams = Object.assign(Object.assign({}, audioTranscriptParams), { audio_url: audioUrl });
440
447
  }
441
448
  else {
442
- // audio is of uploadable type
443
- audioUrl = yield this.files.upload(audio);
449
+ transcriptParams = params;
444
450
  }
445
451
  const data = yield this.fetchJson("/v2/transcript", {
446
452
  method: "POST",
447
- body: JSON.stringify(Object.assign(Object.assign({}, createParams), { audio_url: audioUrl })),
453
+ body: JSON.stringify(transcriptParams),
448
454
  });
449
455
  return data;
450
456
  });
451
457
  }
452
458
  /**
453
459
  * Create a transcript.
454
- * @param params The parameters to create a transcript.
455
- * @param options The options used for creating the new transcript.
460
+ * @param params - The parameters to create a transcript.
461
+ * @param options - The options used for creating the new transcript.
456
462
  * @returns A promise that resolves to the transcript.
457
463
  * @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
458
464
  */
459
465
  create(params, options) {
460
- var _a;
461
466
  return __awaiter(this, void 0, void 0, function* () {
467
+ var _a;
462
468
  const path = getPath(params.audio_url);
463
469
  if (path !== null) {
464
470
  const uploadUrl = yield this.files.upload(path);
@@ -476,13 +482,13 @@ class TranscriptService extends BaseService {
476
482
  }
477
483
  /**
478
484
  * Wait until the transcript ready, either the status is "completed" or "error".
479
- * @param transcriptId The ID of the transcript.
480
- * @param options The options to wait until the transcript is ready.
485
+ * @param transcriptId - The ID of the transcript.
486
+ * @param options - The options to wait until the transcript is ready.
481
487
  * @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
482
488
  */
483
489
  waitUntilReady(transcriptId, options) {
484
- var _a, _b;
485
490
  return __awaiter(this, void 0, void 0, function* () {
491
+ var _a, _b;
486
492
  const pollingInterval = (_a = options === null || options === void 0 ? void 0 : options.pollingInterval) !== null && _a !== void 0 ? _a : 3000;
487
493
  const pollingTimeout = (_b = options === null || options === void 0 ? void 0 : options.pollingTimeout) !== null && _b !== void 0 ? _b : -1;
488
494
  const startTime = Date.now();
@@ -504,7 +510,7 @@ class TranscriptService extends BaseService {
504
510
  }
505
511
  /**
506
512
  * Retrieve a transcript.
507
- * @param id The identifier of the transcript.
513
+ * @param id - The identifier of the transcript.
508
514
  * @returns A promise that resolves to the transcript.
509
515
  */
510
516
  get(id) {
@@ -512,20 +518,20 @@ class TranscriptService extends BaseService {
512
518
  }
513
519
  /**
514
520
  * Retrieves a page of transcript listings.
515
- * @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
521
+ * @param params - The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
516
522
  */
517
- list(parameters) {
523
+ list(params) {
518
524
  return __awaiter(this, void 0, void 0, function* () {
519
525
  let url = "/v2/transcript";
520
- if (typeof parameters === "string") {
521
- url = parameters;
526
+ if (typeof params === "string") {
527
+ url = params;
522
528
  }
523
- else if (parameters) {
524
- url = `${url}?${new URLSearchParams(Object.keys(parameters).map((key) => {
529
+ else if (params) {
530
+ url = `${url}?${new URLSearchParams(Object.keys(params).map((key) => {
525
531
  var _a;
526
532
  return [
527
533
  key,
528
- ((_a = parameters[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
534
+ ((_a = params[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
529
535
  ];
530
536
  }))}`;
531
537
  }
@@ -541,7 +547,7 @@ class TranscriptService extends BaseService {
541
547
  }
542
548
  /**
543
549
  * Delete a transcript
544
- * @param id The identifier of the transcript.
550
+ * @param id - The identifier of the transcript.
545
551
  * @returns A promise that resolves to the transcript.
546
552
  */
547
553
  delete(id) {
@@ -550,9 +556,9 @@ class TranscriptService extends BaseService {
550
556
  /**
551
557
  * Search through the transcript for a specific set of keywords.
552
558
  * You can search for individual words, numbers, or phrases containing up to five words or numbers.
553
- * @param id The identifier of the transcript.
554
- * @param words Keywords to search for.
555
- * @return A promise that resolves to the sentences.
559
+ * @param id - The identifier of the transcript.
560
+ * @param words - Keywords to search for.
561
+ * @returns A promise that resolves to the sentences.
556
562
  */
557
563
  wordSearch(id, words) {
558
564
  const params = new URLSearchParams({ words: words.join(",") });
@@ -560,29 +566,29 @@ class TranscriptService extends BaseService {
560
566
  }
561
567
  /**
562
568
  * Retrieve all sentences of a transcript.
563
- * @param id The identifier of the transcript.
564
- * @return A promise that resolves to the sentences.
569
+ * @param id - The identifier of the transcript.
570
+ * @returns A promise that resolves to the sentences.
565
571
  */
566
572
  sentences(id) {
567
573
  return this.fetchJson(`/v2/transcript/${id}/sentences`);
568
574
  }
569
575
  /**
570
576
  * Retrieve all paragraphs of a transcript.
571
- * @param id The identifier of the transcript.
572
- * @return A promise that resolves to the paragraphs.
577
+ * @param id - The identifier of the transcript.
578
+ * @returns A promise that resolves to the paragraphs.
573
579
  */
574
580
  paragraphs(id) {
575
581
  return this.fetchJson(`/v2/transcript/${id}/paragraphs`);
576
582
  }
577
583
  /**
578
584
  * Retrieve subtitles of a transcript.
579
- * @param id The identifier of the transcript.
580
- * @param format The format of the subtitles.
581
- * @param chars_per_caption The maximum number of characters per caption.
582
- * @return A promise that resolves to the subtitles text.
585
+ * @param id - The identifier of the transcript.
586
+ * @param format - The format of the subtitles.
587
+ * @param chars_per_caption - The maximum number of characters per caption.
588
+ * @returns A promise that resolves to the subtitles text.
583
589
  */
584
- subtitles(id, format = "srt", chars_per_caption) {
585
- return __awaiter(this, void 0, void 0, function* () {
590
+ subtitles(id_1) {
591
+ return __awaiter(this, arguments, void 0, function* (id, format = "srt", chars_per_caption) {
586
592
  let url = `/v2/transcript/${id}/${format}`;
587
593
  if (chars_per_caption) {
588
594
  const params = new URLSearchParams();
@@ -595,8 +601,8 @@ class TranscriptService extends BaseService {
595
601
  }
596
602
  /**
597
603
  * Retrieve redactions of a transcript.
598
- * @param id The identifier of the transcript.
599
- * @return A promise that resolves to the subtitles text.
604
+ * @param id - The identifier of the transcript.
605
+ * @returns A promise that resolves to the subtitles text.
600
606
  */
601
607
  redactions(id) {
602
608
  return this.fetchJson(`/v2/transcript/${id}/redacted-audio`);
@@ -614,8 +620,8 @@ path) {
614
620
  class FileService extends BaseService {
615
621
  /**
616
622
  * Upload a local file to AssemblyAI.
617
- * @param input The local file path to upload, or a stream or buffer of the file to upload.
618
- * @return A promise that resolves to the uploaded file URL.
623
+ * @param input - The local file path to upload, or a stream or buffer of the file to upload.
624
+ * @returns A promise that resolves to the uploaded file URL.
619
625
  */
620
626
  upload(input) {
621
627
  return __awaiter(this, void 0, void 0, function* () {
@@ -641,7 +647,7 @@ const defaultBaseUrl = "https://api.assemblyai.com";
641
647
  class AssemblyAI {
642
648
  /**
643
649
  * Create a new AssemblyAI client.
644
- * @param params The parameters for the service, including the API key and base URL, if any.
650
+ * @param params - The parameters for the service, including the API key and base URL, if any.
645
651
  */
646
652
  constructor(params) {
647
653
  params.baseUrl = params.baseUrl || defaultBaseUrl;