@generaltranslation/api 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @generaltranslation/api
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2217](https://github.com/generaltranslation/gt/pull/2217) [`bf3ce1e`](https://github.com/generaltranslation/gt/commit/bf3ce1eb967e1798c95b78c04313de2c8362932c) Thanks [@internal-gt-public-api-sync](https://github.com/apps/internal-gt-public-api-sync)! - Sync the GT API OpenAPI contract and regenerate the SDK.
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#2254](https://github.com/generaltranslation/gt/pull/2254) [`8e59be2`](https://github.com/generaltranslation/gt/commit/8e59be28c129b4b9509ce8897156de3282b2a295) Thanks [@eoinest](https://github.com/eoinest)! - Add Apple `.xcstrings` catalog upload support to the CLI. An `.xcstrings` catalog holds every locale in one file; on upload the CLI extracts a source-only slice (only the catalog's `sourceLanguage` localization per entry) and uploads that as the source document. The slice is serialized with a pinned byte layout and hashed into its `versionId`, so an unchanged catalog re-slices byte-identically and does not re-upload. Configure it under `files.xcstrings` in `gt.config.json`; patterns without `[locale]` are expected because the catalog is shared across locales.
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -3,14 +3,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  /**
4
4
  * Create a Project
5
5
  *
6
- * 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`.
6
+ * Create a Project in the Organization selected by the orgId path parameter. Requires org:projects:create. Enabling CDN delivery also requires project:write.
7
7
  */
8
8
  const createProject = (options) => options.client.post({
9
9
  security: [{
10
10
  scheme: "bearer",
11
11
  type: "http"
12
+ }, {
13
+ scheme: "bearer",
14
+ type: "http"
12
15
  }],
13
- url: "/v2/projects",
16
+ url: "/v2/orgs/{orgId}/projects",
14
17
  ...options,
15
18
  headers: {
16
19
  "Content-Type": "application/json",
@@ -18,16 +21,19 @@ const createProject = (options) => options.client.post({
18
21
  }
19
22
  });
20
23
  /**
21
- * Upload source files
24
+ * Create a Project API Key
22
25
  *
23
- * Upload one or more source files to the project. Max 100 files per request.
26
+ * Create an API key for the selected Project. Requires project:api_keys:write and delegates only Project permissions held by the request identity.
24
27
  */
25
- const uploadSourceFiles = (options) => options.client.post({
28
+ const createProjectApiKey = (options) => options.client.post({
26
29
  security: [{
27
30
  scheme: "bearer",
28
31
  type: "http"
32
+ }, {
33
+ scheme: "bearer",
34
+ type: "http"
29
35
  }],
30
- url: "/v2/project/files/upload-files",
36
+ url: "/v2/projects/{projectId}/api-keys",
31
37
  ...options,
32
38
  headers: {
33
39
  "Content-Type": "application/json",
@@ -43,6 +49,9 @@ const uploadTranslations = (options) => options.client.post({
43
49
  security: [{
44
50
  scheme: "bearer",
45
51
  type: "http"
52
+ }, {
53
+ scheme: "bearer",
54
+ type: "http"
46
55
  }],
47
56
  url: "/v2/project/files/upload-translations",
48
57
  ...options,
@@ -52,33 +61,35 @@ const uploadTranslations = (options) => options.client.post({
52
61
  }
53
62
  });
54
63
  /**
55
- * Upload Project assets
64
+ * Get Project information
56
65
  *
57
- * 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.
66
+ * Read the authenticated Project's name, Organization ID, locale settings, and auto-approval setting.
58
67
  */
59
- const uploadAssets = (options) => options.client.post({
68
+ const getProjectInfo = (options) => options.client.get({
60
69
  security: [{
61
70
  scheme: "bearer",
62
71
  type: "http"
72
+ }, {
73
+ scheme: "bearer",
74
+ type: "http"
63
75
  }],
64
- url: "/v2/project/assets",
65
- ...options,
66
- headers: {
67
- "Content-Type": "application/json",
68
- ...options.headers
69
- }
76
+ url: "/v2/project/info/{projectId}",
77
+ ...options
70
78
  });
71
79
  /**
72
- * Submit translation diffs
80
+ * Update Project information
73
81
  *
74
- * Overwrite translations with user-provided localized content.
82
+ * Update the Project's default locale or CDN delivery setting.
75
83
  */
76
- const submitUserEditDiffs = (options) => options.client.post({
84
+ const updateProjectInfo = (options) => options.client.post({
77
85
  security: [{
78
86
  scheme: "bearer",
79
87
  type: "http"
88
+ }, {
89
+ scheme: "bearer",
90
+ type: "http"
80
91
  }],
81
- url: "/v2/project/files/diffs",
92
+ url: "/v2/project/info/{projectId}",
82
93
  ...options,
83
94
  headers: {
84
95
  "Content-Type": "application/json",
@@ -86,31 +97,19 @@ const submitUserEditDiffs = (options) => options.client.post({
86
97
  }
87
98
  });
88
99
  /**
89
- * Check if context generation is needed
90
- *
91
- * Check whether the Project needs translation context generated. This deprecated endpoint is retained for backward compatibility and is no longer called by current clients.
100
+ * Translate content at runtime
92
101
  *
93
- * @deprecated
102
+ * Translate one or more strings or structured content entries with caching and memoization. Development API keys are accepted for this endpoint.
94
103
  */
95
- const shouldGenerateProjectContext = (options) => options.client.get({
104
+ const translate = (options) => options.client.post({
96
105
  security: [{
97
106
  scheme: "bearer",
98
107
  type: "http"
99
- }],
100
- url: "/v2/project/setup/should-generate",
101
- ...options
102
- });
103
- /**
104
- * Generate translation context
105
- *
106
- * Generate glossaries and translation instructions for the project.
107
- */
108
- const generateProjectContext = (options) => options.client.post({
109
- security: [{
108
+ }, {
110
109
  scheme: "bearer",
111
110
  type: "http"
112
111
  }],
113
- url: "/v2/project/setup/generate",
112
+ url: "/v2/translate",
114
113
  ...options,
115
114
  headers: {
116
115
  "Content-Type": "application/json",
@@ -118,31 +117,35 @@ const generateProjectContext = (options) => options.client.post({
118
117
  }
119
118
  });
120
119
  /**
121
- * Get context generation job status
122
- *
123
- * Track a context generation job. This deprecated endpoint is retained for backward compatibility; new integrations should use `POST /v2/project/jobs/info`.
120
+ * Get translation status for a file
124
121
  *
125
- * @deprecated
122
+ * Return translation progress and availability by locale for one source file, along with its source metadata.
126
123
  */
127
- const getProjectContextGenerationStatus = (options) => options.client.get({
124
+ const getTranslationStatus = (options) => options.client.get({
128
125
  security: [{
129
126
  scheme: "bearer",
130
127
  type: "http"
128
+ }, {
129
+ scheme: "bearer",
130
+ type: "http"
131
131
  }],
132
- url: "/v2/project/setup/status/{jobId}",
132
+ url: "/v2/project/translations/files/status/{fileId}",
133
133
  ...options
134
134
  });
135
135
  /**
136
- * Queue files for translation
136
+ * Get branch information
137
137
  *
138
- * Enqueue uploaded source files for background translation. Max 100 files per request. The response shape depends on the requested `gt-api-version`.
138
+ * Return the Project's default branch and any branches requested by name.
139
139
  */
140
- const enqueueFileTranslations = (options) => options.client.post({
140
+ const getBranchInfo = (options) => options.client.post({
141
141
  security: [{
142
142
  scheme: "bearer",
143
143
  type: "http"
144
+ }, {
145
+ scheme: "bearer",
146
+ type: "http"
144
147
  }],
145
- url: "/v2/project/translations/enqueue",
148
+ url: "/v2/project/branches/info",
146
149
  ...options,
147
150
  headers: {
148
151
  "Content-Type": "application/json",
@@ -150,16 +153,19 @@ const enqueueFileTranslations = (options) => options.client.post({
150
153
  }
151
154
  });
152
155
  /**
153
- * Publish or unpublish files
156
+ * Create a branch
154
157
  *
155
- * Publish or unpublish translated files to the CDN. Requires CDN to be enabled.
158
+ * Create a new branch, or rename and confirm the default branch.
156
159
  */
157
- const publishFiles = (options) => options.client.post({
160
+ const createBranch = (options) => options.client.post({
158
161
  security: [{
159
162
  scheme: "bearer",
160
163
  type: "http"
164
+ }, {
165
+ scheme: "bearer",
166
+ type: "http"
161
167
  }],
162
- url: "/v2/project/files/publish",
168
+ url: "/v2/project/branches/create",
163
169
  ...options,
164
170
  headers: {
165
171
  "Content-Type": "application/json",
@@ -167,31 +173,39 @@ const publishFiles = (options) => options.client.post({
167
173
  }
168
174
  });
169
175
  /**
170
- * Download a single file
171
- *
172
- * Download a single source or translated file. This deprecated endpoint is retained for backward compatibility; new integrations should use `POST /v2/project/files/download`.
176
+ * Create or update a tag
173
177
  *
174
- * @deprecated
178
+ * Create or upsert a tag that points at a set of file versions.
175
179
  */
176
- const downloadFile = (options) => options.client.get({
180
+ const createTag = (options) => options.client.post({
177
181
  security: [{
178
182
  scheme: "bearer",
179
183
  type: "http"
184
+ }, {
185
+ scheme: "bearer",
186
+ type: "http"
180
187
  }],
181
- url: "/v2/project/files/download/{fileId}",
182
- ...options
188
+ url: "/v2/project/tags/create",
189
+ ...options,
190
+ headers: {
191
+ "Content-Type": "application/json",
192
+ ...options.headers
193
+ }
183
194
  });
184
195
  /**
185
- * Download multiple files
196
+ * Upload Project assets
186
197
  *
187
- * Download up to 100 source or translated files in one request.
198
+ * 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.
188
199
  */
189
- const downloadFiles = (options) => options.client.post({
200
+ const uploadAssets = (options) => options.client.post({
190
201
  security: [{
191
202
  scheme: "bearer",
192
203
  type: "http"
204
+ }, {
205
+ scheme: "bearer",
206
+ type: "http"
193
207
  }],
194
- url: "/v2/project/files/download",
208
+ url: "/v2/project/assets",
195
209
  ...options,
196
210
  headers: {
197
211
  "Content-Type": "application/json",
@@ -199,16 +213,19 @@ const downloadFiles = (options) => options.client.post({
199
213
  }
200
214
  });
201
215
  /**
202
- * Get branch information
216
+ * Submit translation diffs
203
217
  *
204
- * Return the Project's default branch and any branches requested by name.
218
+ * Overwrite translations with user-provided localized content.
205
219
  */
206
- const getBranchInfo = (options) => options.client.post({
220
+ const submitUserEditDiffs = (options) => options.client.post({
207
221
  security: [{
208
222
  scheme: "bearer",
209
223
  type: "http"
224
+ }, {
225
+ scheme: "bearer",
226
+ type: "http"
210
227
  }],
211
- url: "/v2/project/branches/info",
228
+ url: "/v2/project/files/diffs",
212
229
  ...options,
213
230
  headers: {
214
231
  "Content-Type": "application/json",
@@ -216,16 +233,19 @@ const getBranchInfo = (options) => options.client.post({
216
233
  }
217
234
  });
218
235
  /**
219
- * Create a branch
236
+ * Move or rename files
220
237
  *
221
- * Create a new branch, or rename and confirm the default branch.
238
+ * Clone source files and their translations under new file IDs.
222
239
  */
223
- const createBranch = (options) => options.client.post({
240
+ const processFileMoves = (options) => options.client.post({
224
241
  security: [{
225
242
  scheme: "bearer",
226
243
  type: "http"
244
+ }, {
245
+ scheme: "bearer",
246
+ type: "http"
227
247
  }],
228
- url: "/v2/project/branches/create",
248
+ url: "/v2/project/files/moves",
229
249
  ...options,
230
250
  headers: {
231
251
  "Content-Type": "application/json",
@@ -233,16 +253,19 @@ const createBranch = (options) => options.client.post({
233
253
  }
234
254
  });
235
255
  /**
236
- * Create or update a tag
256
+ * Find orphaned files
237
257
  *
238
- * Create or upsert a tag that points at a set of file versions.
258
+ * Return files on a branch that are not present in the provided file ID list.
239
259
  */
240
- const createTag = (options) => options.client.post({
260
+ const getOrphanedFiles = (options) => options.client.post({
241
261
  security: [{
242
262
  scheme: "bearer",
243
263
  type: "http"
264
+ }, {
265
+ scheme: "bearer",
266
+ type: "http"
244
267
  }],
245
- url: "/v2/project/tags/create",
268
+ url: "/v2/project/files/orphaned",
246
269
  ...options,
247
270
  headers: {
248
271
  "Content-Type": "application/json",
@@ -250,29 +273,39 @@ const createTag = (options) => options.client.post({
250
273
  }
251
274
  });
252
275
  /**
253
- * Get Project information
276
+ * Get file metadata
254
277
  *
255
- * Read the authenticated Project's name, Organization ID, locale settings, and auto-approval setting.
278
+ * Get detailed metadata for specific source and translated files.
256
279
  */
257
- const getProjectInfo = (options) => options.client.get({
280
+ const getFileInfo = (options) => options.client.post({
258
281
  security: [{
259
282
  scheme: "bearer",
260
283
  type: "http"
284
+ }, {
285
+ scheme: "bearer",
286
+ type: "http"
261
287
  }],
262
- url: "/v2/project/info/{projectId}",
263
- ...options
288
+ url: "/v2/project/files/info",
289
+ ...options,
290
+ headers: {
291
+ "Content-Type": "application/json",
292
+ ...options.headers
293
+ }
264
294
  });
265
295
  /**
266
- * Update Project information
296
+ * Download multiple files
267
297
  *
268
- * Update the Project's default locale or CDN delivery setting.
298
+ * Download up to 100 source or translated files in one request.
269
299
  */
270
- const updateProjectInfo = (options) => options.client.post({
300
+ const downloadFiles = (options) => options.client.post({
271
301
  security: [{
272
302
  scheme: "bearer",
273
303
  type: "http"
304
+ }, {
305
+ scheme: "bearer",
306
+ type: "http"
274
307
  }],
275
- url: "/v2/project/info/{projectId}",
308
+ url: "/v2/project/files/download",
276
309
  ...options,
277
310
  headers: {
278
311
  "Content-Type": "application/json",
@@ -280,6 +313,24 @@ const updateProjectInfo = (options) => options.client.post({
280
313
  }
281
314
  });
282
315
  /**
316
+ * Download a single file
317
+ *
318
+ * Download a single source or translated file. This deprecated endpoint is retained for backward compatibility; new integrations should use `POST /v2/project/files/download`.
319
+ *
320
+ * @deprecated
321
+ */
322
+ const downloadFile = (options) => options.client.get({
323
+ security: [{
324
+ scheme: "bearer",
325
+ type: "http"
326
+ }, {
327
+ scheme: "bearer",
328
+ type: "http"
329
+ }],
330
+ url: "/v2/project/files/download/{fileId}",
331
+ ...options
332
+ });
333
+ /**
283
334
  * Get translation job status
284
335
  *
285
336
  * Return normalized status information for one or more queued translation or context generation jobs.
@@ -288,6 +339,9 @@ const getTranslationJobInfo = (options) => options.client.post({
288
339
  security: [{
289
340
  scheme: "bearer",
290
341
  type: "http"
342
+ }, {
343
+ scheme: "bearer",
344
+ type: "http"
291
345
  }],
292
346
  url: "/v2/project/jobs/info",
293
347
  ...options,
@@ -297,16 +351,19 @@ const getTranslationJobInfo = (options) => options.client.post({
297
351
  }
298
352
  });
299
353
  /**
300
- * Translate content at runtime
354
+ * Generate translation context
301
355
  *
302
- * Translate one or more strings or structured content entries with caching and memoization. Development API keys are accepted for this endpoint.
356
+ * Generate glossaries and translation instructions for the project.
303
357
  */
304
- const translate = (options) => options.client.post({
358
+ const generateProjectContext = (options) => options.client.post({
305
359
  security: [{
306
360
  scheme: "bearer",
307
361
  type: "http"
362
+ }, {
363
+ scheme: "bearer",
364
+ type: "http"
308
365
  }],
309
- url: "/v2/translate",
366
+ url: "/v2/project/setup/generate",
310
367
  ...options,
311
368
  headers: {
312
369
  "Content-Type": "application/json",
@@ -314,16 +371,19 @@ const translate = (options) => options.client.post({
314
371
  }
315
372
  });
316
373
  /**
317
- * Get file metadata
374
+ * Publish or unpublish files
318
375
  *
319
- * Get detailed metadata for specific source and translated files.
376
+ * Publish or unpublish translated files to the CDN. Requires CDN to be enabled.
320
377
  */
321
- const getFileInfo = (options) => options.client.post({
378
+ const publishFiles = (options) => options.client.post({
322
379
  security: [{
323
380
  scheme: "bearer",
324
381
  type: "http"
382
+ }, {
383
+ scheme: "bearer",
384
+ type: "http"
325
385
  }],
326
- url: "/v2/project/files/info",
386
+ url: "/v2/project/files/publish",
327
387
  ...options,
328
388
  headers: {
329
389
  "Content-Type": "application/json",
@@ -331,29 +391,19 @@ const getFileInfo = (options) => options.client.post({
331
391
  }
332
392
  });
333
393
  /**
334
- * Get translation status for a file
394
+ * Upload source files
335
395
  *
336
- * Return translation progress and availability by locale for one source file, along with its source metadata.
396
+ * Upload one or more source files to the project. Max 100 files per request.
337
397
  */
338
- const getTranslationStatus = (options) => options.client.get({
398
+ const uploadSourceFiles = (options) => options.client.post({
339
399
  security: [{
340
400
  scheme: "bearer",
341
401
  type: "http"
342
- }],
343
- url: "/v2/project/translations/files/status/{fileId}",
344
- ...options
345
- });
346
- /**
347
- * Move or rename files
348
- *
349
- * Clone source files and their translations under new file IDs.
350
- */
351
- const processFileMoves = (options) => options.client.post({
352
- security: [{
402
+ }, {
353
403
  scheme: "bearer",
354
404
  type: "http"
355
405
  }],
356
- url: "/v2/project/files/moves",
406
+ url: "/v2/project/files/upload-files",
357
407
  ...options,
358
408
  headers: {
359
409
  "Content-Type": "application/json",
@@ -361,16 +411,19 @@ const processFileMoves = (options) => options.client.post({
361
411
  }
362
412
  });
363
413
  /**
364
- * Find orphaned files
414
+ * Queue files for translation
365
415
  *
366
- * Return files on a branch that are not present in the provided file ID list.
416
+ * Enqueue uploaded source files for background translation. Max 100 files per request. The response shape depends on the requested `gt-api-version`.
367
417
  */
368
- const getOrphanedFiles = (options) => options.client.post({
418
+ const enqueueFileTranslations = (options) => options.client.post({
369
419
  security: [{
370
420
  scheme: "bearer",
371
421
  type: "http"
422
+ }, {
423
+ scheme: "bearer",
424
+ type: "http"
372
425
  }],
373
- url: "/v2/project/files/orphaned",
426
+ url: "/v2/project/translations/enqueue",
374
427
  ...options,
375
428
  headers: {
376
429
  "Content-Type": "application/json",
@@ -1196,6 +1249,7 @@ exports.createApiClient = createApiClient;
1196
1249
  exports.createBranch = createBranch;
1197
1250
  exports.createCliWizardSession = createCliWizardSession;
1198
1251
  exports.createProject = createProject;
1252
+ exports.createProjectApiKey = createProjectApiKey;
1199
1253
  exports.createTag = createTag;
1200
1254
  exports.decodeBase64 = decodeBase64;
1201
1255
  exports.decodeFileContent = decodeFileContent;
@@ -1210,7 +1264,6 @@ exports.getBranchInfo = getBranchInfo;
1210
1264
  exports.getCliWizardSession = getCliWizardSession;
1211
1265
  exports.getFileInfo = getFileInfo;
1212
1266
  exports.getOrphanedFiles = getOrphanedFiles;
1213
- exports.getProjectContextGenerationStatus = getProjectContextGenerationStatus;
1214
1267
  exports.getProjectInfo = getProjectInfo;
1215
1268
  exports.getTranslationJobInfo = getTranslationJobInfo;
1216
1269
  exports.getTranslationStatus = getTranslationStatus;
@@ -1218,7 +1271,6 @@ exports.pollJobs = pollJobs;
1218
1271
  exports.processBatches = processBatches;
1219
1272
  exports.processFileMoves = processFileMoves;
1220
1273
  exports.publishFiles = publishFiles;
1221
- exports.shouldGenerateProjectContext = shouldGenerateProjectContext;
1222
1274
  exports.submitUserEditDiffs = submitUserEditDiffs;
1223
1275
  exports.translate = translate;
1224
1276
  exports.updateProjectInfo = updateProjectInfo;