~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/taskqueue/v1beta2/taskqueue-gen.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Package taskqueue provides access to the TaskQueue API.
 
2
//
 
3
// See https://developers.google.com/appengine/docs/python/taskqueue/rest
 
4
//
 
5
// Usage example:
 
6
//
 
7
//   import "google.golang.org/api/taskqueue/v1beta2"
 
8
//   ...
 
9
//   taskqueueService, err := taskqueue.New(oauthHttpClient)
 
10
package taskqueue
 
11
 
 
12
import (
 
13
        "bytes"
 
14
        "encoding/json"
 
15
        "errors"
 
16
        "fmt"
 
17
        "google.golang.org/api/googleapi"
 
18
        "io"
 
19
        "net/http"
 
20
        "net/url"
 
21
        "strconv"
 
22
        "strings"
 
23
)
 
24
 
 
25
// Always reference these packages, just in case the auto-generated code
 
26
// below doesn't.
 
27
var _ = bytes.NewBuffer
 
28
var _ = strconv.Itoa
 
29
var _ = fmt.Sprintf
 
30
var _ = json.NewDecoder
 
31
var _ = io.Copy
 
32
var _ = url.Parse
 
33
var _ = googleapi.Version
 
34
var _ = errors.New
 
35
var _ = strings.Replace
 
36
 
 
37
const apiId = "taskqueue:v1beta2"
 
38
const apiName = "taskqueue"
 
39
const apiVersion = "v1beta2"
 
40
const basePath = "https://www.googleapis.com/taskqueue/v1beta2/projects/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // Manage your Tasks and Taskqueues
 
45
        TaskqueueScope = "https://www.googleapis.com/auth/taskqueue"
 
46
 
 
47
        // Consume Tasks from your Taskqueues
 
48
        TaskqueueConsumerScope = "https://www.googleapis.com/auth/taskqueue.consumer"
 
49
)
 
50
 
 
51
func New(client *http.Client) (*Service, error) {
 
52
        if client == nil {
 
53
                return nil, errors.New("client is nil")
 
54
        }
 
55
        s := &Service{client: client, BasePath: basePath}
 
56
        s.Taskqueues = NewTaskqueuesService(s)
 
57
        s.Tasks = NewTasksService(s)
 
58
        return s, nil
 
59
}
 
60
 
 
61
type Service struct {
 
62
        client   *http.Client
 
63
        BasePath string // API endpoint base URL
 
64
 
 
65
        Taskqueues *TaskqueuesService
 
66
 
 
67
        Tasks *TasksService
 
68
}
 
69
 
 
70
func NewTaskqueuesService(s *Service) *TaskqueuesService {
 
71
        rs := &TaskqueuesService{s: s}
 
72
        return rs
 
73
}
 
74
 
 
75
type TaskqueuesService struct {
 
76
        s *Service
 
77
}
 
78
 
 
79
func NewTasksService(s *Service) *TasksService {
 
80
        rs := &TasksService{s: s}
 
81
        return rs
 
82
}
 
83
 
 
84
type TasksService struct {
 
85
        s *Service
 
86
}
 
87
 
 
88
type Task struct {
 
89
        // EnqueueTimestamp: Time (in seconds since the epoch) at which the task
 
90
        // was enqueued.
 
91
        EnqueueTimestamp int64 `json:"enqueueTimestamp,omitempty,string"`
 
92
 
 
93
        // Id: Name of the task.
 
94
        Id string `json:"id,omitempty"`
 
95
 
 
96
        // Kind: The kind of object returned, in this case set to task.
 
97
        Kind string `json:"kind,omitempty"`
 
98
 
 
99
        // LeaseTimestamp: Time (in seconds since the epoch) at which the task
 
100
        // lease will expire. This value is 0 if the task isnt currently leased
 
101
        // out to a worker.
 
102
        LeaseTimestamp int64 `json:"leaseTimestamp,omitempty,string"`
 
103
 
 
104
        // PayloadBase64: A bag of bytes which is the task payload. The payload
 
105
        // on the JSON side is always Base64 encoded.
 
106
        PayloadBase64 string `json:"payloadBase64,omitempty"`
 
107
 
 
108
        // QueueName: Name of the queue that the task is in.
 
109
        QueueName string `json:"queueName,omitempty"`
 
110
 
 
111
        // Retry_count: The number of leases applied to this task.
 
112
        Retry_count int64 `json:"retry_count,omitempty"`
 
113
 
 
114
        // Tag: Tag for the task, could be used later to lease tasks grouped by
 
115
        // a specific tag.
 
116
        Tag string `json:"tag,omitempty"`
 
117
}
 
118
 
 
119
type TaskQueue struct {
 
120
        // Acl: ACLs that are applicable to this TaskQueue object.
 
121
        Acl *TaskQueueAcl `json:"acl,omitempty"`
 
122
 
 
123
        // Id: Name of the taskqueue.
 
124
        Id string `json:"id,omitempty"`
 
125
 
 
126
        // Kind: The kind of REST object returned, in this case taskqueue.
 
127
        Kind string `json:"kind,omitempty"`
 
128
 
 
129
        // MaxLeases: The number of times we should lease out tasks before
 
130
        // giving up on them. If unset we lease them out forever until a worker
 
131
        // deletes the task.
 
132
        MaxLeases int64 `json:"maxLeases,omitempty"`
 
133
 
 
134
        // Stats: Statistics for the TaskQueue object in question.
 
135
        Stats *TaskQueueStats `json:"stats,omitempty"`
 
136
}
 
