generaltranslation 7.9.1 → 8.0.0-alpha.1

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.
Files changed (33) hide show
  1. package/dist/errors/ApiError.d.ts +7 -0
  2. package/dist/errors.cjs.min.cjs +2 -0
  3. package/dist/errors.cjs.min.cjs.map +1 -0
  4. package/dist/errors.d.ts +9 -0
  5. package/dist/errors.esm.min.mjs +2 -0
  6. package/dist/errors.esm.min.mjs.map +1 -0
  7. package/dist/index.cjs.min.cjs +3 -3
  8. package/dist/index.cjs.min.cjs.map +1 -1
  9. package/dist/index.d.ts +200 -269
  10. package/dist/index.esm.min.mjs +3 -3
  11. package/dist/index.esm.min.mjs.map +1 -1
  12. package/dist/translate/api.d.ts +1 -0
  13. package/dist/translate/checkJobStatus.d.ts +8 -0
  14. package/dist/translate/createBranch.d.ts +10 -0
  15. package/dist/translate/queryBranchData.d.ts +3 -0
  16. package/dist/translate/queryFileData.d.ts +42 -0
  17. package/dist/translate/submitUserEditDiffs.d.ts +3 -3
  18. package/dist/translate/utils/batch.d.ts +52 -0
  19. package/dist/types-dir/api/branch.d.ts +10 -0
  20. package/dist/types-dir/api/checkFileTranslations.d.ts +1 -4
  21. package/dist/types-dir/api/downloadFileBatch.d.ts +16 -7
  22. package/dist/types-dir/api/enqueueFiles.d.ts +13 -22
  23. package/dist/types-dir/api/file.d.ts +29 -7
  24. package/dist/types-dir/api/uploadFiles.d.ts +5 -10
  25. package/dist/types.d.ts +135 -39
  26. package/package.json +12 -1
  27. package/dist/translate/checkFileTranslations.d.ts +0 -1
  28. package/dist/translate/checkSetupStatus.d.ts +0 -8
  29. package/dist/translate/checkTranslationStatus.d.ts +0 -1
  30. package/dist/translate/downloadFile.d.ts +0 -1
  31. package/dist/translate/enqueueEntries.d.ts +0 -1
  32. package/dist/translate/fetchTranslations.d.ts +0 -1
  33. package/dist/translate/shouldSetupProject.d.ts +0 -3
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { DataFormat as DataFormat$1 } from 'src/types';
2
+
1
3
  type CustomMapping = Record<string, string | Partial<LocaleProperties>>;
2
4
 
