@maxim_mazurok/gapi.client.translate-v3 0.0.20231013 → 0.0.20231201

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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@maxim_mazurok/gapi.client.translate-v3",
3
- "version": "0.0.20231013",
3
+ "version": "0.0.20231201",
4
4
  "description": "TypeScript typings for Cloud Translation API v3",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
8
+ },
5
9
  "license": "MIT",
6
10
  "author": {
7
- "email": "maxim@mazurok.com",
8
11
  "name": "Maxim Mazurok",
12
+ "email": "maxim@mazurok.com",
9
13
  "url": "https://maxim.mazurok.com"
10
14
  },
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
- },
15
15
  "types": "index.d.ts",
16
16
  "dependencies": {
17
17
  "@types/gapi.client": "*",
package/readme.md CHANGED
@@ -25,10 +25,13 @@ gapi.load('client', () => {
25
25
  Then load api client wrapper:
26
26
 
27
27
  ```typescript
28
- gapi.client.load('https://translation.googleapis.com/$discovery/rest?version=v3', () => {
29
- // now we can use:
30
- // gapi.client.translate
31
- });
28
+ gapi.client.load(
29
+ 'https://translation.googleapis.com/$discovery/rest?version=v3',
30
+ () => {
31
+ // now we can use:
32
+ // gapi.client.translate
33
+ }
34
+ );
32
35
  ```
33
36
 
34
37
  ```typescript
@@ -45,47 +48,47 @@ Don't forget to authenticate your client before sending any request to resources
45
48
  // declare client_id registered in Google Developers Console
46
49
  var client_id = '',
47
50
  scope = [
48
- // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
49
- 'https://www.googleapis.com/auth/cloud-platform',
51
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
52
+ 'https://www.googleapis.com/auth/cloud-platform',
50
53
 
51
- // Translate text from one language to another using Google Translate
52
- 'https://www.googleapis.com/auth/cloud-translation',
53
- ],
54
- immediate = true;
54
+ // Translate text from one language to another using Google Translate
55
+ 'https://www.googleapis.com/auth/cloud-translation',
56
+ ],
57
+ immediate = true;
55
58
  // ...
56
59
 
57
60
  gapi.auth.authorize(
58
- { client_id: client_id, scope: scope, immediate: immediate },
61
+ {client_id: client_id, scope: scope, immediate: immediate},
59
62
  authResult => {
60
63
  if (authResult && !authResult.error) {
61
- /* handle successful authorization */
64
+ /* handle successful authorization */
62
65
  } else {
63
- /* handle authorization error */
66
+ /* handle authorization error */
64
67
  }
65
- });
68
+ }
69
+ );
66
70
  ```
67
71
 
68
72
  After that you can use Cloud Translation API resources: <!-- TODO: make this work for multiple namespaces -->
69
73
 
70
74
  ```typescript
71
-
72
75
  /*
73
76
  Detects the language of text within a request.
74
77
  */
75
- await gapi.client.translate.projects.detectLanguage({ parent: "parent", });
78
+ await gapi.client.translate.projects.detectLanguage({parent: 'parent'});
76
79
 
77
80
  /*
78
81
  Returns a list of supported languages for translation.
79
82
  */
80
- await gapi.client.translate.projects.getSupportedLanguages({ parent: "parent", });
83
+ await gapi.client.translate.projects.getSupportedLanguages({parent: 'parent'});
81
84
 
82
85
  /*
83
86
  Romanize input text written in non-Latin scripts to Latin text.
84
87
  */
85
- await gapi.client.translate.projects.romanizeText({ parent: "parent", });
88
+ await gapi.client.translate.projects.romanizeText({parent: 'parent'});
86
89
 
87
90
  /*
88
91
  Translates input text and returns translated text.
89
92
  */
90
- await gapi.client.translate.projects.translateText({ parent: "parent", });
93
+ await gapi.client.translate.projects.translateText({parent: 'parent'});
91
94
  ```
package/tests.ts DELETED
@@ -1,510 +0,0 @@
1
- /* This is stub file for gapi.client.translate-v3 definition tests */
2
- // IMPORTANT
3
- // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
- // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
-
6
- // Revision: 20231013
7
-
8
- gapi.load('client', async () => {
9
- /** now we can use gapi.client */
10
-
11
- await gapi.client.load('https://translation.googleapis.com/$discovery/rest?version=v3');
12
- /** now we can use gapi.client.translate */
13
-
14
- /** don't forget to authenticate your client before sending any request to resources: */
15
- /** declare client_id registered in Google Developers Console */
16
- const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
- const scope = [
18
- /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
19
- 'https://www.googleapis.com/auth/cloud-platform',
20
- /** Translate text from one language to another using Google Translate */
21
- 'https://www.googleapis.com/auth/cloud-translation',
22
- ];
23
- const immediate = false;
24
- gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
25
- if (authResult && !authResult.error) {
26
- /** handle successful authorization */
27
- run();
28
- } else {
29
- /** handle authorization error */
30
- }
31
- });
32
-
33
- async function run() {
34
- /** Detects the language of text within a request. */
35
- await gapi.client.translate.projects.detectLanguage({
36
- parent: "Test string",
37
- }, {
38
- content: "Test string",
39
- labels: {
40
- A: "Test string"
41
- },
42
- mimeType: "Test string",
43
- model: "Test string",
44
- });
45
- /** Returns a list of supported languages for translation. */
46
- await gapi.client.translate.projects.getSupportedLanguages({
47
- displayLanguageCode: "Test string",
48
- model: "Test string",
49
- parent: "Test string",
50
- });
51
- /** Romanize input text written in non-Latin scripts to Latin text. */
52
- await gapi.client.translate.projects.romanizeText({
53
- parent: "Test string",
54
- }, {
55
- contents: [
56
- "Test string"
57
- ],
58
- sourceLanguageCode: "Test string",
59
- });
60
- /** Translates input text and returns translated text. */
61
- await gapi.client.translate.projects.translateText({
62
- parent: "Test string",
63
- }, {
64
- contents: [
65
- "Test string"
66
- ],
67
- glossaryConfig: {
68
- glossary: "Test string",
69
- ignoreCase: true,
70
- },
71
- labels: {
72
- A: "Test string"
73
- },
74
- mimeType: "Test string",
75
- model: "Test string",
76
- sourceLanguageCode: "Test string",
77
- targetLanguageCode: "Test string",
78
- transliterationConfig: {
79
- enableTransliteration: true,
80
- },
81
- });
82
- /**
83
- * Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial
84
- * results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name
85
- * to poll the status of the call.
86
- */
87
- await gapi.client.translate.projects.locations.batchTranslateDocument({
88
- parent: "Test string",
89
- }, {
90
- customizedAttribution: "Test string",
91
- enableRotationCorrection: true,
92
- enableShadowRemovalNativePdf: true,
93
- formatConversions: {
94
- A: "Test string"
95
- },
96
- glossaries: {
97
- A: {
98
- glossary: "Test string",
99
- ignoreCase: true,
100
- }
101
- },
102
- inputConfigs: [
103
- {
104
- gcsSource: {
105
- inputUri: "Test string",
106
- },
107
- }
108
- ],
109
- models: {
110
- A: "Test string"
111
- },
112
- outputConfig: {
113
- gcsDestination: {
114
- outputUriPrefix: "Test string",
115
- },
116
- },
117
- sourceLanguageCode: "Test string",
118
- targetLanguageCodes: [
119
- "Test string"
120
- ],
121
- });
122
- /**
123
- * Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results
124
- * (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll
125
- * the status of the call.
126
- */
127
- await gapi.client.translate.projects.locations.batchTranslateText({
128
- parent: "Test string",
129
- }, {
130
- glossaries: {
131
- A: {
132
- glossary: "Test string",
133
- ignoreCase: true,
134
- }
135
- },
136
- inputConfigs: [
137
- {
138
- gcsSource: {
139
- inputUri: "Test string",
140
- },
141
- mimeType: "Test string",
142
- }
143
- ],
144
- labels: {
145
- A: "Test string"
146
- },
147
- models: {
148
- A: "Test string"
149
- },
150
- outputConfig: {
151
- gcsDestination: {
152
- outputUriPrefix: "Test string",
153
- },
154
- },
155
- sourceLanguageCode: "Test string",
156
- targetLanguageCodes: [
157
- "Test string"
158
- ],
159
- });
160
- /** Detects the language of text within a request. */
161
- await gapi.client.translate.projects.locations.detectLanguage({
162
- parent: "Test string",
163
- }, {
164
- content: "Test string",
165
- labels: {
166
- A: "Test string"
167
- },
168
- mimeType: "Test string",
169
- model: "Test string",
170
- });
171
- /** Gets information about a location. */
172
- await gapi.client.translate.projects.locations.get({
173
- name: "Test string",
174
- });
175
- /** Returns a list of supported languages for translation. */
176
- await gapi.client.translate.projects.locations.getSupportedLanguages({
177
- displayLanguageCode: "Test string",
178
- model: "Test string",
179
- parent: "Test string",
180
- });
181
- /** Lists information about the supported locations for this service. */
182
- await gapi.client.translate.projects.locations.list({
183
- filter: "Test string",
184
- name: "Test string",
185
- pageSize: 42,
186
- pageToken: "Test string",
187
- });
188
- /** Romanize input text written in non-Latin scripts to Latin text. */
189
- await gapi.client.translate.projects.locations.romanizeText({
190
- parent: "Test string",
191
- }, {
192
- contents: [
193
- "Test string"
194
- ],
195
- sourceLanguageCode: "Test string",
196
- });
197
- /** Translates documents in synchronous mode. */
198
- await gapi.client.translate.projects.locations.translateDocument({
199
- parent: "Test string",
200
- }, {
201
- customizedAttribution: "Test string",
202
- documentInputConfig: {
203
- content: "Test string",
204
- gcsSource: {
205
- inputUri: "Test string",
206
- },
207
- mimeType: "Test string",
208
- },
209
- documentOutputConfig: {
210
- gcsDestination: {
211
- outputUriPrefix: "Test string",
212
- },
213
- mimeType: "Test string",
214
- },
215
- enableRotationCorrection: true,
216
- enableShadowRemovalNativePdf: true,
217
- glossaryConfig: {
218
- glossary: "Test string",
219
- ignoreCase: true,
220
- },
221
- isTranslateNativePdfOnly: true,
222
- labels: {
223
- A: "Test string"
224
- },
225
- model: "Test string",
226
- sourceLanguageCode: "Test string",
227
- targetLanguageCode: "Test string",
228
- });
229
- /** Translates input text and returns translated text. */
230
- await gapi.client.translate.projects.locations.translateText({
231
- parent: "Test string",
232
- }, {
233
- contents: [
234
- "Test string"
235
- ],
236
- glossaryConfig: {
237
- glossary: "Test string",
238
- ignoreCase: true,
239
- },
240
- labels: {
241
- A: "Test string"
242
- },
243
- mimeType: "Test string",
244
- model: "Test string",
245
- sourceLanguageCode: "Test string",
246
- targetLanguageCode: "Test string",
247
- transliterationConfig: {
248
- enableTransliteration: true,
249
- },
250
- });
251
- /** Creates a Dataset. */
252
- await gapi.client.translate.projects.locations.datasets.create({
253
- parent: "Test string",
254
- }, {
255
- createTime: "Test string",
256
- displayName: "Test string",
257
- exampleCount: 42,
258
- name: "Test string",
259
- sourceLanguageCode: "Test string",
260
- targetLanguageCode: "Test string",
261
- testExampleCount: 42,
262
- trainExampleCount: 42,
263
- updateTime: "Test string",
264
- validateExampleCount: 42,
265
- });
266
- /** Deletes a dataset and all of its contents. */
267
- await gapi.client.translate.projects.locations.datasets.delete({
268
- name: "Test string",
269
- });
270
- /** Exports dataset's data to the provided output location. */
271
- await gapi.client.translate.projects.locations.datasets.exportData({
272
- dataset: "Test string",
273
- }, {
274
- outputConfig: {
275
- gcsDestination: {
276
- outputUriPrefix: "Test string",
277
- },
278
- },
279
- });
280
- /** Gets a Dataset. */
281
- await gapi.client.translate.projects.locations.datasets.get({
282
- name: "Test string",
283
- });
284
- /** Import sentence pairs into translation Dataset. */
285
- await gapi.client.translate.projects.locations.datasets.importData({
286
- dataset: "Test string",
287
- }, {
288
- inputConfig: {
289
- inputFiles: [
290
- {
291
- gcsSource: {
292
- inputUri: "Test string",
293
- },
294
- usage: "Test string",
295
- }
296
- ],
297
- },
298
- });
299
- /** Lists datasets. */
300
- await gapi.client.translate.projects.locations.datasets.list({
301
- pageSize: 42,
302
- pageToken: "Test string",
303
- parent: "Test string",
304
- });
305
- /** Lists sentence pairs in the dataset. */
306
- await gapi.client.translate.projects.locations.datasets.examples.list({
307
- filter: "Test string",
308
- pageSize: 42,
309
- pageToken: "Test string",
310
- parent: "Test string",
311
- });
312
- /** Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. */
313
- await gapi.client.translate.projects.locations.glossaries.create({
314
- parent: "Test string",
315
- }, {
316
- displayName: "Test string",
317
- endTime: "Test string",
318
- entryCount: 42,
319
- inputConfig: {
320
- gcsSource: {
321
- inputUri: "Test string",
322
- },
323
- },
324
- languageCodesSet: {
325
- languageCodes: [
326
- "Test string"
327
- ],
328
- },
329
- languagePair: {
330
- sourceLanguageCode: "Test string",
331
- targetLanguageCode: "Test string",
332
- },
333
- name: "Test string",
334
- submitTime: "Test string",
335
- });
336
- /** Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist. */
337
- await gapi.client.translate.projects.locations.glossaries.delete({
338
- name: "Test string",
339
- });
340
- /** Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. */
341
- await gapi.client.translate.projects.locations.glossaries.get({
342
- name: "Test string",
343
- });
344
- /** Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. */
345
- await gapi.client.translate.projects.locations.glossaries.list({
346
- filter: "Test string",
347
- pageSize: 42,
348
- pageToken: "Test string",
349
- parent: "Test string",
350
- });
351
- /** Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated. */
352
- await gapi.client.translate.projects.locations.glossaries.patch({
353
- name: "Test string",
354
- updateMask: "Test string",
355
- }, {
356
- displayName: "Test string",
357
- endTime: "Test string",
358
- entryCount: 42,
359
- inputConfig: {
360
- gcsSource: {
361
- inputUri: "Test string",
362
- },
363
- },
364
- languageCodesSet: {
365
- languageCodes: [
366
- "Test string"
367
- ],
368
- },
369
- languagePair: {
370
- sourceLanguageCode: "Test string",
371
- targetLanguageCode: "Test string",
372
- },
373
- name: "Test string",
374
- submitTime: "Test string",
375
- });
376
- /** Creates a glossary entry. */
377
- await gapi.client.translate.projects.locations.glossaries.glossaryEntries.create({
378
- parent: "Test string",
379
- }, {
380
- description: "Test string",
381
- name: "Test string",
382
- termsPair: {
383
- sourceTerm: {
384
- languageCode: "Test string",
385
- text: "Test string",
386
- },
387
- targetTerm: {
388
- languageCode: "Test string",
389
- text: "Test string",
390
- },
391
- },
392
- termsSet: {
393
- terms: [
394
- {
395
- languageCode: "Test string",
396
- text: "Test string",
397
- }
398
- ],
399
- },
400
- });
401
- /** Deletes a single entry from the glossary */
402
- await gapi.client.translate.projects.locations.glossaries.glossaryEntries.delete({
403
- name: "Test string",
404
- });
405
- /** Gets a single glossary entry by the given id. */
406
- await gapi.client.translate.projects.locations.glossaries.glossaryEntries.get({
407
- name: "Test string",
408
- });
409
- /** List the entries for the glossary. */
410
- await gapi.client.translate.projects.locations.glossaries.glossaryEntries.list({
411
- pageSize: 42,
412
- pageToken: "Test string",
413
- parent: "Test string",
414
- });
415
- /** Updates a glossary entry. */
416
- await gapi.client.translate.projects.locations.glossaries.glossaryEntries.patch({
417
- name: "Test string",
418
- }, {
419
- description: "Test string",
420
- name: "Test string",
421
- termsPair: {
422
- sourceTerm: {
423
- languageCode: "Test string",
424
- text: "Test string",
425
- },
426
- targetTerm: {
427
- languageCode: "Test string",
428
- text: "Test string",
429
- },
430
- },
431
- termsSet: {
432
- terms: [
433
- {
434
- languageCode: "Test string",
435
- text: "Test string",
436
- }
437
- ],
438
- },
439
- });
440
- /** Creates a Model. */
441
- await gapi.client.translate.projects.locations.models.create({
442
- parent: "Test string",
443
- }, {
444
- createTime: "Test string",
445
- dataset: "Test string",
446
- displayName: "Test string",
447
- name: "Test string",
448
- sourceLanguageCode: "Test string",
449
- targetLanguageCode: "Test string",
450
- testExampleCount: 42,
451
- trainExampleCount: 42,
452
- updateTime: "Test string",
453
- validateExampleCount: 42,
454
- });
455
- /** Deletes a model. */
456
- await gapi.client.translate.projects.locations.models.delete({
457
- name: "Test string",
458
- });
459
- /** Gets a model. */
460
- await gapi.client.translate.projects.locations.models.get({
461
- name: "Test string",
462
- });
463
- /** Lists models. */
464
- await gapi.client.translate.projects.locations.models.list({
465
- filter: "Test string",
466
- pageSize: 42,
467
- pageToken: "Test string",
468
- parent: "Test string",
469
- });
470
- /**
471
- * Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this
472
- * method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation
473
- * completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of
474
- * 1, corresponding to `Code.CANCELLED`.
475
- */
476
- await gapi.client.translate.projects.locations.operations.cancel({
477
- name: "Test string",
478
- }, {
479
- });
480
- /**
481
- * Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support
482
- * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
483
- */
484
- await gapi.client.translate.projects.locations.operations.delete({
485
- name: "Test string",
486
- });
487
- /** Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. */
488
- await gapi.client.translate.projects.locations.operations.get({
489
- name: "Test string",
490
- });
491
- /** Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. */
492
- await gapi.client.translate.projects.locations.operations.list({
493
- filter: "Test string",
494
- name: "Test string",
495
- pageSize: 42,
496
- pageToken: "Test string",
497
- });
498
- /**
499
- * Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is
500
- * immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns
501
- * `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an
502
- * immediate response is no guarantee that the operation is done.
503
- */
504
- await gapi.client.translate.projects.locations.operations.wait({
505
- name: "Test string",
506
- }, {
507
- timeout: "Test string",
508
- });
509
- }
510
- });
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "lib": ["es6", "dom"],
5
- "noImplicitAny": true,
6
- "noImplicitThis": true,
7
- "strictNullChecks": true,
8
- "baseUrl": "../",
9
- "typeRoots": [
10
- "../"
11
- ],
12
- "types": [],
13
- "noEmit": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "strictFunctionTypes": true
16
- },
17
- "files": ["index.d.ts", "tests.ts"]
18
- }
package/tslint.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "dtslint/dtslint.json",
3
- "rules": {
4
- "no-redundant-jsdoc": false
5
- }
6
- }