@maxim_mazurok/gapi.client.cloudfunctions-v1 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-v1",
3
+ "version": "0.0.20220805",
4
+ "description": "TypeScript typings for Cloud Functions 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,78 @@
1
+ # TypeScript typings for Cloud Functions API v1
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-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://cloudfunctions.googleapis.com/$discovery/rest?version=v1', () => {
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', 'v1', () => {
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
+
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.cloudfunctions.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.cloudfunctions.operations.list({ });
78
+ ```
package/tests.ts ADDED
@@ -0,0 +1,309 @@
1
+ /* This is stub file for gapi.client.cloudfunctions-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: 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=v1');
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
+ /** 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.cloudfunctions.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.cloudfunctions.operations.list({
43
+ filter: "Test string",
44
+ name: "Test string",
45
+ pageSize: 42,
46
+ pageToken: "Test string",
47
+ });
48
+ /** Lists information about the supported locations for this service. */
49
+ await gapi.client.cloudfunctions.projects.locations.list({
50
+ filter: "Test string",
51
+ name: "Test string",
52
+ pageSize: 42,
53
+ pageToken: "Test string",
54
+ });
55
+ /**
56
+ * Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate
57
+ * Limits](https://cloud.google.com/functions/quotas#rate_limits).
58
+ */
59
+ await gapi.client.cloudfunctions.projects.locations.functions.call({
60
+ name: "Test string",
61
+ }, {
62
+ data: "Test string",
63
+ });
64
+ /** 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. */
65
+ await gapi.client.cloudfunctions.projects.locations.functions.create({
66
+ location: "Test string",
67
+ }, {
68
+ availableMemoryMb: 42,
69
+ buildEnvironmentVariables: {
70
+ A: "Test string"
71
+ },
72
+ buildId: "Test string",
73
+ buildName: "Test string",
74
+ buildWorkerPool: "Test string",
75
+ description: "Test string",
76
+ dockerRegistry: "Test string",
77
+ dockerRepository: "Test string",
78
+ entryPoint: "Test string",
79
+ environmentVariables: {
80
+ A: "Test string"
81
+ },
82
+ eventTrigger: {
83
+ eventType: "Test string",
84
+ failurePolicy: {
85
+ retry: {
86
+ },
87
+ },
88
+ resource: "Test string",
89
+ service: "Test string",
90
+ },
91
+ httpsTrigger: {
92
+ securityLevel: "Test string",
93
+ url: "Test string",
94
+ },
95
+ ingressSettings: "Test string",
96
+ kmsKeyName: "Test string",
97
+ labels: {
98
+ A: "Test string"
99
+ },
100
+ maxInstances: 42,
101
+ minInstances: 42,
102
+ name: "Test string",
103
+ network: "Test string",
104
+ runtime: "Test string",
105
+ secretEnvironmentVariables: [
106
+ {
107
+ key: "Test string",
108
+ projectId: "Test string",
109
+ secret: "Test string",
110
+ version: "Test string",
111
+ }
112
+ ],
113
+ secretVolumes: [
114
+ {
115
+ mountPath: "Test string",
116
+ projectId: "Test string",
117
+ secret: "Test string",
118
+ versions: [
119
+ {
120
+ path: "Test string",
121
+ version: "Test string",
122
+ }
123
+ ],
124
+ }
125
+ ],
126
+ serviceAccountEmail: "Test string",
127
+ sourceArchiveUrl: "Test string",
128
+ sourceRepository: {
129
+ deployedUrl: "Test string",
130
+ url: "Test string",
131
+ },
132
+ sourceToken: "Test string",
133
+ sourceUploadUrl: "Test string",
134
+ status: "Test string",
135
+ timeout: "Test string",
136
+ updateTime: "Test string",
137
+ versionId: "Test string",
138
+ vpcConnector: "Test string",
139
+ vpcConnectorEgressSettings: "Test string",
140
+ });
141
+ /** 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. */
142
+ await gapi.client.cloudfunctions.projects.locations.functions.delete({
143
+ name: "Test string",
144
+ });
145
+ /**
146
+ * Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information
147
+ * about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
148
+ */
149
+ await gapi.client.cloudfunctions.projects.locations.functions.generateDownloadUrl({
150
+ name: "Test string",
151
+ }, {
152
+ versionId: "Test string",
153
+ });
154
+ /**
155
+ * 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
156
+ * 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
157
+ * uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No
158
+ * credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials
159
+ * would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type:
160
+ * application/zip` * `x-goog-content-length-range: 0,104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`
161
+ */
162
+ await gapi.client.cloudfunctions.projects.locations.functions.generateUploadUrl({
163
+ parent: "Test string",
164
+ }, {
165
+ kmsKeyName: "Test string",
166
+ });
167
+ /** Returns a function with the given name from the requested project. */
168
+ await gapi.client.cloudfunctions.projects.locations.functions.get({
169
+ name: "Test string",
170
+ });
171
+ /** Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set. */
172
+ await gapi.client.cloudfunctions.projects.locations.functions.getIamPolicy({
173
+ "options.requestedPolicyVersion": 42,
174
+ resource: "Test string",
175
+ });
176
+ /** Returns a list of functions that belong to the requested project. */
177
+ await gapi.client.cloudfunctions.projects.locations.functions.list({
178
+ pageSize: 42,
179
+ pageToken: "Test string",
180
+ parent: "Test string",
181
+ });
182
+ /** Updates existing function. */
183
+ await gapi.client.cloudfunctions.projects.locations.functions.patch({
184
+ name: "Test string",
185
+ updateMask: "Test string",
186
+ }, {
187
+ availableMemoryMb: 42,
188
+ buildEnvironmentVariables: {
189
+ A: "Test string"
190
+ },
191
+ buildId: "Test string",
192
+ buildName: "Test string",
193
+ buildWorkerPool: "Test string",
194
+ description: "Test string",
195
+ dockerRegistry: "Test string",
196
+ dockerRepository: "Test string",
197
+ entryPoint: "Test string",
198
+ environmentVariables: {
199
+ A: "Test string"
200
+ },
201
+ eventTrigger: {
202
+ eventType: "Test string",
203
+ failurePolicy: {
204
+ retry: {
205
+ },
206
+ },
207
+ resource: "Test string",
208
+ service: "Test string",
209
+ },
210
+ httpsTrigger: {
211
+ securityLevel: "Test string",
212
+ url: "Test string",
213
+ },
214
+ ingressSettings: "Test string",
215
+ kmsKeyName: "Test string",
216
+ labels: {
217
+ A: "Test string"
218
+ },
219
+ maxInstances: 42,
220
+ minInstances: 42,
221
+ name: "Test string",
222
+ network: "Test string",
223
+ runtime: "Test string",
224
+ secretEnvironmentVariables: [
225
+ {
226
+ key: "Test string",
227
+ projectId: "Test string",
228
+ secret: "Test string",
229
+ version: "Test string",
230
+ }
231
+ ],
232
+ secretVolumes: [
233
+ {
234
+ mountPath: "Test string",
235
+ projectId: "Test string",
236
+ secret: "Test string",
237
+ versions: [
238
+ {
239
+ path: "Test string",
240
+ version: "Test string",
241
+ }
242
+ ],
243
+ }
244
+ ],
245
+ serviceAccountEmail: "Test string",
246
+ sourceArchiveUrl: "Test string",
247
+ sourceRepository: {
248
+ deployedUrl: "Test string",
249
+ url: "Test string",
250
+ },
251
+ sourceToken: "Test string",
252
+ sourceUploadUrl: "Test string",
253
+ status: "Test string",
254
+ timeout: "Test string",
255
+ updateTime: "Test string",
256
+ versionId: "Test string",
257
+ vpcConnector: "Test string",
258
+ vpcConnectorEgressSettings: "Test string",
259
+ });
260
+ /** Sets the IAM access control policy on the specified function. Replaces any existing policy. */
261
+ await gapi.client.cloudfunctions.projects.locations.functions.setIamPolicy({
262
+ resource: "Test string",
263
+ }, {
264
+ policy: {
265
+ auditConfigs: [
266
+ {
267
+ auditLogConfigs: [
268
+ {
269
+ exemptedMembers: [
270
+ "Test string"
271
+ ],
272
+ logType: "Test string",
273
+ }
274
+ ],
275
+ service: "Test string",
276
+ }
277
+ ],
278
+ bindings: [
279
+ {
280
+ condition: {
281
+ description: "Test string",
282
+ expression: "Test string",
283
+ location: "Test string",
284
+ title: "Test string",
285
+ },
286
+ members: [
287
+ "Test string"
288
+ ],
289
+ role: "Test string",
290
+ }
291
+ ],
292
+ etag: "Test string",
293
+ version: 42,
294
+ },
295
+ updateMask: "Test string",
296
+ });
297
+ /**
298
+ * Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND
299
+ * error.
300
+ */
301
+ await gapi.client.cloudfunctions.projects.locations.functions.testIamPermissions({
302
+ resource: "Test string",
303
+ }, {
304
+ permissions: [
305
+ "Test string"
306
+ ],
307
+ });
308
+ }
309
+ });
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
+ }