3
5
  type LocaleProperties = {
@@ -121,42 +123,12 @@ type Entry = {
121
123
  metadata?: EntryMetadata;
122
124
  };
123
125
 
124
- type TranslationStatusResult = {
125
- count: number;
126
- availableLocales: string[];
127
- locales: string[];
128
- localesWaitingForApproval: any[];
129
- };
130
- type CheckTranslationStatusOptions = {
131
- timeout?: number;
132
- };
133
-
134
- type FileFormat = 'GTJSON' | 'JSON' | 'YAML' | 'MDX' | 'MD' | 'TS' | 'JS' | 'HTML';
135
- type CompletedFileTranslationData = {
136
- locale: string;
137
- metadata: any;
138
- fileId: string;
139
- fileName: string;
140
- versionId: string;
141
- id: string;
142
- isReady: boolean;
143
- downloadUrl: string;
144
- };
145
-
146
- type FileTranslationQuery = {
147
- versionId: string;
148
- fileName?: string;
149
- fileId?: string;
150
- locale: string;
151
- };
152
126
  type CheckFileTranslationsOptions = {
153
127
  timeout?: number;
154
128
  };
155
- type CheckFileTranslationsResult = {
156
- translations: CompletedFileTranslationData[];
157
- };
158
129
  type FileQuery = {
159
130
  fileId: string;
131
+ branchId?: string;
160
132
  versionId?: string;
161
133
  };
162
134
  type FileQueryResult = {
@@ -183,75 +155,65 @@ type FileQueryResult = {
183
155
  }[];
184
156
  };
185
157
 
158
+ type FileFormat = 'GTJSON' | 'JSON' | 'YAML' | 'MDX' | 'MD' | 'TS' | 'JS' | 'HTML';
159
+ /**
160
+ * File object structure for referencing files
161
+ * @param fileId - The ID of the file
162
+ * @param versionId - The ID of the version of the file
163
+ * @param branchId - The ID of the branch of the file
164
+ * @param locale - The locale of the file ()
165
+ */
166
+ type FileReference = {
167
+ fileId: string;
168
+ versionId: string;
169
+ branchId: string;
170
+ fileName: string;
171
+ fileFormat: FileFormat;
172
+ dataFormat?: DataFormat$1;
173
+ };
174
+
175
+ type DownloadFileBatchRequest = {
176
+ fileId: string;
177
+ branchId?: string;
178
+ versionId?: string;
179
+ locale?: string;
180
+ }[];
186
181
  type DownloadFileBatchOptions = {
187
182
  timeout?: number;
188
183
  };
189
- type File = {
184
+ type DownloadedFile = {
190
185
  id: string;
191
- fileName: string;
186
+ branchId: string;
187
+ fileId: string;
188
+ versionId: string;
189
+ locale?: string;
190
+ fileName?: string;
192
191
  data: string;
193
- metadata: any;
192
+ metadata: Record<string, any>;
194
193
  fileFormat: FileFormat;
195
194
  };
196
195
  type DownloadFileBatchResult = {
197
- files: File[];
196
+ files: DownloadedFile[];
198
197
  count: number;
199
198
  };
200
199
 
201
- type FetchTranslationsOptions = {
202
- timeout?: number;
203
- };
204
- type RetrievedTranslation = {
205
- locale: string;
206
- translation: any;
207
- };
208
- type RetrievedTranslations = RetrievedTranslation[];
209
- type FetchTranslationsResult = {
210
- translations: RetrievedTranslations;
211
- };
212
-
213
- type Updates = ({
214
- metadata: Record<string, any>;
215
- } & ({
216
- dataFormat: 'JSX';
217
- source: JsxChildren;
218
- } | {
219
- dataFormat: 'ICU';
220
- source: string;
221
- } | {
222
- dataFormat: 'I18NEXT';
223
- source: string;
224
- }))[];
225
200
  type EnqueueFilesResult = {
226
- translations: CompletedFileTranslationData[];
227
- data: Record<string, {
228
- fileName: string;
229
- versionId: string;
230
- }>;
201
+ jobData: {
202
+ [jobId: string]: {
203
+ sourceFileId: string;
204
+ fileId: string;
205
+ versionId: string;
206
+ branchId: string;
207
+ targetLocale: string;
208
+ projectId: string;
209
+ force: boolean;
210
+ modelProvider?: string;
211
+ };
212
+ };
231
213
  locales: string[];
232
214
  message: string;
233
215
  };
234
216
 
235
- type EnqueueEntriesOptions = {
236
- timeout?: number;
237
- sourceLocale?: string;
238
- targetLocales?: string[];
239
- dataFormat?: DataFormat;
240
- version?: string;
241
- description?: string;
242
- requireApproval?: boolean;
243
- modelProvider?: string;
244
- };
245
- type EnqueueEntriesResult = {
246
- versionId: string;
247
- locales: string[];
248
- message: string;
249
- projectSettings: {
250
- cdnEnabled: boolean;
251
- requireApproval: boolean;
252
- };
253
- };
254
-
255
217
  type DownloadFileOptions = {
256
218
  timeout?: number;
257
219
  };
@@ -295,6 +257,86 @@ type TranslationResult = RequestSuccess | TranslationError;
295
257
  */
296
258
  type TranslateManyResult = Array<TranslationResult>;
297
259
 
260
+ type BranchDataResult = {
261
+ branches: {
262
+ id: string;
263
+ name: string;
264
+ }[];
265
+ defaultBranch: {
266
+ id: string;
267
+ name: string;
268
+ } | null;
269
+ };
270
+
271
+ type BranchQuery = {
272
+ branchNames: string[];
273
+ };
274
+
275
+ type FileDataQuery = {
276
+ sourceFiles?: {
277
+ fileId: string;
278
+ versionId: string;
279
+ branchId: string;
280
+ }[];
281
+ translatedFiles?: {
282
+ fileId: string;
283
+ versionId: string;
284
+ branchId: string;
285
+ locale: string;
286
+ }[];
287
+ };
288
+ type FileDataResult = {
289
+ sourceFiles?: {
290
+ branchId: string;
291
+ fileId: string;
292
+ versionId: string;
293
+ fileName: string;
294
+ fileFormat: string;
295
+ dataFormat: string | null;
296
+ createdAt: string;
297
+ updatedAt: string;
298
+ approvalRequiredAt: string | null;
299
+ publishedAt: string | null;
300
+ locales: string[];
301
+ sourceLocale: string;
302
+ }[];
303
+ translatedFiles?: {
304
+ branchId: string;
305
+ fileId: string;
306
+ versionId: string;
307
+ fileFormat: string;
308
+ dataFormat: string | null;
309
+ createdAt: string;
310
+ updatedAt: string;
311
+ approvedAt: string | null;
312
+ publishedAt: string | null;
313
+ completedAt: string | null;
314
+ locale: string;
315
+ }[];
316
+ };
317
+
318
+ type JobStatus = 'queued' | 'processing' | 'completed' | 'failed' | 'unknown';
319
+ type CheckJobStatusResult = {
320
+ jobId: string;
321
+ status: JobStatus;
322
+ error?: {
323
+ message: string;
324
+ };
325
+ }[];
326
+
327
+ type SubmitUserEditDiff = {
328
+ fileName: string;
329
+ locale: string;
330
+ diff: string;
331
+ branchId: string;
332
+ versionId: string;
333
+ fileId: string;
334
+ localContent?: string;
335
+ };
336
+ type SubmitUserEditDiffsPayload = {
337
+ diffs: SubmitUserEditDiff[];
338
+ };
339
+
298
340
  type FormatVariables = Record<string, string | number | boolean | null | undefined | Date>;
299
341
 
300
342
  type SetupProjectResult = {
@@ -308,19 +350,6 @@ type SetupProjectOptions = {
308
350
  timeoutMs?: number;
309
351
  };
310
352
 
311
- type SetupJobStatus = 'queued' | 'processing' | 'completed' | 'failed';
312
- type CheckSetupStatusResult = {
313
- jobId: string;
314
- status: SetupJobStatus;
315
- error?: {
316
- message: string;
317
- };
318
- };
319
-
320
- type ShouldSetupProjectResult = {
321
- shouldSetupProject: boolean;
322
- };
323
-
324
353
  type EnqueueOptions = {
325
354
  sourceLocale: string;
326
355
  targetLocales: string[];
@@ -331,19 +360,6 @@ type EnqueueOptions = {
331
360
  timeout?: number;
332
361
  };
333
362
 
334
- type SubmitUserEditDiff = {
335
- fileName: string;
336
- locale: string;
337
- diff: string;
338
- versionId?: string;
339
- fileId?: string;
340
- localContent?: string;
341
- };
342
- type SubmitUserEditDiffsPayload = {
343
- projectId?: string;
344
- diffs: SubmitUserEditDiff[];
345
- };
346
-
347
363
  type CustomRegionMapping = {
348
364
  [region: string]: {
349
365
  name?: string;
@@ -353,6 +369,9 @@ type CustomRegionMapping = {
353
369
  };
354
370
 
355
371
  type FileUpload = {
372
+ branchId?: string;
373
+ incomingBranchId?: string;
374
+ checkedOutBranchId?: string;
356
375
  content: string;
357
376
  fileName: string;
358
377
  fileFormat: FileFormat;
@@ -361,21 +380,13 @@ type FileUpload = {
361
380
  versionId?: string;
362
381
  fileId?: string;
363
382
  };
364
- type FileUploadRef = {
365
- fileId: string;
366
- versionId: string;
367
- fileName: string;
368
- fileFormat: FileFormat;
369
- dataFormat?: DataFormat;
370
- locale?: string;
371
- };
372
383
  type UploadFilesOptions = {
373
384
  sourceLocale: string;
374
385
  modelProvider?: string;
375
386
  timeout?: number;
376
387
  };
377
388
  type UploadFilesResponse = {
378
- uploadedFiles: FileUploadRef[];
389
+ uploadedFiles: FileReference[];
379
390
  count: number;
380
391
  message: string;
381
392
  };
@@ -388,6 +399,17 @@ type ProjectData = {
388
399
  currentLocales: string[];
389
400
  };
390
401
 
402
+ type CreateBranchQuery = {
403
+ branchName: string;
404
+ defaultBranch: boolean;
405
+ };
406
+ type CreateBranchResult = {
407
+ branch: {
408
+ id: string;
409
+ name: string;
410
+ };
411
+ };
412
+
391
413
  /**
392
414
  * Type representing the constructor parameters for the GT class.
393
415
  * @typedef {Object} GTConstructorParams
@@ -467,36 +489,19 @@ declare class GT {
467
489
  private _getTranslationConfig;
468
490
  private _validateAuth;
469
491
  /**
470
- * Enqueues translation entries for processing.
492
+ * Queries branch information from the API.
471
493
  *
472
- * @param {Updates} updates - The translation entries to enqueue.
473
- * @param {EnqueueEntriesOptions} options - Options for enqueueing entries.
474
- * @param {string} library - The library being used (for context).
475
- * @returns {Promise<EnqueueTranslationEntriesResult>} The result of the enqueue operation.
476
- *
477
- * @example
478
- * @deprecated Use the {@link enqueueFiles} method instead. Will be removed in v8.0.0.
479
- * const gt = new GT({
480
- * sourceLocale: 'en-US',
481
- * targetLocale: 'es-ES',
482
- * locales: ['en-US', 'es-ES', 'fr-FR']
483
- * });
494
+ * @param {BranchQuery} query - Object mapping the current branch and incoming branches
495
+ * @returns {Promise<BranchDataResult>} The branch information
496
+ */
497
+ queryBranchData(query: BranchQuery): Promise<BranchDataResult>;
498
+ /**
499
+ * Creates a new branch in the API. If the branch already exists, it will be returned.
484
500
  *
485
- * const result = await gt.enqueueEntries([
486
- * {
487
- * content: 'Hello, world!',
488
- * fileName: 'Button.tsx',
489
- * fileFormat: 'TS',
490
- * dataFormat: 'JSX',
491
- * },
492
- * ], {
493
- * sourceLocale: 'en-US',
494
- * targetLocales: ['es-ES', 'fr-FR'],
495
- * publish: true,
496
- * description: 'Translations for the Button component',
497
- * });
501
+ * @param {CreateBranchQuery} query - Object mapping the branch name and default branch flag
502
+ * @returns {Promise<CreateBranchResult>} The created branch information
498
503
  */
499
- enqueueEntries(updates: Updates, options?: EnqueueEntriesOptions): Promise<EnqueueEntriesResult>;
504
+ createBranch(query: CreateBranchQuery): Promise<CreateBranchResult>;
500
505
  /**
501
506
  * Enqueues project setup job using the specified file references
502
507
  *
@@ -505,32 +510,30 @@ declare class GT {
505
510
  * files that have already been uploaded via uploadSourceFiles. The setup jobs are queued
506
511
  * for processing and will generate a project setup based on the source files.
507
512
  *
508
- * @param {FileUploadRef[]} files - Array of file references containing IDs of previously uploaded source files
513
+ * @param {FileReference[]} files - Array of file references containing IDs of previously uploaded source files
509
514
  * @param {SetupProjectOptions} [options] - Optional settings for target locales and timeout
510
515
  * @returns {Promise<SetupProjectResult>} Object containing the jobId and status
511
516
  */
512
- setupProject(files: FileUploadRef[], options?: SetupProjectOptions): Promise<SetupProjectResult>;
517
+ setupProject(files: FileReference[], options?: SetupProjectOptions): Promise<SetupProjectResult>;
513
518
  /**
514
- * Checks the current status of a project setup job by its unique identifier.
519
+ * Checks the current status of one or more project jobs by their unique identifiers.
515
520
  *
516
- * This method polls the API to determine whether a setup job is still running,
517
- * has completed successfully, or has failed. Setup jobs are created when
518
- * uploading source files to initialize project translation workflows.
521
+ * This method polls the API to determine whether one or more jobs are still running,
522
+ * have completed successfully, or have failed. Jobs are created after calling either enqueueFiles or setupProject.
519
523
  *
520
- * @param {string} jobId - The unique identifier of the setup job to check
524
+ * @param {string[]} jobIds - The unique identifiers of the jobs to check
521
525
  * @param {number} [timeoutMs] - Optional timeout in milliseconds for the API request
522
- * @returns {Promise<CheckSetupStatusResult>} Object containing the job status
523
- */
524
- checkSetupStatus(jobId: string, timeoutMs?: number): Promise<CheckSetupStatusResult>;
525
- /**
526
- * Checks if a prpject requires setup.
526
+ * @returns {Promise<CheckJobStatusResult>} Object containing the job status
527
527
  *
528
- * This method queries API to check if a project has been set up and returns
529
- * true if setup is missing
530
- *
531
- * @returns {Promise<ShouldSetupProjectResult>} Object containing shouldSetupProject
528
+ * @example
529
+ * const result = await gt.checkJobStatus([
530
+ * 'job-123',
531
+ * 'job-456',
532
+ * ], {
533
+ * timeout: 10000,
534
+ * });
532
535
  */
533
- shouldSetupProject(): Promise<ShouldSetupProjectResult>;
536
+ checkJobStatus(jobIds: string[], timeoutMs?: number): Promise<CheckJobStatusResult>;
534
537
  /**
535
538
  * Enqueues translation jobs for previously uploaded source files.
536
539
  *
@@ -540,11 +543,11 @@ declare class GT {
540
543
  * uploadSourceFiles. The translation jobs are queued for processing and will
541
544
  * generate translated content based on the source files and target locales provided.
542
545
  *
543
- * @param {FileUploadRef[]} files - Array of file references containing IDs of previously uploaded source files
546
+ * @param {FileReference[]} files - Array of file references containing IDs of previously uploaded source files
544
547
  * @param {EnqueueOptions} options - Configuration options including source locale, target locales, and job settings
545
548
  * @returns {Promise<EnqueueFilesResult>} Result containing job IDs, queue status, and processing information
546
549
  */
547
- enqueueFiles(files: FileUploadRef[], options: EnqueueOptions): Promise<EnqueueFilesResult>;
550
+ enqueueFiles(files: FileReference[], options: EnqueueOptions): Promise<EnqueueFilesResult>;
548
551
  /**
549
552
  * Submits user edit diffs for existing translations so future generations preserve user intent.
550
553
  *
@@ -553,28 +556,26 @@ declare class GT {
553
556
  */
554
557
  submitUserEditDiffs(payload: SubmitUserEditDiffsPayload): Promise<void>;
555
558
  /**
556
- * Checks the translation status of files.
559
+ * Queries data about one or more source or translation files.
557
560
  *
558
- * @param {Object} data - Object mapping source paths to file information.
559
- * @param {CheckFileTranslationsOptions} options - Options for checking file translations.
560
- * @returns {Promise<CheckFileTranslationsResult>} The file translation status information.
561
+ * @param {FileDataQuery} data - Object mapping source and translation file information.
562
+ * @param {CheckFileTranslationsOptions} options - Options for the API call.
563
+ * @returns {Promise<FileDataResult>} The source and translation file data information.
561
564
  *
562
565
  * @example
563
- * const gt = new GT({
564
- * sourceLocale: 'en-US',
565
- * targetLocale: 'es-ES',
566
- * locales: ['en-US', 'es-ES', 'fr-FR']
567
- * });
568
- *
569
- * const result = await gt.checkFileTranslations([
570
- * { sourcePath: 'src/components/Button.tsx', locale: 'es-ES' },
571
- * { sourcePath: 'src/components/Input.tsx', locale: 'fr-FR' },
572
- * ], {
566
+ * const result = await gt.queryFileData({
567
+ * sourceFiles: [
568
+ * { fileId: '1234567890', versionId: '1234567890', branchId: '1234567890' },
569
+ * ],
570
+ * translatedFiles: [
571
+ * { fileId: '1234567890', versionId: '1234567890', branchId: '1234567890', locale: 'es-ES' },
572
+ * ],
573
+ * }, {
573
574
  * timeout: 10000,
574
575
  * });
575
576
  *
576
577
  */
577
- checkFileTranslations(data: FileTranslationQuery[], options?: CheckFileTranslationsOptions): Promise<CheckFileTranslationsResult>;
578
+ queryFileData(data: FileDataQuery, options?: CheckFileTranslationsOptions): Promise<FileDataResult>;
578
579
  /**
579
580
  * Gets source and translation information for a given file ID and version ID.
580
581
  *
@@ -583,12 +584,6 @@ declare class GT {
583
584
  * @returns {Promise<FileQueryResult>} The source file and translation information.
584
585
  *
585
586
  * @example
586
- * const gt = new GT({
587
- * sourceLocale: 'en-US',
588
- * targetLocale: 'es-ES',
589
- * locales: ['en-US', 'es-ES', 'fr-FR']
590
- * });
591
- *
592
587
  * const result = await gt.querySourceFile(
593
588
  * { fileId: '1234567890', versionId: '1234567890' },
594
589
  * { timeout: 10000 }
@@ -603,12 +598,6 @@ declare class GT {
603
598
  * @returns {Promise<ProjectData>} The project data.
604
599
  *
605
600
  * @example
606
- * const gt = new GT({
607
- * sourceLocale: 'en-US',
608
- * targetLocale: 'es-ES',
609
- * locales: ['en-US', 'es-ES', 'fr-FR']
610
- * });
611
- *
612
601
  * const result = await gt.getProjectData(
613
602
  * '1234567890'
614
603
  * );
@@ -618,107 +607,49 @@ declare class GT {
618
607
  timeout?: number;
619
608
  }): Promise<ProjectData>;
620
609
  /**
621
- * Checks the translation status of a version.
622
- *
623
- * @param {string} versionId - The ID of the version to check.
624
- * @param {CheckTranslationStatusOptions} options - Options for checking the translation status.
625
- * @returns {Promise<TranslationStatusResult>} The translation status of the version.
626
- *
627
- * @example
628
- * @deprecated Use the {@link checkFileTranslations} method instead. Will be removed in v7.0.0.
629
- * const gt = new GT({
630
- * sourceLocale: 'en-US',
631
- * targetLocale: 'es-ES',
632
- * locales: ['en-US', 'es-ES', 'fr-FR']
633
- * });
634
- *
635
- * const result = await gt.checkTranslationStatus('1234567890', {
636
- * timeout: 10000,
637
- * });
638
- */
639
- checkTranslationStatus(versionId: string, options?: CheckTranslationStatusOptions): Promise<TranslationStatusResult>;
640
- /**
641
- * Downloads a single translation file.
642
- *
643
- * @param {string} translationId - The ID of the translation to download.
644
- * @param {DownloadFileOptions} options - Options for downloading the file.
645
- * @returns {Promise<DownloadFileResult>} The downloaded file content and metadata.
646
- * @deprecated Use the {@link downloadTranslatedFile} method instead. Will be removed in v7.0.0.
647
- * @example
648
- * const gt = new GT({
649
- * sourceLocale: 'en-US',
650
- * targetLocale: 'es-ES',
651
- * locales: ['en-US', 'es-ES', 'fr-FR']
652
- * });
653
- *
654
- * const result = await gt.downloadFile('1234567890', {
655
- * timeout: 10000,
656
- * });
657
- */
658
- downloadFile(translationId: string, options?: DownloadFileOptions): Promise<ArrayBuffer>;
659
- /**
660
- * Downloads a single translated file.
610
+ * Downloads a single file.
661
611
  *
662
- * @param {string} file - The file to download.
612
+ * @param file - The file query object.
613
+ * @param {string} file.fileId - The ID of the file to download.
614
+ * @param {string} [file.branchId] - The ID of the branch to download the file from. If not provided, the default branch will be used.
615
+ * @param {string} [file.locale] - The locale to download the file for. If not provided, the source file will be downloaded.
616
+ * @param {string} [file.versionId] - The version ID to download the file from. If not provided, the latest version will be used.
663
617
  * @param {DownloadFileOptions} options - Options for downloading the file.
664
618
  * @returns {Promise<string>} The downloaded file content.
665
619
  *
666
620
  * @example
667
- * const gt = new GT({
668
- * sourceLocale: 'en-US',
669
- * targetLocale: 'es-ES',
670
- * locales: ['en-US', 'es-ES', 'fr-FR']
671
- * });
672
- *
673
- * const result = await gt.downloadTranslatedFile({
621
+ * const result = await gt.downloadFile({
674
622
  * fileId: '1234567890',
623
+ * branchId: '1234567890',
675
624
  * locale: 'es-ES',
676
625
  * versionId: '1234567890',
677
626
  * }, {
678
627
  * timeout: 10000,
679
628
  * });
680
629
  */
681
- downloadTranslatedFile(file: {
630
+ downloadFile(file: {
682
631
  fileId: string;
683
- locale: string;
632
+ branchId?: string;
633
+ locale?: string;
684
634
  versionId?: string;
685
635
  }, options?: DownloadFileOptions): Promise<string>;
686
636
  /**
687
- * Downloads multiple translation files in a batch.
637
+ * Downloads multiple files in a batch.
688
638
  *
689
- * @param {string[]} fileIds - Array of file IDs to download.
639
+ * @param {DownloadFileBatchRequest} requests - Array of file query objects to download.
690
640
  * @param {DownloadFileBatchOptions} options - Options for the batch download.
691
641
  * @returns {Promise<DownloadFileBatchResult>} The batch download results.
692
642
  *
693
643
  * @example
694
- * const gt = new GT({
695
- * sourceLocale: 'en-US',
696
- * targetLocale: 'es-ES',
697
- * locales: ['en-US', 'es-ES', 'fr-FR']
698
- * });
699
- *
700
- * const result = await gt.downloadFileBatch(['1234567890', '1234567891'], {
644
+ * const result = await gt.downloadFileBatch([{
645
+ * fileId: '1234567890',
646
+ * locale: 'es-ES',
647
+ * versionId: '1234567890',
648
+ * }], {
701
649
  * timeout: 10000,
702
650
  * });
703
651
  */
704
- downloadFileBatch(fileIds: string[], options?: DownloadFileBatchOptions): Promise<DownloadFileBatchResult>;
705
- /**
706
- * Fetches translation metadata and information.
707
- *
708
- * @param {string} versionId - The version ID to fetch translations for.
709
- * @param {FetchTranslationsOptions} options - Options for fetching translations.
710
- * @returns {Promise<FetchTranslationsResult>} The translation metadata and information.
711
- *
712
- * @example
713
- * const gt = new GT({
714
- * sourceLocale: 'en-US',
715
- * targetLocale: 'es-ES',
716
- * locales: ['en-US', 'es-ES', 'fr-FR']
717
- * });
718
- *
719
- * const result = await gt.fetchTranslations('1234567890');
720
- */
721
- fetchTranslations(versionId: string, options?: FetchTranslationsOptions): Promise<FetchTranslationsResult>;
652
+ downloadFileBatch(requests: DownloadFileBatchRequest, options?: DownloadFileBatchOptions): Promise<DownloadFileBatchResult>;
722
653
  /**
723
654
  * Translates the source content to the target locale.
724
655
  * @deprecated Use the {@link translate} method instead.