137
 
 
138
type TaskQueueAcl struct {
 
139
        // AdminEmails: Email addresses of users who are "admins" of the
 
140
        // TaskQueue. This means they can control the queue, eg set ACLs for the
 
141
        // queue.
 
142
        AdminEmails []string `json:"adminEmails,omitempty"`
 
143
 
 
144
        // ConsumerEmails: Email addresses of users who can "consume" tasks from
 
145
        // the TaskQueue. This means they can Dequeue and Delete tasks from the
 
146
        // queue.
 
147
        ConsumerEmails []string `json:"consumerEmails,omitempty"`
 
148
 
 
149
        // ProducerEmails: Email addresses of users who can "produce" tasks into
 
150
        // the TaskQueue. This means they can Insert tasks into the queue.
 
151
        ProducerEmails []string `json:"producerEmails,omitempty"`
 
152
}
 
153
 
 
154
type TaskQueueStats struct {
 
155
        // LeasedLastHour: Number of tasks leased in the last hour.
 
156
        LeasedLastHour int64 `json:"leasedLastHour,omitempty,string"`
 
157
 
 
158
        // LeasedLastMinute: Number of tasks leased in the last minute.
 
159
        LeasedLastMinute int64 `json:"leasedLastMinute,omitempty,string"`
 
160
 
 
161
        // OldestTask: The timestamp (in seconds since the epoch) of the oldest
 
162
        // unfinished task.
 
163
        OldestTask int64 `json:"oldestTask,omitempty,string"`
 
164
 
 
165
        // TotalTasks: Number of tasks in the queue.
 
166
        TotalTasks int64 `json:"totalTasks,omitempty"`
 
167
}
 
168
 
 
169
type Tasks struct {
 
170
        // Items: The actual list of tasks returned as a result of the lease
 
171
        // operation.
 
172
        Items []*Task `json:"items,omitempty"`
 
173
 
 
174
        // Kind: The kind of object returned, a list of tasks.
 
175
        Kind string `json:"kind,omitempty"`
 
176
}
 
177
 
 
178
type Tasks2 struct {
 
179
        // Items: The actual list of tasks currently active in the TaskQueue.
 
180
        Items []*Task `json:"items,omitempty"`
 
181
 
 
182
        // Kind: The kind of object returned, a list of tasks.
 
183
        Kind string `json:"kind,omitempty"`
 
184
}
 
185
 
 
186
// method id "taskqueue.taskqueues.get":
 
187
 
 
188
type TaskqueuesGetCall struct {
 
189
        s         *Service
 
190
        project   string
 
191
        taskqueue string
 
192
        opt_      map[string]interface{}
 
193
}
 
194
 
 
195
// Get: Get detailed information about a TaskQueue.
 
196
func (r *TaskqueuesService) Get(project string, taskqueue string) *TaskqueuesGetCall {
 
197
        c := &TaskqueuesGetCall{s: r.s, opt_: make(map[string]interface{})}
 
198
        c.project = project
 
199
        c.taskqueue = taskqueue
 
200
        return c
 
201
}
 
202
 
 
203
// GetStats sets the optional parameter "getStats": Whether to get
 
204
// stats.
 
205
func (c *TaskqueuesGetCall) GetStats(getStats bool) *TaskqueuesGetCall {
 
206
        c.opt_["getStats"] = getStats
 
207
        return c
 
208
}
 
209
 
 
210
// Fields allows partial responses to be retrieved.
 
211
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
212
// for more information.
 
213
func (c *TaskqueuesGetCall) Fields(s ...googleapi.Field) *TaskqueuesGetCall {
 
214
        c.opt_["fields"] = googleapi.CombineFields(s)
 
215
        return c
 
216
}
 
217
 
 
218
func (c *TaskqueuesGetCall) Do() (*TaskQueue, error) {
 
219
        var body io.Reader = nil
 
220
        params := make(url.Values)
 
221
        params.Set("alt", "json")
 
222
        if v, ok := c.opt_["getStats"]; ok {
 
223
                params.Set("getStats", fmt.Sprintf("%v", v))
 
224
        }
 
225
        if v, ok := c.opt_["fields"]; ok {
 
226
                params.Set("fields", fmt.Sprintf("%v", v))
 
227
        }
 
228
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}")
 
229
        urls += "?" + params.Encode()
 
230
        req, _ := http.NewRequest("GET", urls, body)
 
231
        googleapi.Expand(req.URL, map[string]string{
 
232
                "project":   c.project,
 
233
                "taskqueue": c.taskqueue,
 
234
        })
 
235
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
236
        res, err := c.s.client.Do(req)
 
237
        if err != nil {
 
238
                return nil, err
 
239
        }
 
240
        defer googleapi.CloseBody(res)
 
