@maxim_mazurok/gapi.client.cloudtasks-v2 0.0.20220813

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.cloudtasks-v2",
3
+ "version": "0.0.20220813",
4
+ "description": "TypeScript typings for Cloud Tasks API v2",
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 Tasks API v2
2
+
3
+ Manages the execution of large numbers of distributed requests.
4
+ For detailed description please check [documentation](https://cloud.google.com/tasks/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Tasks API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.cloudtasks-v2 --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://cloudtasks.googleapis.com/$discovery/rest?version=v2', () => {
29
+ // now we can use:
30
+ // gapi.client.cloudtasks
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('cloudtasks', 'v2', () => {
37
+ // now we can use:
38
+ // gapi.client.cloudtasks
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 Tasks API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,308 @@
1
+ /* This is stub file for gapi.client.cloudtasks-v2 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: 20220813
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://cloudtasks.googleapis.com/$discovery/rest?version=v2');
12
+ /** now we can use gapi.client.cloudtasks */
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 information about a location. */
33
+ await gapi.client.cloudtasks.projects.locations.get({
34
+ name: "Test string",
35
+ });
36
+ /** Lists information about the supported locations for this service. */
37
+ await gapi.client.cloudtasks.projects.locations.list({
38
+ filter: "Test string",
39
+ name: "Test string",
40
+ pageSize: 42,
41
+ pageToken: "Test string",
42
+ });
43
+ /**
44
+ * Creates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was
45
+ * dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of
46
+ * Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
47
+ */
48
+ await gapi.client.cloudtasks.projects.locations.queues.create({
49
+ parent: "Test string",
50
+ }, {
51
+ appEngineRoutingOverride: {
52
+ host: "Test string",
53
+ instance: "Test string",
54
+ service: "Test string",
55
+ version: "Test string",
56
+ },
57
+ name: "Test string",
58
+ purgeTime: "Test string",
59
+ rateLimits: {
60
+ maxBurstSize: 42,
61
+ maxConcurrentDispatches: 42,
62
+ maxDispatchesPerSecond: 42,
63
+ },
64
+ retryConfig: {
65
+ maxAttempts: 42,
66
+ maxBackoff: "Test string",
67
+ maxDoublings: 42,
68
+ maxRetryDuration: "Test string",
69
+ minBackoff: "Test string",
70
+ },
71
+ stackdriverLoggingConfig: {
72
+ samplingRatio: 42,
73
+ },
74
+ state: "Test string",
75
+ });
76
+ /**
77
+ * Deletes a queue. This command will delete the queue even if it has tasks in it. Note: If you delete a queue, a queue with the same name can't be created for 7 days. WARNING: Using this
78
+ * method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and
79
+ * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
80
+ */
81
+ await gapi.client.cloudtasks.projects.locations.queues.delete({
82
+ name: "Test string",
83
+ });
84
+ /** Gets a queue. */
85
+ await gapi.client.cloudtasks.projects.locations.queues.get({
86
+ name: "Test string",
87
+ });
88
+ /**
89
+ * Gets the access control policy for a Queue. Returns an empty policy if the resource exists and does not have a policy set. Authorization requires the following [Google
90
+ * IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.getIamPolicy`
91
+ */
92
+ await gapi.client.cloudtasks.projects.locations.queues.getIamPolicy({
93
+ resource: "Test string",
94
+ }, {
95
+ options: {
96
+ requestedPolicyVersion: 42,
97
+ },
98
+ });
99
+ /** Lists queues. Queues are returned in lexicographical order. */
100
+ await gapi.client.cloudtasks.projects.locations.queues.list({
101
+ filter: "Test string",
102
+ pageSize: 42,
103
+ pageToken: "Test string",
104
+ parent: "Test string",
105
+ });
106
+ /**
107
+ * Updates a queue. This method creates the queue if it does not exist and updates the queue if it does exist. Queues created with this method allow tasks to live for a maximum of 31 days.
108
+ * After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App
109
+ * Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this
110
+ * method.
111
+ */
112
+ await gapi.client.cloudtasks.projects.locations.queues.patch({
113
+ name: "Test string",
114
+ updateMask: "Test string",
115
+ }, {
116
+ appEngineRoutingOverride: {
117
+ host: "Test string",
118
+ instance: "Test string",
119
+ service: "Test string",
120
+ version: "Test string",
121
+ },
122
+ name: "Test string",
123
+ purgeTime: "Test string",
124
+ rateLimits: {
125
+ maxBurstSize: 42,
126
+ maxConcurrentDispatches: 42,
127
+ maxDispatchesPerSecond: 42,
128
+ },
129
+ retryConfig: {
130
+ maxAttempts: 42,
131
+ maxBackoff: "Test string",
132
+ maxDoublings: 42,
133
+ maxRetryDuration: "Test string",
134
+ minBackoff: "Test string",
135
+ },
136
+ stackdriverLoggingConfig: {
137
+ samplingRatio: 42,
138
+ },
139
+ state: "Test string",
140
+ });
141
+ /**
142
+ * Pauses the queue. If a queue is paused then the system will stop dispatching tasks until the queue is resumed via ResumeQueue. Tasks can still be added when the queue is paused. A queue
143
+ * is paused if its state is PAUSED.
144
+ */
145
+ await gapi.client.cloudtasks.projects.locations.queues.pause({
146
+ name: "Test string",
147
+ }, {
148
+ });
149
+ /**
150
+ * Purges a queue by deleting all of its tasks. All tasks created before this method is called are permanently deleted. Purge operations can take up to one minute to take effect. Tasks
151
+ * might be dispatched before the purge takes effect. A purge is irreversible.
152
+ */
153
+ await gapi.client.cloudtasks.projects.locations.queues.purge({
154
+ name: "Test string",
155
+ }, {
156
+ });
157
+ /**
158
+ * Resume a queue. This method resumes a queue after it has been PAUSED or DISABLED. The state of a queue is stored in the queue's state; after calling this method it will be set to
159
+ * RUNNING. WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing
160
+ * Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
161
+ */
162
+ await gapi.client.cloudtasks.projects.locations.queues.resume({
163
+ name: "Test string",
164
+ }, {
165
+ });
166
+ /**
167
+ * Sets the access control policy for a Queue. Replaces any existing policy. Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required
168
+ * to use the Cloud Console. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.setIamPolicy`
169
+ */
170
+ await gapi.client.cloudtasks.projects.locations.queues.setIamPolicy({
171
+ resource: "Test string",
172
+ }, {
173
+ policy: {
174
+ bindings: [
175
+ {
176
+ condition: {
177
+ description: "Test string",
178
+ expression: "Test string",
179
+ location: "Test string",
180
+ title: "Test string",
181
+ },
182
+ members: [
183
+ "Test string"
184
+ ],
185
+ role: "Test string",
186
+ }
187
+ ],
188
+ etag: "Test string",
189
+ version: 42,
190
+ },
191
+ });
192
+ /**
193
+ * Returns permissions that a caller has on a Queue. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error. Note: This operation is designed
194
+ * to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
195
+ */
196
+ await gapi.client.cloudtasks.projects.locations.queues.testIamPermissions({
197
+ resource: "Test string",
198
+ }, {
199
+ permissions: [
200
+ "Test string"
201
+ ],
202
+ });
203
+ /** Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * The maximum task size is 100KB. */
204
+ await gapi.client.cloudtasks.projects.locations.queues.tasks.create({
205
+ parent: "Test string",
206
+ }, {
207
+ responseView: "Test string",
208
+ task: {
209
+ appEngineHttpRequest: {
210
+ appEngineRouting: {
211
+ host: "Test string",
212
+ instance: "Test string",
213
+ service: "Test string",
214
+ version: "Test string",
215
+ },
216
+ body: "Test string",
217
+ headers: {
218
+ A: "Test string"
219
+ },
220
+ httpMethod: "Test string",
221
+ relativeUri: "Test string",
222
+ },
223
+ createTime: "Test string",
224
+ dispatchCount: 42,
225
+ dispatchDeadline: "Test string",
226
+ firstAttempt: {
227
+ dispatchTime: "Test string",
228
+ responseStatus: {
229
+ code: 42,
230
+ details: [
231
+ {
232
+ A: 42
233
+ }
234
+ ],
235
+ message: "Test string",
236
+ },
237
+ responseTime: "Test string",
238
+ scheduleTime: "Test string",
239
+ },
240
+ httpRequest: {
241
+ body: "Test string",
242
+ headers: {
243
+ A: "Test string"
244
+ },
245
+ httpMethod: "Test string",
246
+ oauthToken: {
247
+ scope: "Test string",
248
+ serviceAccountEmail: "Test string",
249
+ },
250
+ oidcToken: {
251
+ audience: "Test string",
252
+ serviceAccountEmail: "Test string",
253
+ },
254
+ url: "Test string",
255
+ },
256
+ lastAttempt: {
257
+ dispatchTime: "Test string",
258
+ responseStatus: {
259
+ code: 42,
260
+ details: [
261
+ {
262
+ A: 42
263
+ }
264
+ ],
265
+ message: "Test string",
266
+ },
267
+ responseTime: "Test string",
268
+ scheduleTime: "Test string",
269
+ },
270
+ name: "Test string",
271
+ responseCount: 42,
272
+ scheduleTime: "Test string",
273
+ view: "Test string",
274
+ },
275
+ });
276
+ /** Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed. */
277
+ await gapi.client.cloudtasks.projects.locations.queues.tasks.delete({
278
+ name: "Test string",
279
+ });
280
+ /** Gets a task. */
281
+ await gapi.client.cloudtasks.projects.locations.queues.tasks.get({
282
+ name: "Test string",
283
+ responseView: "Test string",
284
+ });
285
+ /**
286
+ * Lists the tasks in a queue. By default, only the BASIC view is retrieved due to performance considerations; response_view controls the subset of information which is returned. The tasks
287
+ * may be returned in any order. The ordering may change at any time.
288
+ */
289
+ await gapi.client.cloudtasks.projects.locations.queues.tasks.list({
290
+ pageSize: 42,
291
+ pageToken: "Test string",
292
+ parent: "Test string",
293
+ responseView: "Test string",
294
+ });
295
+ /**
296
+ * Forces a task to run now. When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its RateLimits or is PAUSED. This
297
+ * command is meant to be used for manual debugging. For example, RunTask can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now. The
298
+ * dispatched task is returned. That is, the task that is returned contains the status after the task is dispatched but before the task is received by its target. If Cloud Tasks receives a
299
+ * successful response from the task's target, then the task will be deleted; otherwise the task's schedule_time will be reset to the time that RunTask was called plus the retry delay
300
+ * specified in the queue's RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has already succeeded or permanently failed.
301
+ */
302
+ await gapi.client.cloudtasks.projects.locations.queues.tasks.run({
303
+ name: "Test string",
304
+ }, {
305
+ responseView: "Test string",
306
+ });
307
+ }
308
+ });
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
+ }