@generaltranslation/api 0.2.0 → 0.2.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.
package/dist/index.mjs CHANGED
@@ -2,14 +2,17 @@
2
2
  /**
3
3
  * Create a Project
4
4
  *
5
- * Create a Project in the Organization associated with an Organization API key. The key must have the `org:projects:create` permission. Project keys cannot use this endpoint. Enabling CDN delivery also requires `project:write`.
5
+ * Create a Project in the Organization selected by the orgId path parameter. Requires org:projects:create. Enabling CDN delivery also requires project:write.
6
6
  */
7
7
  const createProject = (options) => options.client.post({
8
8
  security: [{
9
9
  scheme: "bearer",
10
10
  type: "http"
11
+ }, {
12
+ scheme: "bearer",
13
+ type: "http"
11
14
  }],
12
- url: "/v2/projects",
15
+ url: "/v2/orgs/{orgId}/projects",
13
16
  ...options,
14
17
  headers: {
15
18
  "Content-Type": "application/json",
@@ -17,16 +20,19 @@ const createProject = (options) => options.client.post({
17
20
  }
18
21
  });
19
22
  /**
20
- * Upload source files
23
+ * Create a Project API Key
21
24
  *
22
- * Upload one or more source files to the project. Max 100 files per request.
25
+ * Create an API key for the selected Project. Requires project:api_keys:write and delegates only Project permissions held by the request identity.
23
26
  */
24
- const uploadSourceFiles = (options) => options.client.post({
27
+ const createProjectApiKey = (options) => options.client.post({
25
28
  security: [{
26
29
  scheme: "bearer",
27
30
  type: "http"
31
+ }, {
32
+ scheme: "bearer",
33
+ type: "http"
28
34
  }],
29
- url: "/v2/project/files/upload-files",
35
+ url: "/v2/projects/{projectId}/api-keys",
30
36
  ...options,
31
37
  headers: {
32
38
  "Content-Type": "application/json",
@@ -42,6 +48,9 @@ const uploadTranslations = (options) => options.client.post({
42
48
  security: [{
43
49
  scheme: "bearer",
44
50
  type: "http"
51
+ }, {
52
+ scheme: "bearer",
53
+ type: "http"
45
54
  }],
46
55
  url: "/v2/project/files/upload-translations",
47
56
  ...options,
@@ -51,33 +60,35 @@ const uploadTranslations = (options) => options.client.post({
51
60
  }
52
61
  });
53
62
  /**
54
- * Upload Project assets
63
+ * Get Project information
55
64
  *
56
- * Upload OpenType or TrueType fonts through a Project and make them available to Lottie translation workflows across its Organization. Each font is keyed by a normalized identity derived from its family, weight, and italic style (from the supplied `family` and `style`, or from the font metadata and file name). Re-uploading the same identity overwrites the existing asset, so complete retries after a `500` response are safe.
65
+ * Read the authenticated Project's name, Organization ID, locale settings, and auto-approval setting.
57
66
  */
58
- const uploadAssets = (options) => options.client.post({
67
+ const getProjectInfo = (options) => options.client.get({
59
68
  security: [{
60
69
  scheme: "bearer",
61
70
  type: "http"
71
+ }, {
72
+ scheme: "bearer",
73
+ type: "http"
62
74
  }],
63
- url: "/v2/project/assets",
64
- ...options,
65
- headers: {
66
- "Content-Type": "application/json",
67
- ...options.headers
68
- }
75
+ url: "/v2/project/info/{projectId}",
76
+ ...options
69
77
  });
70
78
  /**
71
- * Submit translation diffs
79
+ * Update Project information
72
80
  *
73
- * Overwrite translations with user-provided localized content.
81
+ * Update the Project's default locale or CDN delivery setting.
74
82
  */
75
- const submitUserEditDiffs = (options) => options.client.post({
83
+ const updateProjectInfo = (options) => options.client.post({
76
84
  security: [{
77
85
  scheme: "bearer",
78
86
  type: "http"
87
+ }, {
88
+ scheme: "bearer",
89
+ type: "http"
79
90
  }],
80
- url: "/v2/project/files/diffs",
91
+ url: "/v2/project/info/{projectId}",
81
92
  ...options,
82
93
  headers: {
83
94
  "Content-Type": "application/json",
@@ -85,31 +96,19 @@ const submitUserEditDiffs = (options) => options.client.post({
85
96
  }
86
97
  });
87
98
  /**
88
- * Check if context generation is needed
89
- *
90
- * Check whether the Project needs translation context generated. This deprecated endpoint is retained for backward compatibility and is no longer called by current clients.
99
+ * Translate content at runtime
91
100
  *
92
- * @deprecated
101
+ * Translate one or more strings or structured content entries with caching and memoization. Development API keys are accepted for this endpoint.
93
102
  */
94
- const shouldGenerateProjectContext = (options) => options.client.get({
103
+ const translate = (options) => options.client.post({
95
104
  security: [{
96
105
  scheme: "bearer",
97
106
  type: "http"
98
- }],
99
- url: "/v2/project/setup/should-generate",
100
- ...options
101
- });
102
- /**
103
- * Generate translation context
104
- *
105
- * Generate glossaries and translation instructions for the project.
106
- */
107
- const generateProjectContext = (options) => options.client.post({
108
- security: [{
107
+ }, {
109
108
  scheme: "bearer",
110
109
  type: "http"
111
110
  }],
112
- url: "/v2/project/setup/generate",
111
+ url: "/v2/translate",
113
112
  ...options,
114
113
  headers: {
115
114
  "Content-Type": "application/json",
@@ -117,31 +116,35 @@ const generateProjectContext = (options) => options.client.post({
117
116
  }
118
117
  });
119
118
  /**
120
- * Get context generation job status
121
- *
122
- * Track a context generation job. This deprecated endpoint is retained for backward compatibility; new integrations should use `POST /v2/project/jobs/info`.
119
+ * Get translation status for a file
123
120
  *
124
- * @deprecated
121
+ * Return translation progress and availability by locale for one source file, along with its source metadata.
125
122
  */
126
- const getProjectContextGenerationStatus = (options) => options.client.get({
123
+ const getTranslationStatus = (options) => options.client.get({
127
124
  security: [{
128
125
  scheme: "bearer",
129
126
  type: "http"
127
+ }, {
128
+ scheme: "bearer",
129
+ type: "http"
130
130
  }],
131
- url: "/v2/project/setup/status/{jobId}",
131
+ url: "/v2/project/translations/files/status/{fileId}",
132
132
  ...options
133
133
  });
134
134
  /**
135
- * Queue files for translation
135
+ * Get branch information
136
136
  *
137
- * Enqueue uploaded source files for background translation. Max 100 files per request. The response shape depends on the requested `gt-api-version`.
137
+ * Return the Project's default branch and any branches requested by name.
138
138
  */
139
- const enqueueFileTranslations = (options) => options.client.post({
139
+ const getBranchInfo = (options) => options.client.post({
140
140
  security: [{
141
141
  scheme: "bearer",
142
142
  type: "http"
143
+ }, {
144
+ scheme: "bearer",
145
+ type: "http"
143
146
  }],
144
- url: "/v2/project/translations/enqueue",
147
+ url: "/v2/project/branches/info",
145
148
  ...options,
146
149
  headers: {
147
150
  "Content-Type": "application/json",
@@ -149,16 +152,19 @@ const enqueueFileTranslations = (options) => options.client.post({
149
152
  }
150
153
  });
151
154
  /**
152
- * Publish or unpublish files
155
+ * Create a branch
153
156
  *
154
- * Publish or unpublish translated files to the CDN. Requires CDN to be enabled.
157
+ * Create a new branch, or rename and confirm the default branch.
155
158
  */
156
- const publishFiles = (options) => options.client.post({
159
+ const createBranch = (options) => options.client.post({
157
160
  security: [{
158
161
  scheme: "bearer",
159
162
  type: "http"
163
+ }, {
164
+ scheme: "bearer",
165
+ type: "http"
160
166
  }],
161
- url: "/v2/project/files/publish",
167
+ url: "/v2/project/branches/create",
162
168
  ...options,
163
169
  headers: {
164
170
  "Content-Type": "application/json",
@@ -166,31 +172,39 @@ const publishFiles = (options) => options.client.post({
166
172
  }
167
173
  });
168
174
  /**
169
- * Download a single file
170
- *
171
- * Download a single source or translated file. This deprecated endpoint is retained for backward compatibility; new integrations should use `POST /v2/project/files/download`.
175
+ * Create or update a tag
172
176
  *
173
- * @deprecated
177
+ * Create or upsert a tag that points at a set of file versions.
174
178
  */
175
- const downloadFile = (options) => options.client.get({
179
+ const createTag = (options) => options.client.post({
176
180
  security: [{
177
181
  scheme: "bearer",
178
182
  type: "http"
183
+ }, {
184
+ scheme: "bearer",
185
+ type: "http"
179
186
  }],
180
- url: "/v2/project/files/download/{fileId}",
181
- ...options
187
+ url: "/v2/project/tags/create",
188
+ ...options,
189
+ headers: {
190
+ "Content-Type": "application/json",
191
+ ...options.headers
192
+ }
182
193
  });
183
194
  /**
184
- * Download multiple files
195
+ * Upload Project assets
185
196
  *
186
- * Download up to 100 source or translated files in one request.
197
+ * Upload OpenType or TrueType fonts through a Project and make them available to Lottie translation workflows across its Organization. Each font is keyed by a normalized identity derived from its family, weight, and italic style (from the supplied `family` and `style`, or from the font metadata and file name). Re-uploading the same identity overwrites the existing asset, so complete retries after a `500` response are safe.
187
198
  */
188
- const downloadFiles = (options) => options.client.post({
199
+ const uploadAssets = (options) => options.client.post({
189
200
  security: [{
190
201
  scheme: "bearer",
191
202
  type: "http"
203
+ }, {
204
+ scheme: "bearer",
205
+ type: "http"
192
206
  }],
193
- url: "/v2/project/files/download",
207
+ url: "/v2/project/assets",
194
208
  ...options,
195
209
  headers: {
196
210
  "Content-Type": "application/json",
@@ -198,16 +212,19 @@ const downloadFiles = (options) => options.client.post({
198
212
  }
199
213
  });
200
214
  /**
201
- * Get branch information
215
+ * Submit translation diffs
202
216
  *
203
- * Return the Project's default branch and any branches requested by name.
217
+ * Overwrite translations with user-provided localized content.
204
218
  */
205
- const getBranchInfo = (options) => options.client.post({
219
+ const submitUserEditDiffs = (options) => options.client.post({
206
220
  security: [{
207
221
  scheme: "bearer",
208
222
  type: "http"
223
+ }, {
224
+ scheme: "bearer",
225
+ type: "http"
209
226
  }],
210
- url: "/v2/project/branches/info",
227
+ url: "/v2/project/files/diffs",
211
228
  ...options,
212
229
  headers: {
213
230
  "Content-Type": "application/json",
@@ -215,16 +232,19 @@ const getBranchInfo = (options) => options.client.post({
215
232
  }
216
233
  });
217
234
  /**
218
- * Create a branch
235
+ * Move or rename files
219
236
  *
220
- * Create a new branch, or rename and confirm the default branch.
237
+ * Clone source files and their translations under new file IDs.
221
238
  */
222
- const createBranch = (options) => options.client.post({
239
+ const processFileMoves = (options) => options.client.post({
223
240
  security: [{
224
241
  scheme: "bearer",
225
242
  type: "http"
243
+ }, {
244
+ scheme: "bearer",
245
+ type: "http"
226
246
  }],
227
- url: "/v2/project/branches/create",
247
+ url: "/v2/project/files/moves",
228
248
  ...options,
229
249
  headers: {
230
250
  "Content-Type": "application/json",
@@ -232,16 +252,19 @@ const createBranch = (options) => options.client.post({
232
252
  }
233
253
  });
234
254
  /**
235
- * Create or update a tag
255
+ * Find orphaned files
236
256
  *
237
- * Create or upsert a tag that points at a set of file versions.
257
+ * Return files on a branch that are not present in the provided file ID list.
238
258
  */
239
- const createTag = (options) => options.client.post({
259
+ const getOrphanedFiles = (options) => options.client.post({
240
260
  security: [{
241
261
  scheme: "bearer",
242
262
  type: "http"
263
+ }, {
264
+ scheme: "bearer",
265
+ type: "http"
243
266
  }],
244
- url: "/v2/project/tags/create",
267
+ url: "/v2/project/files/orphaned",
245
268
  ...options,
246
269
  headers: {
247
270
  "Content-Type": "application/json",
@@ -249,29 +272,39 @@ const createTag = (options) => options.client.post({
249
272
  }
250
273
  });
251
274
  /**
252
- * Get Project information
275
+ * Get file metadata
253
276
  *
254
- * Read the authenticated Project's name, Organization ID, locale settings, and auto-approval setting.
277
+ * Get detailed metadata for specific source and translated files.
255
278
  */
256
- const getProjectInfo = (options) => options.client.get({
279
+ const getFileInfo = (options) => options.client.post({
257
280
  security: [{
258
281
  scheme: "bearer",
259
282
  type: "http"
283
+ }, {
284
+ scheme: "bearer",
285
+ type: "http"
260
286
  }],
261
- url: "/v2/project/info/{projectId}",
262
- ...options
287
+ url: "/v2/project/files/info",
288
+ ...options,
289
+ headers: {
290
+ "Content-Type": "application/json",
291
+ ...options.headers
292
+ }
263
293
  });
264
294
  /**
265
- * Update Project information
295
+ * Download multiple files
266
296
  *
267
- * Update the Project's default locale or CDN delivery setting.
297
+ * Download up to 100 source or translated files in one request.
268
298
  */
269
- const updateProjectInfo = (options) => options.client.post({
299
+ const downloadFiles = (options) => options.client.post({
270
300
  security: [{
271
301
  scheme: "bearer",
272
302
  type: "http"
303
+ }, {
304
+ scheme: "bearer",
305
+ type: "http"
273
306
  }],
274
- url: "/v2/project/info/{projectId}",
307
+ url: "/v2/project/files/download",
275
308
  ...options,
276
309
  headers: {
277
310
  "Content-Type": "application/json",
@@ -279,6 +312,24 @@ const updateProjectInfo = (options) => options.client.post({
279
312
  }
280
313
  });
281
314
  /**
315
+ * Download a single file
316
+ *
317
+ * Download a single source or translated file. This deprecated endpoint is retained for backward compatibility; new integrations should use `POST /v2/project/files/download`.
318
+ *
319
+ * @deprecated
320
+ */
321
+ const downloadFile = (options) => options.client.get({
322
+ security: [{
323
+ scheme: "bearer",
324
+ type: "http"
325
+ }, {
326
+ scheme: "bearer",
327
+ type: "http"
328
+ }],
329
+ url: "/v2/project/files/download/{fileId}",
330
+ ...options
331
+ });
332
+ /**
282
333
  * Get translation job status
283
334
  *
284
335
  * Return normalized status information for one or more queued translation or context generation jobs.
@@ -287,6 +338,9 @@ const getTranslationJobInfo = (options) => options.client.post({
287
338
  security: [{
288
339
  scheme: "bearer",
289
340
  type: "http"
341
+ }, {
342
+ scheme: "bearer",
343
+ type: "http"
290
344
  }],
291
345
  url: "/v2/project/jobs/info",
292
346
  ...options,
@@ -296,16 +350,19 @@ const getTranslationJobInfo = (options) => options.client.post({
296
350
  }
297
351
  });
298
352
  /**
299
- * Translate content at runtime
353
+ * Generate translation context
300
354
  *
301
- * Translate one or more strings or structured content entries with caching and memoization. Development API keys are accepted for this endpoint.
355
+ * Generate glossaries and translation instructions for the project.
302
356
  */
303
- const translate = (options) => options.client.post({
357
+ const generateProjectContext = (options) => options.client.post({
304
358
  security: [{
305
359
  scheme: "bearer",
306
360
  type: "http"
361
+ }, {
362
+ scheme: "bearer",
363
+ type: "http"
307
364
  }],
308
- url: "/v2/translate",
365
+ url: "/v2/project/setup/generate",
309
366
  ...options,
310
367
  headers: {
311
368
  "Content-Type": "application/json",
@@ -313,16 +370,19 @@ const translate = (options) => options.client.post({
313
370
  }
314
371
  });
315
372
  /**
316
- * Get file metadata
373
+ * Publish or unpublish files
317
374
  *
318
- * Get detailed metadata for specific source and translated files.
375
+ * Publish or unpublish translated files to the CDN. Requires CDN to be enabled.
319
376
  */
320
- const getFileInfo = (options) => options.client.post({
377
+ const publishFiles = (options) => options.client.post({
321
378
  security: [{
322
379
  scheme: "bearer",
323
380
  type: "http"
381
+ }, {
382
+ scheme: "bearer",
383
+ type: "http"
324
384
  }],
325
- url: "/v2/project/files/info",
385
+ url: "/v2/project/files/publish",
326
386
  ...options,
327
387
  headers: {
328
388
  "Content-Type": "application/json",
@@ -330,29 +390,19 @@ const getFileInfo = (options) => options.client.post({
330
390
  }
331
391
  });
332
392
  /**
333
- * Get translation status for a file
393
+ * Upload source files
334
394
  *
335
- * Return translation progress and availability by locale for one source file, along with its source metadata.
395
+ * Upload one or more source files to the project. Max 100 files per request.
336
396
  */
337
- const getTranslationStatus = (options) => options.client.get({
397
+ const uploadSourceFiles = (options) => options.client.post({
338
398
  security: [{
339
399
  scheme: "bearer",
340
400
  type: "http"
341
- }],
342
- url: "/v2/project/translations/files/status/{fileId}",
343
- ...options
344
- });
345
- /**
346
- * Move or rename files
347
- *
348
- * Clone source files and their translations under new file IDs.
349
- */
350
- const processFileMoves = (options) => options.client.post({
351
- security: [{
401
+ }, {
352
402
  scheme: "bearer",
353
403
  type: "http"
354
404
  }],
355
- url: "/v2/project/files/moves",
405
+ url: "/v2/project/files/upload-files",
356
406
  ...options,
357
407
  headers: {
358
408
  "Content-Type": "application/json",
@@ -360,16 +410,19 @@ const processFileMoves = (options) => options.client.post({
360
410
  }
361
411
  });
362
412
  /**
363
- * Find orphaned files
413
+ * Queue files for translation
364
414
  *
365
- * Return files on a branch that are not present in the provided file ID list.
415
+ * Enqueue uploaded source files for background translation. Max 100 files per request. The response shape depends on the requested `gt-api-version`.
366
416
  */
367
- const getOrphanedFiles = (options) => options.client.post({
417
+ const enqueueFileTranslations = (options) => options.client.post({
368
418
  security: [{
369
419
  scheme: "bearer",
370
420
  type: "http"
421
+ }, {
422
+ scheme: "bearer",
423
+ type: "http"
371
424
  }],
372
- url: "/v2/project/files/orphaned",
425
+ url: "/v2/project/translations/enqueue",
373
426
  ...options,
374
427
  headers: {
375
428
  "Content-Type": "application/json",
@@ -1188,6 +1241,6 @@ function createApiClient(config) {
1188
1241
  });
1189
1242
  }
1190
1243
  //#endregion
1191
- export { API_VERSION, DEFAULT_BATCH_SIZE, awaitJobs, createApiClient, createBranch, createCliWizardSession, createProject, createTag, decodeBase64, decodeFileContent, deleteCliWizardSession, downloadFile, downloadFiles, encodeBase64, encodeFileContent, enqueueFileTranslations, generateProjectContext, getBranchInfo, getCliWizardSession, getFileInfo, getOrphanedFiles, getProjectContextGenerationStatus, getProjectInfo, getTranslationJobInfo, getTranslationStatus, pollJobs, processBatches, processFileMoves, publishFiles, shouldGenerateProjectContext, submitUserEditDiffs, translate, updateProjectInfo, uploadAssets, uploadSourceFiles, uploadTranslations };
1244
+ export { API_VERSION, DEFAULT_BATCH_SIZE, awaitJobs, createApiClient, createBranch, createCliWizardSession, createProject, createProjectApiKey, createTag, decodeBase64, decodeFileContent, deleteCliWizardSession, downloadFile, downloadFiles, encodeBase64, encodeFileContent, enqueueFileTranslations, generateProjectContext, getBranchInfo, getCliWizardSession, getFileInfo, getOrphanedFiles, getProjectInfo, getTranslationJobInfo, getTranslationStatus, pollJobs, processBatches, processFileMoves, publishFiles, submitUserEditDiffs, translate, updateProjectInfo, uploadAssets, uploadSourceFiles, uploadTranslations };
1192
1245
 
1193
1246
  //# sourceMappingURL=index.mjs.map