generaltranslation 7.6.0 → 7.6.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.d.ts CHANGED
@@ -5,10 +5,11 @@ import { SetupProjectResult } from './translate/setupProject';
5
5
  import { CheckSetupStatusResult } from './translate/checkSetupStatus';
6
6
  import { ShouldSetupProjectResult } from './translate/shouldSetupProject';
7
7
  import { EnqueueOptions } from './translate/enqueueFiles';
8
- import { FileTranslationQuery } from './types-dir/checkFileTranslations';
8
+ import { FileQuery, FileQueryResult, FileTranslationQuery } from './types-dir/checkFileTranslations';
9
9
  import { CheckTranslationStatusOptions, TranslationStatusResult } from './types-dir/translationStatus';
10
10
  import { CustomRegionMapping } from './locales/getRegionProperties';
11
- import { FileUpload, FileUploadRef, UploadFilesOptions } from './types-dir/uploadFiles';
11
+ import { FileUpload, FileUploadRef, UploadFilesOptions, UploadFilesResponse } from './types-dir/uploadFiles';
12
+ import { ProjectData } from './types-dir/project';
12
13
  /**
13
14
  * Type representing the constructor parameters for the GT class.
14
15
  * @typedef {Object} GTConstructorParams
@@ -189,6 +190,48 @@ export declare class GT {
189
190
  *
190
191
  */
191
192
  checkFileTranslations(data: FileTranslationQuery[], options?: CheckFileTranslationsOptions): Promise<CheckFileTranslationsResult>;
193
+ /**
194
+ * Gets source and translation information for a given file ID and version ID.
195
+ *
196
+ * @param {FileQuery} data - File query containing file ID and version ID.
197
+ * @param {CheckFileTranslationsOptions} options - Options for getting source and translation information.
198
+ * @returns {Promise<FileQueryResult>} The source file and translation information.
199
+ *
200
+ * @example
201
+ * const gt = new GT({
202
+ * sourceLocale: 'en-US',
203
+ * targetLocale: 'es-ES',
204
+ * locales: ['en-US', 'es-ES', 'fr-FR']
205
+ * });
206
+ *
207
+ * const result = await gt.querySourceFile(
208
+ * { fileId: '1234567890', versionId: '1234567890' },
209
+ * { timeout: 10000 }
210
+ * );
211
+ *
212
+ */
213
+ querySourceFile(data: FileQuery, options?: CheckFileTranslationsOptions): Promise<FileQueryResult>;
214
+ /**
215
+ * Get project data for a given project ID.
216
+ *
217
+ * @param {string} projectId - The ID of the project to get the data for.
218
+ * @returns {Promise<ProjectData>} The project data.
219
+ *
220
+ * @example
221
+ * const gt = new GT({
222
+ * sourceLocale: 'en-US',
223
+ * targetLocale: 'es-ES',
224
+ * locales: ['en-US', 'es-ES', 'fr-FR']
225
+ * });
226
+ *
227
+ * const result = await gt.getProjectData(
228
+ * '1234567890'
229
+ * );
230
+ *
231
+ */
232
+ getProjectData(projectId: string, options?: {
233
+ timeout?: number;
234
+ }): Promise<ProjectData>;
192
235
  /**
193
236
  * Checks the translation status of a version.
194
237
  *
@@ -215,7 +258,7 @@ export declare class GT {
215
258
  * @param {string} translationId - The ID of the translation to download.
216
259
  * @param {DownloadFileOptions} options - Options for downloading the file.
217
260
  * @returns {Promise<DownloadFileResult>} The downloaded file content and metadata.
218
- *
261
+ * @deprecated Use the {@link downloadTranslatedFile} method instead. Will be removed in v7.0.0.
219
262
  * @example
220
263
  * const gt = new GT({
221
264
  * sourceLocale: 'en-US',
@@ -228,6 +271,33 @@ export declare class GT {
228
271
  * });
229
272
  */
230
273
  downloadFile(translationId: string, options?: DownloadFileOptions): Promise<ArrayBuffer>;
274
+ /**
275
+ * Downloads a single translated file.
276
+ *
277
+ * @param {string} file - The file to download.
278
+ * @param {DownloadFileOptions} options - Options for downloading the file.
279
+ * @returns {Promise<string>} The downloaded file content.
280
+ *
281
+ * @example
282
+ * const gt = new GT({
283
+ * sourceLocale: 'en-US',
284
+ * targetLocale: 'es-ES',
285
+ * locales: ['en-US', 'es-ES', 'fr-FR']
286
+ * });
287
+ *
288
+ * const result = await gt.downloadTranslatedFile({
289
+ * fileId: '1234567890',
290
+ * locale: 'es-ES',
291
+ * versionId: '1234567890',
292
+ * }, {
293
+ * timeout: 10000,
294
+ * });
295
+ */
296
+ downloadTranslatedFile(file: {
297
+ fileId: string;
298
+ locale: string;
299
+ versionId?: string;
300
+ }, options?: DownloadFileOptions): Promise<string>;
231
301
  /**
232
302
  * Downloads multiple translation files in a batch.
233
303
  *
@@ -353,11 +423,11 @@ export declare class GT {
353
423
  *
354
424
  * @param {Array<{source: FileUpload}>} files - Array of objects containing source file data to upload
355
425
  * @param {UploadFilesOptions} options - Configuration options including source locale and other upload settings
356
- * @returns {Promise<any>} Upload result containing file IDs, version information, and upload status
426
+ * @returns {Promise<UploadFilesResponse>} Upload result containing file IDs, version information, and upload status
357
427
  */
358
428
  uploadSourceFiles(files: {
359
429
  source: FileUpload;
360
- }[], options: UploadFilesOptions): Promise<any>;
430
+ }[], options: UploadFilesOptions): Promise<UploadFilesResponse>;
361
431
  /**
362
432
  * Uploads translation files that correspond to previously uploaded source files.
363
433
  *
@@ -370,12 +440,12 @@ export declare class GT {
370
440
  * - `source`: Reference to the existing source file (contains IDs but no content)
371
441
  * - `translations`: Array of translated files, each containing content, locale, and reference IDs
372
442
  * @param {UploadFilesOptions} options - Configuration options including source locale and upload settings
373
- * @returns {Promise<any>} Upload result containing translation IDs, status, and processing information
443
+ * @returns {Promise<UploadFilesResponse>} Upload result containing translation IDs, status, and processing information
374
444
  */
375
445
  uploadTranslations(files: {
376
446
  source: FileUpload;
377
447
  translations: FileUpload[];
378
- }[], options: UploadFilesOptions): Promise<any>;
448
+ }[], options: UploadFilesOptions): Promise<UploadFilesResponse>;
379
449
  /**
380
450
  * Formats a message according to the specified locales and options.
381
451
  *