@maxim_mazurok/gapi.client.language-v1 0.0.20231127 → 0.0.20231209

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.language-v1",
3
- "version": "0.0.20231127",
3
+ "version": "0.0.20231209",
4
4
  "description": "TypeScript typings for Cloud Natural Language API v1",
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://language.googleapis.com/$discovery/rest?version=v1', () => {
29
- // now we can use:
30
- // gapi.client.language
31
- });
28
+ gapi.client.load(
29
+ 'https://language.googleapis.com/$discovery/rest?version=v1',
30
+ () => {
31
+ // now we can use:
32
+ // gapi.client.language
33
+ }
34
+ );
32
35
  ```
33
36
 
34
37
  ```typescript
@@ -45,62 +48,62 @@ 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
- // Apply machine learning models to reveal the structure and meaning of text
49
- 'https://www.googleapis.com/auth/cloud-language',
51
+ // Apply machine learning models to reveal the structure and meaning of text
52
+ 'https://www.googleapis.com/auth/cloud-language',
50
53
 
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;
54
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
55
+ 'https://www.googleapis.com/auth/cloud-platform',
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 Natural Language API resources: <!-- TODO: make this work for multiple namespaces -->
69
73
 
70
74
  ```typescript
71
-
72
75
  /*
73
76
  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
77
  */
75
- await gapi.client.language.documents.analyzeEntities({ });
78
+ await gapi.client.language.documents.analyzeEntities({});
76
79
 
77
80
  /*
78
81
  Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.
79
82
  */
80
- await gapi.client.language.documents.analyzeEntitySentiment({ });
83
+ await gapi.client.language.documents.analyzeEntitySentiment({});
81
84
 
82
85
  /*
83
86
  Analyzes the sentiment of the provided text.
84
87
  */
85
- await gapi.client.language.documents.analyzeSentiment({ });
88
+ await gapi.client.language.documents.analyzeSentiment({});
86
89
 
87
90
  /*
88
91
  Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
89
92
  */
90
- await gapi.client.language.documents.analyzeSyntax({ });
93
+ await gapi.client.language.documents.analyzeSyntax({});
91
94
 
92
95
  /*
93
96
  A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
94
97
  */
95
- await gapi.client.language.documents.annotateText({ });
98
+ await gapi.client.language.documents.annotateText({});
96
99
 
97
100
  /*
98
101
  Classifies a document into categories.
99
102
  */
100
- await gapi.client.language.documents.classifyText({ });
103
+ await gapi.client.language.documents.classifyText({});
101
104
 
102
105
  /*
103
106
  Moderates a document for harmful and sensitive categories.
104
107
  */
105
- await gapi.client.language.documents.moderateText({ });
108
+ await gapi.client.language.documents.moderateText({});
106
109
  ```
package/tests.ts DELETED
@@ -1,132 +0,0 @@
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: 20231127
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
- classificationModelOptions: {
90
- v1Model: {
91
- },
92
- v2Model: {
93
- contentCategoriesVersion: "Test string",
94
- },
95
- },
96
- classifyText: true,
97
- extractDocumentSentiment: true,
98
- extractEntities: true,
99
- extractEntitySentiment: true,
100
- extractSyntax: true,
101
- moderateText: true,
102
- },
103
- });
104
- /** Classifies a document into categories. */
105
- await gapi.client.language.documents.classifyText({
106
- }, {
107
- classificationModelOptions: {
108
- v1Model: {
109
- },
110
- v2Model: {
111
- contentCategoriesVersion: "Test string",
112
- },
113
- },
114
- document: {
115
- content: "Test string",
116
- gcsContentUri: "Test string",
117
- language: "Test string",
118
- type: "Test string",
119
- },
120
- });
121
- /** Moderates a document for harmful and sensitive categories. */
122
- await gapi.client.language.documents.moderateText({
123
- }, {
124
- document: {
125
- content: "Test string",
126
- gcsContentUri: "Test string",
127
- language: "Test string",
128
- type: "Test string",
129
- },
130
- });
131
- }
132
- });
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
- }