241
        if err := googleapi.CheckResponse(res); err != nil {
 
242
                return nil, err
 
243
        }
 
244
        var ret *TaskQueue
 
245
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
246
                return nil, err
 
247
        }
 
248
        return ret, nil
 
249
        // {
 
250
        //   "description": "Get detailed information about a TaskQueue.",
 
251
        //   "httpMethod": "GET",
 
252
        //   "id": "taskqueue.taskqueues.get",
 
253
        //   "parameterOrder": [
 
254
        //     "project",
 
255
        //     "taskqueue"
 
256
        //   ],
 
257
        //   "parameters": {
 
258
        //     "getStats": {
 
259
        //       "description": "Whether to get stats. Optional.",
 
260
        //       "location": "query",
 
261
        //       "type": "boolean"
 
262
        //     },
 
263
        //     "project": {
 
264
        //       "description": "The project under which the queue lies.",
 
265
        //       "location": "path",
 
266
        //       "required": true,
 
267
        //       "type": "string"
 
268
        //     },
 
269
        //     "taskqueue": {
 
270
        //       "description": "The id of the taskqueue to get the properties of.",
 
271
        //       "location": "path",
 
272
        //       "required": true,
 
273
        //       "type": "string"
 
274
        //     }
 
275
        //   },
 
276
        //   "path": "{project}/taskqueues/{taskqueue}",
 
277
        //   "response": {
 
278
        //     "$ref": "TaskQueue"
 
279
        //   },
 
280
        //   "scopes": [
 
281
        //     "https://www.googleapis.com/auth/taskqueue",
 
282
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
283
        //   ]
 
284
        // }
 
285
 
 
286
}
 
287
 
 
288
// method id "taskqueue.tasks.delete":
 
289
 
 
290
type TasksDeleteCall struct {
 
291
        s         *Service
 
292
        project   string
 
293
        taskqueue string
 
294
        task      string
 
295
        opt_      map[string]interface{}
 
296
}
 
297
 
 
298
// Delete: Delete a task from a TaskQueue.
 
299
func (r *TasksService) Delete(project string, taskqueue string, task string) *TasksDeleteCall {
 
300
        c := &TasksDeleteCall{s: r.s, opt_: make(map[string]interface{})}
 
301
        c.project = project
 
302
        c.taskqueue = taskqueue
 
303
        c.task = task
 
304
        return c
 
305
}
 
306
 
 
307
// Fields allows partial responses to be retrieved.
 
308
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
309
// for more information.
 
310
func (c *TasksDeleteCall) Fields(s ...googleapi.Field) *TasksDeleteCall {
 
311
        c.opt_["fields"] = googleapi.CombineFields(s)
 
312
        return c
 
313
}
 
314
 
 
315
func (c *TasksDeleteCall) Do() error {
 
316
        var body io.Reader = nil
 
317
        params := make(url.Values)
 
318
        params.Set("alt", "json")
 
319
        if v, ok := c.opt_["fields"]; ok {
 
320
                params.Set("fields", fmt.Sprintf("%v", v))
 
321
        }
 
322
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks/{task}")
 
323
        urls += "?" + params.Encode()
 
324
        req, _ := http.NewRequest("DELETE", urls, body)
 
325
        googleapi.Expand(req.URL, map[string]string{
 
326
                "project":   c.project,
 
327
                "taskqueue": c.taskqueue,
 
328
                "task":      c.task,
 
329
        })
 
330
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
331
        res, err := c.s.client.Do(req)
 
332
        if err != nil {
 
333
                return err
 
334
        }
 
335
        defer googleapi.CloseBody(res)
 
336
        if err := googleapi.CheckResponse(res); err != nil {
 
337
                return err
 
338
        }
 
339
        return nil
 
340
        // {
 
341
        //   "description": "Delete a task from a TaskQueue.",
 
342
        //   "httpMethod": "DELETE",
 
343
        //   "id": "taskqueue.tasks.delete",
 
344
        //   "parameterOrder": [
 
345
        //     "project",
 
346
        //     "taskqueue",
 
347
        //     "task"
 
348
        //   ],
 
349
        //   "parameters": {
 
350
        //     "project": {
 
351
        //       "description": "The project under which the queue lies.",
 
352
        //       "location": "path",
 
353
        //       "required": true,
 
354
        //       "type": "string"
 
355
        //     },
 
356
        //     "task": {
 
357
        //       "description": "The id of the task to delete.",
 
358
        //       "location": "path",
 
359
        //       "required": true,
 
360
        //       "type": "string"
 
361
        //     },
 
362
        //     "taskqueue": {
 
363
        //       "description": "The taskqueue to delete a task from.",
 
364
        //       "location": "path",
 
365
        //       "required": true,
 
366
        //       "type": "string"
 
367
        //     }
 
368
        //   },
 
369
        //   "path": "{project}/taskqueues/{taskqueue}/tasks/{task}",
 
370
        //   "scopes": [
 
371
        //     "https://www.googleapis.com/auth/taskqueue",
 
372
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
373
        //   ]
 
374
        // }
 
375
 
 
376
}
 
377
 
 
378
// method id "taskqueue.tasks.get":
 
