@maxim_mazurok/gapi.client.discoveryengine-v1alpha 0.0.20230102

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.discoveryengine-v1alpha",
3
+ "version": "0.0.20230102",
4
+ "description": "TypeScript typings for Discovery Engine API v1alpha",
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,68 @@
1
+ # TypeScript typings for Discovery Engine API v1alpha
2
+
3
+ Discovery Engine API.
4
+ For detailed description please check [documentation](https://cloud.google.com/discovery-engine/docs).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Discovery Engine API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.discoveryengine-v1alpha --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://discoveryengine.googleapis.com/$discovery/rest?version=v1alpha', () => {
29
+ // now we can use:
30
+ // gapi.client.discoveryengine
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('discoveryengine', 'v1alpha', () => {
37
+ // now we can use:
38
+ // gapi.client.discoveryengine
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 Discovery Engine API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,475 @@
1
+ /* This is stub file for gapi.client.discoveryengine-v1alpha 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: 20230102
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://discoveryengine.googleapis.com/$discovery/rest?version=v1alpha');
12
+ /** now we can use gapi.client.discoveryengine */
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
+ /** Creates a Document. */
33
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.documents.create({
34
+ documentId: "Test string",
35
+ parent: "Test string",
36
+ }, {
37
+ id: "Test string",
38
+ jsonData: "Test string",
39
+ name: "Test string",
40
+ parentDocumentId: "Test string",
41
+ schemaId: "Test string",
42
+ structData: {
43
+ A: 42
44
+ },
45
+ });
46
+ /** Deletes a Document. */
47
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.documents.delete({
48
+ name: "Test string",
49
+ });
50
+ /** Gets a Document. */
51
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.documents.get({
52
+ name: "Test string",
53
+ });
54
+ /**
55
+ * Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created. Note: It is possible for a subset of the Documents to be successfully
56
+ * updated.
57
+ */
58
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.documents.import({
59
+ parent: "Test string",
60
+ }, {
61
+ bigquerySource: {
62
+ dataSchema: "Test string",
63
+ datasetId: "Test string",
64
+ gcsStagingDir: "Test string",
65
+ partitionDate: {
66
+ day: 42,
67
+ month: 42,
68
+ year: 42,
69
+ },
70
+ projectId: "Test string",
71
+ tableId: "Test string",
72
+ },
73
+ errorConfig: {
74
+ gcsPrefix: "Test string",
75
+ },
76
+ gcsSource: {
77
+ dataSchema: "Test string",
78
+ inputUris: [
79
+ "Test string"
80
+ ],
81
+ },
82
+ inlineSource: {
83
+ documents: [
84
+ {
85
+ id: "Test string",
86
+ jsonData: "Test string",
87
+ name: "Test string",
88
+ parentDocumentId: "Test string",
89
+ schemaId: "Test string",
90
+ structData: {
91
+ A: 42
92
+ },
93
+ }
94
+ ],
95
+ },
96
+ reconciliationMode: "Test string",
97
+ });
98
+ /** Gets a list of Documents. */
99
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.documents.list({
100
+ pageSize: 42,
101
+ pageToken: "Test string",
102
+ parent: "Test string",
103
+ });
104
+ /** Updates a Document. */
105
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.documents.patch({
106
+ allowMissing: true,
107
+ name: "Test string",
108
+ }, {
109
+ id: "Test string",
110
+ jsonData: "Test string",
111
+ name: "Test string",
112
+ parentDocumentId: "Test string",
113
+ schemaId: "Test string",
114
+ structData: {
115
+ A: 42
116
+ },
117
+ });
118
+ /** 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. */
119
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.operations.get({
120
+ name: "Test string",
121
+ });
122
+ /**
123
+ * 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
124
+ * 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
125
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
126
+ * ensure the name binding is the parent resource, without the operations collection id.
127
+ */
128
+ await gapi.client.discoveryengine.projects.locations.dataStores.branches.operations.list({
129
+ filter: "Test string",
130
+ name: "Test string",
131
+ pageSize: 42,
132
+ pageToken: "Test string",
133
+ });
134
+ /** 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. */
135
+ await gapi.client.discoveryengine.projects.locations.dataStores.models.operations.get({
136
+ name: "Test string",
137
+ });
138
+ /**
139
+ * 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
140
+ * 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
141
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
142
+ * ensure the name binding is the parent resource, without the operations collection id.
143
+ */
144
+ await gapi.client.discoveryengine.projects.locations.dataStores.models.operations.list({
145
+ filter: "Test string",
146
+ name: "Test string",
147
+ pageSize: 42,
148
+ pageToken: "Test string",
149
+ });
150
+ /** 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. */
151
+ await gapi.client.discoveryengine.projects.locations.dataStores.operations.get({
152
+ name: "Test string",
153
+ });
154
+ /**
155
+ * 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
156
+ * 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
157
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
158
+ * ensure the name binding is the parent resource, without the operations collection id.
159
+ */
160
+ await gapi.client.discoveryengine.projects.locations.dataStores.operations.list({
161
+ filter: "Test string",
162
+ name: "Test string",
163
+ pageSize: 42,
164
+ pageToken: "Test string",
165
+ });
166
+ /** Makes a recommendation, which requires a contextual user event. */
167
+ await gapi.client.discoveryengine.projects.locations.dataStores.servingConfigs.recommend({
168
+ servingConfig: "Test string",
169
+ }, {
170
+ filter: "Test string",
171
+ pageSize: 42,
172
+ params: {
173
+ A: 42
174
+ },
175
+ userEvent: {
176
+ attributes: {
177
+ A: {
178
+ numbers: [
179
+ 42
180
+ ],
181
+ text: [
182
+ "Test string"
183
+ ],
184
+ }
185
+ },
186
+ attributionToken: "Test string",
187
+ completionInfo: {
188
+ selectedPosition: 42,
189
+ selectedSuggestion: "Test string",
190
+ },
191
+ directUserRequest: true,
192
+ documents: [
193
+ {
194
+ id: "Test string",
195
+ name: "Test string",
196
+ promotionIds: [
197
+ "Test string"
198
+ ],
199
+ quantity: 42,
200
+ }
201
+ ],
202
+ eventTime: "Test string",
203
+ eventType: "Test string",
204
+ filter: "Test string",
205
+ mediaInfo: {
206
+ mediaProgressDuration: "Test string",
207
+ mediaProgressPercentage: 42,
208
+ },
209
+ pageInfo: {
210
+ pageCategory: "Test string",
211
+ pageviewId: "Test string",
212
+ referrerUri: "Test string",
213
+ uri: "Test string",
214
+ },
215
+ panel: {
216
+ displayName: "Test string",
217
+ panelId: "Test string",
218
+ panelPosition: 42,
219
+ totalPanels: 42,
220
+ },
221
+ promotionIds: [
222
+ "Test string"
223
+ ],
224
+ searchInfo: {
225
+ offset: 42,
226
+ orderBy: "Test string",
227
+ searchQuery: "Test string",
228
+ },
229
+ sessionId: "Test string",
230
+ tagIds: [
231
+ "Test string"
232
+ ],
233
+ transactionInfo: {
234
+ cost: 42,
235
+ currency: "Test string",
236
+ discountValue: 42,
237
+ tax: 42,
238
+ transactionId: "Test string",
239
+ value: 42,
240
+ },
241
+ userInfo: {
242
+ userAgent: "Test string",
243
+ userId: "Test string",
244
+ },
245
+ userPseudoId: "Test string",
246
+ },
247
+ userLabels: {
248
+ A: "Test string"
249
+ },
250
+ validateOnly: true,
251
+ });
252
+ /**
253
+ * Writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain. This method is used only by the Discovery Engine
254
+ * API JavaScript pixel and Google Tag Manager. Users should not call this method directly.
255
+ */
256
+ await gapi.client.discoveryengine.projects.locations.dataStores.userEvents.collect({
257
+ ets: "Test string",
258
+ parent: "Test string",
259
+ uri: "Test string",
260
+ userEvent: "Test string",
261
+ });
262
+ /**
263
+ * Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events. Operation.response is
264
+ * of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.
265
+ */
266
+ await gapi.client.discoveryengine.projects.locations.dataStores.userEvents.import({
267
+ parent: "Test string",
268
+ }, {
269
+ bigquerySource: {
270
+ dataSchema: "Test string",
271
+ datasetId: "Test string",
272
+ gcsStagingDir: "Test string",
273
+ partitionDate: {
274
+ day: 42,
275
+ month: 42,
276
+ year: 42,
277
+ },
278
+ projectId: "Test string",
279
+ tableId: "Test string",
280
+ },
281
+ errorConfig: {
282
+ gcsPrefix: "Test string",
283
+ },
284
+ gcsSource: {
285
+ dataSchema: "Test string",
286
+ inputUris: [
287
+ "Test string"
288
+ ],
289
+ },
290
+ inlineSource: {
291
+ userEvents: [
292
+ {
293
+ attributes: {
294
+ A: {
295
+ numbers: [
296
+ 42
297
+ ],
298
+ text: [
299
+ "Test string"
300
+ ],
301
+ }
302
+ },
303
+ attributionToken: "Test string",
304
+ completionInfo: {
305
+ selectedPosition: 42,
306
+ selectedSuggestion: "Test string",
307
+ },
308
+ directUserRequest: true,
309
+ documents: [
310
+ {
311
+ id: "Test string",
312
+ name: "Test string",
313
+ promotionIds: [
314
+ "Test string"
315
+ ],
316
+ quantity: 42,
317
+ }
318
+ ],
319
+ eventTime: "Test string",
320
+ eventType: "Test string",
321
+ filter: "Test string",
322
+ mediaInfo: {
323
+ mediaProgressDuration: "Test string",
324
+ mediaProgressPercentage: 42,
325
+ },
326
+ pageInfo: {
327
+ pageCategory: "Test string",
328
+ pageviewId: "Test string",
329
+ referrerUri: "Test string",
330
+ uri: "Test string",
331
+ },
332
+ panel: {
333
+ displayName: "Test string",
334
+ panelId: "Test string",
335
+ panelPosition: 42,
336
+ totalPanels: 42,
337
+ },
338
+ promotionIds: [
339
+ "Test string"
340
+ ],
341
+ searchInfo: {
342
+ offset: 42,
343
+ orderBy: "Test string",
344
+ searchQuery: "Test string",
345
+ },
346
+ sessionId: "Test string",
347
+ tagIds: [
348
+ "Test string"
349
+ ],
350
+ transactionInfo: {
351
+ cost: 42,
352
+ currency: "Test string",
353
+ discountValue: 42,
354
+ tax: 42,
355
+ transactionId: "Test string",
356
+ value: 42,
357
+ },
358
+ userInfo: {
359
+ userAgent: "Test string",
360
+ userId: "Test string",
361
+ },
362
+ userPseudoId: "Test string",
363
+ }
364
+ ],
365
+ },
366
+ });
367
+ /** Writes a single user event. */
368
+ await gapi.client.discoveryengine.projects.locations.dataStores.userEvents.write({
369
+ parent: "Test string",
370
+ }, {
371
+ attributes: {
372
+ A: {
373
+ numbers: [
374
+ 42
375
+ ],
376
+ text: [
377
+ "Test string"
378
+ ],
379
+ }
380
+ },
381
+ attributionToken: "Test string",
382
+ completionInfo: {
383
+ selectedPosition: 42,
384
+ selectedSuggestion: "Test string",
385
+ },
386
+ directUserRequest: true,
387
+ documents: [
388
+ {
389
+ id: "Test string",
390
+ name: "Test string",
391
+ promotionIds: [
392
+ "Test string"
393
+ ],
394
+ quantity: 42,
395
+ }
396
+ ],
397
+ eventTime: "Test string",
398
+ eventType: "Test string",
399
+ filter: "Test string",
400
+ mediaInfo: {
401
+ mediaProgressDuration: "Test string",
402
+ mediaProgressPercentage: 42,
403
+ },
404
+ pageInfo: {
405
+ pageCategory: "Test string",
406
+ pageviewId: "Test string",
407
+ referrerUri: "Test string",
408
+ uri: "Test string",
409
+ },
410
+ panel: {
411
+ displayName: "Test string",
412
+ panelId: "Test string",
413
+ panelPosition: 42,
414
+ totalPanels: 42,
415
+ },
416
+ promotionIds: [
417
+ "Test string"
418
+ ],
419
+ searchInfo: {
420
+ offset: 42,
421
+ orderBy: "Test string",
422
+ searchQuery: "Test string",
423
+ },
424
+ sessionId: "Test string",
425
+ tagIds: [
426
+ "Test string"
427
+ ],
428
+ transactionInfo: {
429
+ cost: 42,
430
+ currency: "Test string",
431
+ discountValue: 42,
432
+ tax: 42,
433
+ transactionId: "Test string",
434
+ value: 42,
435
+ },
436
+ userInfo: {
437
+ userAgent: "Test string",
438
+ userId: "Test string",
439
+ },
440
+ userPseudoId: "Test string",
441
+ });
442
+ /** 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. */
443
+ await gapi.client.discoveryengine.projects.locations.operations.get({
444
+ name: "Test string",
445
+ });
446
+ /**
447
+ * 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
448
+ * 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
449
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
450
+ * ensure the name binding is the parent resource, without the operations collection id.
451
+ */
452
+ await gapi.client.discoveryengine.projects.locations.operations.list({
453
+ filter: "Test string",
454
+ name: "Test string",
455
+ pageSize: 42,
456
+ pageToken: "Test string",
457
+ });
458
+ /** 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. */
459
+ await gapi.client.discoveryengine.projects.operations.get({
460
+ name: "Test string",
461
+ });
462
+ /**
463
+ * 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
464
+ * 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
465
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
466
+ * ensure the name binding is the parent resource, without the operations collection id.
467
+ */
468
+ await gapi.client.discoveryengine.projects.operations.list({
469
+ filter: "Test string",
470
+ name: "Test string",
471
+ pageSize: 42,
472
+ pageToken: "Test string",
473
+ });
474
+ }
475
+ });
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
+ }