@maxim_mazurok/gapi.client.cloudtasks-v2beta2 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/index.d.ts +1819 -0
- package/package.json +20 -0
- package/readme.md +68 -0
- package/tests.ts +455 -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.cloudtasks-v2beta2",
|
|
3
|
+
"version": "0.0.20220813",
|
|
4
|
+
"description": "TypeScript typings for Cloud Tasks API v2beta2",
|
|
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 v2beta2
|
|
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-v2beta2 --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=v2beta2', () => {
|
|
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', 'v2beta2', () => {
|
|
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,455 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.cloudtasks-v2beta2 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=v2beta2');
|
|
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
|
+
* Note: This feature is in its experimental stage. You must request access to the API through the [Cloud Tasks BufferQueues Experiment Signup form](https://forms.gle/X8Zr5hiXH5tTGFqh8).
|
|
45
|
+
* Creates and buffers a new task without the need to explicitly define a Task message. The queue must be an http queue (i.e., must have HTTP target). This method is used for a simplified
|
|
46
|
+
* application of Cloud Tasks queues in buffer and rate limitting HTTP requests.
|
|
47
|
+
*/
|
|
48
|
+
await gapi.client.cloudtasks.projects.locations.queues.buffer({
|
|
49
|
+
name: "Test string",
|
|
50
|
+
}, {
|
|
51
|
+
body: {
|
|
52
|
+
contentType: "Test string",
|
|
53
|
+
data: "Test string",
|
|
54
|
+
extensions: [
|
|
55
|
+
{
|
|
56
|
+
A: 42
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* 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
|
|
63
|
+
* 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
|
|
64
|
+
* Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
|
|
65
|
+
*/
|
|
66
|
+
await gapi.client.cloudtasks.projects.locations.queues.create({
|
|
67
|
+
parent: "Test string",
|
|
68
|
+
}, {
|
|
69
|
+
appEngineHttpTarget: {
|
|
70
|
+
appEngineRoutingOverride: {
|
|
71
|
+
host: "Test string",
|
|
72
|
+
instance: "Test string",
|
|
73
|
+
service: "Test string",
|
|
74
|
+
version: "Test string",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
httpTarget: {
|
|
78
|
+
headerOverrides: [
|
|
79
|
+
{
|
|
80
|
+
header: {
|
|
81
|
+
key: "Test string",
|
|
82
|
+
value: "Test string",
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
httpMethod: "Test string",
|
|
87
|
+
oauthToken: {
|
|
88
|
+
scope: "Test string",
|
|
89
|
+
serviceAccountEmail: "Test string",
|
|
90
|
+
},
|
|
91
|
+
oidcToken: {
|
|
92
|
+
audience: "Test string",
|
|
93
|
+
serviceAccountEmail: "Test string",
|
|
94
|
+
},
|
|
95
|
+
uriOverride: {
|
|
96
|
+
host: "Test string",
|
|
97
|
+
path: "Test string",
|
|
98
|
+
port: "Test string",
|
|
99
|
+
query: "Test string",
|
|
100
|
+
scheme: "Test string",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
name: "Test string",
|
|
104
|
+
pullTarget: {
|
|
105
|
+
},
|
|
106
|
+
purgeTime: "Test string",
|
|
107
|
+
rateLimits: {
|
|
108
|
+
maxBurstSize: 42,
|
|
109
|
+
maxConcurrentTasks: 42,
|
|
110
|
+
maxTasksDispatchedPerSecond: 42,
|
|
111
|
+
},
|
|
112
|
+
retryConfig: {
|
|
113
|
+
maxAttempts: 42,
|
|
114
|
+
maxBackoff: "Test string",
|
|
115
|
+
maxDoublings: 42,
|
|
116
|
+
maxRetryDuration: "Test string",
|
|
117
|
+
minBackoff: "Test string",
|
|
118
|
+
unlimitedAttempts: true,
|
|
119
|
+
},
|
|
120
|
+
state: "Test string",
|
|
121
|
+
stats: {
|
|
122
|
+
concurrentDispatchesCount: "Test string",
|
|
123
|
+
effectiveExecutionRate: 42,
|
|
124
|
+
executedLastMinuteCount: "Test string",
|
|
125
|
+
oldestEstimatedArrivalTime: "Test string",
|
|
126
|
+
tasksCount: "Test string",
|
|
127
|
+
},
|
|
128
|
+
taskTtl: "Test string",
|
|
129
|
+
tombstoneTtl: "Test string",
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* 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
|
|
133
|
+
* 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
|
|
134
|
+
* queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
|
|
135
|
+
*/
|
|
136
|
+
await gapi.client.cloudtasks.projects.locations.queues.delete({
|
|
137
|
+
name: "Test string",
|
|
138
|
+
});
|
|
139
|
+
/** Gets a queue. */
|
|
140
|
+
await gapi.client.cloudtasks.projects.locations.queues.get({
|
|
141
|
+
name: "Test string",
|
|
142
|
+
readMask: "Test string",
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* 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
|
|
146
|
+
* IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.getIamPolicy`
|
|
147
|
+
*/
|
|
148
|
+
await gapi.client.cloudtasks.projects.locations.queues.getIamPolicy({
|
|
149
|
+
resource: "Test string",
|
|
150
|
+
}, {
|
|
151
|
+
options: {
|
|
152
|
+
requestedPolicyVersion: 42,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
/** Lists queues. Queues are returned in lexicographical order. */
|
|
156
|
+
await gapi.client.cloudtasks.projects.locations.queues.list({
|
|
157
|
+
filter: "Test string",
|
|
158
|
+
pageSize: 42,
|
|
159
|
+
pageToken: "Test string",
|
|
160
|
+
parent: "Test string",
|
|
161
|
+
readMask: "Test string",
|
|
162
|
+
});
|
|
163
|
+
/**
|
|
164
|
+
* 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.
|
|
165
|
+
* 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
|
|
166
|
+
* 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
|
|
167
|
+
* method.
|
|
168
|
+
*/
|
|
169
|
+
await gapi.client.cloudtasks.projects.locations.queues.patch({
|
|
170
|
+
name: "Test string",
|
|
171
|
+
updateMask: "Test string",
|
|
172
|
+
}, {
|
|
173
|
+
appEngineHttpTarget: {
|
|
174
|
+
appEngineRoutingOverride: {
|
|
175
|
+
host: "Test string",
|
|
176
|
+
instance: "Test string",
|
|
177
|
+
service: "Test string",
|
|
178
|
+
version: "Test string",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
httpTarget: {
|
|
182
|
+
headerOverrides: [
|
|
183
|
+
{
|
|
184
|
+
header: {
|
|
185
|
+
key: "Test string",
|
|
186
|
+
value: "Test string",
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
httpMethod: "Test string",
|
|
191
|
+
oauthToken: {
|
|
192
|
+
scope: "Test string",
|
|
193
|
+
serviceAccountEmail: "Test string",
|
|
194
|
+
},
|
|
195
|
+
oidcToken: {
|
|
196
|
+
audience: "Test string",
|
|
197
|
+
serviceAccountEmail: "Test string",
|
|
198
|
+
},
|
|
199
|
+
uriOverride: {
|
|
200
|
+
host: "Test string",
|
|
201
|
+
path: "Test string",
|
|
202
|
+
port: "Test string",
|
|
203
|
+
query: "Test string",
|
|
204
|
+
scheme: "Test string",
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
name: "Test string",
|
|
208
|
+
pullTarget: {
|
|
209
|
+
},
|
|
210
|
+
purgeTime: "Test string",
|
|
211
|
+
rateLimits: {
|
|
212
|
+
maxBurstSize: 42,
|
|
213
|
+
maxConcurrentTasks: 42,
|
|
214
|
+
maxTasksDispatchedPerSecond: 42,
|
|
215
|
+
},
|
|
216
|
+
retryConfig: {
|
|
217
|
+
maxAttempts: 42,
|
|
218
|
+
maxBackoff: "Test string",
|
|
219
|
+
maxDoublings: 42,
|
|
220
|
+
maxRetryDuration: "Test string",
|
|
221
|
+
minBackoff: "Test string",
|
|
222
|
+
unlimitedAttempts: true,
|
|
223
|
+
},
|
|
224
|
+
state: "Test string",
|
|
225
|
+
stats: {
|
|
226
|
+
concurrentDispatchesCount: "Test string",
|
|
227
|
+
effectiveExecutionRate: 42,
|
|
228
|
+
executedLastMinuteCount: "Test string",
|
|
229
|
+
oldestEstimatedArrivalTime: "Test string",
|
|
230
|
+
tasksCount: "Test string",
|
|
231
|
+
},
|
|
232
|
+
taskTtl: "Test string",
|
|
233
|
+
tombstoneTtl: "Test string",
|
|
234
|
+
});
|
|
235
|
+
/**
|
|
236
|
+
* 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
|
|
237
|
+
* is paused if its state is PAUSED.
|
|
238
|
+
*/
|
|
239
|
+
await gapi.client.cloudtasks.projects.locations.queues.pause({
|
|
240
|
+
name: "Test string",
|
|
241
|
+
}, {
|
|
242
|
+
});
|
|
243
|
+
/**
|
|
244
|
+
* 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
|
|
245
|
+
* might be dispatched before the purge takes effect. A purge is irreversible.
|
|
246
|
+
*/
|
|
247
|
+
await gapi.client.cloudtasks.projects.locations.queues.purge({
|
|
248
|
+
name: "Test string",
|
|
249
|
+
}, {
|
|
250
|
+
});
|
|
251
|
+
/**
|
|
252
|
+
* 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
|
|
253
|
+
* 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
|
|
254
|
+
* Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
|
|
255
|
+
*/
|
|
256
|
+
await gapi.client.cloudtasks.projects.locations.queues.resume({
|
|
257
|
+
name: "Test string",
|
|
258
|
+
}, {
|
|
259
|
+
});
|
|
260
|
+
/**
|
|
261
|
+
* 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
|
|
262
|
+
* 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`
|
|
263
|
+
*/
|
|
264
|
+
await gapi.client.cloudtasks.projects.locations.queues.setIamPolicy({
|
|
265
|
+
resource: "Test string",
|
|
266
|
+
}, {
|
|
267
|
+
policy: {
|
|
268
|
+
bindings: [
|
|
269
|
+
{
|
|
270
|
+
condition: {
|
|
271
|
+
description: "Test string",
|
|
272
|
+
expression: "Test string",
|
|
273
|
+
location: "Test string",
|
|
274
|
+
title: "Test string",
|
|
275
|
+
},
|
|
276
|
+
members: [
|
|
277
|
+
"Test string"
|
|
278
|
+
],
|
|
279
|
+
role: "Test string",
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
etag: "Test string",
|
|
283
|
+
version: 42,
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* 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
|
|
288
|
+
* to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
|
|
289
|
+
*/
|
|
290
|
+
await gapi.client.cloudtasks.projects.locations.queues.testIamPermissions({
|
|
291
|
+
resource: "Test string",
|
|
292
|
+
}, {
|
|
293
|
+
permissions: [
|
|
294
|
+
"Test string"
|
|
295
|
+
],
|
|
296
|
+
});
|
|
297
|
+
/**
|
|
298
|
+
* Acknowledges a pull task. The worker, that is, the entity that leased this task must call this method to indicate that the work associated with the task has finished. The worker must
|
|
299
|
+
* acknowledge a task within the lease_duration or the lease will expire and the task will become available to be leased again. After the task is acknowledged, it will not be returned by a
|
|
300
|
+
* later LeaseTasks, GetTask, or ListTasks.
|
|
301
|
+
*/
|
|
302
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.acknowledge({
|
|
303
|
+
name: "Test string",
|
|
304
|
+
}, {
|
|
305
|
+
scheduleTime: "Test string",
|
|
306
|
+
});
|
|
307
|
+
/**
|
|
308
|
+
* Cancel a pull task's lease. The worker can use this method to cancel a task's lease by setting its schedule_time to now. This will make the task available to be leased to the next
|
|
309
|
+
* caller of LeaseTasks.
|
|
310
|
+
*/
|
|
311
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.cancelLease({
|
|
312
|
+
name: "Test string",
|
|
313
|
+
}, {
|
|
314
|
+
responseView: "Test string",
|
|
315
|
+
scheduleTime: "Test string",
|
|
316
|
+
});
|
|
317
|
+
/**
|
|
318
|
+
* Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * For App Engine queues, the maximum task size is 100KB. * For pull
|
|
319
|
+
* queues, the maximum task size is 1MB.
|
|
320
|
+
*/
|
|
321
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.create({
|
|
322
|
+
parent: "Test string",
|
|
323
|
+
}, {
|
|
324
|
+
responseView: "Test string",
|
|
325
|
+
task: {
|
|
326
|
+
appEngineHttpRequest: {
|
|
327
|
+
appEngineRouting: {
|
|
328
|
+
host: "Test string",
|
|
329
|
+
instance: "Test string",
|
|
330
|
+
service: "Test string",
|
|
331
|
+
version: "Test string",
|
|
332
|
+
},
|
|
333
|
+
headers: {
|
|
334
|
+
A: "Test string"
|
|
335
|
+
},
|
|
336
|
+
httpMethod: "Test string",
|
|
337
|
+
payload: "Test string",
|
|
338
|
+
relativeUrl: "Test string",
|
|
339
|
+
},
|
|
340
|
+
createTime: "Test string",
|
|
341
|
+
httpRequest: {
|
|
342
|
+
body: "Test string",
|
|
343
|
+
headers: {
|
|
344
|
+
A: "Test string"
|
|
345
|
+
},
|
|
346
|
+
httpMethod: "Test string",
|
|
347
|
+
oauthToken: {
|
|
348
|
+
scope: "Test string",
|
|
349
|
+
serviceAccountEmail: "Test string",
|
|
350
|
+
},
|
|
351
|
+
oidcToken: {
|
|
352
|
+
audience: "Test string",
|
|
353
|
+
serviceAccountEmail: "Test string",
|
|
354
|
+
},
|
|
355
|
+
url: "Test string",
|
|
356
|
+
},
|
|
357
|
+
name: "Test string",
|
|
358
|
+
pullMessage: {
|
|
359
|
+
payload: "Test string",
|
|
360
|
+
tag: "Test string",
|
|
361
|
+
},
|
|
362
|
+
scheduleTime: "Test string",
|
|
363
|
+
status: {
|
|
364
|
+
attemptDispatchCount: 42,
|
|
365
|
+
attemptResponseCount: 42,
|
|
366
|
+
firstAttemptStatus: {
|
|
367
|
+
dispatchTime: "Test string",
|
|
368
|
+
responseStatus: {
|
|
369
|
+
code: 42,
|
|
370
|
+
details: [
|
|
371
|
+
{
|
|
372
|
+
A: 42
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
message: "Test string",
|
|
376
|
+
},
|
|
377
|
+
responseTime: "Test string",
|
|
378
|
+
scheduleTime: "Test string",
|
|
379
|
+
},
|
|
380
|
+
lastAttemptStatus: {
|
|
381
|
+
dispatchTime: "Test string",
|
|
382
|
+
responseStatus: {
|
|
383
|
+
code: 42,
|
|
384
|
+
details: [
|
|
385
|
+
{
|
|
386
|
+
A: 42
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
message: "Test string",
|
|
390
|
+
},
|
|
391
|
+
responseTime: "Test string",
|
|
392
|
+
scheduleTime: "Test string",
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
view: "Test string",
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
/** Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has completed successfully or permanently failed. */
|
|
399
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.delete({
|
|
400
|
+
name: "Test string",
|
|
401
|
+
});
|
|
402
|
+
/** Gets a task. */
|
|
403
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.get({
|
|
404
|
+
name: "Test string",
|
|
405
|
+
responseView: "Test string",
|
|
406
|
+
});
|
|
407
|
+
/**
|
|
408
|
+
* Leases tasks from a pull queue for lease_duration. This method is invoked by the worker to obtain a lease. The worker must acknowledge the task via AcknowledgeTask after they have
|
|
409
|
+
* performed the work associated with the task. The payload is intended to store data that the worker needs to perform the work associated with the task. To return the payloads in the
|
|
410
|
+
* response, set response_view to FULL. A maximum of 10 qps of LeaseTasks requests are allowed per queue. RESOURCE_EXHAUSTED is returned when this limit is exceeded. RESOURCE_EXHAUSTED is
|
|
411
|
+
* also returned when max_tasks_dispatched_per_second is exceeded.
|
|
412
|
+
*/
|
|
413
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.lease({
|
|
414
|
+
parent: "Test string",
|
|
415
|
+
}, {
|
|
416
|
+
filter: "Test string",
|
|
417
|
+
leaseDuration: "Test string",
|
|
418
|
+
maxTasks: 42,
|
|
419
|
+
responseView: "Test string",
|
|
420
|
+
});
|
|
421
|
+
/**
|
|
422
|
+
* 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
|
|
423
|
+
* may be returned in any order. The ordering may change at any time.
|
|
424
|
+
*/
|
|
425
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.list({
|
|
426
|
+
pageSize: 42,
|
|
427
|
+
pageToken: "Test string",
|
|
428
|
+
parent: "Test string",
|
|
429
|
+
responseView: "Test string",
|
|
430
|
+
});
|
|
431
|
+
/**
|
|
432
|
+
* Renew the current lease of a pull task. The worker can use this method to extend the lease by a new duration, starting from now. The new task lease will be returned in the task's
|
|
433
|
+
* schedule_time.
|
|
434
|
+
*/
|
|
435
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.renewLease({
|
|
436
|
+
name: "Test string",
|
|
437
|
+
}, {
|
|
438
|
+
leaseDuration: "Test string",
|
|
439
|
+
responseView: "Test string",
|
|
440
|
+
scheduleTime: "Test string",
|
|
441
|
+
});
|
|
442
|
+
/**
|
|
443
|
+
* 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
|
|
444
|
+
* 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
|
|
445
|
+
* 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
|
|
446
|
+
* 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
|
|
447
|
+
* specified in the queue's RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has already succeeded or permanently failed. RunTask cannot be called on a pull task.
|
|
448
|
+
*/
|
|
449
|
+
await gapi.client.cloudtasks.projects.locations.queues.tasks.run({
|
|
450
|
+
name: "Test string",
|
|
451
|
+
}, {
|
|
452
|
+
responseView: "Test string",
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
});
|
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
|
+
}
|