379
 
 
380
type TasksGetCall struct {
 
381
        s         *Service
 
382
        project   string
 
383
        taskqueue string
 
384
        task      string
 
385
        opt_      map[string]interface{}
 
386
}
 
387
 
 
388
// Get: Get a particular task from a TaskQueue.
 
389
func (r *TasksService) Get(project string, taskqueue string, task string) *TasksGetCall {
 
390
        c := &TasksGetCall{s: r.s, opt_: make(map[string]interface{})}
 
391
        c.project = project
 
392
        c.taskqueue = taskqueue
 
393
        c.task = task
 
394
        return c
 
395
}
 
396
 
 
397
// Fields allows partial responses to be retrieved.
 
398
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
399
// for more information.
 
400
func (c *TasksGetCall) Fields(s ...googleapi.Field) *TasksGetCall {
 
401
        c.opt_["fields"] = googleapi.CombineFields(s)
 
402
        return c
 
403
}
 
404
 
 
405
func (c *TasksGetCall) Do() (*Task, error) {
 
406
        var body io.Reader = nil
 
407
        params := make(url.Values)
 
408
        params.Set("alt", "json")
 
409
        if v, ok := c.opt_["fields"]; ok {
 
410
                params.Set("fields", fmt.Sprintf("%v", v))
 
411
        }
 
412
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks/{task}")
 
413
        urls += "?" + params.Encode()
 
414
        req, _ := http.NewRequest("GET", urls, body)
 
415
        googleapi.Expand(req.URL, map[string]string{
 
416
                "project":   c.project,
 
417
                "taskqueue": c.taskqueue,
 
418
                "task":      c.task,
 
419
        })
 
420
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
421
        res, err := c.s.client.Do(req)
 
422
        if err != nil {
 
423
                return nil, err
 
424
        }
 
425
        defer googleapi.CloseBody(res)
 
426
        if err := googleapi.CheckResponse(res); err != nil {
 
427
                return nil, err
 
428
        }
 
429
        var ret *Task
 
430
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
431
                return nil, err
 
432
        }
 
433
        return ret, nil
 
434
        // {
 
435
        //   "description": "Get a particular task from a TaskQueue.",
 
436
        //   "httpMethod": "GET",
 
437
        //   "id": "taskqueue.tasks.get",
 
438
        //   "parameterOrder": [
 
439
        //     "project",
 
440
        //     "taskqueue",
 
441
        //     "task"
 
442
        //   ],
 
443
        //   "parameters": {
 
444
        //     "project": {
 
445
        //       "description": "The project under which the queue lies.",
 
446
        //       "location": "path",
 
447
        //       "required": true,
 
448
        //       "type": "string"
 
449
        //     },
 
450
        //     "task": {
 
451
        //       "description": "The task to get properties of.",
 
452
        //       "location": "path",
 
453
        //       "required": true,
 
454
        //       "type": "string"
 
455
        //     },
 
456
        //     "taskqueue": {
 
457
        //       "description": "The taskqueue in which the task belongs.",
 
458
        //       "location": "path",
 
459
        //       "required": true,
 
460
        //       "type": "string"
 
461
        //     }
 
462
        //   },
 
463
        //   "path": "{project}/taskqueues/{taskqueue}/tasks/{task}",
 
464
        //   "response": {
 
465
        //     "$ref": "Task"
 
466
        //   },
 
467
        //   "scopes": [
 
468
        //     "https://www.googleapis.com/auth/taskqueue",
 
469
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
470
        //   ]
 
471
        // }
 
472
 
 
473
}
 
474
 
 
475
// method id "taskqueue.tasks.insert":
 
476
 
 
477
type TasksInsertCall struct {
 
478
        s         *Service
 
479
        project   string
 
480
        taskqueue string
 
481
        task      *Task
 
482
        opt_      map[string]interface{}
 
483
}
 
484
 
 
485
// Insert: Insert a new task in a TaskQueue
 
486
func (r *TasksService) Insert(project string, taskqueue string, task *Task) *TasksInsertCall {
 
487
        c := &TasksInsertCall{s: r.s, opt_: make(map[string]interface{})}
 
488
        c.project = project
 
489
        c.taskqueue = taskqueue
 
490
        c.task = task
 
491
        return c
 
492
}
 
493
 
 
494
// Fields allows partial responses to be retrieved.
 
495
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
496
// for more information.
 
497
func (c *TasksInsertCall) Fields(s ...googleapi.Field) *TasksInsertCall {
 
498
        c.opt_["fields"] = googleapi.CombineFields(s)
 
499
        return c
 
500
}
 
