@maxim_mazurok/gapi.client.speech-v1 0.0.20220808

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 ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.speech-v1",
3
+ "version": "0.0.20220808",
4
+ "description": "TypeScript typings for Cloud Speech-to-Text 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,88 @@
1
+ # TypeScript typings for Cloud Speech-to-Text API v1
2
+
3
+ Converts audio to text by applying powerful neural network models.
4
+ For detailed description please check [documentation](https://cloud.google.com/speech-to-text/docs/quickstart-protocol).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Speech-to-Text API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.speech-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://speech.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.speech
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('speech', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.speech
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
+ // 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',
50
+ ],
51
+ immediate = true;
52
+ // ...
53
+
54
+ gapi.auth.authorize(
55
+ { client_id: client_id, scope: scope, immediate: immediate },
56
+ authResult => {
57
+ if (authResult && !authResult.error) {
58
+ /* handle successful authorization */
59
+ } else {
60
+ /* handle authorization error */
61
+ }
62
+ });
63
+ ```
64
+
65
+ After that you can use Cloud Speech-to-Text API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ 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.
71
+ */
72
+ await gapi.client.speech.operations.get({ name: "name", });
73
+
74
+ /*
75
+ Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
76
+ */
77
+ await gapi.client.speech.operations.list({ });
78
+
79
+ /*
80
+ Performs asynchronous speech recognition: receive results via the google.longrunning.Operations interface. Returns either an `Operation.error` or an `Operation.response` which contains a `LongRunningRecognizeResponse` message. For more information on asynchronous speech recognition, see the [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
81
+ */
82
+ await gapi.client.speech.speech.longrunningrecognize({ });
83
+
84
+ /*
85
+ Performs synchronous speech recognition: receive results after all audio has been sent and processed.
86
+ */
87
+ await gapi.client.speech.speech.recognize({ });
88
+ ```
package/tests.ts ADDED
@@ -0,0 +1,302 @@
1
+ /* This is stub file for gapi.client.speech-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: 20220808
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://speech.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.speech */
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
+ ];
21
+ const immediate = false;
22
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
23
+ if (authResult && !authResult.error) {
24
+ /** handle successful authorization */
25
+ run();
26
+ } else {
27
+ /** handle authorization error */
28
+ }
29
+ });
30
+
31
+ async function run() {
32
+ /** 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. */
33
+ await gapi.client.speech.operations.get({
34
+ name: "Test string",
35
+ });
36
+ /**
37
+ * Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to
38
+ * override the binding to use different resource name schemes, such as `users/*‍/operations`. To override the binding, API services can add a binding such as
39
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
40
+ * ensure the name binding is the parent resource, without the operations collection id.
41
+ */
42
+ await gapi.client.speech.operations.list({
43
+ filter: "Test string",
44
+ name: "Test string",
45
+ pageSize: 42,
46
+ pageToken: "Test string",
47
+ });
48
+ /** Create a custom class. */
49
+ await gapi.client.speech.projects.locations.customClasses.create({
50
+ parent: "Test string",
51
+ }, {
52
+ customClass: {
53
+ customClassId: "Test string",
54
+ items: [
55
+ {
56
+ value: "Test string",
57
+ }
58
+ ],
59
+ name: "Test string",
60
+ },
61
+ customClassId: "Test string",
62
+ });
63
+ /** Delete a custom class. */
64
+ await gapi.client.speech.projects.locations.customClasses.delete({
65
+ name: "Test string",
66
+ });
67
+ /** Get a custom class. */
68
+ await gapi.client.speech.projects.locations.customClasses.get({
69
+ name: "Test string",
70
+ });
71
+ /** List custom classes. */
72
+ await gapi.client.speech.projects.locations.customClasses.list({
73
+ pageSize: 42,
74
+ pageToken: "Test string",
75
+ parent: "Test string",
76
+ });
77
+ /** Update a custom class. */
78
+ await gapi.client.speech.projects.locations.customClasses.patch({
79
+ name: "Test string",
80
+ updateMask: "Test string",
81
+ }, {
82
+ customClassId: "Test string",
83
+ items: [
84
+ {
85
+ value: "Test string",
86
+ }
87
+ ],
88
+ name: "Test string",
89
+ });
90
+ /**
91
+ * Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that
92
+ * includes the PhraseSet.
93
+ */
94
+ await gapi.client.speech.projects.locations.phraseSets.create({
95
+ parent: "Test string",
96
+ }, {
97
+ phraseSet: {
98
+ boost: 42,
99
+ name: "Test string",
100
+ phrases: [
101
+ {
102
+ boost: 42,
103
+ value: "Test string",
104
+ }
105
+ ],
106
+ },
107
+ phraseSetId: "Test string",
108
+ });
109
+ /** Delete a phrase set. */
110
+ await gapi.client.speech.projects.locations.phraseSets.delete({
111
+ name: "Test string",
112
+ });
113
+ /** Get a phrase set. */
114
+ await gapi.client.speech.projects.locations.phraseSets.get({
115
+ name: "Test string",
116
+ });
117
+ /** List phrase sets. */
118
+ await gapi.client.speech.projects.locations.phraseSets.list({
119
+ pageSize: 42,
120
+ pageToken: "Test string",
121
+ parent: "Test string",
122
+ });
123
+ /** Update a phrase set. */
124
+ await gapi.client.speech.projects.locations.phraseSets.patch({
125
+ name: "Test string",
126
+ updateMask: "Test string",
127
+ }, {
128
+ boost: 42,
129
+ name: "Test string",
130
+ phrases: [
131
+ {
132
+ boost: 42,
133
+ value: "Test string",
134
+ }
135
+ ],
136
+ });
137
+ /**
138
+ * Performs asynchronous speech recognition: receive results via the google.longrunning.Operations interface. Returns either an `Operation.error` or an `Operation.response` which contains
139
+ * a `LongRunningRecognizeResponse` message. For more information on asynchronous speech recognition, see the [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
140
+ */
141
+ await gapi.client.speech.speech.longrunningrecognize({
142
+ }, {
143
+ audio: {
144
+ content: "Test string",
145
+ uri: "Test string",
146
+ },
147
+ config: {
148
+ adaptation: {
149
+ customClasses: [
150
+ {
151
+ customClassId: "Test string",
152
+ items: [
153
+ {
154
+ value: "Test string",
155
+ }
156
+ ],
157
+ name: "Test string",
158
+ }
159
+ ],
160
+ phraseSetReferences: [
161
+ "Test string"
162
+ ],
163
+ phraseSets: [
164
+ {
165
+ boost: 42,
166
+ name: "Test string",
167
+ phrases: [
168
+ {
169
+ boost: 42,
170
+ value: "Test string",
171
+ }
172
+ ],
173
+ }
174
+ ],
175
+ },
176
+ alternativeLanguageCodes: [
177
+ "Test string"
178
+ ],
179
+ audioChannelCount: 42,
180
+ diarizationConfig: {
181
+ enableSpeakerDiarization: true,
182
+ maxSpeakerCount: 42,
183
+ minSpeakerCount: 42,
184
+ speakerTag: 42,
185
+ },
186
+ enableAutomaticPunctuation: true,
187
+ enableSeparateRecognitionPerChannel: true,
188
+ enableSpokenEmojis: true,
189
+ enableSpokenPunctuation: true,
190
+ enableWordConfidence: true,
191
+ enableWordTimeOffsets: true,
192
+ encoding: "Test string",
193
+ languageCode: "Test string",
194
+ maxAlternatives: 42,
195
+ metadata: {
196
+ audioTopic: "Test string",
197
+ industryNaicsCodeOfAudio: 42,
198
+ interactionType: "Test string",
199
+ microphoneDistance: "Test string",
200
+ originalMediaType: "Test string",
201
+ originalMimeType: "Test string",
202
+ recordingDeviceName: "Test string",
203
+ recordingDeviceType: "Test string",
204
+ },
205
+ model: "Test string",
206
+ profanityFilter: true,
207
+ sampleRateHertz: 42,
208
+ speechContexts: [
209
+ {
210
+ boost: 42,
211
+ phrases: [
212
+ "Test string"
213
+ ],
214
+ }
215
+ ],
216
+ useEnhanced: true,
217
+ },
218
+ outputConfig: {
219
+ gcsUri: "Test string",
220
+ },
221
+ });
222
+ /** Performs synchronous speech recognition: receive results after all audio has been sent and processed. */
223
+ await gapi.client.speech.speech.recognize({
224
+ }, {
225
+ audio: {
226
+ content: "Test string",
227
+ uri: "Test string",
228
+ },
229
+ config: {
230
+ adaptation: {
231
+ customClasses: [
232
+ {
233
+ customClassId: "Test string",
234
+ items: [
235
+ {
236
+ value: "Test string",
237
+ }
238
+ ],
239
+ name: "Test string",
240
+ }
241
+ ],
242
+ phraseSetReferences: [
243
+ "Test string"
244
+ ],
245
+ phraseSets: [
246
+ {
247
+ boost: 42,
248
+ name: "Test string",
249
+ phrases: [
250
+ {
251
+ boost: 42,
252
+ value: "Test string",
253
+ }
254
+ ],
255
+ }
256
+ ],
257
+ },
258
+ alternativeLanguageCodes: [
259
+ "Test string"
260
+ ],
261
+ audioChannelCount: 42,
262
+ diarizationConfig: {
263
+ enableSpeakerDiarization: true,
264
+ maxSpeakerCount: 42,
265
+ minSpeakerCount: 42,
266
+ speakerTag: 42,
267
+ },
268
+ enableAutomaticPunctuation: true,
269
+ enableSeparateRecognitionPerChannel: true,
270
+ enableSpokenEmojis: true,
271
+ enableSpokenPunctuation: true,
272
+ enableWordConfidence: true,
273
+ enableWordTimeOffsets: true,
274
+ encoding: "Test string",
275
+ languageCode: "Test string",
276
+ maxAlternatives: 42,
277
+ metadata: {
278
+ audioTopic: "Test string",
279
+ industryNaicsCodeOfAudio: 42,
280
+ interactionType: "Test string",
281
+ microphoneDistance: "Test string",
282
+ originalMediaType: "Test string",
283
+ originalMimeType: "Test string",
284
+ recordingDeviceName: "Test string",
285
+ recordingDeviceType: "Test string",
286
+ },
287
+ model: "Test string",
288
+ profanityFilter: true,
289
+ sampleRateHertz: 42,
290
+ speechContexts: [
291
+ {
292
+ boost: 42,
293
+ phrases: [
294
+ "Test string"
295
+ ],
296
+ }
297
+ ],
298
+ useEnhanced: true,
299
+ },
300
+ });
301
+ }
302
+ });
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
+ }