@maxim_mazurok/gapi.client.analyticshub-v1 0.0.20220923
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 +1017 -0
- package/package.json +20 -0
- package/readme.md +71 -0
- package/tests.ts +277 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.analyticshub-v1",
|
|
3
|
+
"version": "0.0.20220923",
|
|
4
|
+
"description": "TypeScript typings for Analytics Hub 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,71 @@
|
|
|
1
|
+
# TypeScript typings for Analytics Hub API v1
|
|
2
|
+
|
|
3
|
+
Exchange data and analytics assets securely and efficiently.
|
|
4
|
+
For detailed description please check [documentation](https://cloud.google.com/bigquery/docs/analytics-hub-introduction).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Analytics Hub API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.analyticshub-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://analyticshub.googleapis.com/$discovery/rest?version=v1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.analyticshub
|
|
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('analyticshub', 'v1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.analyticshub
|
|
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
|
+
// View and manage your data in Google BigQuery and see the email address for your Google Account
|
|
49
|
+
'https://www.googleapis.com/auth/bigquery',
|
|
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 Analytics Hub API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.analyticshub-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: 20220923
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://analyticshub.googleapis.com/$discovery/rest?version=v1');
|
|
12
|
+
/** now we can use gapi.client.analyticshub */
|
|
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
|
+
/** View and manage your data in Google BigQuery and see the email address for your Google Account */
|
|
19
|
+
'https://www.googleapis.com/auth/bigquery',
|
|
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
|
+
/** Lists all data exchanges from projects in a given organization and location. */
|
|
35
|
+
await gapi.client.analyticshub.organizations.locations.dataExchanges.list({
|
|
36
|
+
organization: "Test string",
|
|
37
|
+
pageSize: 42,
|
|
38
|
+
pageToken: "Test string",
|
|
39
|
+
});
|
|
40
|
+
/** Creates a new data exchange. */
|
|
41
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.create({
|
|
42
|
+
dataExchangeId: "Test string",
|
|
43
|
+
parent: "Test string",
|
|
44
|
+
}, {
|
|
45
|
+
description: "Test string",
|
|
46
|
+
displayName: "Test string",
|
|
47
|
+
documentation: "Test string",
|
|
48
|
+
icon: "Test string",
|
|
49
|
+
listingCount: 42,
|
|
50
|
+
name: "Test string",
|
|
51
|
+
primaryContact: "Test string",
|
|
52
|
+
});
|
|
53
|
+
/** Deletes an existing data exchange. */
|
|
54
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.delete({
|
|
55
|
+
name: "Test string",
|
|
56
|
+
});
|
|
57
|
+
/** Gets the details of a data exchange. */
|
|
58
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.get({
|
|
59
|
+
name: "Test string",
|
|
60
|
+
});
|
|
61
|
+
/** Gets the IAM policy. */
|
|
62
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.getIamPolicy({
|
|
63
|
+
resource: "Test string",
|
|
64
|
+
}, {
|
|
65
|
+
options: {
|
|
66
|
+
requestedPolicyVersion: 42,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
/** Lists all data exchanges in a given project and location. */
|
|
70
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.list({
|
|
71
|
+
pageSize: 42,
|
|
72
|
+
pageToken: "Test string",
|
|
73
|
+
parent: "Test string",
|
|
74
|
+
});
|
|
75
|
+
/** Updates an existing data exchange. */
|
|
76
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.patch({
|
|
77
|
+
name: "Test string",
|
|
78
|
+
updateMask: "Test string",
|
|
79
|
+
}, {
|
|
80
|
+
description: "Test string",
|
|
81
|
+
displayName: "Test string",
|
|
82
|
+
documentation: "Test string",
|
|
83
|
+
icon: "Test string",
|
|
84
|
+
listingCount: 42,
|
|
85
|
+
name: "Test string",
|
|
86
|
+
primaryContact: "Test string",
|
|
87
|
+
});
|
|
88
|
+
/** Sets the IAM policy. */
|
|
89
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.setIamPolicy({
|
|
90
|
+
resource: "Test string",
|
|
91
|
+
}, {
|
|
92
|
+
policy: {
|
|
93
|
+
auditConfigs: [
|
|
94
|
+
{
|
|
95
|
+
auditLogConfigs: [
|
|
96
|
+
{
|
|
97
|
+
exemptedMembers: [
|
|
98
|
+
"Test string"
|
|
99
|
+
],
|
|
100
|
+
logType: "Test string",
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
service: "Test string",
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
bindings: [
|
|
107
|
+
{
|
|
108
|
+
condition: {
|
|
109
|
+
description: "Test string",
|
|
110
|
+
expression: "Test string",
|
|
111
|
+
location: "Test string",
|
|
112
|
+
title: "Test string",
|
|
113
|
+
},
|
|
114
|
+
members: [
|
|
115
|
+
"Test string"
|
|
116
|
+
],
|
|
117
|
+
role: "Test string",
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
etag: "Test string",
|
|
121
|
+
version: 42,
|
|
122
|
+
},
|
|
123
|
+
updateMask: "Test string",
|
|
124
|
+
});
|
|
125
|
+
/** Returns the permissions that a caller has. */
|
|
126
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.testIamPermissions({
|
|
127
|
+
resource: "Test string",
|
|
128
|
+
}, {
|
|
129
|
+
permissions: [
|
|
130
|
+
"Test string"
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
/** Creates a new listing. */
|
|
134
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.create({
|
|
135
|
+
listingId: "Test string",
|
|
136
|
+
parent: "Test string",
|
|
137
|
+
}, {
|
|
138
|
+
bigqueryDataset: {
|
|
139
|
+
dataset: "Test string",
|
|
140
|
+
},
|
|
141
|
+
categories: [
|
|
142
|
+
"Test string"
|
|
143
|
+
],
|
|
144
|
+
dataProvider: {
|
|
145
|
+
name: "Test string",
|
|
146
|
+
primaryContact: "Test string",
|
|
147
|
+
},
|
|
148
|
+
description: "Test string",
|
|
149
|
+
displayName: "Test string",
|
|
150
|
+
documentation: "Test string",
|
|
151
|
+
icon: "Test string",
|
|
152
|
+
name: "Test string",
|
|
153
|
+
primaryContact: "Test string",
|
|
154
|
+
publisher: {
|
|
155
|
+
name: "Test string",
|
|
156
|
+
primaryContact: "Test string",
|
|
157
|
+
},
|
|
158
|
+
requestAccess: "Test string",
|
|
159
|
+
state: "Test string",
|
|
160
|
+
});
|
|
161
|
+
/** Deletes a listing. */
|
|
162
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.delete({
|
|
163
|
+
name: "Test string",
|
|
164
|
+
});
|
|
165
|
+
/** Gets the details of a listing. */
|
|
166
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.get({
|
|
167
|
+
name: "Test string",
|
|
168
|
+
});
|
|
169
|
+
/** Gets the IAM policy. */
|
|
170
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.getIamPolicy({
|
|
171
|
+
resource: "Test string",
|
|
172
|
+
}, {
|
|
173
|
+
options: {
|
|
174
|
+
requestedPolicyVersion: 42,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
/** Lists all listings in a given project and location. */
|
|
178
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.list({
|
|
179
|
+
pageSize: 42,
|
|
180
|
+
pageToken: "Test string",
|
|
181
|
+
parent: "Test string",
|
|
182
|
+
});
|
|
183
|
+
/** Updates an existing listing. */
|
|
184
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.patch({
|
|
185
|
+
name: "Test string",
|
|
186
|
+
updateMask: "Test string",
|
|
187
|
+
}, {
|
|
188
|
+
bigqueryDataset: {
|
|
189
|
+
dataset: "Test string",
|
|
190
|
+
},
|
|
191
|
+
categories: [
|
|
192
|
+
"Test string"
|
|
193
|
+
],
|
|
194
|
+
dataProvider: {
|
|
195
|
+
name: "Test string",
|
|
196
|
+
primaryContact: "Test string",
|
|
197
|
+
},
|
|
198
|
+
description: "Test string",
|
|
199
|
+
displayName: "Test string",
|
|
200
|
+
documentation: "Test string",
|
|
201
|
+
icon: "Test string",
|
|
202
|
+
name: "Test string",
|
|
203
|
+
primaryContact: "Test string",
|
|
204
|
+
publisher: {
|
|
205
|
+
name: "Test string",
|
|
206
|
+
primaryContact: "Test string",
|
|
207
|
+
},
|
|
208
|
+
requestAccess: "Test string",
|
|
209
|
+
state: "Test string",
|
|
210
|
+
});
|
|
211
|
+
/** Sets the IAM policy. */
|
|
212
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.setIamPolicy({
|
|
213
|
+
resource: "Test string",
|
|
214
|
+
}, {
|
|
215
|
+
policy: {
|
|
216
|
+
auditConfigs: [
|
|
217
|
+
{
|
|
218
|
+
auditLogConfigs: [
|
|
219
|
+
{
|
|
220
|
+
exemptedMembers: [
|
|
221
|
+
"Test string"
|
|
222
|
+
],
|
|
223
|
+
logType: "Test string",
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
service: "Test string",
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
bindings: [
|
|
230
|
+
{
|
|
231
|
+
condition: {
|
|
232
|
+
description: "Test string",
|
|
233
|
+
expression: "Test string",
|
|
234
|
+
location: "Test string",
|
|
235
|
+
title: "Test string",
|
|
236
|
+
},
|
|
237
|
+
members: [
|
|
238
|
+
"Test string"
|
|
239
|
+
],
|
|
240
|
+
role: "Test string",
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
etag: "Test string",
|
|
244
|
+
version: 42,
|
|
245
|
+
},
|
|
246
|
+
updateMask: "Test string",
|
|
247
|
+
});
|
|
248
|
+
/**
|
|
249
|
+
* Subscribes to a listing. Currently, with Analytics Hub, you can create listings that reference only BigQuery datasets. Upon subscription to a listing for a BigQuery dataset, Analytics
|
|
250
|
+
* Hub creates a linked dataset in the subscriber's project.
|
|
251
|
+
*/
|
|
252
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.subscribe({
|
|
253
|
+
name: "Test string",
|
|
254
|
+
}, {
|
|
255
|
+
destinationDataset: {
|
|
256
|
+
datasetReference: {
|
|
257
|
+
datasetId: "Test string",
|
|
258
|
+
projectId: "Test string",
|
|
259
|
+
},
|
|
260
|
+
description: "Test string",
|
|
261
|
+
friendlyName: "Test string",
|
|
262
|
+
labels: {
|
|
263
|
+
A: "Test string"
|
|
264
|
+
},
|
|
265
|
+
location: "Test string",
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
/** Returns the permissions that a caller has. */
|
|
269
|
+
await gapi.client.analyticshub.projects.locations.dataExchanges.listings.testIamPermissions({
|
|
270
|
+
resource: "Test string",
|
|
271
|
+
}, {
|
|
272
|
+
permissions: [
|
|
273
|
+
"Test string"
|
|
274
|
+
],
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
});
|
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
|
+
}
|