501
 
 
502
func (c *TasksInsertCall) Do() (*Task, error) {
 
503
        var body io.Reader = nil
 
504
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
 
505
        if err != nil {
 
506
                return nil, err
 
507
        }
 
508
        ctype := "application/json"
 
509
        params := make(url.Values)
 
510
        params.Set("alt", "json")
 
511
        if v, ok := c.opt_["fields"]; ok {
 
512
                params.Set("fields", fmt.Sprintf("%v", v))
 
513
        }
 
514
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks")
 
515
        urls += "?" + params.Encode()
 
516
        req, _ := http.NewRequest("POST", urls, body)
 
517
        googleapi.Expand(req.URL, map[string]string{
 
518
                "project":   c.project,
 
519
                "taskqueue": c.taskqueue,
 
520
        })
 
521
        req.Header.Set("Content-Type", ctype)
 
522
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
523
        res, err := c.s.client.Do(req)
 
524
        if err != nil {
 
525
                return nil, err
 
526
        }
 
527
        defer googleapi.CloseBody(res)
 
528
        if err := googleapi.CheckResponse(res); err != nil {
 
529
                return nil, err
 
530
        }
 
531
        var ret *Task
 
532
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
533
                return nil, err
 
534
        }
 
535
        return ret, nil
 
536
        // {
 
537
        //   "description": "Insert a new task in a TaskQueue",
 
538
        //   "httpMethod": "POST",
 
539
        //   "id": "taskqueue.tasks.insert",
 
540
        //   "parameterOrder": [
 
541
        //     "project",
 
542
        //     "taskqueue"
 
543
        //   ],
 
544
        //   "parameters": {
 
545
        //     "project": {
 
546
        //       "description": "The project under which the queue lies",
 
547
        //       "location": "path",
 
548
        //       "required": true,
 
549
        //       "type": "string"
 
550
        //     },
 
551
        //     "taskqueue": {
 
552
        //       "description": "The taskqueue to insert the task into",
 
553
        //       "location": "path",
 
554
        //       "required": true,
 
555
        //       "type": "string"
 
556
        //     }
 
557
        //   },
 
558
        //   "path": "{project}/taskqueues/{taskqueue}/tasks",
 
559
        //   "request": {
 
560
        //     "$ref": "Task"
 
561
        //   },
 
562
        //   "response": {
 
563
        //     "$ref": "Task"
 
564
        //   },
 
565
        //   "scopes": [
 
566
        //     "https://www.googleapis.com/auth/taskqueue",
 
567
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
568
        //   ]
 
569
        // }
 
570
 
 
571
}
 
572
 
 
573
// method id "taskqueue.tasks.lease":
 
574
 
 
575
type TasksLeaseCall struct {
 
576
        s         *Service
 
577
        project   string
 
578
        taskqueue string
 
579
        numTasks  int64
 
580
        leaseSecs int64
 
581
        opt_      map[string]interface{}
 
582
}
 
583
 
 
584
// Lease: Lease 1 or more tasks from a TaskQueue.
 
585
func (r *TasksService) Lease(project string, taskqueue string, numTasks int64, leaseSecs int64) *TasksLeaseCall {
 
586
        c := &TasksLeaseCall{s: r.s, opt_: make(map[string]interface{})}
 
587
        c.project = project
 
588
        c.taskqueue = taskqueue
 
589
        c.numTasks = numTasks
 
590
        c.leaseSecs = leaseSecs
 
591
        return c
 
592
}
 
593
 
 
594
// GroupByTag sets the optional parameter "groupByTag": When true, all
 
595
// returned tasks will have the same tag
 
596
func (c *TasksLeaseCall) GroupByTag(groupByTag bool) *TasksLeaseCall {
 
597
        c.opt_["groupByTag"] = groupByTag
 
598
        return c
 
599
}
 
600
 
 
601
// Tag sets the optional parameter "tag": The tag allowed for tasks in
 
602
// the response. Must only be specified if group_by_tag is true. If
 
603
// group_by_tag is true and tag is not specified the tag will be that of
 
604
// the oldest task by eta, i.e. the first available tag
 
605
func (c *TasksLeaseCall) Tag(tag string) *TasksLeaseCall {
 
606
        c.opt_["tag"] = tag
 
607
        return c
 
608
}
 
609
 
 
610
// Fields allows partial responses to be retrieved.
 
611
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
612
// for more information.
 
613
func (c *TasksLeaseCall) Fields(s ...googleapi.Field) *TasksLeaseCall {
 
614
        c.opt_["fields"] = googleapi.CombineFields(s)
 
615
        return c
 
616
}
 
617
 
 
618
func (c *TasksLeaseCall) Do() (*Tasks, error) {
 
619
        var body io.Reader = nil
 
620
        params := make(url.Values)
 
621
        params.Set("alt", "json")
 
622
        params.Set("leaseSecs", fmt.Sprintf("%v", c.leaseSecs))
 
623
        params.Set("numTasks", fmt.Sprintf("%v", c.numTasks))
 
624
        if v, ok := c.opt_["groupByTag"]; ok {
 
625
                params.Set("groupByTag", fmt.Sprintf("%v", v))
 
626
        }
 
627
        if v, ok := c.opt_["tag"]; ok {
 
628
                params.Set("tag", fmt.Sprintf("%v", v))
 
629
        }
 
630
        if v, ok := c.opt_["fields"]; ok {
 
631
                params.Set("fields", fmt.Sprintf("%v", v))
 
632
        }
 
633
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks/lease")
 
634
        urls += "?" + params.Encode()
 
635
        req, _ := http.NewRequest("POST", urls, body)
 
636
        googleapi.Expand(req.URL, map[string]string{
 
637
                "project":   c.project,
 
638
                "taskqueue": c.taskqueue,
 
639
        })
 
640
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
641
        res, err := c.s.client.Do(req)
 
642
        if err != nil {
 
643
                return nil, err
 
644
        }
 
645
        defer googleapi.CloseBody(res)
 
646
        if err := googleapi.CheckResponse(res); err != nil {
 
647
                return nil, err
 
648
        }
 
649
        var ret *Tasks
 
650
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
651
                return nil, err
 
652
        }
 
