@maxim_mazurok/gapi.client.language-v1 0.0.20220806

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/index.d.ts ADDED
@@ -0,0 +1,583 @@
1
+ /* Type definitions for non-npm package Cloud Natural Language API v1 0.0 */
2
+ // Project: https://cloud.google.com/natural-language/
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://language.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220806
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Cloud Natural Language API v1 */
19
+ function load(urlOrObject: "https://language.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "language", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "language", version: "v1", callback: () => any): void;
24
+
25
+ namespace language {
26
+ interface AnalyzeEntitiesRequest {
27
+ /** Required. Input document. */
28
+ document?: Document;
29
+ /** The encoding type used by the API to calculate offsets. */
30
+ encodingType?: string;
31
+ }
32
+ interface AnalyzeEntitiesResponse {
33
+ /** The recognized entities in the input document. */
34
+ entities?: Entity[];
35
+ /**
36
+ * The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for
37
+ * more details.
38
+ */
39
+ language?: string;
40
+ }
41
+ interface AnalyzeEntitySentimentRequest {
42
+ /** Required. Input document. */
43
+ document?: Document;
44
+ /** The encoding type used by the API to calculate offsets. */
45
+ encodingType?: string;
46
+ }
47
+ interface AnalyzeEntitySentimentResponse {
48
+ /** The recognized entities in the input document with associated sentiments. */
49
+ entities?: Entity[];
50
+ /**
51
+ * The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for
52
+ * more details.
53
+ */
54
+ language?: string;
55
+ }
56
+ interface AnalyzeSentimentRequest {
57
+ /** Required. Input document. */
58
+ document?: Document;
59
+ /** The encoding type used by the API to calculate sentence offsets. */
60
+ encodingType?: string;
61
+ }
62
+ interface AnalyzeSentimentResponse {
63
+ /** The overall sentiment of the input document. */
64
+ documentSentiment?: Sentiment;
65
+ /**
66
+ * The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for
67
+ * more details.
68
+ */
69
+ language?: string;
70
+ /** The sentiment for all the sentences in the document. */
71
+ sentences?: Sentence[];
72
+ }
73
+ interface AnalyzeSyntaxRequest {
74
+ /** Required. Input document. */
75
+ document?: Document;
76
+ /** The encoding type used by the API to calculate offsets. */
77
+ encodingType?: string;
78
+ }
79
+ interface AnalyzeSyntaxResponse {
80
+ /**
81
+ * The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for
82
+ * more details.
83
+ */
84
+ language?: string;
85
+ /** Sentences in the input document. */
86
+ sentences?: Sentence[];
87
+ /** Tokens, along with their syntactic information, in the input document. */
88
+ tokens?: Token[];
89
+ }
90
+ interface AnnotateTextRequest {
91
+ /** Required. Input document. */
92
+ document?: Document;
93
+ /** The encoding type used by the API to calculate offsets. */
94
+ encodingType?: string;
95
+ /** Required. The enabled features. */
96
+ features?: Features;
97
+ }
98
+ interface AnnotateTextResponse {
99
+ /** Categories identified in the input document. */
100
+ categories?: ClassificationCategory[];
101
+ /** The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment. */
102
+ documentSentiment?: Sentiment;
103
+ /** Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities. */
104
+ entities?: Entity[];
105
+ /**
106
+ * The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for
107
+ * more details.
108
+ */
109
+ language?: string;
110
+ /** Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax. */
111
+ sentences?: Sentence[];
112
+ /** Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax. */
113
+ tokens?: Token[];
114
+ }
115
+ interface ClassificationCategory {
116
+ /** The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text. */
117
+ confidence?: number;
118
+ /** The name of the category representing the document, from the [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories). */
119
+ name?: string;
120
+ }
121
+ interface ClassifyTextRequest {
122
+ /** Required. Input document. */
123
+ document?: Document;
124
+ }
125
+ interface ClassifyTextResponse {
126
+ /** Categories representing the input document. */
127
+ categories?: ClassificationCategory[];
128
+ }
129
+ interface DependencyEdge {
130
+ /**
131
+ * Represents the head of this token in the dependency tree. This is the index of the token which has an arc going to this token. The index is the position of the token in the array of
132
+ * tokens returned by the API method. If this token is a root token, then the `head_token_index` is its own index.
133
+ */
134
+ headTokenIndex?: number;
135
+ /** The parse label for the token. */
136
+ label?: string;
137
+ }
138
+ interface Document {
139
+ /** The content of the input in string format. Cloud audit logging exempt since it is based on user data. */
140
+ content?: string;
141
+ /**
142
+ * The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see
143
+ * https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
144
+ */
145
+ gcsContentUri?: string;
146
+ /**
147
+ * The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language
148
+ * Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or
149
+ * automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
150
+ */
151
+ language?: string;
152
+ /** Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. */
153
+ type?: string;
154
+ }
155
+ interface Entity {
156
+ /** The mentions of this entity in the input document. The API currently supports proper noun mentions. */
157
+ mentions?: EntityMention[];
158
+ /**
159
+ * Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the
160
+ * metadata associated with other entity types, see the Type table below.
161
+ */
162
+ metadata?: { [P in string]: string };
163
+ /** The representative name for the entity. */
164
+ name?: string;
165
+ /**
166
+ * The salience score associated with the entity in the [0, 1.0] range. The salience score for an entity provides information about the importance or centrality of that entity to the
167
+ * entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient.
168
+ */
169
+ salience?: number;
170
+ /**
171
+ * For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this
172
+ * entity in the provided document.
173
+ */
174
+ sentiment?: Sentiment;
175
+ /** The entity type. */
176
+ type?: string;
177
+ }
178
+ interface EntityMention {
179
+ /**
180
+ * For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of
181
+ * the entity in the provided document.
182
+ */
183
+ sentiment?: Sentiment;
184
+ /** The mention text. */
185
+ text?: TextSpan;
186
+ /** The type of the entity mention. */
187
+ type?: string;
188
+ }
189
+ interface Features {
190
+ /** Classify the full document into categories. */
191
+ classifyText?: boolean;
192
+ /** Extract document-level sentiment. */
193
+ extractDocumentSentiment?: boolean;
194
+ /** Extract entities. */
195
+ extractEntities?: boolean;
196
+ /** Extract entities and their associated sentiment. */
197
+ extractEntitySentiment?: boolean;
198
+ /** Extract syntax information. */
199
+ extractSyntax?: boolean;
200
+ }
201
+ interface PartOfSpeech {
202
+ /** The grammatical aspect. */
203
+ aspect?: string;
204
+ /** The grammatical case. */
205
+ case?: string;
206
+ /** The grammatical form. */
207
+ form?: string;
208
+ /** The grammatical gender. */
209
+ gender?: string;
210
+ /** The grammatical mood. */
211
+ mood?: string;
212
+ /** The grammatical number. */
213
+ number?: string;
214
+ /** The grammatical person. */
215
+ person?: string;
216
+ /** The grammatical properness. */
217
+ proper?: string;
218
+ /** The grammatical reciprocity. */
219
+ reciprocity?: string;
220
+ /** The part of speech tag. */
221
+ tag?: string;
222
+ /** The grammatical tense. */
223
+ tense?: string;
224
+ /** The grammatical voice. */
225
+ voice?: string;
226
+ }
227
+ interface Sentence {
228
+ /** For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence. */
229
+ sentiment?: Sentiment;
230
+ /** The sentence text. */
231
+ text?: TextSpan;
232
+ }
233
+ interface Sentiment {
234
+ /** A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). */
235
+ magnitude?: number;
236
+ /** Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). */
237
+ score?: number;
238
+ }
239
+ interface Status {
240
+ /** The status code, which should be an enum value of google.rpc.Code. */
241
+ code?: number;
242
+ /** A list of messages that carry the error details. There is a common set of message types for APIs to use. */
243
+ details?: Array<{ [P in string]: any }>;
244
+ /**
245
+ * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the
246
+ * client.
247
+ */
248
+ message?: string;
249
+ }
250
+ interface TextSpan {
251
+ /** The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. */
252
+ beginOffset?: number;
253
+ /** The content of the output text. */
254
+ content?: string;
255
+ }
256
+ interface Token {
257
+ /** Dependency tree parse for this token. */
258
+ dependencyEdge?: DependencyEdge;
259
+ /** [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. */
260
+ lemma?: string;
261
+ /** Parts of speech tag for this token. */
262
+ partOfSpeech?: PartOfSpeech;
263
+ /** The token text. */
264
+ text?: TextSpan;
265
+ }
266
+ interface DocumentsResource {
267
+ /** Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties. */
268
+ analyzeEntities(request: {
269
+ /** V1 error format. */
270
+ "$.xgafv"?: string;
271
+ /** OAuth access token. */
272
+ access_token?: string;
273
+ /** Data format for response. */
274
+ alt?: string;
275
+ /** JSONP */
276
+ callback?: string;
277
+ /** Selector specifying which fields to include in a partial response. */
278
+ fields?: string;
279
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
280
+ key?: string;
281
+ /** OAuth 2.0 token for the current user. */
282
+ oauth_token?: string;
283
+ /** Returns response with indentations and line breaks. */
284
+ prettyPrint?: boolean;
285
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
286
+ quotaUser?: string;
287
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
288
+ upload_protocol?: string;
289
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
290
+ uploadType?: string;
291
+ /** Request body */
292
+ resource: AnalyzeEntitiesRequest;
293
+ }): Request<AnalyzeEntitiesResponse>;
294
+ analyzeEntities(request: {
295
+ /** V1 error format. */
296
+ "$.xgafv"?: string;
297
+ /** OAuth access token. */
298
+ access_token?: string;
299
+ /** Data format for response. */
300
+ alt?: string;
301
+ /** JSONP */
302
+ callback?: string;
303
+ /** Selector specifying which fields to include in a partial response. */
304
+ fields?: string;
305
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
306
+ key?: string;
307
+ /** OAuth 2.0 token for the current user. */
308
+ oauth_token?: string;
309
+ /** Returns response with indentations and line breaks. */
310
+ prettyPrint?: boolean;
311
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
312
+ quotaUser?: string;
313
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
314
+ upload_protocol?: string;
315
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
316
+ uploadType?: string;
317
+ },
318
+ body: AnalyzeEntitiesRequest): Request<AnalyzeEntitiesResponse>;
319
+ /** Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions. */
320
+ analyzeEntitySentiment(request: {
321
+ /** V1 error format. */
322
+ "$.xgafv"?: string;
323
+ /** OAuth access token. */
324
+ access_token?: string;
325
+ /** Data format for response. */
326
+ alt?: string;
327
+ /** JSONP */
328
+ callback?: string;
329
+ /** Selector specifying which fields to include in a partial response. */
330
+ fields?: string;
331
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
332
+ key?: string;
333
+ /** OAuth 2.0 token for the current user. */
334
+ oauth_token?: string;
335
+ /** Returns response with indentations and line breaks. */
336
+ prettyPrint?: boolean;
337
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
338
+ quotaUser?: string;
339
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
340
+ upload_protocol?: string;
341
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
342
+ uploadType?: string;
343
+ /** Request body */
344
+ resource: AnalyzeEntitySentimentRequest;
345
+ }): Request<AnalyzeEntitySentimentResponse>;
346
+ analyzeEntitySentiment(request: {
347
+ /** V1 error format. */
348
+ "$.xgafv"?: string;
349
+ /** OAuth access token. */
350
+ access_token?: string;
351
+ /** Data format for response. */
352
+ alt?: string;
353
+ /** JSONP */
354
+ callback?: string;
355
+ /** Selector specifying which fields to include in a partial response. */
356
+ fields?: string;
357
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
358
+ key?: string;
359
+ /** OAuth 2.0 token for the current user. */
360
+ oauth_token?: string;
361
+ /** Returns response with indentations and line breaks. */
362
+ prettyPrint?: boolean;
363
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
364
+ quotaUser?: string;
365
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
366
+ upload_protocol?: string;
367
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
368
+ uploadType?: string;
369
+ },
370
+ body: AnalyzeEntitySentimentRequest): Request<AnalyzeEntitySentimentResponse>;
371
+ /** Analyzes the sentiment of the provided text. */
372
+ analyzeSentiment(request: {
373
+ /** V1 error format. */
374
+ "$.xgafv"?: string;
375
+ /** OAuth access token. */
376
+ access_token?: string;
377
+ /** Data format for response. */
378
+ alt?: string;
379
+ /** JSONP */
380
+ callback?: string;
381
+ /** Selector specifying which fields to include in a partial response. */
382
+ fields?: string;
383
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
384
+ key?: string;
385
+ /** OAuth 2.0 token for the current user. */
386
+ oauth_token?: string;
387
+ /** Returns response with indentations and line breaks. */
388
+ prettyPrint?: boolean;
389
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
390
+ quotaUser?: string;
391
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
392
+ upload_protocol?: string;
393
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
394
+ uploadType?: string;
395
+ /** Request body */
396
+ resource: AnalyzeSentimentRequest;
397
+ }): Request<AnalyzeSentimentResponse>;
398
+ analyzeSentiment(request: {
399
+ /** V1 error format. */
400
+ "$.xgafv"?: string;
401
+ /** OAuth access token. */
402
+ access_token?: string;
403
+ /** Data format for response. */
404
+ alt?: string;
405
+ /** JSONP */
406
+ callback?: string;
407
+ /** Selector specifying which fields to include in a partial response. */
408
+ fields?: string;
409
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
410
+ key?: string;
411
+ /** OAuth 2.0 token for the current user. */
412
+ oauth_token?: string;
413
+ /** Returns response with indentations and line breaks. */
414
+ prettyPrint?: boolean;
415
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
416
+ quotaUser?: string;
417
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
418
+ upload_protocol?: string;
419
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
420
+ uploadType?: string;
421
+ },
422
+ body: AnalyzeSentimentRequest): Request<AnalyzeSentimentResponse>;
423
+ /** Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties. */
424
+ analyzeSyntax(request: {
425
+ /** V1 error format. */
426
+ "$.xgafv"?: string;
427
+ /** OAuth access token. */
428
+ access_token?: string;
429
+ /** Data format for response. */
430
+ alt?: string;
431
+ /** JSONP */
432
+ callback?: string;
433
+ /** Selector specifying which fields to include in a partial response. */
434
+ fields?: string;
435
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
436
+ key?: string;
437
+ /** OAuth 2.0 token for the current user. */
438
+ oauth_token?: string;
439
+ /** Returns response with indentations and line breaks. */
440
+ prettyPrint?: boolean;
441
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
442
+ quotaUser?: string;
443
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
444
+ upload_protocol?: string;
445
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
446
+ uploadType?: string;
447
+ /** Request body */
448
+ resource: AnalyzeSyntaxRequest;
449
+ }): Request<AnalyzeSyntaxResponse>;
450
+ analyzeSyntax(request: {
451
+ /** V1 error format. */
452
+ "$.xgafv"?: string;
453
+ /** OAuth access token. */
454
+ access_token?: string;
455
+ /** Data format for response. */
456
+ alt?: string;
457
+ /** JSONP */
458
+ callback?: string;
459
+ /** Selector specifying which fields to include in a partial response. */
460
+ fields?: string;
461
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
462
+ key?: string;
463
+ /** OAuth 2.0 token for the current user. */
464
+ oauth_token?: string;
465
+ /** Returns response with indentations and line breaks. */
466
+ prettyPrint?: boolean;
467
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
468
+ quotaUser?: string;
469
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
470
+ upload_protocol?: string;
471
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
472
+ uploadType?: string;
473
+ },
474
+ body: AnalyzeSyntaxRequest): Request<AnalyzeSyntaxResponse>;
475
+ /** A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call. */
476
+ annotateText(request: {
477
+ /** V1 error format. */
478
+ "$.xgafv"?: string;
479
+ /** OAuth access token. */
480
+ access_token?: string;
481
+ /** Data format for response. */
482
+ alt?: string;
483
+ /** JSONP */
484
+ callback?: string;
485
+ /** Selector specifying which fields to include in a partial response. */
486
+ fields?: string;
487
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
488
+ key?: string;
489
+ /** OAuth 2.0 token for the current user. */
490
+ oauth_token?: string;
491
+ /** Returns response with indentations and line breaks. */
492
+ prettyPrint?: boolean;
493
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
494
+ quotaUser?: string;
495
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
496
+ upload_protocol?: string;
497
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
498
+ uploadType?: string;
499
+ /** Request body */
500
+ resource: AnnotateTextRequest;
501
+ }): Request<AnnotateTextResponse>;
502
+ annotateText(request: {
503
+ /** V1 error format. */
504
+ "$.xgafv"?: string;
505
+ /** OAuth access token. */
506
+ access_token?: string;
507
+ /** Data format for response. */
508
+ alt?: string;
509
+ /** JSONP */
510
+ callback?: string;
511
+ /** Selector specifying which fields to include in a partial response. */
512
+ fields?: string;
513
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
514
+ key?: string;
515
+ /** OAuth 2.0 token for the current user. */
516
+ oauth_token?: string;
517
+ /** Returns response with indentations and line breaks. */
518
+ prettyPrint?: boolean;
519
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
520
+ quotaUser?: string;
521
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
522
+ upload_protocol?: string;
523
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
524
+ uploadType?: string;
525
+ },
526
+ body: AnnotateTextRequest): Request<AnnotateTextResponse>;
527
+ /** Classifies a document into categories. */
528
+ classifyText(request: {
529
+ /** V1 error format. */
530
+ "$.xgafv"?: string;
531
+ /** OAuth access token. */
532
+ access_token?: string;
533
+ /** Data format for response. */
534
+ alt?: string;
535
+ /** JSONP */
536
+ callback?: string;
537
+ /** Selector specifying which fields to include in a partial response. */
538
+ fields?: string;
539
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
540
+ key?: string;
541
+ /** OAuth 2.0 token for the current user. */
542
+ oauth_token?: string;
543
+ /** Returns response with indentations and line breaks. */
544
+ prettyPrint?: boolean;
545
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
546
+ quotaUser?: string;
547
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
548
+ upload_protocol?: string;
549
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
550
+ uploadType?: string;
551
+ /** Request body */
552
+ resource: ClassifyTextRequest;
553
+ }): Request<ClassifyTextResponse>;
554
+ classifyText(request: {
555
+ /** V1 error format. */
556
+ "$.xgafv"?: string;
557
+ /** OAuth access token. */
558
+ access_token?: string;
559
+ /** Data format for response. */
560
+ alt?: string;
561
+ /** JSONP */
562
+ callback?: string;
563
+ /** Selector specifying which fields to include in a partial response. */
564
+ fields?: string;
565
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
566
+ key?: string;
567
+ /** OAuth 2.0 token for the current user. */
568
+ oauth_token?: string;
569
+ /** Returns response with indentations and line breaks. */
570
+ prettyPrint?: boolean;
571
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
572
+ quotaUser?: string;
573
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
574
+ upload_protocol?: string;
575
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
576
+ uploadType?: string;
577
+ },
578
+ body: ClassifyTextRequest): Request<ClassifyTextResponse>;
579
+ }
580
+
581
+ const documents: DocumentsResource;
582
+ }
583
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.language-v1",
3
+ "version": "0.0.20220806",
4
+ "description": "TypeScript typings for Cloud Natural Language API v1",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,101 @@
1
+ # TypeScript typings for Cloud Natural Language API v1
2
+
3
+ Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations, to developers.
4
+ For detailed description please check [documentation](https://cloud.google.com/natural-language/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Natural Language API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.language-v1 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://language.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.language
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('language', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.language
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // Apply machine learning models to reveal the structure and meaning of text
49
+ 'https://www.googleapis.com/auth/cloud-language',
50
+
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',
53
+ ],
54
+ immediate = true;
55
+ // ...
56
+
57
+ gapi.auth.authorize(
58
+ { client_id: client_id, scope: scope, immediate: immediate },
59
+ authResult => {
60
+ if (authResult && !authResult.error) {
61
+ /* handle successful authorization */
62
+ } else {
63
+ /* handle authorization error */
64
+ }
65
+ });
66
+ ```
67
+
68
+ After that you can use Cloud Natural Language API resources: <!-- TODO: make this work for multiple namespaces -->
69
+
70
+ ```typescript
71
+
72
+ /*
73
+ Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
74
+ */
75
+ await gapi.client.language.documents.analyzeEntities({ });
76
+
77
+ /*
78
+ Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.
79
+ */
80
+ await gapi.client.language.documents.analyzeEntitySentiment({ });
81
+
82
+ /*
83
+ Analyzes the sentiment of the provided text.
84
+ */
85
+ await gapi.client.language.documents.analyzeSentiment({ });
86
+
87
+ /*
88
+ Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
89
+ */
90
+ await gapi.client.language.documents.analyzeSyntax({ });
91
+
92
+ /*
93
+ A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
94
+ */
95
+ await gapi.client.language.documents.annotateText({ });
96
+
97
+ /*
98
+ Classifies a document into categories.
99
+ */
100
+ await gapi.client.language.documents.classifyText({ });
101
+ ```
package/tests.ts ADDED
@@ -0,0 +1,107 @@
1
+ /* This is stub file for gapi.client.language-v1 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: 20220806
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://language.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.language */
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
+ /** Apply machine learning models to reveal the structure and meaning of text */
19
+ 'https://www.googleapis.com/auth/cloud-language',
20
+ /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
21
+ 'https://www.googleapis.com/auth/cloud-platform',
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
+ /** Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties. */
35
+ await gapi.client.language.documents.analyzeEntities({
36
+ }, {
37
+ document: {
38
+ content: "Test string",
39
+ gcsContentUri: "Test string",
40
+ language: "Test string",
41
+ type: "Test string",
42
+ },
43
+ encodingType: "Test string",
44
+ });
45
+ /** Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions. */
46
+ await gapi.client.language.documents.analyzeEntitySentiment({
47
+ }, {
48
+ document: {
49
+ content: "Test string",
50
+ gcsContentUri: "Test string",
51
+ language: "Test string",
52
+ type: "Test string",
53
+ },
54
+ encodingType: "Test string",
55
+ });
56
+ /** Analyzes the sentiment of the provided text. */
57
+ await gapi.client.language.documents.analyzeSentiment({
58
+ }, {
59
+ document: {
60
+ content: "Test string",
61
+ gcsContentUri: "Test string",
62
+ language: "Test string",
63
+ type: "Test string",
64
+ },
65
+ encodingType: "Test string",
66
+ });
67
+ /** Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties. */
68
+ await gapi.client.language.documents.analyzeSyntax({
69
+ }, {
70
+ document: {
71
+ content: "Test string",
72
+ gcsContentUri: "Test string",
73
+ language: "Test string",
74
+ type: "Test string",
75
+ },
76
+ encodingType: "Test string",
77
+ });
78
+ /** A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call. */
79
+ await gapi.client.language.documents.annotateText({
80
+ }, {
81
+ document: {
82
+ content: "Test string",
83
+ gcsContentUri: "Test string",
84
+ language: "Test string",
85
+ type: "Test string",
86
+ },
87
+ encodingType: "Test string",
88
+ features: {
89
+ classifyText: true,
90
+ extractDocumentSentiment: true,
91
+ extractEntities: true,
92
+ extractEntitySentiment: true,
93
+ extractSyntax: true,
94
+ },
95
+ });
96
+ /** Classifies a document into categories. */
97
+ await gapi.client.language.documents.classifyText({
98
+ }, {
99
+ document: {
100
+ content: "Test string",
101
+ gcsContentUri: "Test string",
102
+ language: "Test string",
103
+ type: "Test string",
104
+ },
105
+ });
106
+ }
107
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
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 ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }