@maxim_mazurok/gapi.client.cloudfunctions-v2beta 0.0.20220805

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.cloudfunctions-v2beta",
3
+ "version": "0.0.20220805",
4
+ "description": "TypeScript typings for Cloud Functions API v2beta",
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 Cloud Functions API v2beta
2
+
3
+ Manages lightweight user-provided functions executed in response to events.
4
+ For detailed description please check [documentation](https://cloud.google.com/functions).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Functions API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.cloudfunctions-v2beta --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://cloudfunctions.googleapis.com/$discovery/rest?version=v2beta', () => {
29
+ // now we can use:
30
+ // gapi.client.cloudfunctions
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('cloudfunctions', 'v2beta', () => {
37
+ // now we can use:
38
+ // gapi.client.cloudfunctions
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 Functions API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,384 @@
1
+ /* This is stub file for gapi.client.cloudfunctions-v2beta 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: 20220805
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://cloudfunctions.googleapis.com/$discovery/rest?version=v2beta');
12
+ /** now we can use gapi.client.cloudfunctions */
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
+ /** Lists information about the supported locations for this service. */
33
+ await gapi.client.cloudfunctions.projects.locations.list({
34
+ filter: "Test string",
35
+ name: "Test string",
36
+ pageSize: 42,
37
+ pageToken: "Test string",
38
+ });
39
+ /** Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error. */
40
+ await gapi.client.cloudfunctions.projects.locations.functions.create({
41
+ functionId: "Test string",
42
+ parent: "Test string",
43
+ }, {
44
+ buildConfig: {
45
+ build: "Test string",
46
+ dockerRepository: "Test string",
47
+ entryPoint: "Test string",
48
+ environmentVariables: {
49
+ A: "Test string"
50
+ },
51
+ runtime: "Test string",
52
+ source: {
53
+ repoSource: {
54
+ branchName: "Test string",
55
+ commitSha: "Test string",
56
+ dir: "Test string",
57
+ invertRegex: true,
58
+ projectId: "Test string",
59
+ repoName: "Test string",
60
+ tagName: "Test string",
61
+ },
62
+ storageSource: {
63
+ bucket: "Test string",
64
+ generation: "Test string",
65
+ object: "Test string",
66
+ },
67
+ },
68
+ sourceProvenance: {
69
+ resolvedRepoSource: {
70
+ branchName: "Test string",
71
+ commitSha: "Test string",
72
+ dir: "Test string",
73
+ invertRegex: true,
74
+ projectId: "Test string",
75
+ repoName: "Test string",
76
+ tagName: "Test string",
77
+ },
78
+ resolvedStorageSource: {
79
+ bucket: "Test string",
80
+ generation: "Test string",
81
+ object: "Test string",
82
+ },
83
+ },
84
+ workerPool: "Test string",
85
+ },
86
+ description: "Test string",
87
+ environment: "Test string",
88
+ eventTrigger: {
89
+ channel: "Test string",
90
+ eventFilters: [
91
+ {
92
+ attribute: "Test string",
93
+ operator: "Test string",
94
+ value: "Test string",
95
+ }
96
+ ],
97
+ eventType: "Test string",
98
+ pubsubTopic: "Test string",
99
+ retryPolicy: "Test string",
100
+ serviceAccountEmail: "Test string",
101
+ trigger: "Test string",
102
+ triggerRegion: "Test string",
103
+ },
104
+ labels: {
105
+ A: "Test string"
106
+ },
107
+ name: "Test string",
108
+ serviceConfig: {
109
+ allTrafficOnLatestRevision: true,
110
+ availableMemory: "Test string",
111
+ environmentVariables: {
112
+ A: "Test string"
113
+ },
114
+ ingressSettings: "Test string",
115
+ maxInstanceCount: 42,
116
+ minInstanceCount: 42,
117
+ revision: "Test string",
118
+ secretEnvironmentVariables: [
119
+ {
120
+ key: "Test string",
121
+ projectId: "Test string",
122
+ secret: "Test string",
123
+ version: "Test string",
124
+ }
125
+ ],
126
+ secretVolumes: [
127
+ {
128
+ mountPath: "Test string",
129
+ projectId: "Test string",
130
+ secret: "Test string",
131
+ versions: [
132
+ {
133
+ path: "Test string",
134
+ version: "Test string",
135
+ }
136
+ ],
137
+ }
138
+ ],
139
+ service: "Test string",
140
+ serviceAccountEmail: "Test string",
141
+ timeoutSeconds: 42,
142
+ uri: "Test string",
143
+ vpcConnector: "Test string",
144
+ vpcConnectorEgressSettings: "Test string",
145
+ },
146
+ state: "Test string",
147
+ stateMessages: [
148
+ {
149
+ message: "Test string",
150
+ severity: "Test string",
151
+ type: "Test string",
152
+ }
153
+ ],
154
+ updateTime: "Test string",
155
+ });
156
+ /** Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function. */
157
+ await gapi.client.cloudfunctions.projects.locations.functions.delete({
158
+ name: "Test string",
159
+ });
160
+ /**
161
+ * Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information
162
+ * about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
163
+ */
164
+ await gapi.client.cloudfunctions.projects.locations.functions.generateDownloadUrl({
165
+ name: "Test string",
166
+ }, {
167
+ });
168
+ /**
169
+ * Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once
170
+ * the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When
171
+ * uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs
172
+ * provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have
173
+ * permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be
174
+ * specified: * `Authorization: Bearer YOUR_TOKEN`
175
+ */
176
+ await gapi.client.cloudfunctions.projects.locations.functions.generateUploadUrl({
177
+ parent: "Test string",
178
+ }, {
179
+ });
180
+ /** Returns a function with the given name from the requested project. */
181
+ await gapi.client.cloudfunctions.projects.locations.functions.get({
182
+ name: "Test string",
183
+ });
184
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
185
+ await gapi.client.cloudfunctions.projects.locations.functions.getIamPolicy({
186
+ "options.requestedPolicyVersion": 42,
187
+ resource: "Test string",
188
+ });
189
+ /** Returns a list of functions that belong to the requested project. */
190
+ await gapi.client.cloudfunctions.projects.locations.functions.list({
191
+ filter: "Test string",
192
+ orderBy: "Test string",
193
+ pageSize: 42,
194
+ pageToken: "Test string",
195
+ parent: "Test string",
196
+ });
197
+ /** Updates existing function. */
198
+ await gapi.client.cloudfunctions.projects.locations.functions.patch({
199
+ name: "Test string",
200
+ updateMask: "Test string",
201
+ }, {
202
+ buildConfig: {
203
+ build: "Test string",
204
+ dockerRepository: "Test string",
205
+ entryPoint: "Test string",
206
+ environmentVariables: {
207
+ A: "Test string"
208
+ },
209
+ runtime: "Test string",
210
+ source: {
211
+ repoSource: {
212
+ branchName: "Test string",
213
+ commitSha: "Test string",
214
+ dir: "Test string",
215
+ invertRegex: true,
216
+ projectId: "Test string",
217
+ repoName: "Test string",
218
+ tagName: "Test string",
219
+ },
220
+ storageSource: {
221
+ bucket: "Test string",
222
+ generation: "Test string",
223
+ object: "Test string",
224
+ },
225
+ },
226
+ sourceProvenance: {
227
+ resolvedRepoSource: {
228
+ branchName: "Test string",
229
+ commitSha: "Test string",
230
+ dir: "Test string",
231
+ invertRegex: true,
232
+ projectId: "Test string",
233
+ repoName: "Test string",
234
+ tagName: "Test string",
235
+ },
236
+ resolvedStorageSource: {
237
+ bucket: "Test string",
238
+ generation: "Test string",
239
+ object: "Test string",
240
+ },
241
+ },
242
+ workerPool: "Test string",
243
+ },
244
+ description: "Test string",
245
+ environment: "Test string",
246
+ eventTrigger: {
247
+ channel: "Test string",
248
+ eventFilters: [
249
+ {
250
+ attribute: "Test string",
251
+ operator: "Test string",
252
+ value: "Test string",
253
+ }
254
+ ],
255
+ eventType: "Test string",
256
+ pubsubTopic: "Test string",
257
+ retryPolicy: "Test string",
258
+ serviceAccountEmail: "Test string",
259
+ trigger: "Test string",
260
+ triggerRegion: "Test string",
261
+ },
262
+ labels: {
263
+ A: "Test string"
264
+ },
265
+ name: "Test string",
266
+ serviceConfig: {
267
+ allTrafficOnLatestRevision: true,
268
+ availableMemory: "Test string",
269
+ environmentVariables: {
270
+ A: "Test string"
271
+ },
272
+ ingressSettings: "Test string",
273
+ maxInstanceCount: 42,
274
+ minInstanceCount: 42,
275
+ revision: "Test string",
276
+ secretEnvironmentVariables: [
277
+ {
278
+ key: "Test string",
279
+ projectId: "Test string",
280
+ secret: "Test string",
281
+ version: "Test string",
282
+ }
283
+ ],
284
+ secretVolumes: [
285
+ {
286
+ mountPath: "Test string",
287
+ projectId: "Test string",
288
+ secret: "Test string",
289
+ versions: [
290
+ {
291
+ path: "Test string",
292
+ version: "Test string",
293
+ }
294
+ ],
295
+ }
296
+ ],
297
+ service: "Test string",
298
+ serviceAccountEmail: "Test string",
299
+ timeoutSeconds: 42,
300
+ uri: "Test string",
301
+ vpcConnector: "Test string",
302
+ vpcConnectorEgressSettings: "Test string",
303
+ },
304
+ state: "Test string",
305
+ stateMessages: [
306
+ {
307
+ message: "Test string",
308
+ severity: "Test string",
309
+ type: "Test string",
310
+ }
311
+ ],
312
+ updateTime: "Test string",
313
+ });
314
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
315
+ await gapi.client.cloudfunctions.projects.locations.functions.setIamPolicy({
316
+ resource: "Test string",
317
+ }, {
318
+ policy: {
319
+ auditConfigs: [
320
+ {
321
+ auditLogConfigs: [
322
+ {
323
+ exemptedMembers: [
324
+ "Test string"
325
+ ],
326
+ logType: "Test string",
327
+ }
328
+ ],
329
+ service: "Test string",
330
+ }
331
+ ],
332
+ bindings: [
333
+ {
334
+ condition: {
335
+ description: "Test string",
336
+ expression: "Test string",
337
+ location: "Test string",
338
+ title: "Test string",
339
+ },
340
+ members: [
341
+ "Test string"
342
+ ],
343
+ role: "Test string",
344
+ }
345
+ ],
346
+ etag: "Test string",
347
+ version: 42,
348
+ },
349
+ updateMask: "Test string",
350
+ });
351
+ /**
352
+ * Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This
353
+ * operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
354
+ */
355
+ await gapi.client.cloudfunctions.projects.locations.functions.testIamPermissions({
356
+ resource: "Test string",
357
+ }, {
358
+ permissions: [
359
+ "Test string"
360
+ ],
361
+ });
362
+ /** 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. */
363
+ await gapi.client.cloudfunctions.projects.locations.operations.get({
364
+ name: "Test string",
365
+ });
366
+ /**
367
+ * 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
368
+ * 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
369
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
370
+ * ensure the name binding is the parent resource, without the operations collection id.
371
+ */
372
+ await gapi.client.cloudfunctions.projects.locations.operations.list({
373
+ filter: "Test string",
374
+ name: "Test string",
375
+ pageSize: 42,
376
+ pageToken: "Test string",
377
+ });
378
+ /** Returns a list of runtimes that are supported for the requested project. */
379
+ await gapi.client.cloudfunctions.projects.locations.runtimes.list({
380
+ filter: "Test string",
381
+ parent: "Test string",
382
+ });
383
+ }
384
+ });
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
+ }