653
        return ret, nil
 
654
        // {
 
655
        //   "description": "Lease 1 or more tasks from a TaskQueue.",
 
656
        //   "httpMethod": "POST",
 
657
        //   "id": "taskqueue.tasks.lease",
 
658
        //   "parameterOrder": [
 
659
        //     "project",
 
660
        //     "taskqueue",
 
661
        //     "numTasks",
 
662
        //     "leaseSecs"
 
663
        //   ],
 
664
        //   "parameters": {
 
665
        //     "groupByTag": {
 
666
        //       "description": "When true, all returned tasks will have the same tag",
 
667
        //       "location": "query",
 
668
        //       "type": "boolean"
 
669
        //     },
 
670
        //     "leaseSecs": {
 
671
        //       "description": "The lease in seconds.",
 
672
        //       "format": "int32",
 
673
        //       "location": "query",
 
674
        //       "required": true,
 
675
        //       "type": "integer"
 
676
        //     },
 
677
        //     "numTasks": {
 
678
        //       "description": "The number of tasks to lease.",
 
679
        //       "format": "int32",
 
680
        //       "location": "query",
 
681
        //       "required": true,
 
682
        //       "type": "integer"
 
683
        //     },
 
684
        //     "project": {
 
685
        //       "description": "The project under which the queue lies.",
 
686
        //       "location": "path",
 
687
        //       "required": true,
 
688
        //       "type": "string"
 
689
        //     },
 
690
        //     "tag": {
 
691
        //       "description": "The tag allowed for tasks in the response. Must only be specified if group_by_tag is true. If group_by_tag is true and tag is not specified the tag will be that of the oldest task by eta, i.e. the first available tag",
 
692
        //       "location": "query",
 
693
        //       "type": "string"
 
694
        //     },
 
695
        //     "taskqueue": {
 
696
        //       "description": "The taskqueue to lease a task from.",
 
697
        //       "location": "path",
 
698
        //       "required": true,
 
699
        //       "type": "string"
 
700
        //     }
 
701
        //   },
 
702
        //   "path": "{project}/taskqueues/{taskqueue}/tasks/lease",
 
703
        //   "response": {
 
704
        //     "$ref": "Tasks"
 
705
        //   },
 
706
        //   "scopes": [
 
707
        //     "https://www.googleapis.com/auth/taskqueue",
 
708
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
709
        //   ]
 
710
        // }
 
711
 
 
712
}
 
713
 
 
714
// method id "taskqueue.tasks.list":
 
715
 
 
716
type TasksListCall struct {
 
717
        s         *Service
 
718
        project   string
 
719
        taskqueue string
 
720
        opt_      map[string]interface{}
 
721
}
 
722
 
 
723
// List: List Tasks in a TaskQueue
 
724
func (r *TasksService) List(project string, taskqueue string) *TasksListCall {
 
725
        c := &TasksListCall{s: r.s, opt_: make(map[string]interface{})}
 
726
        c.project = project
 
727
        c.taskqueue = taskqueue
 
728
        return c
 
729
}
 
730
 
 
731
// Fields allows partial responses to be retrieved.
 
732
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
733
// for more information.
 
734
func (c *TasksListCall) Fields(s ...googleapi.Field) *TasksListCall {
 
735
        c.opt_["fields"] = googleapi.CombineFields(s)
 
736
        return c
 
737
}
 
738
 
 
739
func (c *TasksListCall) Do() (*Tasks2, error) {
 
740
        var body io.Reader = nil
 
741
        params := make(url.Values)
 
742
        params.Set("alt", "json")
 
743
        if v, ok := c.opt_["fields"]; ok {
 
744
                params.Set("fields", fmt.Sprintf("%v", v))
 
745
        }
 
746
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks")
 
747
        urls += "?" + params.Encode()
 
748
        req, _ := http.NewRequest("GET", urls, body)
 
749
        googleapi.Expand(req.URL, map[string]string{
 
750
                "project":   c.project,
 
751
                "taskqueue": c.taskqueue,
 
752
        })
 
753
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
754
        res, err := c.s.client.Do(req)
 
755
        if err != nil {
 
756
                return nil, err
 
757
        }
 
758
        defer googleapi.CloseBody(res)
 
759
        if err := googleapi.CheckResponse(res); err != nil {
 
760
                return nil, err
 
761
        }
 
762
        var ret *Tasks2
 
763
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
764
                return nil, err
 
765
        }
 
766
        return ret, nil
 
767
        // {
 
768
        //   "description": "List Tasks in a TaskQueue",
 
769
        //   "httpMethod": "GET",
 
770
        //   "id": "taskqueue.tasks.list",
 
771
        //   "parameterOrder": [
 
772
        //     "project",
 
773
        //     "taskqueue"
 
774
        //   ],
 
775
        //   "parameters": {
 
776
        //     "project": {
 
777
        //       "description": "The project under which the queue lies.",
 
778
        //       "location": "path",
 
779
        //       "required": true,
 
780
        //       "type": "string"
 
781
        //     },
 
782
        //     "taskqueue": {
 
783
        //       "description": "The id of the taskqueue to list tasks from.",
 
784
        //       "location": "path",
 
785
        //       "required": true,
 
786
        //       "type": "string"
 
787
        //     }
 
788
        //   },
 
789
        //   "path": "{project}/taskqueues/{taskqueue}/tasks",
 
790
        //   "response": {
 
791
        //     "$ref": "Tasks2"
 
792
        //   },
 
793
        //   "scopes": [
 
794
        //     "https://www.googleapis.com/auth/taskqueue",
 
795
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
796
        //   ]
 
797
        // }
 
798
 
 
799
}
 
800
 
 
801
// method id "taskqueue.tasks.patch":
 
802
 
 
803
type TasksPatchCall struct {
 
804
        s               *Service
 
805
        project         string
 
806
        taskqueue       string
 
807
        task            string
 
808
        newLeaseSeconds int64
 
809
        task2           *Task
 
810
        opt_            map[string]interface{}
 
811
}
 
812
 
 
813
// Patch: Update tasks that are leased out of a TaskQueue. This method
 
814
// supports patch semantics.
 
815
func (r *TasksService) Patch(project string, taskqueue string, task string, newLeaseSeconds int64, task2 *Task) *TasksPatchCall {
 
816
        c := &TasksPatchCall{s: r.s, opt_: make(map[string]interface{})}
 
817
        c.project = project
 
818
        c.taskqueue = taskqueue
 
819
        c.task = task
 
820
        c.newLeaseSeconds = newLeaseSeconds
 
821
        c.task2 = task2
 
822
        return c
 
823
}
 
824
 
 
825
// Fields allows partial responses to be retrieved.
 
826
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
827
// for more information.
 
828
func (c *TasksPatchCall) Fields(s ...googleapi.Field) *TasksPatchCall {
 
829
        c.opt_["fields"] = googleapi.CombineFields(s)
 
830
        return c
 
831
}
 
832
 
 
833
func (c *TasksPatchCall) Do() (*Task, error) {
 
834
        var body io.Reader = nil
 
835
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.task2)
 
836
        if err != nil {
 
837
                return nil, err
 
838
        }
 
839
        ctype := "application/json"
 
840
        params := make(url.Values)
 
841
        params.Set("alt", "json")
 
842
        params.Set("newLeaseSeconds", fmt.Sprintf("%v", c.newLeaseSeconds))
 
843
        if v, ok := c.opt_["fields"]; ok {
 
844
                params.Set("fields", fmt.Sprintf("%v", v))
 
845
        }
 
846
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks/{task}")
 
847
        urls += "?" + params.Encode()
 
848
        req, _ := http.NewRequest("PATCH", urls, body)
 
849
        googleapi.Expand(req.URL, map[string]string{
 
850
                "project":   c.project,
 
851
                "taskqueue": c.taskqueue,
 
852
                "task":      c.task,
 
853
        })
 
854
        req.Header.Set("Content-Type", ctype)
 
855
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
856
        res, err := c.s.client.Do(req)
 
857
        if err != nil {
 
858
                return nil, err
 
859
        }
 
860
        defer googleapi.CloseBody(res)
 
861
        if err := googleapi.CheckResponse(res); err != nil {
 
862
                return nil, err
 
863
        }
 
864
        var ret *Task
 
865
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
866
                return nil, err
 
867
        }
 
868
        return ret, nil
 
869
        // {
 
870
        //   "description": "Update tasks that are leased out of a TaskQueue. This method supports patch semantics.",
 
871
        //   "httpMethod": "PATCH",
 
872
        //   "id": "taskqueue.tasks.patch",
 
873
        //   "parameterOrder": [
 
874
        //     "project",
 
875
        //     "taskqueue",
 
876
        //     "task",
 
877
        //     "newLeaseSeconds"
 
878
        //   ],
 
879
        //   "parameters": {
 
880
        //     "newLeaseSeconds": {
 
881
        //       "description": "The new lease in seconds.",
 
882
        //       "format": "int32",
 
883
        //       "location": "query",
 
884
        //       "required": true,
 
885
        //       "type": "integer"
 
886
        //     },
 
887
        //     "project": {
 
888
        //       "description": "The project under which the queue lies.",
 
889
        //       "location": "path",
 
890
        //       "required": true,
 
891
        //       "type": "string"
 
892
        //     },
 
893
        //     "task": {
 
894
        //       "location": "path",
 
895
        //       "required": true,
 
896
        //       "type": "string"
 
897
        //     },
 
898
        //     "taskqueue": {
 
899
        //       "location": "path",
 
900
        //       "required": true,
 
901
        //       "type": "string"
 
902
        //     }
 
903
        //   },
 
904
        //   "path": "{project}/taskqueues/{taskqueue}/tasks/{task}",
 
905
        //   "request": {
 
906
        //     "$ref": "Task"
 
907
        //   },
 
908
        //   "response": {
 
909
        //     "$ref": "Task"
 
910
        //   },
 
911
        //   "scopes": [
 
912
        //     "https://www.googleapis.com/auth/taskqueue",
 
913
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
914
        //   ]
 
915
        // }
 
916
 
 
917
}
 
918
 
 
919
// method id "taskqueue.tasks.update":
 
920
 
 
921
type TasksUpdateCall struct {
 
922
        s               *Service
 
923
        project         string
 
924
        taskqueue       string
 
925
        task            string
 
926
        newLeaseSeconds int64
 
927
        task2           *Task
 
928
        opt_            map[string]interface{}
 
929
}
 
930
 
 
931
// Update: Update tasks that are leased out of a TaskQueue.
 
932
func (r *TasksService) Update(project string, taskqueue string, task string, newLeaseSeconds int64, task2 *Task) *TasksUpdateCall {
 
933
        c := &TasksUpdateCall{s: r.s, opt_: make(map[string]interface{})}
 
934
        c.project = project
 
935
        c.taskqueue = taskqueue
 
936
        c.task = task
 
937
        c.newLeaseSeconds = newLeaseSeconds
 
938
        c.task2 = task2
 
939
        return c
 
940
}
 
941
 
 
942
// Fields allows partial responses to be retrieved.
 
943
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
944
// for more information.
 
945
func (c *TasksUpdateCall) Fields(s ...googleapi.Field) *TasksUpdateCall {
 
946
        c.opt_["fields"] = googleapi.CombineFields(s)
 
947
        return c
 
948
}
 
949
 
 
950
func (c *TasksUpdateCall) Do() (*Task, error) {
 
951
        var body io.Reader = nil
 
952
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.task2)
 
953
        if err != nil {
 
954
                return nil, err
 
955
        }
 
956
        ctype := "application/json"
 
957
        params := make(url.Values)
 
958
        params.Set("alt", "json")
 
959
        params.Set("newLeaseSeconds", fmt.Sprintf("%v", c.newLeaseSeconds))
 
960
        if v, ok := c.opt_["fields"]; ok {
 
961
                params.Set("fields", fmt.Sprintf("%v", v))
 
962
        }
 
963
        urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks/{task}")
 
964
        urls += "?" + params.Encode()
 
965
        req, _ := http.NewRequest("POST", urls, body)
 
966
        googleapi.Expand(req.URL, map[string]string{
 
967
                "project":   c.project,
 
968
                "taskqueue": c.taskqueue,
 
969
                "task":      c.task,
 
970
        })
 
971
        req.Header.Set("Content-Type", ctype)
 
972
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
973
        res, err := c.s.client.Do(req)
 
974
        if err != nil {
 
975
                return nil, err
 
976
        }
 
977
        defer googleapi.CloseBody(res)
 
978
        if err := googleapi.CheckResponse(res); err != nil {
 
979
                return nil, err
 
980
        }
 
981
        var ret *Task
 
982
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
983
                return nil, err
 
984
        }
 
985
        return ret, nil
 
986
        // {
 
987
        //   "description": "Update tasks that are leased out of a TaskQueue.",
 
988
        //   "httpMethod": "POST",
 
989
        //   "id": "taskqueue.tasks.update",
 
990
        //   "parameterOrder": [
 
991
        //     "project",
 
992
        //     "taskqueue",
 
993
        //     "task",
 
994
        //     "newLeaseSeconds"
 
995
        //   ],
 
996
        //   "parameters": {
 
997
        //     "newLeaseSeconds": {
 
998
        //       "description": "The new lease in seconds.",
 
999
        //       "format": "int32",
 
1000
        //       "location": "query",
 
1001
        //       "required": true,
 
1002
        //       "type": "integer"
 
1003
        //     },
 
1004
        //     "project": {
 
1005
        //       "description": "The project under which the queue lies.",
 
1006
        //       "location": "path",
 
1007
        //       "required": true,
 
1008
        //       "type": "string"
 
1009
        //     },
 
1010
        //     "task": {
 
1011
        //       "location": "path",
 
1012
        //       "required": true,
 
1013
        //       "type": "string"
 
1014
        //     },
 
1015
        //     "taskqueue": {
 
1016
        //       "location": "path",
 
1017
        //       "required": true,
 
1018
        //       "type": "string"
 
1019
        //     }
 
1020
        //   },
 
1021
        //   "path": "{project}/taskqueues/{taskqueue}/tasks/{task}",
 
1022
        //   "request": {
 
1023
        //     "$ref": "Task"
 
1024
        //   },
 
1025
        //   "response": {
 
1026
        //     "$ref": "Task"
 
1027
        //   },
 
1028
        //   "scopes": [
 
1029
        //     "https://www.googleapis.com/auth/taskqueue",
 
1030
        //     "https://www.googleapis.com/auth/taskqueue.consumer"
 
1031
        //   ]
 
1032
        // }
 
1033
 
 
1034
}