~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/gmail/v1/gmail-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 gmail provides access to the Gmail API.
 
2
//
 
3
// See https://developers.google.com/gmail/api/
 
4
//
 
5
// Usage example:
 
6
//
 
7
//   import "google.golang.org/api/gmail/v1"
 
8
//   ...
 
9
//   gmailService, err := gmail.New(oauthHttpClient)
 
10
package gmail
 
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 = "gmail:v1"
 
38
const apiName = "gmail"
 
39
const apiVersion = "v1"
 
40
const basePath = "https://www.googleapis.com/gmail/v1/users/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // View and manage your mail
 
45
        MailGoogleComScope = "https://mail.google.com/"
 
46
 
 
47
        // Manage drafts and send emails
 
48
        GmailComposeScope = "https://www.googleapis.com/auth/gmail.compose"
 
49
 
 
50
        // View and modify but not delete your email
 
51
        GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify"
 
52
 
 
53
        // View your emails messages and settings
 
54
        GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.readonly"
 
55
)
 
56
 
 
57
func New(client *http.Client) (*Service, error) {
 
58
        if client == nil {
 
59
                return nil, errors.New("client is nil")
 
60
        }
 
61
        s := &Service{client: client, BasePath: basePath}
 
62
        s.Users = NewUsersService(s)
 
63
        return s, nil
 
64
}
 
65
 
 
66
type Service struct {
 
67
        client   *http.Client
 
68
        BasePath string // API endpoint base URL
 
69
 
 
70
        Users *UsersService
 
71
}
 
72
 
 
73
func NewUsersService(s *Service) *UsersService {
 
74
        rs := &UsersService{s: s}
 
75
        rs.Drafts = NewUsersDraftsService(s)
 
76
        rs.History = NewUsersHistoryService(s)
 
77
        rs.Labels = NewUsersLabelsService(s)
 
78
        rs.Messages = NewUsersMessagesService(s)
 
79
        rs.Threads = NewUsersThreadsService(s)
 
80
        return rs
 
81
}
 
82
 
 
83
type UsersService struct {
 
84
        s *Service
 
85
 
 
86
        Drafts *UsersDraftsService
 
87
 
 
88
        History *UsersHistoryService
 
89
 
 
90
        Labels *UsersLabelsService
 
91
 
 
92
        Messages *UsersMessagesService
 
93
 
 
94
        Threads *UsersThreadsService
 
95
}
 
96
 
 
97
func NewUsersDraftsService(s *Service) *UsersDraftsService {
 
98
        rs := &UsersDraftsService{s: s}
 
99
        return rs
 
100
}
 
101
 
 
102
type UsersDraftsService struct {
 
103
        s *Service
 
104
}
 
105
 
 
106
func NewUsersHistoryService(s *Service) *UsersHistoryService {
 
107
        rs := &UsersHistoryService{s: s}
 
108
        return rs
 
109
}
 
110
 
 
111
type UsersHistoryService struct {
 
112
        s *Service
 
113
}
 
114
 
 
115
func NewUsersLabelsService(s *Service) *UsersLabelsService {
 
116
        rs := &UsersLabelsService{s: s}
 
117
        return rs
 
118
}
 
119
 
 
120
type UsersLabelsService struct {
 
121
        s *Service
 
122
}
 
123
 
 
124
func NewUsersMessagesService(s *Service) *UsersMessagesService {
 
125
        rs := &UsersMessagesService{s: s}
 
126
        rs.Attachments = NewUsersMessagesAttachmentsService(s)
 
127
        return rs
 
128
}
 
129
 
 
130
type UsersMessagesService struct {
 
131
        s *Service
 
132
 
 
133
        Attachments *UsersMessagesAttachmentsService
 
134
}
 
135
 
 
136
func NewUsersMessagesAttachmentsService(s *Service) *UsersMessagesAttachmentsService {
 
137
        rs := &UsersMessagesAttachmentsService{s: s}
 
138
        return rs
 
139
}
 
140
 
 
141
type UsersMessagesAttachmentsService struct {
 
142
        s *Service
 
143
}
 
144
 
 
145
func NewUsersThreadsService(s *Service) *UsersThreadsService {
 
146
        rs := &UsersThreadsService{s: s}
 
147
        return rs
 
148
}
 
149
 
 
150
type UsersThreadsService struct {
 
151
        s *Service
 
152
}
 
153
 
 
154
type Draft struct {
 
155
        // Id: The immutable ID of the draft.
 
156
        Id string `json:"id,omitempty"`
 
157
 
 
158
        // Message: The message content of the draft.
 
159
        Message *Message `json:"message,omitempty"`
 
160
}
 
161
 
 
162
type History struct {
 
163
        // Id: The mailbox sequence ID.
 
164
        Id uint64 `json:"id,omitempty,string"`
 
165
 
 
166
        // Messages: The messages that changed in this history record.
 
167
        Messages []*Message `json:"messages,omitempty"`
 
168
}
 
169
 
 
170
type Label struct {
 
171
        // Id: The immutable ID of the label.
 
172
        Id string `json:"id,omitempty"`
 
173
 
 
174
        // LabelListVisibility: The visibility of the label in the label list in
 
175
        // the Gmail web interface.
 
176
        LabelListVisibility string `json:"labelListVisibility,omitempty"`
 
177
 
 
178
        // MessageListVisibility: The visibility of the label in the message
 
179
        // list in the Gmail web interface.
 
180
        MessageListVisibility string `json:"messageListVisibility,omitempty"`
 
181
 
 
182
        // MessagesTotal: The total number of messages with the label.
 
183
        MessagesTotal int64 `json:"messagesTotal,omitempty"`
 
184
 
 
185
        // MessagesUnread: The number of unread messages with the label.
 
186
        MessagesUnread int64 `json:"messagesUnread,omitempty"`
 
187
 
 
188
        // Name: The display name of the label.
 
189
        Name string `json:"name,omitempty"`
 
190
 
 
191
        // ThreadsTotal: The total number of threads with the label.
 
192
        ThreadsTotal int64 `json:"threadsTotal,omitempty"`
 
193
 
 
194
        // ThreadsUnread: The number of unread threads with the label.
 
195
        ThreadsUnread int64 `json:"threadsUnread,omitempty"`
 
196
 
 
197
        // Type: The owner type for the label. User labels are created by the
 
198
        // user and can be modified and deleted by the user and can be applied
 
199
        // to any message or thread. System labels are internally created and
 
200
        // cannot be added, modified, or deleted. System labels may be able to
 
201
        // be applied to or removed from messages and threads under some
 
202
        // circumstances but this is not guaranteed. For example, users can
 
203
        // apply and remove the INBOX and UNREAD labels from messages and
 
204
        // threads, but cannot apply or remove the DRAFTS or SENT labels from
 
205
        // messages or threads.
 
206
        Type string `json:"type,omitempty"`
 
207
}
 
208
 
 
209
type ListDraftsResponse struct {
 
210
        // Drafts: List of drafts.
 
211
        Drafts []*Draft `json:"drafts,omitempty"`
 
212
 
 
213
        // NextPageToken: Token to retrieve the next page of results in the
 
214
        // list.
 
215
        NextPageToken string `json:"nextPageToken,omitempty"`
 
216
 
 
217
        // ResultSizeEstimate: Estimated total number of results.
 
218
        ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
 
219
}
 
220
 
 
221
type ListHistoryResponse struct {
 
222
        // History: List of history records.
 
223
        History []*History `json:"history,omitempty"`
 
224
 
 
225
        // HistoryId: The ID of the mailbox's current history record.
 
226
        HistoryId uint64 `json:"historyId,omitempty,string"`
 
227
 
 
228
        // NextPageToken: Page token to retrieve the next page of results in the
 
229
        // list.
 
230
        NextPageToken string `json:"nextPageToken,omitempty"`
 
231
}
 
232
 
 
233
type ListLabelsResponse struct {
 
234
        // Labels: List of labels.
 
235
        Labels []*Label `json:"labels,omitempty"`
 
236
}
 
237
 
 
238
type ListMessagesResponse struct {
 
239
        // Messages: List of messages.
 
240
        Messages []*Message `json:"messages,omitempty"`
 
241
 
 
242
        // NextPageToken: Token to retrieve the next page of results in the
 
243
        // list.
 
244
        NextPageToken string `json:"nextPageToken,omitempty"`
 
245
 
 
246
        // ResultSizeEstimate: Estimated total number of results.
 
247
        ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
 
248
}
 
249
 
 
250
type ListThreadsResponse struct {
 
251
        // NextPageToken: Page token to retrieve the next page of results in the
 
252
        // list.
 
253
        NextPageToken string `json:"nextPageToken,omitempty"`
 
254
 
 
255
        // ResultSizeEstimate: Estimated total number of results.
 
256
        ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
 
257
 
 
258
        // Threads: List of threads.
 
259
        Threads []*Thread `json:"threads,omitempty"`
 
260
}
 
261
 
 
262
type Message struct {
 
263
        // HistoryId: The ID of the last history record that modified this
 
264
        // message.
 
265
        HistoryId uint64 `json:"historyId,omitempty,string"`
 
266
 
 
267
        // Id: The immutable ID of the message.
 
268
        Id string `json:"id,omitempty"`
 
269
 
 
270
        // LabelIds: List of IDs of labels applied to this message.
 
271
        LabelIds []string `json:"labelIds,omitempty"`
 
272
 
 
273
        // Payload: The parsed email structure in the message parts.
 
274
        Payload *MessagePart `json:"payload,omitempty"`
 
275
 
 
276
        // Raw: The entire email message in an RFC 2822 formatted and URL-safe
 
277
        // base64 encoded string. Returned in messages.get and drafts.get
 
278
        // responses when the format=RAW parameter is supplied.
 
279
        Raw string `json:"raw,omitempty"`
 
280
 
 
281
        // SizeEstimate: Estimated size in bytes of the message.
 
282
        SizeEstimate int64 `json:"sizeEstimate,omitempty"`
 
283
 
 
284
        // Snippet: A short part of the message text.
 
285
        Snippet string `json:"snippet,omitempty"`
 
286
 
 
287
        // ThreadId: The ID of the thread the message belongs to. To add a
 
288
        // message or draft to a thread, the following criteria must be met:
 
289
        // -
 
290
        // The requested threadId must be specified on the Message or
 
291
        // Draft.Message you supply with your request.
 
292
        // - The References and
 
293
        // In-Reply-To headers must be set in compliance with the RFC 2822
 
294
        // standard.
 
295
        // - The Subject headers must match.
 
296
        ThreadId string `json:"threadId,omitempty"`
 
297
}
 
298
 
 
299
type MessagePart struct {
 
300
        // Body: The message part body for this part, which may be empty for
 
301
        // container MIME message parts.
 
302
        Body *MessagePartBody `json:"body,omitempty"`
 
303
 
 
304
        // Filename: The filename of the attachment. Only present if this
 
305
        // message part represents an attachment.
 
306
        Filename string `json:"filename,omitempty"`
 
307
 
 
308
        // Headers: List of headers on this message part. For the top-level
 
309
        // message part, representing the entire message payload, it will
 
310
        // contain the standard RFC 2822 email headers such as To, From, and
 
311
        // Subject.
 
312
        Headers []*MessagePartHeader `json:"headers,omitempty"`
 
313
 
 
314
        // MimeType: The MIME type of the message part.
 
315
        MimeType string `json:"mimeType,omitempty"`
 
316
 
 
317
        // PartId: The immutable ID of the message part.
 
318
        PartId string `json:"partId,omitempty"`
 
319
 
 
320
        // Parts: The child MIME message parts of this part. This only applies
 
321
        // to container MIME message parts, for example multipart/*. For non-
 
322
        // container MIME message part types, such as text/plain, this field is
 
323
        // empty. For more information, see RFC 1521.
 
324
        Parts []*MessagePart `json:"parts,omitempty"`
 
325
}
 
326
 
 
327
type MessagePartBody struct {
 
328
        // AttachmentId: When present, contains the ID of an external attachment
 
329
        // that can be retrieved in a separate messages.attachments.get request.
 
330
        // When not present, the entire content of the message part body is
 
331
        // contained in the data field.
 
332
        AttachmentId string `json:"attachmentId,omitempty"`
 
333
 
 
334
        // Data: The body data of a MIME message part. May be empty for MIME
 
335
        // container types that have no message body or when the body data is
 
336
        // sent as a separate attachment. An attachment ID is present if the
 
337
        // body data is contained in a separate attachment.
 
338
        Data string `json:"data,omitempty"`
 
339
 
 
340
        // Size: Total number of bytes in the body of the message part.
 
341
        Size int64 `json:"size,omitempty"`
 
342
}
 
343
 
 
344
type MessagePartHeader struct {
 
345
        // Name: The name of the header before the : separator. For example, To.
 
346
        Name string `json:"name,omitempty"`
 
347
 
 
348
        // Value: The value of the header after the : separator. For example,
 
349
        // someuser@example.com.
 
350
        Value string `json:"value,omitempty"`
 
351
}
 
352
 
 
353
type ModifyMessageRequest struct {
 
354
        // AddLabelIds: A list of IDs of labels to add to this message.
 
355
        AddLabelIds []string `json:"addLabelIds,omitempty"`
 
356
 
 
357
        // RemoveLabelIds: A list IDs of labels to remove from this message.
 
358
        RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
 
359
}
 
360
 
 
361
type ModifyThreadRequest struct {
 
362
        // AddLabelIds: A list of IDs of labels to add to this thread.
 
363
        AddLabelIds []string `json:"addLabelIds,omitempty"`
 
364
 
 
365
        // RemoveLabelIds: A list of IDs of labels to remove from this thread.
 
366
        RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
 
367
}
 
368
 
 
369
type Profile struct {
 
370
        // EmailAddress: The user's email address.
 
371
        EmailAddress string `json:"emailAddress,omitempty"`
 
372
 
 
373
        // HistoryId: The ID of the mailbox's current history record.
 
374
        HistoryId uint64 `json:"historyId,omitempty,string"`
 
375
 
 
376
        // MessagesTotal: The total number of messages in the mailbox.
 
377
        MessagesTotal int64 `json:"messagesTotal,omitempty"`
 
378
 
 
379
        // ThreadsTotal: The total number of threads in the mailbox.
 
380
        ThreadsTotal int64 `json:"threadsTotal,omitempty"`
 
381
}
 
382
 
 
383
type Thread struct {
 
384
        // HistoryId: The ID of the last history record that modified this
 
385
        // thread.
 
386
        HistoryId uint64 `json:"historyId,omitempty,string"`
 
387
 
 
388
        // Id: The unique ID of the thread.
 
389
        Id string `json:"id,omitempty"`
 
390
 
 
391
        // Messages: The list of messages in the thread.
 
392
        Messages []*Message `json:"messages,omitempty"`
 
393
 
 
394
        // Snippet: A short part of the message text.
 
395
        Snippet string `json:"snippet,omitempty"`
 
396
}
 
397
 
 
398
// method id "gmail.users.getProfile":
 
399
 
 
400
type UsersGetProfileCall struct {
 
401
        s      *Service
 
402
        userId string
 
403
        opt_   map[string]interface{}
 
404
}
 
405
 
 
406
// GetProfile: Gets the current user's Gmail profile.
 
407
func (r *UsersService) GetProfile(userId string) *UsersGetProfileCall {
 
408
        c := &UsersGetProfileCall{s: r.s, opt_: make(map[string]interface{})}
 
409
        c.userId = userId
 
410
        return c
 
411
}
 
412
 
 
413
// Fields allows partial responses to be retrieved.
 
414
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
415
// for more information.
 
416
func (c *UsersGetProfileCall) Fields(s ...googleapi.Field) *UsersGetProfileCall {
 
417
        c.opt_["fields"] = googleapi.CombineFields(s)
 
418
        return c
 
419
}
 
420
 
 
421
func (c *UsersGetProfileCall) Do() (*Profile, error) {
 
422
        var body io.Reader = nil
 
423
        params := make(url.Values)
 
424
        params.Set("alt", "json")
 
425
        if v, ok := c.opt_["fields"]; ok {
 
426
                params.Set("fields", fmt.Sprintf("%v", v))
 
427
        }
 
428
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/profile")
 
429
        urls += "?" + params.Encode()
 
430
        req, _ := http.NewRequest("GET", urls, body)
 
431
        googleapi.Expand(req.URL, map[string]string{
 
432
                "userId": c.userId,
 
433
        })
 
434
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
435
        res, err := c.s.client.Do(req)
 
436
        if err != nil {
 
437
                return nil, err
 
438
        }
 
439
        defer googleapi.CloseBody(res)
 
440
        if err := googleapi.CheckResponse(res); err != nil {
 
441
                return nil, err
 
442
        }
 
443
        var ret *Profile
 
444
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
445
                return nil, err
 
446
        }
 
447
        return ret, nil
 
448
        // {
 
449
        //   "description": "Gets the current user's Gmail profile.",
 
450
        //   "httpMethod": "GET",
 
451
        //   "id": "gmail.users.getProfile",
 
452
        //   "parameterOrder": [
 
453
        //     "userId"
 
454
        //   ],
 
455
        //   "parameters": {
 
456
        //     "userId": {
 
457
        //       "default": "me",
 
458
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
459
        //       "location": "path",
 
460
        //       "required": true,
 
461
        //       "type": "string"
 
462
        //     }
 
463
        //   },
 
464
        //   "path": "{userId}/profile",
 
465
        //   "response": {
 
466
        //     "$ref": "Profile"
 
467
        //   },
 
468
        //   "scopes": [
 
469
        //     "https://mail.google.com/",
 
470
        //     "https://www.googleapis.com/auth/gmail.compose",
 
471
        //     "https://www.googleapis.com/auth/gmail.modify",
 
472
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
473
        //   ]
 
474
        // }
 
475
 
 
476
}
 
477
 
 
478
// method id "gmail.users.drafts.create":
 
479
 
 
480
type UsersDraftsCreateCall struct {
 
481
        s      *Service
 
482
        userId string
 
483
        draft  *Draft
 
484
        opt_   map[string]interface{}
 
485
        media_ io.Reader
 
486
}
 
487
 
 
488
// Create: Creates a new draft with the DRAFT label.
 
489
func (r *UsersDraftsService) Create(userId string, draft *Draft) *UsersDraftsCreateCall {
 
490
        c := &UsersDraftsCreateCall{s: r.s, opt_: make(map[string]interface{})}
 
491
        c.userId = userId
 
492
        c.draft = draft
 
493
        return c
 
494
}
 
495
func (c *UsersDraftsCreateCall) Media(r io.Reader) *UsersDraftsCreateCall {
 
496
        c.media_ = r
 
497
        return c
 
498
}
 
499
 
 
500
// Fields allows partial responses to be retrieved.
 
501
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
502
// for more information.
 
503
func (c *UsersDraftsCreateCall) Fields(s ...googleapi.Field) *UsersDraftsCreateCall {
 
504
        c.opt_["fields"] = googleapi.CombineFields(s)
 
505
        return c
 
506
}
 
507
 
 
508
func (c *UsersDraftsCreateCall) Do() (*Draft, error) {
 
509
        var body io.Reader = nil
 
510
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
 
511
        if err != nil {
 
512
                return nil, err
 
513
        }
 
514
        ctype := "application/json"
 
515
        params := make(url.Values)
 
516
        params.Set("alt", "json")
 
517
        if v, ok := c.opt_["fields"]; ok {
 
518
                params.Set("fields", fmt.Sprintf("%v", v))
 
519
        }
 
520
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts")
 
521
        if c.media_ != nil {
 
522
                urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
 
523
                params.Set("uploadType", "multipart")
 
524
        }
 
525
        urls += "?" + params.Encode()
 
526
        contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
 
527
        req, _ := http.NewRequest("POST", urls, body)
 
528
        googleapi.Expand(req.URL, map[string]string{
 
529
                "userId": c.userId,
 
530
        })
 
531
        if hasMedia_ {
 
532
                req.ContentLength = contentLength_
 
533
        }
 
534
        req.Header.Set("Content-Type", ctype)
 
535
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
536
        res, err := c.s.client.Do(req)
 
537
        if err != nil {
 
538
                return nil, err
 
539
        }
 
540
        defer googleapi.CloseBody(res)
 
541
        if err := googleapi.CheckResponse(res); err != nil {
 
542
                return nil, err
 
543
        }
 
544
        var ret *Draft
 
545
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
546
                return nil, err
 
547
        }
 
548
        return ret, nil
 
549
        // {
 
550
        //   "description": "Creates a new draft with the DRAFT label.",
 
551
        //   "httpMethod": "POST",
 
552
        //   "id": "gmail.users.drafts.create",
 
553
        //   "mediaUpload": {
 
554
        //     "accept": [
 
555
        //       "message/rfc822"
 
556
        //     ],
 
557
        //     "maxSize": "35MB",
 
558
        //     "protocols": {
 
559
        //       "resumable": {
 
560
        //         "multipart": true,
 
561
        //         "path": "/resumable/upload/gmail/v1/users/{userId}/drafts"
 
562
        //       },
 
563
        //       "simple": {
 
564
        //         "multipart": true,
 
565
        //         "path": "/upload/gmail/v1/users/{userId}/drafts"
 
566
        //       }
 
567
        //     }
 
568
        //   },
 
569
        //   "parameterOrder": [
 
570
        //     "userId"
 
571
        //   ],
 
572
        //   "parameters": {
 
573
        //     "userId": {
 
574
        //       "default": "me",
 
575
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
576
        //       "location": "path",
 
577
        //       "required": true,
 
578
        //       "type": "string"
 
579
        //     }
 
580
        //   },
 
581
        //   "path": "{userId}/drafts",
 
582
        //   "request": {
 
583
        //     "$ref": "Draft"
 
584
        //   },
 
585
        //   "response": {
 
586
        //     "$ref": "Draft"
 
587
        //   },
 
588
        //   "scopes": [
 
589
        //     "https://mail.google.com/",
 
590
        //     "https://www.googleapis.com/auth/gmail.compose",
 
591
        //     "https://www.googleapis.com/auth/gmail.modify"
 
592
        //   ],
 
593
        //   "supportsMediaUpload": true
 
594
        // }
 
595
 
 
596
}
 
597
 
 
598
// method id "gmail.users.drafts.delete":
 
599
 
 
600
type UsersDraftsDeleteCall struct {
 
601
        s      *Service
 
602
        userId string
 
603
        id     string
 
604
        opt_   map[string]interface{}
 
605
}
 
606
 
 
607
// Delete: Immediately and permanently deletes the specified draft. Does
 
608
// not simply trash it.
 
609
func (r *UsersDraftsService) Delete(userId string, id string) *UsersDraftsDeleteCall {
 
610
        c := &UsersDraftsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
 
611
        c.userId = userId
 
612
        c.id = id
 
613
        return c
 
614
}
 
615
 
 
616
// Fields allows partial responses to be retrieved.
 
617
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
618
// for more information.
 
619
func (c *UsersDraftsDeleteCall) Fields(s ...googleapi.Field) *UsersDraftsDeleteCall {
 
620
        c.opt_["fields"] = googleapi.CombineFields(s)
 
621
        return c
 
622
}
 
623
 
 
624
func (c *UsersDraftsDeleteCall) Do() error {
 
625
        var body io.Reader = nil
 
626
        params := make(url.Values)
 
627
        params.Set("alt", "json")
 
628
        if v, ok := c.opt_["fields"]; ok {
 
629
                params.Set("fields", fmt.Sprintf("%v", v))
 
630
        }
 
631
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}")
 
632
        urls += "?" + params.Encode()
 
633
        req, _ := http.NewRequest("DELETE", urls, body)
 
634
        googleapi.Expand(req.URL, map[string]string{
 
635
                "userId": c.userId,
 
636
                "id":     c.id,
 
637
        })
 
638
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
639
        res, err := c.s.client.Do(req)
 
640
        if err != nil {
 
641
                return err
 
642
        }
 
643
        defer googleapi.CloseBody(res)
 
644
        if err := googleapi.CheckResponse(res); err != nil {
 
645
                return err
 
646
        }
 
647
        return nil
 
648
        // {
 
649
        //   "description": "Immediately and permanently deletes the specified draft. Does not simply trash it.",
 
650
        //   "httpMethod": "DELETE",
 
651
        //   "id": "gmail.users.drafts.delete",
 
652
        //   "parameterOrder": [
 
653
        //     "userId",
 
654
        //     "id"
 
655
        //   ],
 
656
        //   "parameters": {
 
657
        //     "id": {
 
658
        //       "description": "The ID of the draft to delete.",
 
659
        //       "location": "path",
 
660
        //       "required": true,
 
661
        //       "type": "string"
 
662
        //     },
 
663
        //     "userId": {
 
664
        //       "default": "me",
 
665
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
666
        //       "location": "path",
 
667
        //       "required": true,
 
668
        //       "type": "string"
 
669
        //     }
 
670
        //   },
 
671
        //   "path": "{userId}/drafts/{id}",
 
672
        //   "scopes": [
 
673
        //     "https://mail.google.com/",
 
674
        //     "https://www.googleapis.com/auth/gmail.compose",
 
675
        //     "https://www.googleapis.com/auth/gmail.modify"
 
676
        //   ]
 
677
        // }
 
678
 
 
679
}
 
680
 
 
681
// method id "gmail.users.drafts.get":
 
682
 
 
683
type UsersDraftsGetCall struct {
 
684
        s      *Service
 
685
        userId string
 
686
        id     string
 
687
        opt_   map[string]interface{}
 
688
}
 
689
 
 
690
// Get: Gets the specified draft.
 
691
func (r *UsersDraftsService) Get(userId string, id string) *UsersDraftsGetCall {
 
692
        c := &UsersDraftsGetCall{s: r.s, opt_: make(map[string]interface{})}
 
693
        c.userId = userId
 
694
        c.id = id
 
695
        return c
 
696
}
 
697
 
 
698
// Format sets the optional parameter "format": The format to return the
 
699
// draft in.
 
700
func (c *UsersDraftsGetCall) Format(format string) *UsersDraftsGetCall {
 
701
        c.opt_["format"] = format
 
702
        return c
 
703
}
 
704
 
 
705
// Fields allows partial responses to be retrieved.
 
706
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
707
// for more information.
 
708
func (c *UsersDraftsGetCall) Fields(s ...googleapi.Field) *UsersDraftsGetCall {
 
709
        c.opt_["fields"] = googleapi.CombineFields(s)
 
710
        return c
 
711
}
 
712
 
 
713
func (c *UsersDraftsGetCall) Do() (*Draft, error) {
 
714
        var body io.Reader = nil
 
715
        params := make(url.Values)
 
716
        params.Set("alt", "json")
 
717
        if v, ok := c.opt_["format"]; ok {
 
718
                params.Set("format", fmt.Sprintf("%v", v))
 
719
        }
 
720
        if v, ok := c.opt_["fields"]; ok {
 
721
                params.Set("fields", fmt.Sprintf("%v", v))
 
722
        }
 
723
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}")
 
724
        urls += "?" + params.Encode()
 
725
        req, _ := http.NewRequest("GET", urls, body)
 
726
        googleapi.Expand(req.URL, map[string]string{
 
727
                "userId": c.userId,
 
728
                "id":     c.id,
 
729
        })
 
730
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
731
        res, err := c.s.client.Do(req)
 
732
        if err != nil {
 
733
                return nil, err
 
734
        }
 
735
        defer googleapi.CloseBody(res)
 
736
        if err := googleapi.CheckResponse(res); err != nil {
 
737
                return nil, err
 
738
        }
 
739
        var ret *Draft
 
740
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
741
                return nil, err
 
742
        }
 
743
        return ret, nil
 
744
        // {
 
745
        //   "description": "Gets the specified draft.",
 
746
        //   "httpMethod": "GET",
 
747
        //   "id": "gmail.users.drafts.get",
 
748
        //   "parameterOrder": [
 
749
        //     "userId",
 
750
        //     "id"
 
751
        //   ],
 
752
        //   "parameters": {
 
753
        //     "format": {
 
754
        //       "default": "full",
 
755
        //       "description": "The format to return the draft in.",
 
756
        //       "enum": [
 
757
        //         "full",
 
758
        //         "metadata",
 
759
        //         "minimal",
 
760
        //         "raw"
 
761
        //       ],
 
762
        //       "enumDescriptions": [
 
763
        //         "",
 
764
        //         "",
 
765
        //         "",
 
766
        //         ""
 
767
        //       ],
 
768
        //       "location": "query",
 
769
        //       "type": "string"
 
770
        //     },
 
771
        //     "id": {
 
772
        //       "description": "The ID of the draft to retrieve.",
 
773
        //       "location": "path",
 
774
        //       "required": true,
 
775
        //       "type": "string"
 
776
        //     },
 
777
        //     "userId": {
 
778
        //       "default": "me",
 
779
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
780
        //       "location": "path",
 
781
        //       "required": true,
 
782
        //       "type": "string"
 
783
        //     }
 
784
        //   },
 
785
        //   "path": "{userId}/drafts/{id}",
 
786
        //   "response": {
 
787
        //     "$ref": "Draft"
 
788
        //   },
 
789
        //   "scopes": [
 
790
        //     "https://mail.google.com/",
 
791
        //     "https://www.googleapis.com/auth/gmail.compose",
 
792
        //     "https://www.googleapis.com/auth/gmail.modify",
 
793
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
794
        //   ]
 
795
        // }
 
796
 
 
797
}
 
798
 
 
799
// method id "gmail.users.drafts.list":
 
800
 
 
801
type UsersDraftsListCall struct {
 
802
        s      *Service
 
803
        userId string
 
804
        opt_   map[string]interface{}
 
805
}
 
806
 
 
807
// List: Lists the drafts in the user's mailbox.
 
808
func (r *UsersDraftsService) List(userId string) *UsersDraftsListCall {
 
809
        c := &UsersDraftsListCall{s: r.s, opt_: make(map[string]interface{})}
 
810
        c.userId = userId
 
811
        return c
 
812
}
 
813
 
 
814
// MaxResults sets the optional parameter "maxResults": Maximum number
 
815
// of drafts to return.
 
816
func (c *UsersDraftsListCall) MaxResults(maxResults int64) *UsersDraftsListCall {
 
817
        c.opt_["maxResults"] = maxResults
 
818
        return c
 
819
}
 
820
 
 
821
// PageToken sets the optional parameter "pageToken": Page token to
 
822
// retrieve a specific page of results in the list.
 
823
func (c *UsersDraftsListCall) PageToken(pageToken string) *UsersDraftsListCall {
 
824
        c.opt_["pageToken"] = pageToken
 
825
        return c
 
826
}
 
827
 
 
828
// Fields allows partial responses to be retrieved.
 
829
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
830
// for more information.
 
831
func (c *UsersDraftsListCall) Fields(s ...googleapi.Field) *UsersDraftsListCall {
 
832
        c.opt_["fields"] = googleapi.CombineFields(s)
 
833
        return c
 
834
}
 
835
 
 
836
func (c *UsersDraftsListCall) Do() (*ListDraftsResponse, error) {
 
837
        var body io.Reader = nil
 
838
        params := make(url.Values)
 
839
        params.Set("alt", "json")
 
840
        if v, ok := c.opt_["maxResults"]; ok {
 
841
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
842
        }
 
843
        if v, ok := c.opt_["pageToken"]; ok {
 
844
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
845
        }
 
846
        if v, ok := c.opt_["fields"]; ok {
 
847
                params.Set("fields", fmt.Sprintf("%v", v))
 
848
        }
 
849
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts")
 
850
        urls += "?" + params.Encode()
 
851
        req, _ := http.NewRequest("GET", urls, body)
 
852
        googleapi.Expand(req.URL, map[string]string{
 
853
                "userId": c.userId,
 
854
        })
 
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 *ListDraftsResponse
 
865
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
866
                return nil, err
 
867
        }
 
868
        return ret, nil
 
869
        // {
 
870
        //   "description": "Lists the drafts in the user's mailbox.",
 
871
        //   "httpMethod": "GET",
 
872
        //   "id": "gmail.users.drafts.list",
 
873
        //   "parameterOrder": [
 
874
        //     "userId"
 
875
        //   ],
 
876
        //   "parameters": {
 
877
        //     "maxResults": {
 
878
        //       "default": "100",
 
879
        //       "description": "Maximum number of drafts to return.",
 
880
        //       "format": "uint32",
 
881
        //       "location": "query",
 
882
        //       "type": "integer"
 
883
        //     },
 
884
        //     "pageToken": {
 
885
        //       "description": "Page token to retrieve a specific page of results in the list.",
 
886
        //       "location": "query",
 
887
        //       "type": "string"
 
888
        //     },
 
889
        //     "userId": {
 
890
        //       "default": "me",
 
891
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
892
        //       "location": "path",
 
893
        //       "required": true,
 
894
        //       "type": "string"
 
895
        //     }
 
896
        //   },
 
897
        //   "path": "{userId}/drafts",
 
898
        //   "response": {
 
899
        //     "$ref": "ListDraftsResponse"
 
900
        //   },
 
901
        //   "scopes": [
 
902
        //     "https://mail.google.com/",
 
903
        //     "https://www.googleapis.com/auth/gmail.compose",
 
904
        //     "https://www.googleapis.com/auth/gmail.modify",
 
905
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
906
        //   ]
 
907
        // }
 
908
 
 
909
}
 
910
 
 
911
// method id "gmail.users.drafts.send":
 
912
 
 
913
type UsersDraftsSendCall struct {
 
914
        s      *Service
 
915
        userId string
 
916
        draft  *Draft
 
917
        opt_   map[string]interface{}
 
918
        media_ io.Reader
 
919
}
 
920
 
 
921
// Send: Sends the specified, existing draft to the recipients in the
 
922
// To, Cc, and Bcc headers.
 
923
func (r *UsersDraftsService) Send(userId string, draft *Draft) *UsersDraftsSendCall {
 
924
        c := &UsersDraftsSendCall{s: r.s, opt_: make(map[string]interface{})}
 
925
        c.userId = userId
 
926
        c.draft = draft
 
927
        return c
 
928
}
 
929
func (c *UsersDraftsSendCall) Media(r io.Reader) *UsersDraftsSendCall {
 
930
        c.media_ = r
 
931
        return c
 
932
}
 
933
 
 
934
// Fields allows partial responses to be retrieved.
 
935
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
936
// for more information.
 
937
func (c *UsersDraftsSendCall) Fields(s ...googleapi.Field) *UsersDraftsSendCall {
 
938
        c.opt_["fields"] = googleapi.CombineFields(s)
 
939
        return c
 
940
}
 
941
 
 
942
func (c *UsersDraftsSendCall) Do() (*Message, error) {
 
943
        var body io.Reader = nil
 
944
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
 
945
        if err != nil {
 
946
                return nil, err
 
947
        }
 
948
        ctype := "application/json"
 
949
        params := make(url.Values)
 
950
        params.Set("alt", "json")
 
951
        if v, ok := c.opt_["fields"]; ok {
 
952
                params.Set("fields", fmt.Sprintf("%v", v))
 
953
        }
 
954
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/send")
 
955
        if c.media_ != nil {
 
956
                urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
 
957
                params.Set("uploadType", "multipart")
 
958
        }
 
959
        urls += "?" + params.Encode()
 
960
        contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
 
961
        req, _ := http.NewRequest("POST", urls, body)
 
962
        googleapi.Expand(req.URL, map[string]string{
 
963
                "userId": c.userId,
 
964
        })
 
965
        if hasMedia_ {
 
966
                req.ContentLength = contentLength_
 
967
        }
 
968
        req.Header.Set("Content-Type", ctype)
 
969
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
970
        res, err := c.s.client.Do(req)
 
971
        if err != nil {
 
972
                return nil, err
 
973
        }
 
974
        defer googleapi.CloseBody(res)
 
975
        if err := googleapi.CheckResponse(res); err != nil {
 
976
                return nil, err
 
977
        }
 
978
        var ret *Message
 
979
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
980
                return nil, err
 
981
        }
 
982
        return ret, nil
 
983
        // {
 
984
        //   "description": "Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.",
 
985
        //   "httpMethod": "POST",
 
986
        //   "id": "gmail.users.drafts.send",
 
987
        //   "mediaUpload": {
 
988
        //     "accept": [
 
989
        //       "message/rfc822"
 
990
        //     ],
 
991
        //     "maxSize": "35MB",
 
992
        //     "protocols": {
 
993
        //       "resumable": {
 
994
        //         "multipart": true,
 
995
        //         "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/send"
 
996
        //       },
 
997
        //       "simple": {
 
998
        //         "multipart": true,
 
999
        //         "path": "/upload/gmail/v1/users/{userId}/drafts/send"
 
1000
        //       }
 
1001
        //     }
 
1002
        //   },
 
1003
        //   "parameterOrder": [
 
1004
        //     "userId"
 
1005
        //   ],
 
1006
        //   "parameters": {
 
1007
        //     "userId": {
 
1008
        //       "default": "me",
 
1009
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1010
        //       "location": "path",
 
1011
        //       "required": true,
 
1012
        //       "type": "string"
 
1013
        //     }
 
1014
        //   },
 
1015
        //   "path": "{userId}/drafts/send",
 
1016
        //   "request": {
 
1017
        //     "$ref": "Draft"
 
1018
        //   },
 
1019
        //   "response": {
 
1020
        //     "$ref": "Message"
 
1021
        //   },
 
1022
        //   "scopes": [
 
1023
        //     "https://mail.google.com/",
 
1024
        //     "https://www.googleapis.com/auth/gmail.compose",
 
1025
        //     "https://www.googleapis.com/auth/gmail.modify"
 
1026
        //   ],
 
1027
        //   "supportsMediaUpload": true
 
1028
        // }
 
1029
 
 
1030
}
 
1031
 
 
1032
// method id "gmail.users.drafts.update":
 
1033
 
 
1034
type UsersDraftsUpdateCall struct {
 
1035
        s      *Service
 
1036
        userId string
 
1037
        id     string
 
1038
        draft  *Draft
 
1039
        opt_   map[string]interface{}
 
1040
        media_ io.Reader
 
1041
}
 
1042
 
 
1043
// Update: Replaces a draft's content.
 
1044
func (r *UsersDraftsService) Update(userId string, id string, draft *Draft) *UsersDraftsUpdateCall {
 
1045
        c := &UsersDraftsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
 
1046
        c.userId = userId
 
1047
        c.id = id
 
1048
        c.draft = draft
 
1049
        return c
 
1050
}
 
1051
func (c *UsersDraftsUpdateCall) Media(r io.Reader) *UsersDraftsUpdateCall {
 
1052
        c.media_ = r
 
1053
        return c
 
1054
}
 
1055
 
 
1056
// Fields allows partial responses to be retrieved.
 
1057
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1058
// for more information.
 
1059
func (c *UsersDraftsUpdateCall) Fields(s ...googleapi.Field) *UsersDraftsUpdateCall {
 
1060
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1061
        return c
 
1062
}
 
1063
 
 
1064
func (c *UsersDraftsUpdateCall) Do() (*Draft, error) {
 
1065
        var body io.Reader = nil
 
1066
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
 
1067
        if err != nil {
 
1068
                return nil, err
 
1069
        }
 
1070
        ctype := "application/json"
 
1071
        params := make(url.Values)
 
1072
        params.Set("alt", "json")
 
1073
        if v, ok := c.opt_["fields"]; ok {
 
1074
                params.Set("fields", fmt.Sprintf("%v", v))
 
1075
        }
 
1076
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}")
 
1077
        if c.media_ != nil {
 
1078
                urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
 
1079
                params.Set("uploadType", "multipart")
 
1080
        }
 
1081
        urls += "?" + params.Encode()
 
1082
        contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
 
1083
        req, _ := http.NewRequest("PUT", urls, body)
 
1084
        googleapi.Expand(req.URL, map[string]string{
 
1085
                "userId": c.userId,
 
1086
                "id":     c.id,
 
1087
        })
 
1088
        if hasMedia_ {
 
1089
                req.ContentLength = contentLength_
 
1090
        }
 
1091
        req.Header.Set("Content-Type", ctype)
 
1092
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1093
        res, err := c.s.client.Do(req)
 
1094
        if err != nil {
 
1095
                return nil, err
 
1096
        }
 
1097
        defer googleapi.CloseBody(res)
 
1098
        if err := googleapi.CheckResponse(res); err != nil {
 
1099
                return nil, err
 
1100
        }
 
1101
        var ret *Draft
 
1102
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1103
                return nil, err
 
1104
        }
 
1105
        return ret, nil
 
1106
        // {
 
1107
        //   "description": "Replaces a draft's content.",
 
1108
        //   "httpMethod": "PUT",
 
1109
        //   "id": "gmail.users.drafts.update",
 
1110
        //   "mediaUpload": {
 
1111
        //     "accept": [
 
1112
        //       "message/rfc822"
 
1113
        //     ],
 
1114
        //     "maxSize": "35MB",
 
1115
        //     "protocols": {
 
1116
        //       "resumable": {
 
1117
        //         "multipart": true,
 
1118
        //         "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/{id}"
 
1119
        //       },
 
1120
        //       "simple": {
 
1121
        //         "multipart": true,
 
1122
        //         "path": "/upload/gmail/v1/users/{userId}/drafts/{id}"
 
1123
        //       }
 
1124
        //     }
 
1125
        //   },
 
1126
        //   "parameterOrder": [
 
1127
        //     "userId",
 
1128
        //     "id"
 
1129
        //   ],
 
1130
        //   "parameters": {
 
1131
        //     "id": {
 
1132
        //       "description": "The ID of the draft to update.",
 
1133
        //       "location": "path",
 
1134
        //       "required": true,
 
1135
        //       "type": "string"
 
1136
        //     },
 
1137
        //     "userId": {
 
1138
        //       "default": "me",
 
1139
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1140
        //       "location": "path",
 
1141
        //       "required": true,
 
1142
        //       "type": "string"
 
1143
        //     }
 
1144
        //   },
 
1145
        //   "path": "{userId}/drafts/{id}",
 
1146
        //   "request": {
 
1147
        //     "$ref": "Draft"
 
1148
        //   },
 
1149
        //   "response": {
 
1150
        //     "$ref": "Draft"
 
1151
        //   },
 
1152
        //   "scopes": [
 
1153
        //     "https://mail.google.com/",
 
1154
        //     "https://www.googleapis.com/auth/gmail.compose",
 
1155
        //     "https://www.googleapis.com/auth/gmail.modify"
 
1156
        //   ],
 
1157
        //   "supportsMediaUpload": true
 
1158
        // }
 
1159
 
 
1160
}
 
1161
 
 
1162
// method id "gmail.users.history.list":
 
1163
 
 
1164
type UsersHistoryListCall struct {
 
1165
        s      *Service
 
1166
        userId string
 
1167
        opt_   map[string]interface{}
 
1168
}
 
1169
 
 
1170
// List: Lists the history of all changes to the given mailbox. History
 
1171
// results are returned in chronological order (increasing historyId).
 
1172
func (r *UsersHistoryService) List(userId string) *UsersHistoryListCall {
 
1173
        c := &UsersHistoryListCall{s: r.s, opt_: make(map[string]interface{})}
 
1174
        c.userId = userId
 
1175
        return c
 
1176
}
 
1177
 
 
1178
// LabelId sets the optional parameter "labelId": Only return messages
 
1179
// with a label matching the ID.
 
1180
func (c *UsersHistoryListCall) LabelId(labelId string) *UsersHistoryListCall {
 
1181
        c.opt_["labelId"] = labelId
 
1182
        return c
 
1183
}
 
1184
 
 
1185
// MaxResults sets the optional parameter "maxResults": The maximum
 
1186
// number of history records to return.
 
1187
func (c *UsersHistoryListCall) MaxResults(maxResults int64) *UsersHistoryListCall {
 
1188
        c.opt_["maxResults"] = maxResults
 
1189
        return c
 
1190
}
 
1191
 
 
1192
// PageToken sets the optional parameter "pageToken": Page token to
 
1193
// retrieve a specific page of results in the list.
 
1194
func (c *UsersHistoryListCall) PageToken(pageToken string) *UsersHistoryListCall {
 
1195
        c.opt_["pageToken"] = pageToken
 
1196
        return c
 
1197
}
 
1198
 
 
1199
// StartHistoryId sets the optional parameter "startHistoryId":
 
1200
// Required. Returns history records after the specified startHistoryId.
 
1201
// The supplied startHistoryId should be obtained from the historyId of
 
1202
// a message, thread, or previous list response. History IDs increase
 
1203
// chronologically but are not contiguous with random gaps in between
 
1204
// valid IDs. Supplying an invalid or out of date startHistoryId
 
1205
// typically returns an HTTP 404 error code. A historyId is typically
 
1206
// valid for at least a week, but in some circumstances may be valid for
 
1207
// only a few hours. If you receive an HTTP 404 error response, your
 
1208
// application should perform a full sync. If you receive no
 
1209
// nextPageToken in the response, there are no updates to retrieve and
 
1210
// you can store the returned historyId for a future request.
 
1211
func (c *UsersHistoryListCall) StartHistoryId(startHistoryId uint64) *UsersHistoryListCall {
 
1212
        c.opt_["startHistoryId"] = startHistoryId
 
1213
        return c
 
1214
}
 
1215
 
 
1216
// Fields allows partial responses to be retrieved.
 
1217
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1218
// for more information.
 
1219
func (c *UsersHistoryListCall) Fields(s ...googleapi.Field) *UsersHistoryListCall {
 
1220
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1221
        return c
 
1222
}
 
1223
 
 
1224
func (c *UsersHistoryListCall) Do() (*ListHistoryResponse, error) {
 
1225
        var body io.Reader = nil
 
1226
        params := make(url.Values)
 
1227
        params.Set("alt", "json")
 
1228
        if v, ok := c.opt_["labelId"]; ok {
 
1229
                params.Set("labelId", fmt.Sprintf("%v", v))
 
1230
        }
 
1231
        if v, ok := c.opt_["maxResults"]; ok {
 
1232
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
1233
        }
 
1234
        if v, ok := c.opt_["pageToken"]; ok {
 
1235
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
1236
        }
 
1237
        if v, ok := c.opt_["startHistoryId"]; ok {
 
1238
                params.Set("startHistoryId", fmt.Sprintf("%v", v))
 
1239
        }
 
1240
        if v, ok := c.opt_["fields"]; ok {
 
1241
                params.Set("fields", fmt.Sprintf("%v", v))
 
1242
        }
 
1243
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/history")
 
1244
        urls += "?" + params.Encode()
 
1245
        req, _ := http.NewRequest("GET", urls, body)
 
1246
        googleapi.Expand(req.URL, map[string]string{
 
1247
                "userId": c.userId,
 
1248
        })
 
1249
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1250
        res, err := c.s.client.Do(req)
 
1251
        if err != nil {
 
1252
                return nil, err
 
1253
        }
 
1254
        defer googleapi.CloseBody(res)
 
1255
        if err := googleapi.CheckResponse(res); err != nil {
 
1256
                return nil, err
 
1257
        }
 
1258
        var ret *ListHistoryResponse
 
1259
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1260
                return nil, err
 
1261
        }
 
1262
        return ret, nil
 
1263
        // {
 
1264
        //   "description": "Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).",
 
1265
        //   "httpMethod": "GET",
 
1266
        //   "id": "gmail.users.history.list",
 
1267
        //   "parameterOrder": [
 
1268
        //     "userId"
 
1269
        //   ],
 
1270
        //   "parameters": {
 
1271
        //     "labelId": {
 
1272
        //       "description": "Only return messages with a label matching the ID.",
 
1273
        //       "location": "query",
 
1274
        //       "type": "string"
 
1275
        //     },
 
1276
        //     "maxResults": {
 
1277
        //       "default": "100",
 
1278
        //       "description": "The maximum number of history records to return.",
 
1279
        //       "format": "uint32",
 
1280
        //       "location": "query",
 
1281
        //       "type": "integer"
 
1282
        //     },
 
1283
        //     "pageToken": {
 
1284
        //       "description": "Page token to retrieve a specific page of results in the list.",
 
1285
        //       "location": "query",
 
1286
        //       "type": "string"
 
1287
        //     },
 
1288
        //     "startHistoryId": {
 
1289
        //       "description": "Required. Returns history records after the specified startHistoryId. The supplied startHistoryId should be obtained from the historyId of a message, thread, or previous list response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date startHistoryId typically returns an HTTP 404 error code. A historyId is typically valid for at least a week, but in some circumstances may be valid for only a few hours. If you receive an HTTP 404 error response, your application should perform a full sync. If you receive no nextPageToken in the response, there are no updates to retrieve and you can store the returned historyId for a future request.",
 
1290
        //       "format": "uint64",
 
1291
        //       "location": "query",
 
1292
        //       "type": "string"
 
1293
        //     },
 
1294
        //     "userId": {
 
1295
        //       "default": "me",
 
1296
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1297
        //       "location": "path",
 
1298
        //       "required": true,
 
1299
        //       "type": "string"
 
1300
        //     }
 
1301
        //   },
 
1302
        //   "path": "{userId}/history",
 
1303
        //   "response": {
 
1304
        //     "$ref": "ListHistoryResponse"
 
1305
        //   },
 
1306
        //   "scopes": [
 
1307
        //     "https://mail.google.com/",
 
1308
        //     "https://www.googleapis.com/auth/gmail.modify",
 
1309
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
1310
        //   ]
 
1311
        // }
 
1312
 
 
1313
}
 
1314
 
 
1315
// method id "gmail.users.labels.create":
 
1316
 
 
1317
type UsersLabelsCreateCall struct {
 
1318
        s      *Service
 
1319
        userId string
 
1320
        label  *Label
 
1321
        opt_   map[string]interface{}
 
1322
}
 
1323
 
 
1324
// Create: Creates a new label.
 
1325
func (r *UsersLabelsService) Create(userId string, label *Label) *UsersLabelsCreateCall {
 
1326
        c := &UsersLabelsCreateCall{s: r.s, opt_: make(map[string]interface{})}
 
1327
        c.userId = userId
 
1328
        c.label = label
 
1329
        return c
 
1330
}
 
1331
 
 
1332
// Fields allows partial responses to be retrieved.
 
1333
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1334
// for more information.
 
1335
func (c *UsersLabelsCreateCall) Fields(s ...googleapi.Field) *UsersLabelsCreateCall {
 
1336
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1337
        return c
 
1338
}
 
1339
 
 
1340
func (c *UsersLabelsCreateCall) Do() (*Label, error) {
 
1341
        var body io.Reader = nil
 
1342
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
 
1343
        if err != nil {
 
1344
                return nil, err
 
1345
        }
 
1346
        ctype := "application/json"
 
1347
        params := make(url.Values)
 
1348
        params.Set("alt", "json")
 
1349
        if v, ok := c.opt_["fields"]; ok {
 
1350
                params.Set("fields", fmt.Sprintf("%v", v))
 
1351
        }
 
1352
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels")
 
1353
        urls += "?" + params.Encode()
 
1354
        req, _ := http.NewRequest("POST", urls, body)
 
1355
        googleapi.Expand(req.URL, map[string]string{
 
1356
                "userId": c.userId,
 
1357
        })
 
1358
        req.Header.Set("Content-Type", ctype)
 
1359
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1360
        res, err := c.s.client.Do(req)
 
1361
        if err != nil {
 
1362
                return nil, err
 
1363
        }
 
1364
        defer googleapi.CloseBody(res)
 
1365
        if err := googleapi.CheckResponse(res); err != nil {
 
1366
                return nil, err
 
1367
        }
 
1368
        var ret *Label
 
1369
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1370
                return nil, err
 
1371
        }
 
1372
        return ret, nil
 
1373
        // {
 
1374
        //   "description": "Creates a new label.",
 
1375
        //   "httpMethod": "POST",
 
1376
        //   "id": "gmail.users.labels.create",
 
1377
        //   "parameterOrder": [
 
1378
        //     "userId"
 
1379
        //   ],
 
1380
        //   "parameters": {
 
1381
        //     "userId": {
 
1382
        //       "default": "me",
 
1383
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1384
        //       "location": "path",
 
1385
        //       "required": true,
 
1386
        //       "type": "string"
 
1387
        //     }
 
1388
        //   },
 
1389
        //   "path": "{userId}/labels",
 
1390
        //   "request": {
 
1391
        //     "$ref": "Label"
 
1392
        //   },
 
1393
        //   "response": {
 
1394
        //     "$ref": "Label"
 
1395
        //   },
 
1396
        //   "scopes": [
 
1397
        //     "https://mail.google.com/",
 
1398
        //     "https://www.googleapis.com/auth/gmail.modify"
 
1399
        //   ]
 
1400
        // }
 
1401
 
 
1402
}
 
1403
 
 
1404
// method id "gmail.users.labels.delete":
 
1405
 
 
1406
type UsersLabelsDeleteCall struct {
 
1407
        s      *Service
 
1408
        userId string
 
1409
        id     string
 
1410
        opt_   map[string]interface{}
 
1411
}
 
1412
 
 
1413
// Delete: Immediately and permanently deletes the specified label and
 
1414
// removes it from any messages and threads that it is applied to.
 
1415
func (r *UsersLabelsService) Delete(userId string, id string) *UsersLabelsDeleteCall {
 
1416
        c := &UsersLabelsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
 
1417
        c.userId = userId
 
1418
        c.id = id
 
1419
        return c
 
1420
}
 
1421
 
 
1422
// Fields allows partial responses to be retrieved.
 
1423
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1424
// for more information.
 
1425
func (c *UsersLabelsDeleteCall) Fields(s ...googleapi.Field) *UsersLabelsDeleteCall {
 
1426
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1427
        return c
 
1428
}
 
1429
 
 
1430
func (c *UsersLabelsDeleteCall) Do() error {
 
1431
        var body io.Reader = nil
 
1432
        params := make(url.Values)
 
1433
        params.Set("alt", "json")
 
1434
        if v, ok := c.opt_["fields"]; ok {
 
1435
                params.Set("fields", fmt.Sprintf("%v", v))
 
1436
        }
 
1437
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
 
1438
        urls += "?" + params.Encode()
 
1439
        req, _ := http.NewRequest("DELETE", urls, body)
 
1440
        googleapi.Expand(req.URL, map[string]string{
 
1441
                "userId": c.userId,
 
1442
                "id":     c.id,
 
1443
        })
 
1444
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1445
        res, err := c.s.client.Do(req)
 
1446
        if err != nil {
 
1447
                return err
 
1448
        }
 
1449
        defer googleapi.CloseBody(res)
 
1450
        if err := googleapi.CheckResponse(res); err != nil {
 
1451
                return err
 
1452
        }
 
1453
        return nil
 
1454
        // {
 
1455
        //   "description": "Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.",
 
1456
        //   "httpMethod": "DELETE",
 
1457
        //   "id": "gmail.users.labels.delete",
 
1458
        //   "parameterOrder": [
 
1459
        //     "userId",
 
1460
        //     "id"
 
1461
        //   ],
 
1462
        //   "parameters": {
 
1463
        //     "id": {
 
1464
        //       "description": "The ID of the label to delete.",
 
1465
        //       "location": "path",
 
1466
        //       "required": true,
 
1467
        //       "type": "string"
 
1468
        //     },
 
1469
        //     "userId": {
 
1470
        //       "default": "me",
 
1471
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1472
        //       "location": "path",
 
1473
        //       "required": true,
 
1474
        //       "type": "string"
 
1475
        //     }
 
1476
        //   },
 
1477
        //   "path": "{userId}/labels/{id}",
 
1478
        //   "scopes": [
 
1479
        //     "https://mail.google.com/",
 
1480
        //     "https://www.googleapis.com/auth/gmail.modify"
 
1481
        //   ]
 
1482
        // }
 
1483
 
 
1484
}
 
1485
 
 
1486
// method id "gmail.users.labels.get":
 
1487
 
 
1488
type UsersLabelsGetCall struct {
 
1489
        s      *Service
 
1490
        userId string
 
1491
        id     string
 
1492
        opt_   map[string]interface{}
 
1493
}
 
1494
 
 
1495
// Get: Gets the specified label.
 
1496
func (r *UsersLabelsService) Get(userId string, id string) *UsersLabelsGetCall {
 
1497
        c := &UsersLabelsGetCall{s: r.s, opt_: make(map[string]interface{})}
 
1498
        c.userId = userId
 
1499
        c.id = id
 
1500
        return c
 
1501
}
 
1502
 
 
1503
// Fields allows partial responses to be retrieved.
 
1504
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1505
// for more information.
 
1506
func (c *UsersLabelsGetCall) Fields(s ...googleapi.Field) *UsersLabelsGetCall {
 
1507
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1508
        return c
 
1509
}
 
1510
 
 
1511
func (c *UsersLabelsGetCall) Do() (*Label, error) {
 
1512
        var body io.Reader = nil
 
1513
        params := make(url.Values)
 
1514
        params.Set("alt", "json")
 
1515
        if v, ok := c.opt_["fields"]; ok {
 
1516
                params.Set("fields", fmt.Sprintf("%v", v))
 
1517
        }
 
1518
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
 
1519
        urls += "?" + params.Encode()
 
1520
        req, _ := http.NewRequest("GET", urls, body)
 
1521
        googleapi.Expand(req.URL, map[string]string{
 
1522
                "userId": c.userId,
 
1523
                "id":     c.id,
 
1524
        })
 
1525
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1526
        res, err := c.s.client.Do(req)
 
1527
        if err != nil {
 
1528
                return nil, err
 
1529
        }
 
1530
        defer googleapi.CloseBody(res)
 
1531
        if err := googleapi.CheckResponse(res); err != nil {
 
1532
                return nil, err
 
1533
        }
 
1534
        var ret *Label
 
1535
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1536
                return nil, err
 
1537
        }
 
1538
        return ret, nil
 
1539
        // {
 
1540
        //   "description": "Gets the specified label.",
 
1541
        //   "httpMethod": "GET",
 
1542
        //   "id": "gmail.users.labels.get",
 
1543
        //   "parameterOrder": [
 
1544
        //     "userId",
 
1545
        //     "id"
 
1546
        //   ],
 
1547
        //   "parameters": {
 
1548
        //     "id": {
 
1549
        //       "description": "The ID of the label to retrieve.",
 
1550
        //       "location": "path",
 
1551
        //       "required": true,
 
1552
        //       "type": "string"
 
1553
        //     },
 
1554
        //     "userId": {
 
1555
        //       "default": "me",
 
1556
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1557
        //       "location": "path",
 
1558
        //       "required": true,
 
1559
        //       "type": "string"
 
1560
        //     }
 
1561
        //   },
 
1562
        //   "path": "{userId}/labels/{id}",
 
1563
        //   "response": {
 
1564
        //     "$ref": "Label"
 
1565
        //   },
 
1566
        //   "scopes": [
 
1567
        //     "https://mail.google.com/",
 
1568
        //     "https://www.googleapis.com/auth/gmail.modify",
 
1569
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
1570
        //   ]
 
1571
        // }
 
1572
 
 
1573
}
 
1574
 
 
1575
// method id "gmail.users.labels.list":
 
1576
 
 
1577
type UsersLabelsListCall struct {
 
1578
        s      *Service
 
1579
        userId string
 
1580
        opt_   map[string]interface{}
 
1581
}
 
1582
 
 
1583
// List: Lists all labels in the user's mailbox.
 
1584
func (r *UsersLabelsService) List(userId string) *UsersLabelsListCall {
 
1585
        c := &UsersLabelsListCall{s: r.s, opt_: make(map[string]interface{})}
 
1586
        c.userId = userId
 
1587
        return c
 
1588
}
 
1589
 
 
1590
// Fields allows partial responses to be retrieved.
 
1591
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1592
// for more information.
 
1593
func (c *UsersLabelsListCall) Fields(s ...googleapi.Field) *UsersLabelsListCall {
 
1594
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1595
        return c
 
1596
}
 
1597
 
 
1598
func (c *UsersLabelsListCall) Do() (*ListLabelsResponse, error) {
 
1599
        var body io.Reader = nil
 
1600
        params := make(url.Values)
 
1601
        params.Set("alt", "json")
 
1602
        if v, ok := c.opt_["fields"]; ok {
 
1603
                params.Set("fields", fmt.Sprintf("%v", v))
 
1604
        }
 
1605
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels")
 
1606
        urls += "?" + params.Encode()
 
1607
        req, _ := http.NewRequest("GET", urls, body)
 
1608
        googleapi.Expand(req.URL, map[string]string{
 
1609
                "userId": c.userId,
 
1610
        })
 
1611
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1612
        res, err := c.s.client.Do(req)
 
1613
        if err != nil {
 
1614
                return nil, err
 
1615
        }
 
1616
        defer googleapi.CloseBody(res)
 
1617
        if err := googleapi.CheckResponse(res); err != nil {
 
1618
                return nil, err
 
1619
        }
 
1620
        var ret *ListLabelsResponse
 
1621
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1622
                return nil, err
 
1623
        }
 
1624
        return ret, nil
 
1625
        // {
 
1626
        //   "description": "Lists all labels in the user's mailbox.",
 
1627
        //   "httpMethod": "GET",
 
1628
        //   "id": "gmail.users.labels.list",
 
1629
        //   "parameterOrder": [
 
1630
        //     "userId"
 
1631
        //   ],
 
1632
        //   "parameters": {
 
1633
        //     "userId": {
 
1634
        //       "default": "me",
 
1635
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1636
        //       "location": "path",
 
1637
        //       "required": true,
 
1638
        //       "type": "string"
 
1639
        //     }
 
1640
        //   },
 
1641
        //   "path": "{userId}/labels",
 
1642
        //   "response": {
 
1643
        //     "$ref": "ListLabelsResponse"
 
1644
        //   },
 
1645
        //   "scopes": [
 
1646
        //     "https://mail.google.com/",
 
1647
        //     "https://www.googleapis.com/auth/gmail.modify",
 
1648
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
1649
        //   ]
 
1650
        // }
 
1651
 
 
1652
}
 
1653
 
 
1654
// method id "gmail.users.labels.patch":
 
1655
 
 
1656
type UsersLabelsPatchCall struct {
 
1657
        s      *Service
 
1658
        userId string
 
1659
        id     string
 
1660
        label  *Label
 
1661
        opt_   map[string]interface{}
 
1662
}
 
1663
 
 
1664
// Patch: Updates the specified label. This method supports patch
 
1665
// semantics.
 
1666
func (r *UsersLabelsService) Patch(userId string, id string, label *Label) *UsersLabelsPatchCall {
 
1667
        c := &UsersLabelsPatchCall{s: r.s, opt_: make(map[string]interface{})}
 
1668
        c.userId = userId
 
1669
        c.id = id
 
1670
        c.label = label
 
1671
        return c
 
1672
}
 
1673
 
 
1674
// Fields allows partial responses to be retrieved.
 
1675
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1676
// for more information.
 
1677
func (c *UsersLabelsPatchCall) Fields(s ...googleapi.Field) *UsersLabelsPatchCall {
 
1678
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1679
        return c
 
1680
}
 
1681
 
 
1682
func (c *UsersLabelsPatchCall) Do() (*Label, error) {
 
1683
        var body io.Reader = nil
 
1684
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
 
1685
        if err != nil {
 
1686
                return nil, err
 
1687
        }
 
1688
        ctype := "application/json"
 
1689
        params := make(url.Values)
 
1690
        params.Set("alt", "json")
 
1691
        if v, ok := c.opt_["fields"]; ok {
 
1692
                params.Set("fields", fmt.Sprintf("%v", v))
 
1693
        }
 
1694
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
 
1695
        urls += "?" + params.Encode()
 
1696
        req, _ := http.NewRequest("PATCH", urls, body)
 
1697
        googleapi.Expand(req.URL, map[string]string{
 
1698
                "userId": c.userId,
 
1699
                "id":     c.id,
 
1700
        })
 
1701
        req.Header.Set("Content-Type", ctype)
 
1702
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1703
        res, err := c.s.client.Do(req)
 
1704
        if err != nil {
 
1705
                return nil, err
 
1706
        }
 
1707
        defer googleapi.CloseBody(res)
 
1708
        if err := googleapi.CheckResponse(res); err != nil {
 
1709
                return nil, err
 
1710
        }
 
1711
        var ret *Label
 
1712
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1713
                return nil, err
 
1714
        }
 
1715
        return ret, nil
 
1716
        // {
 
1717
        //   "description": "Updates the specified label. This method supports patch semantics.",
 
1718
        //   "httpMethod": "PATCH",
 
1719
        //   "id": "gmail.users.labels.patch",
 
1720
        //   "parameterOrder": [
 
1721
        //     "userId",
 
1722
        //     "id"
 
1723
        //   ],
 
1724
        //   "parameters": {
 
1725
        //     "id": {
 
1726
        //       "description": "The ID of the label to update.",
 
1727
        //       "location": "path",
 
1728
        //       "required": true,
 
1729
        //       "type": "string"
 
1730
        //     },
 
1731
        //     "userId": {
 
1732
        //       "default": "me",
 
1733
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1734
        //       "location": "path",
 
1735
        //       "required": true,
 
1736
        //       "type": "string"
 
1737
        //     }
 
1738
        //   },
 
1739
        //   "path": "{userId}/labels/{id}",
 
1740
        //   "request": {
 
1741
        //     "$ref": "Label"
 
1742
        //   },
 
1743
        //   "response": {
 
1744
        //     "$ref": "Label"
 
1745
        //   },
 
1746
        //   "scopes": [
 
1747
        //     "https://mail.google.com/",
 
1748
        //     "https://www.googleapis.com/auth/gmail.modify"
 
1749
        //   ]
 
1750
        // }
 
1751
 
 
1752
}
 
1753
 
 
1754
// method id "gmail.users.labels.update":
 
1755
 
 
1756
type UsersLabelsUpdateCall struct {
 
1757
        s      *Service
 
1758
        userId string
 
1759
        id     string
 
1760
        label  *Label
 
1761
        opt_   map[string]interface{}
 
1762
}
 
1763
 
 
1764
// Update: Updates the specified label.
 
1765
func (r *UsersLabelsService) Update(userId string, id string, label *Label) *UsersLabelsUpdateCall {
 
1766
        c := &UsersLabelsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
 
1767
        c.userId = userId
 
1768
        c.id = id
 
1769
        c.label = label
 
1770
        return c
 
1771
}
 
1772
 
 
1773
// Fields allows partial responses to be retrieved.
 
1774
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1775
// for more information.
 
1776
func (c *UsersLabelsUpdateCall) Fields(s ...googleapi.Field) *UsersLabelsUpdateCall {
 
1777
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1778
        return c
 
1779
}
 
1780
 
 
1781
func (c *UsersLabelsUpdateCall) Do() (*Label, error) {
 
1782
        var body io.Reader = nil
 
1783
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
 
1784
        if err != nil {
 
1785
                return nil, err
 
1786
        }
 
1787
        ctype := "application/json"
 
1788
        params := make(url.Values)
 
1789
        params.Set("alt", "json")
 
1790
        if v, ok := c.opt_["fields"]; ok {
 
1791
                params.Set("fields", fmt.Sprintf("%v", v))
 
1792
        }
 
1793
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
 
1794
        urls += "?" + params.Encode()
 
1795
        req, _ := http.NewRequest("PUT", urls, body)
 
1796
        googleapi.Expand(req.URL, map[string]string{
 
1797
                "userId": c.userId,
 
1798
                "id":     c.id,
 
1799
        })
 
1800
        req.Header.Set("Content-Type", ctype)
 
1801
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1802
        res, err := c.s.client.Do(req)
 
1803
        if err != nil {
 
1804
                return nil, err
 
1805
        }
 
1806
        defer googleapi.CloseBody(res)
 
1807
        if err := googleapi.CheckResponse(res); err != nil {
 
1808
                return nil, err
 
1809
        }
 
1810
        var ret *Label
 
1811
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
1812
                return nil, err
 
1813
        }
 
1814
        return ret, nil
 
1815
        // {
 
1816
        //   "description": "Updates the specified label.",
 
1817
        //   "httpMethod": "PUT",
 
1818
        //   "id": "gmail.users.labels.update",
 
1819
        //   "parameterOrder": [
 
1820
        //     "userId",
 
1821
        //     "id"
 
1822
        //   ],
 
1823
        //   "parameters": {
 
1824
        //     "id": {
 
1825
        //       "description": "The ID of the label to update.",
 
1826
        //       "location": "path",
 
1827
        //       "required": true,
 
1828
        //       "type": "string"
 
1829
        //     },
 
1830
        //     "userId": {
 
1831
        //       "default": "me",
 
1832
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1833
        //       "location": "path",
 
1834
        //       "required": true,
 
1835
        //       "type": "string"
 
1836
        //     }
 
1837
        //   },
 
1838
        //   "path": "{userId}/labels/{id}",
 
1839
        //   "request": {
 
1840
        //     "$ref": "Label"
 
1841
        //   },
 
1842
        //   "response": {
 
1843
        //     "$ref": "Label"
 
1844
        //   },
 
1845
        //   "scopes": [
 
1846
        //     "https://mail.google.com/",
 
1847
        //     "https://www.googleapis.com/auth/gmail.modify"
 
1848
        //   ]
 
1849
        // }
 
1850
 
 
1851
}
 
1852
 
 
1853
// method id "gmail.users.messages.delete":
 
1854
 
 
1855
type UsersMessagesDeleteCall struct {
 
1856
        s      *Service
 
1857
        userId string
 
1858
        id     string
 
1859
        opt_   map[string]interface{}
 
1860
}
 
1861
 
 
1862
// Delete: Immediately and permanently deletes the specified message.
 
1863
// This operation cannot be undone. Prefer messages.trash instead.
 
1864
func (r *UsersMessagesService) Delete(userId string, id string) *UsersMessagesDeleteCall {
 
1865
        c := &UsersMessagesDeleteCall{s: r.s, opt_: make(map[string]interface{})}
 
1866
        c.userId = userId
 
1867
        c.id = id
 
1868
        return c
 
1869
}
 
1870
 
 
1871
// Fields allows partial responses to be retrieved.
 
1872
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1873
// for more information.
 
1874
func (c *UsersMessagesDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesDeleteCall {
 
1875
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1876
        return c
 
1877
}
 
1878
 
 
1879
func (c *UsersMessagesDeleteCall) Do() error {
 
1880
        var body io.Reader = nil
 
1881
        params := make(url.Values)
 
1882
        params.Set("alt", "json")
 
1883
        if v, ok := c.opt_["fields"]; ok {
 
1884
                params.Set("fields", fmt.Sprintf("%v", v))
 
1885
        }
 
1886
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}")
 
1887
        urls += "?" + params.Encode()
 
1888
        req, _ := http.NewRequest("DELETE", urls, body)
 
1889
        googleapi.Expand(req.URL, map[string]string{
 
1890
                "userId": c.userId,
 
1891
                "id":     c.id,
 
1892
        })
 
1893
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1894
        res, err := c.s.client.Do(req)
 
1895
        if err != nil {
 
1896
                return err
 
1897
        }
 
1898
        defer googleapi.CloseBody(res)
 
1899
        if err := googleapi.CheckResponse(res); err != nil {
 
1900
                return err
 
1901
        }
 
1902
        return nil
 
1903
        // {
 
1904
        //   "description": "Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.",
 
1905
        //   "httpMethod": "DELETE",
 
1906
        //   "id": "gmail.users.messages.delete",
 
1907
        //   "parameterOrder": [
 
1908
        //     "userId",
 
1909
        //     "id"
 
1910
        //   ],
 
1911
        //   "parameters": {
 
1912
        //     "id": {
 
1913
        //       "description": "The ID of the message to delete.",
 
1914
        //       "location": "path",
 
1915
        //       "required": true,
 
1916
        //       "type": "string"
 
1917
        //     },
 
1918
        //     "userId": {
 
1919
        //       "default": "me",
 
1920
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
1921
        //       "location": "path",
 
1922
        //       "required": true,
 
1923
        //       "type": "string"
 
1924
        //     }
 
1925
        //   },
 
1926
        //   "path": "{userId}/messages/{id}",
 
1927
        //   "scopes": [
 
1928
        //     "https://mail.google.com/"
 
1929
        //   ]
 
1930
        // }
 
1931
 
 
1932
}
 
1933
 
 
1934
// method id "gmail.users.messages.get":
 
1935
 
 
1936
type UsersMessagesGetCall struct {
 
1937
        s      *Service
 
1938
        userId string
 
1939
        id     string
 
1940
        opt_   map[string]interface{}
 
1941
}
 
1942
 
 
1943
// Get: Gets the specified message.
 
1944
func (r *UsersMessagesService) Get(userId string, id string) *UsersMessagesGetCall {
 
1945
        c := &UsersMessagesGetCall{s: r.s, opt_: make(map[string]interface{})}
 
1946
        c.userId = userId
 
1947
        c.id = id
 
1948
        return c
 
1949
}
 
1950
 
 
1951
// Format sets the optional parameter "format": The format to return the
 
1952
// message in.
 
1953
func (c *UsersMessagesGetCall) Format(format string) *UsersMessagesGetCall {
 
1954
        c.opt_["format"] = format
 
1955
        return c
 
1956
}
 
1957
 
 
1958
// MetadataHeaders sets the optional parameter "metadataHeaders": When
 
1959
// given and format is METADATA, only include headers specified.
 
1960
func (c *UsersMessagesGetCall) MetadataHeaders(metadataHeaders string) *UsersMessagesGetCall {
 
1961
        c.opt_["metadataHeaders"] = metadataHeaders
 
1962
        return c
 
1963
}
 
1964
 
 
1965
// Fields allows partial responses to be retrieved.
 
1966
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
1967
// for more information.
 
1968
func (c *UsersMessagesGetCall) Fields(s ...googleapi.Field) *UsersMessagesGetCall {
 
1969
        c.opt_["fields"] = googleapi.CombineFields(s)
 
1970
        return c
 
1971
}
 
1972
 
 
1973
func (c *UsersMessagesGetCall) Do() (*Message, error) {
 
1974
        var body io.Reader = nil
 
1975
        params := make(url.Values)
 
1976
        params.Set("alt", "json")
 
1977
        if v, ok := c.opt_["format"]; ok {
 
1978
                params.Set("format", fmt.Sprintf("%v", v))
 
1979
        }
 
1980
        if v, ok := c.opt_["metadataHeaders"]; ok {
 
1981
                params.Set("metadataHeaders", fmt.Sprintf("%v", v))
 
1982
        }
 
1983
        if v, ok := c.opt_["fields"]; ok {
 
1984
                params.Set("fields", fmt.Sprintf("%v", v))
 
1985
        }
 
1986
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}")
 
1987
        urls += "?" + params.Encode()
 
1988
        req, _ := http.NewRequest("GET", urls, body)
 
1989
        googleapi.Expand(req.URL, map[string]string{
 
1990
                "userId": c.userId,
 
1991
                "id":     c.id,
 
1992
        })
 
1993
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
1994
        res, err := c.s.client.Do(req)
 
1995
        if err != nil {
 
1996
                return nil, err
 
1997
        }
 
1998
        defer googleapi.CloseBody(res)
 
1999
        if err := googleapi.CheckResponse(res); err != nil {
 
2000
                return nil, err
 
2001
        }
 
2002
        var ret *Message
 
2003
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2004
                return nil, err
 
2005
        }
 
2006
        return ret, nil
 
2007
        // {
 
2008
        //   "description": "Gets the specified message.",
 
2009
        //   "httpMethod": "GET",
 
2010
        //   "id": "gmail.users.messages.get",
 
2011
        //   "parameterOrder": [
 
2012
        //     "userId",
 
2013
        //     "id"
 
2014
        //   ],
 
2015
        //   "parameters": {
 
2016
        //     "format": {
 
2017
        //       "default": "full",
 
2018
        //       "description": "The format to return the message in.",
 
2019
        //       "enum": [
 
2020
        //         "full",
 
2021
        //         "metadata",
 
2022
        //         "minimal",
 
2023
        //         "raw"
 
2024
        //       ],
 
2025
        //       "enumDescriptions": [
 
2026
        //         "",
 
2027
        //         "",
 
2028
        //         "",
 
2029
        //         ""
 
2030
        //       ],
 
2031
        //       "location": "query",
 
2032
        //       "type": "string"
 
2033
        //     },
 
2034
        //     "id": {
 
2035
        //       "description": "The ID of the message to retrieve.",
 
2036
        //       "location": "path",
 
2037
        //       "required": true,
 
2038
        //       "type": "string"
 
2039
        //     },
 
2040
        //     "metadataHeaders": {
 
2041
        //       "description": "When given and format is METADATA, only include headers specified.",
 
2042
        //       "location": "query",
 
2043
        //       "repeated": true,
 
2044
        //       "type": "string"
 
2045
        //     },
 
2046
        //     "userId": {
 
2047
        //       "default": "me",
 
2048
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2049
        //       "location": "path",
 
2050
        //       "required": true,
 
2051
        //       "type": "string"
 
2052
        //     }
 
2053
        //   },
 
2054
        //   "path": "{userId}/messages/{id}",
 
2055
        //   "response": {
 
2056
        //     "$ref": "Message"
 
2057
        //   },
 
2058
        //   "scopes": [
 
2059
        //     "https://mail.google.com/",
 
2060
        //     "https://www.googleapis.com/auth/gmail.modify",
 
2061
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
2062
        //   ]
 
2063
        // }
 
2064
 
 
2065
}
 
2066
 
 
2067
// method id "gmail.users.messages.import":
 
2068
 
 
2069
type UsersMessagesImportCall struct {
 
2070
        s       *Service
 
2071
        userId  string
 
2072
        message *Message
 
2073
        opt_    map[string]interface{}
 
2074
        media_  io.Reader
 
2075
}
 
2076
 
 
2077
// Import: Imports a message into only this user's mailbox, with
 
2078
// standard email delivery scanning and classification similar to
 
2079
// receiving via SMTP. Does not send a message.
 
2080
func (r *UsersMessagesService) Import(userId string, message *Message) *UsersMessagesImportCall {
 
2081
        c := &UsersMessagesImportCall{s: r.s, opt_: make(map[string]interface{})}
 
2082
        c.userId = userId
 
2083
        c.message = message
 
2084
        return c
 
2085
}
 
2086
 
 
2087
// InternalDateSource sets the optional parameter "internalDateSource":
 
2088
// Source for Gmail's internal date of the message.
 
2089
func (c *UsersMessagesImportCall) InternalDateSource(internalDateSource string) *UsersMessagesImportCall {
 
2090
        c.opt_["internalDateSource"] = internalDateSource
 
2091
        return c
 
2092
}
 
2093
func (c *UsersMessagesImportCall) Media(r io.Reader) *UsersMessagesImportCall {
 
2094
        c.media_ = r
 
2095
        return c
 
2096
}
 
2097
 
 
2098
// Fields allows partial responses to be retrieved.
 
2099
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2100
// for more information.
 
2101
func (c *UsersMessagesImportCall) Fields(s ...googleapi.Field) *UsersMessagesImportCall {
 
2102
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2103
        return c
 
2104
}
 
2105
 
 
2106
func (c *UsersMessagesImportCall) Do() (*Message, error) {
 
2107
        var body io.Reader = nil
 
2108
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
 
2109
        if err != nil {
 
2110
                return nil, err
 
2111
        }
 
2112
        ctype := "application/json"
 
2113
        params := make(url.Values)
 
2114
        params.Set("alt", "json")
 
2115
        if v, ok := c.opt_["internalDateSource"]; ok {
 
2116
                params.Set("internalDateSource", fmt.Sprintf("%v", v))
 
2117
        }
 
2118
        if v, ok := c.opt_["fields"]; ok {
 
2119
                params.Set("fields", fmt.Sprintf("%v", v))
 
2120
        }
 
2121
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/import")
 
2122
        if c.media_ != nil {
 
2123
                urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
 
2124
                params.Set("uploadType", "multipart")
 
2125
        }
 
2126
        urls += "?" + params.Encode()
 
2127
        contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
 
2128
        req, _ := http.NewRequest("POST", urls, body)
 
2129
        googleapi.Expand(req.URL, map[string]string{
 
2130
                "userId": c.userId,
 
2131
        })
 
2132
        if hasMedia_ {
 
2133
                req.ContentLength = contentLength_
 
2134
        }
 
2135
        req.Header.Set("Content-Type", ctype)
 
2136
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2137
        res, err := c.s.client.Do(req)
 
2138
        if err != nil {
 
2139
                return nil, err
 
2140
        }
 
2141
        defer googleapi.CloseBody(res)
 
2142
        if err := googleapi.CheckResponse(res); err != nil {
 
2143
                return nil, err
 
2144
        }
 
2145
        var ret *Message
 
2146
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2147
                return nil, err
 
2148
        }
 
2149
        return ret, nil
 
2150
        // {
 
2151
        //   "description": "Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message.",
 
2152
        //   "httpMethod": "POST",
 
2153
        //   "id": "gmail.users.messages.import",
 
2154
        //   "mediaUpload": {
 
2155
        //     "accept": [
 
2156
        //       "message/rfc822"
 
2157
        //     ],
 
2158
        //     "maxSize": "35MB",
 
2159
        //     "protocols": {
 
2160
        //       "resumable": {
 
2161
        //         "multipart": true,
 
2162
        //         "path": "/resumable/upload/gmail/v1/users/{userId}/messages/import"
 
2163
        //       },
 
2164
        //       "simple": {
 
2165
        //         "multipart": true,
 
2166
        //         "path": "/upload/gmail/v1/users/{userId}/messages/import"
 
2167
        //       }
 
2168
        //     }
 
2169
        //   },
 
2170
        //   "parameterOrder": [
 
2171
        //     "userId"
 
2172
        //   ],
 
2173
        //   "parameters": {
 
2174
        //     "internalDateSource": {
 
2175
        //       "default": "dateHeader",
 
2176
        //       "description": "Source for Gmail's internal date of the message.",
 
2177
        //       "enum": [
 
2178
        //         "dateHeader",
 
2179
        //         "receivedTime"
 
2180
        //       ],
 
2181
        //       "enumDescriptions": [
 
2182
        //         "",
 
2183
        //         ""
 
2184
        //       ],
 
2185
        //       "location": "query",
 
2186
        //       "type": "string"
 
2187
        //     },
 
2188
        //     "userId": {
 
2189
        //       "default": "me",
 
2190
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2191
        //       "location": "path",
 
2192
        //       "required": true,
 
2193
        //       "type": "string"
 
2194
        //     }
 
2195
        //   },
 
2196
        //   "path": "{userId}/messages/import",
 
2197
        //   "request": {
 
2198
        //     "$ref": "Message"
 
2199
        //   },
 
2200
        //   "response": {
 
2201
        //     "$ref": "Message"
 
2202
        //   },
 
2203
        //   "scopes": [
 
2204
        //     "https://mail.google.com/",
 
2205
        //     "https://www.googleapis.com/auth/gmail.modify"
 
2206
        //   ],
 
2207
        //   "supportsMediaUpload": true
 
2208
        // }
 
2209
 
 
2210
}
 
2211
 
 
2212
// method id "gmail.users.messages.insert":
 
2213
 
 
2214
type UsersMessagesInsertCall struct {
 
2215
        s       *Service
 
2216
        userId  string
 
2217
        message *Message
 
2218
        opt_    map[string]interface{}
 
2219
        media_  io.Reader
 
2220
}
 
2221
 
 
2222
// Insert: Directly inserts a message into only this user's mailbox
 
2223
// similar to IMAP APPEND, bypassing most scanning and classification.
 
2224
// Does not send a message.
 
2225
func (r *UsersMessagesService) Insert(userId string, message *Message) *UsersMessagesInsertCall {
 
2226
        c := &UsersMessagesInsertCall{s: r.s, opt_: make(map[string]interface{})}
 
2227
        c.userId = userId
 
2228
        c.message = message
 
2229
        return c
 
2230
}
 
2231
 
 
2232
// InternalDateSource sets the optional parameter "internalDateSource":
 
2233
// Source for Gmail's internal date of the message.
 
2234
func (c *UsersMessagesInsertCall) InternalDateSource(internalDateSource string) *UsersMessagesInsertCall {
 
2235
        c.opt_["internalDateSource"] = internalDateSource
 
2236
        return c
 
2237
}
 
2238
func (c *UsersMessagesInsertCall) Media(r io.Reader) *UsersMessagesInsertCall {
 
2239
        c.media_ = r
 
2240
        return c
 
2241
}
 
2242
 
 
2243
// Fields allows partial responses to be retrieved.
 
2244
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2245
// for more information.
 
2246
func (c *UsersMessagesInsertCall) Fields(s ...googleapi.Field) *UsersMessagesInsertCall {
 
2247
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2248
        return c
 
2249
}
 
2250
 
 
2251
func (c *UsersMessagesInsertCall) Do() (*Message, error) {
 
2252
        var body io.Reader = nil
 
2253
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
 
2254
        if err != nil {
 
2255
                return nil, err
 
2256
        }
 
2257
        ctype := "application/json"
 
2258
        params := make(url.Values)
 
2259
        params.Set("alt", "json")
 
2260
        if v, ok := c.opt_["internalDateSource"]; ok {
 
2261
                params.Set("internalDateSource", fmt.Sprintf("%v", v))
 
2262
        }
 
2263
        if v, ok := c.opt_["fields"]; ok {
 
2264
                params.Set("fields", fmt.Sprintf("%v", v))
 
2265
        }
 
2266
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages")
 
2267
        if c.media_ != nil {
 
2268
                urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
 
2269
                params.Set("uploadType", "multipart")
 
2270
        }
 
2271
        urls += "?" + params.Encode()
 
2272
        contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
 
2273
        req, _ := http.NewRequest("POST", urls, body)
 
2274
        googleapi.Expand(req.URL, map[string]string{
 
2275
                "userId": c.userId,
 
2276
        })
 
2277
        if hasMedia_ {
 
2278
                req.ContentLength = contentLength_
 
2279
        }
 
2280
        req.Header.Set("Content-Type", ctype)
 
2281
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2282
        res, err := c.s.client.Do(req)
 
2283
        if err != nil {
 
2284
                return nil, err
 
2285
        }
 
2286
        defer googleapi.CloseBody(res)
 
2287
        if err := googleapi.CheckResponse(res); err != nil {
 
2288
                return nil, err
 
2289
        }
 
2290
        var ret *Message
 
2291
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2292
                return nil, err
 
2293
        }
 
2294
        return ret, nil
 
2295
        // {
 
2296
        //   "description": "Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.",
 
2297
        //   "httpMethod": "POST",
 
2298
        //   "id": "gmail.users.messages.insert",
 
2299
        //   "mediaUpload": {
 
2300
        //     "accept": [
 
2301
        //       "message/rfc822"
 
2302
        //     ],
 
2303
        //     "maxSize": "35MB",
 
2304
        //     "protocols": {
 
2305
        //       "resumable": {
 
2306
        //         "multipart": true,
 
2307
        //         "path": "/resumable/upload/gmail/v1/users/{userId}/messages"
 
2308
        //       },
 
2309
        //       "simple": {
 
2310
        //         "multipart": true,
 
2311
        //         "path": "/upload/gmail/v1/users/{userId}/messages"
 
2312
        //       }
 
2313
        //     }
 
2314
        //   },
 
2315
        //   "parameterOrder": [
 
2316
        //     "userId"
 
2317
        //   ],
 
2318
        //   "parameters": {
 
2319
        //     "internalDateSource": {
 
2320
        //       "default": "receivedTime",
 
2321
        //       "description": "Source for Gmail's internal date of the message.",
 
2322
        //       "enum": [
 
2323
        //         "dateHeader",
 
2324
        //         "receivedTime"
 
2325
        //       ],
 
2326
        //       "enumDescriptions": [
 
2327
        //         "",
 
2328
        //         ""
 
2329
        //       ],
 
2330
        //       "location": "query",
 
2331
        //       "type": "string"
 
2332
        //     },
 
2333
        //     "userId": {
 
2334
        //       "default": "me",
 
2335
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2336
        //       "location": "path",
 
2337
        //       "required": true,
 
2338
        //       "type": "string"
 
2339
        //     }
 
2340
        //   },
 
2341
        //   "path": "{userId}/messages",
 
2342
        //   "request": {
 
2343
        //     "$ref": "Message"
 
2344
        //   },
 
2345
        //   "response": {
 
2346
        //     "$ref": "Message"
 
2347
        //   },
 
2348
        //   "scopes": [
 
2349
        //     "https://mail.google.com/",
 
2350
        //     "https://www.googleapis.com/auth/gmail.modify"
 
2351
        //   ],
 
2352
        //   "supportsMediaUpload": true
 
2353
        // }
 
2354
 
 
2355
}
 
2356
 
 
2357
// method id "gmail.users.messages.list":
 
2358
 
 
2359
type UsersMessagesListCall struct {
 
2360
        s      *Service
 
2361
        userId string
 
2362
        opt_   map[string]interface{}
 
2363
}
 
2364
 
 
2365
// List: Lists the messages in the user's mailbox.
 
2366
func (r *UsersMessagesService) List(userId string) *UsersMessagesListCall {
 
2367
        c := &UsersMessagesListCall{s: r.s, opt_: make(map[string]interface{})}
 
2368
        c.userId = userId
 
2369
        return c
 
2370
}
 
2371
 
 
2372
// IncludeSpamTrash sets the optional parameter "includeSpamTrash":
 
2373
// Include messages from SPAM and TRASH in the results.
 
2374
func (c *UsersMessagesListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersMessagesListCall {
 
2375
        c.opt_["includeSpamTrash"] = includeSpamTrash
 
2376
        return c
 
2377
}
 
2378
 
 
2379
// LabelIds sets the optional parameter "labelIds": Only return messages
 
2380
// with labels that match all of the specified label IDs.
 
2381
func (c *UsersMessagesListCall) LabelIds(labelIds string) *UsersMessagesListCall {
 
2382
        c.opt_["labelIds"] = labelIds
 
2383
        return c
 
2384
}
 
2385
 
 
2386
// MaxResults sets the optional parameter "maxResults": Maximum number
 
2387
// of messages to return.
 
2388
func (c *UsersMessagesListCall) MaxResults(maxResults int64) *UsersMessagesListCall {
 
2389
        c.opt_["maxResults"] = maxResults
 
2390
        return c
 
2391
}
 
2392
 
 
2393
// PageToken sets the optional parameter "pageToken": Page token to
 
2394
// retrieve a specific page of results in the list.
 
2395
func (c *UsersMessagesListCall) PageToken(pageToken string) *UsersMessagesListCall {
 
2396
        c.opt_["pageToken"] = pageToken
 
2397
        return c
 
2398
}
 
2399
 
 
2400
// Q sets the optional parameter "q": Only return messages matching the
 
2401
// specified query. Supports the same query format as the Gmail search
 
2402
// box. For example, "from:someuser@example.com rfc822msgid: is:unread".
 
2403
func (c *UsersMessagesListCall) Q(q string) *UsersMessagesListCall {
 
2404
        c.opt_["q"] = q
 
2405
        return c
 
2406
}
 
2407
 
 
2408
// Fields allows partial responses to be retrieved.
 
2409
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2410
// for more information.
 
2411
func (c *UsersMessagesListCall) Fields(s ...googleapi.Field) *UsersMessagesListCall {
 
2412
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2413
        return c
 
2414
}
 
2415
 
 
2416
func (c *UsersMessagesListCall) Do() (*ListMessagesResponse, error) {
 
2417
        var body io.Reader = nil
 
2418
        params := make(url.Values)
 
2419
        params.Set("alt", "json")
 
2420
        if v, ok := c.opt_["includeSpamTrash"]; ok {
 
2421
                params.Set("includeSpamTrash", fmt.Sprintf("%v", v))
 
2422
        }
 
2423
        if v, ok := c.opt_["labelIds"]; ok {
 
2424
                params.Set("labelIds", fmt.Sprintf("%v", v))
 
2425
        }
 
2426
        if v, ok := c.opt_["maxResults"]; ok {
 
2427
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
2428
        }
 
2429
        if v, ok := c.opt_["pageToken"]; ok {
 
2430
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
2431
        }
 
2432
        if v, ok := c.opt_["q"]; ok {
 
2433
                params.Set("q", fmt.Sprintf("%v", v))
 
2434
        }
 
2435
        if v, ok := c.opt_["fields"]; ok {
 
2436
                params.Set("fields", fmt.Sprintf("%v", v))
 
2437
        }
 
2438
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages")
 
2439
        urls += "?" + params.Encode()
 
2440
        req, _ := http.NewRequest("GET", urls, body)
 
2441
        googleapi.Expand(req.URL, map[string]string{
 
2442
                "userId": c.userId,
 
2443
        })
 
2444
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2445
        res, err := c.s.client.Do(req)
 
2446
        if err != nil {
 
2447
                return nil, err
 
2448
        }
 
2449
        defer googleapi.CloseBody(res)
 
2450
        if err := googleapi.CheckResponse(res); err != nil {
 
2451
                return nil, err
 
2452
        }
 
2453
        var ret *ListMessagesResponse
 
2454
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2455
                return nil, err
 
2456
        }
 
2457
        return ret, nil
 
2458
        // {
 
2459
        //   "description": "Lists the messages in the user's mailbox.",
 
2460
        //   "httpMethod": "GET",
 
2461
        //   "id": "gmail.users.messages.list",
 
2462
        //   "parameterOrder": [
 
2463
        //     "userId"
 
2464
        //   ],
 
2465
        //   "parameters": {
 
2466
        //     "includeSpamTrash": {
 
2467
        //       "default": "false",
 
2468
        //       "description": "Include messages from SPAM and TRASH in the results.",
 
2469
        //       "location": "query",
 
2470
        //       "type": "boolean"
 
2471
        //     },
 
2472
        //     "labelIds": {
 
2473
        //       "description": "Only return messages with labels that match all of the specified label IDs.",
 
2474
        //       "location": "query",
 
2475
        //       "repeated": true,
 
2476
        //       "type": "string"
 
2477
        //     },
 
2478
        //     "maxResults": {
 
2479
        //       "default": "100",
 
2480
        //       "description": "Maximum number of messages to return.",
 
2481
        //       "format": "uint32",
 
2482
        //       "location": "query",
 
2483
        //       "type": "integer"
 
2484
        //     },
 
2485
        //     "pageToken": {
 
2486
        //       "description": "Page token to retrieve a specific page of results in the list.",
 
2487
        //       "location": "query",
 
2488
        //       "type": "string"
 
2489
        //     },
 
2490
        //     "q": {
 
2491
        //       "description": "Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\".",
 
2492
        //       "location": "query",
 
2493
        //       "type": "string"
 
2494
        //     },
 
2495
        //     "userId": {
 
2496
        //       "default": "me",
 
2497
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2498
        //       "location": "path",
 
2499
        //       "required": true,
 
2500
        //       "type": "string"
 
2501
        //     }
 
2502
        //   },
 
2503
        //   "path": "{userId}/messages",
 
2504
        //   "response": {
 
2505
        //     "$ref": "ListMessagesResponse"
 
2506
        //   },
 
2507
        //   "scopes": [
 
2508
        //     "https://mail.google.com/",
 
2509
        //     "https://www.googleapis.com/auth/gmail.modify",
 
2510
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
2511
        //   ]
 
2512
        // }
 
2513
 
 
2514
}
 
2515
 
 
2516
// method id "gmail.users.messages.modify":
 
2517
 
 
2518
type UsersMessagesModifyCall struct {
 
2519
        s                    *Service
 
2520
        userId               string
 
2521
        id                   string
 
2522
        modifymessagerequest *ModifyMessageRequest
 
2523
        opt_                 map[string]interface{}
 
2524
}
 
2525
 
 
2526
// Modify: Modifies the labels on the specified message.
 
2527
func (r *UsersMessagesService) Modify(userId string, id string, modifymessagerequest *ModifyMessageRequest) *UsersMessagesModifyCall {
 
2528
        c := &UsersMessagesModifyCall{s: r.s, opt_: make(map[string]interface{})}
 
2529
        c.userId = userId
 
2530
        c.id = id
 
2531
        c.modifymessagerequest = modifymessagerequest
 
2532
        return c
 
2533
}
 
2534
 
 
2535
// Fields allows partial responses to be retrieved.
 
2536
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2537
// for more information.
 
2538
func (c *UsersMessagesModifyCall) Fields(s ...googleapi.Field) *UsersMessagesModifyCall {
 
2539
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2540
        return c
 
2541
}
 
2542
 
 
2543
func (c *UsersMessagesModifyCall) Do() (*Message, error) {
 
2544
        var body io.Reader = nil
 
2545
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifymessagerequest)
 
2546
        if err != nil {
 
2547
                return nil, err
 
2548
        }
 
2549
        ctype := "application/json"
 
2550
        params := make(url.Values)
 
2551
        params.Set("alt", "json")
 
2552
        if v, ok := c.opt_["fields"]; ok {
 
2553
                params.Set("fields", fmt.Sprintf("%v", v))
 
2554
        }
 
2555
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}/modify")
 
2556
        urls += "?" + params.Encode()
 
2557
        req, _ := http.NewRequest("POST", urls, body)
 
2558
        googleapi.Expand(req.URL, map[string]string{
 
2559
                "userId": c.userId,
 
2560
                "id":     c.id,
 
2561
        })
 
2562
        req.Header.Set("Content-Type", ctype)
 
2563
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2564
        res, err := c.s.client.Do(req)
 
2565
        if err != nil {
 
2566
                return nil, err
 
2567
        }
 
2568
        defer googleapi.CloseBody(res)
 
2569
        if err := googleapi.CheckResponse(res); err != nil {
 
2570
                return nil, err
 
2571
        }
 
2572
        var ret *Message
 
2573
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2574
                return nil, err
 
2575
        }
 
2576
        return ret, nil
 
2577
        // {
 
2578
        //   "description": "Modifies the labels on the specified message.",
 
2579
        //   "httpMethod": "POST",
 
2580
        //   "id": "gmail.users.messages.modify",
 
2581
        //   "parameterOrder": [
 
2582
        //     "userId",
 
2583
        //     "id"
 
2584
        //   ],
 
2585
        //   "parameters": {
 
2586
        //     "id": {
 
2587
        //       "description": "The ID of the message to modify.",
 
2588
        //       "location": "path",
 
2589
        //       "required": true,
 
2590
        //       "type": "string"
 
2591
        //     },
 
2592
        //     "userId": {
 
2593
        //       "default": "me",
 
2594
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2595
        //       "location": "path",
 
2596
        //       "required": true,
 
2597
        //       "type": "string"
 
2598
        //     }
 
2599
        //   },
 
2600
        //   "path": "{userId}/messages/{id}/modify",
 
2601
        //   "request": {
 
2602
        //     "$ref": "ModifyMessageRequest"
 
2603
        //   },
 
2604
        //   "response": {
 
2605
        //     "$ref": "Message"
 
2606
        //   },
 
2607
        //   "scopes": [
 
2608
        //     "https://mail.google.com/",
 
2609
        //     "https://www.googleapis.com/auth/gmail.modify"
 
2610
        //   ]
 
2611
        // }
 
2612
 
 
2613
}
 
2614
 
 
2615
// method id "gmail.users.messages.send":
 
2616
 
 
2617
type UsersMessagesSendCall struct {
 
2618
        s       *Service
 
2619
        userId  string
 
2620
        message *Message
 
2621
        opt_    map[string]interface{}
 
2622
        media_  io.Reader
 
2623
}
 
2624
 
 
2625
// Send: Sends the specified message to the recipients in the To, Cc,
 
2626
// and Bcc headers.
 
2627
func (r *UsersMessagesService) Send(userId string, message *Message) *UsersMessagesSendCall {
 
2628
        c := &UsersMessagesSendCall{s: r.s, opt_: make(map[string]interface{})}
 
2629
        c.userId = userId
 
2630
        c.message = message
 
2631
        return c
 
2632
}
 
2633
func (c *UsersMessagesSendCall) Media(r io.Reader) *UsersMessagesSendCall {
 
2634
        c.media_ = r
 
2635
        return c
 
2636
}
 
2637
 
 
2638
// Fields allows partial responses to be retrieved.
 
2639
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2640
// for more information.
 
2641
func (c *UsersMessagesSendCall) Fields(s ...googleapi.Field) *UsersMessagesSendCall {
 
2642
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2643
        return c
 
2644
}
 
2645
 
 
2646
func (c *UsersMessagesSendCall) Do() (*Message, error) {
 
2647
        var body io.Reader = nil
 
2648
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
 
2649
        if err != nil {
 
2650
                return nil, err
 
2651
        }
 
2652
        ctype := "application/json"
 
2653
        params := make(url.Values)
 
2654
        params.Set("alt", "json")
 
2655
        if v, ok := c.opt_["fields"]; ok {
 
2656
                params.Set("fields", fmt.Sprintf("%v", v))
 
2657
        }
 
2658
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/send")
 
2659
        if c.media_ != nil {
 
2660
                urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
 
2661
                params.Set("uploadType", "multipart")
 
2662
        }
 
2663
        urls += "?" + params.Encode()
 
2664
        contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
 
2665
        req, _ := http.NewRequest("POST", urls, body)
 
2666
        googleapi.Expand(req.URL, map[string]string{
 
2667
                "userId": c.userId,
 
2668
        })
 
2669
        if hasMedia_ {
 
2670
                req.ContentLength = contentLength_
 
2671
        }
 
2672
        req.Header.Set("Content-Type", ctype)
 
2673
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2674
        res, err := c.s.client.Do(req)
 
2675
        if err != nil {
 
2676
                return nil, err
 
2677
        }
 
2678
        defer googleapi.CloseBody(res)
 
2679
        if err := googleapi.CheckResponse(res); err != nil {
 
2680
                return nil, err
 
2681
        }
 
2682
        var ret *Message
 
2683
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2684
                return nil, err
 
2685
        }
 
2686
        return ret, nil
 
2687
        // {
 
2688
        //   "description": "Sends the specified message to the recipients in the To, Cc, and Bcc headers.",
 
2689
        //   "httpMethod": "POST",
 
2690
        //   "id": "gmail.users.messages.send",
 
2691
        //   "mediaUpload": {
 
2692
        //     "accept": [
 
2693
        //       "message/rfc822"
 
2694
        //     ],
 
2695
        //     "maxSize": "35MB",
 
2696
        //     "protocols": {
 
2697
        //       "resumable": {
 
2698
        //         "multipart": true,
 
2699
        //         "path": "/resumable/upload/gmail/v1/users/{userId}/messages/send"
 
2700
        //       },
 
2701
        //       "simple": {
 
2702
        //         "multipart": true,
 
2703
        //         "path": "/upload/gmail/v1/users/{userId}/messages/send"
 
2704
        //       }
 
2705
        //     }
 
2706
        //   },
 
2707
        //   "parameterOrder": [
 
2708
        //     "userId"
 
2709
        //   ],
 
2710
        //   "parameters": {
 
2711
        //     "userId": {
 
2712
        //       "default": "me",
 
2713
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2714
        //       "location": "path",
 
2715
        //       "required": true,
 
2716
        //       "type": "string"
 
2717
        //     }
 
2718
        //   },
 
2719
        //   "path": "{userId}/messages/send",
 
2720
        //   "request": {
 
2721
        //     "$ref": "Message"
 
2722
        //   },
 
2723
        //   "response": {
 
2724
        //     "$ref": "Message"
 
2725
        //   },
 
2726
        //   "scopes": [
 
2727
        //     "https://mail.google.com/",
 
2728
        //     "https://www.googleapis.com/auth/gmail.compose",
 
2729
        //     "https://www.googleapis.com/auth/gmail.modify"
 
2730
        //   ],
 
2731
        //   "supportsMediaUpload": true
 
2732
        // }
 
2733
 
 
2734
}
 
2735
 
 
2736
// method id "gmail.users.messages.trash":
 
2737
 
 
2738
type UsersMessagesTrashCall struct {
 
2739
        s      *Service
 
2740
        userId string
 
2741
        id     string
 
2742
        opt_   map[string]interface{}
 
2743
}
 
2744
 
 
2745
// Trash: Moves the specified message to the trash.
 
2746
func (r *UsersMessagesService) Trash(userId string, id string) *UsersMessagesTrashCall {
 
2747
        c := &UsersMessagesTrashCall{s: r.s, opt_: make(map[string]interface{})}
 
2748
        c.userId = userId
 
2749
        c.id = id
 
2750
        return c
 
2751
}
 
2752
 
 
2753
// Fields allows partial responses to be retrieved.
 
2754
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2755
// for more information.
 
2756
func (c *UsersMessagesTrashCall) Fields(s ...googleapi.Field) *UsersMessagesTrashCall {
 
2757
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2758
        return c
 
2759
}
 
2760
 
 
2761
func (c *UsersMessagesTrashCall) Do() (*Message, error) {
 
2762
        var body io.Reader = nil
 
2763
        params := make(url.Values)
 
2764
        params.Set("alt", "json")
 
2765
        if v, ok := c.opt_["fields"]; ok {
 
2766
                params.Set("fields", fmt.Sprintf("%v", v))
 
2767
        }
 
2768
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}/trash")
 
2769
        urls += "?" + params.Encode()
 
2770
        req, _ := http.NewRequest("POST", urls, body)
 
2771
        googleapi.Expand(req.URL, map[string]string{
 
2772
                "userId": c.userId,
 
2773
                "id":     c.id,
 
2774
        })
 
2775
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2776
        res, err := c.s.client.Do(req)
 
2777
        if err != nil {
 
2778
                return nil, err
 
2779
        }
 
2780
        defer googleapi.CloseBody(res)
 
2781
        if err := googleapi.CheckResponse(res); err != nil {
 
2782
                return nil, err
 
2783
        }
 
2784
        var ret *Message
 
2785
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2786
                return nil, err
 
2787
        }
 
2788
        return ret, nil
 
2789
        // {
 
2790
        //   "description": "Moves the specified message to the trash.",
 
2791
        //   "httpMethod": "POST",
 
2792
        //   "id": "gmail.users.messages.trash",
 
2793
        //   "parameterOrder": [
 
2794
        //     "userId",
 
2795
        //     "id"
 
2796
        //   ],
 
2797
        //   "parameters": {
 
2798
        //     "id": {
 
2799
        //       "description": "The ID of the message to Trash.",
 
2800
        //       "location": "path",
 
2801
        //       "required": true,
 
2802
        //       "type": "string"
 
2803
        //     },
 
2804
        //     "userId": {
 
2805
        //       "default": "me",
 
2806
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2807
        //       "location": "path",
 
2808
        //       "required": true,
 
2809
        //       "type": "string"
 
2810
        //     }
 
2811
        //   },
 
2812
        //   "path": "{userId}/messages/{id}/trash",
 
2813
        //   "response": {
 
2814
        //     "$ref": "Message"
 
2815
        //   },
 
2816
        //   "scopes": [
 
2817
        //     "https://mail.google.com/",
 
2818
        //     "https://www.googleapis.com/auth/gmail.modify"
 
2819
        //   ]
 
2820
        // }
 
2821
 
 
2822
}
 
2823
 
 
2824
// method id "gmail.users.messages.untrash":
 
2825
 
 
2826
type UsersMessagesUntrashCall struct {
 
2827
        s      *Service
 
2828
        userId string
 
2829
        id     string
 
2830
        opt_   map[string]interface{}
 
2831
}
 
2832
 
 
2833
// Untrash: Removes the specified message from the trash.
 
2834
func (r *UsersMessagesService) Untrash(userId string, id string) *UsersMessagesUntrashCall {
 
2835
        c := &UsersMessagesUntrashCall{s: r.s, opt_: make(map[string]interface{})}
 
2836
        c.userId = userId
 
2837
        c.id = id
 
2838
        return c
 
2839
}
 
2840
 
 
2841
// Fields allows partial responses to be retrieved.
 
2842
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2843
// for more information.
 
2844
func (c *UsersMessagesUntrashCall) Fields(s ...googleapi.Field) *UsersMessagesUntrashCall {
 
2845
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2846
        return c
 
2847
}
 
2848
 
 
2849
func (c *UsersMessagesUntrashCall) Do() (*Message, error) {
 
2850
        var body io.Reader = nil
 
2851
        params := make(url.Values)
 
2852
        params.Set("alt", "json")
 
2853
        if v, ok := c.opt_["fields"]; ok {
 
2854
                params.Set("fields", fmt.Sprintf("%v", v))
 
2855
        }
 
2856
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}/untrash")
 
2857
        urls += "?" + params.Encode()
 
2858
        req, _ := http.NewRequest("POST", urls, body)
 
2859
        googleapi.Expand(req.URL, map[string]string{
 
2860
                "userId": c.userId,
 
2861
                "id":     c.id,
 
2862
        })
 
2863
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2864
        res, err := c.s.client.Do(req)
 
2865
        if err != nil {
 
2866
                return nil, err
 
2867
        }
 
2868
        defer googleapi.CloseBody(res)
 
2869
        if err := googleapi.CheckResponse(res); err != nil {
 
2870
                return nil, err
 
2871
        }
 
2872
        var ret *Message
 
2873
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2874
                return nil, err
 
2875
        }
 
2876
        return ret, nil
 
2877
        // {
 
2878
        //   "description": "Removes the specified message from the trash.",
 
2879
        //   "httpMethod": "POST",
 
2880
        //   "id": "gmail.users.messages.untrash",
 
2881
        //   "parameterOrder": [
 
2882
        //     "userId",
 
2883
        //     "id"
 
2884
        //   ],
 
2885
        //   "parameters": {
 
2886
        //     "id": {
 
2887
        //       "description": "The ID of the message to remove from Trash.",
 
2888
        //       "location": "path",
 
2889
        //       "required": true,
 
2890
        //       "type": "string"
 
2891
        //     },
 
2892
        //     "userId": {
 
2893
        //       "default": "me",
 
2894
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2895
        //       "location": "path",
 
2896
        //       "required": true,
 
2897
        //       "type": "string"
 
2898
        //     }
 
2899
        //   },
 
2900
        //   "path": "{userId}/messages/{id}/untrash",
 
2901
        //   "response": {
 
2902
        //     "$ref": "Message"
 
2903
        //   },
 
2904
        //   "scopes": [
 
2905
        //     "https://mail.google.com/",
 
2906
        //     "https://www.googleapis.com/auth/gmail.modify"
 
2907
        //   ]
 
2908
        // }
 
2909
 
 
2910
}
 
2911
 
 
2912
// method id "gmail.users.messages.attachments.get":
 
2913
 
 
2914
type UsersMessagesAttachmentsGetCall struct {
 
2915
        s         *Service
 
2916
        userId    string
 
2917
        messageId string
 
2918
        id        string
 
2919
        opt_      map[string]interface{}
 
2920
}
 
2921
 
 
2922
// Get: Gets the specified message attachment.
 
2923
func (r *UsersMessagesAttachmentsService) Get(userId string, messageId string, id string) *UsersMessagesAttachmentsGetCall {
 
2924
        c := &UsersMessagesAttachmentsGetCall{s: r.s, opt_: make(map[string]interface{})}
 
2925
        c.userId = userId
 
2926
        c.messageId = messageId
 
2927
        c.id = id
 
2928
        return c
 
2929
}
 
2930
 
 
2931
// Fields allows partial responses to be retrieved.
 
2932
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
2933
// for more information.
 
2934
func (c *UsersMessagesAttachmentsGetCall) Fields(s ...googleapi.Field) *UsersMessagesAttachmentsGetCall {
 
2935
        c.opt_["fields"] = googleapi.CombineFields(s)
 
2936
        return c
 
2937
}
 
2938
 
 
2939
func (c *UsersMessagesAttachmentsGetCall) Do() (*MessagePartBody, error) {
 
2940
        var body io.Reader = nil
 
2941
        params := make(url.Values)
 
2942
        params.Set("alt", "json")
 
2943
        if v, ok := c.opt_["fields"]; ok {
 
2944
                params.Set("fields", fmt.Sprintf("%v", v))
 
2945
        }
 
2946
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{messageId}/attachments/{id}")
 
2947
        urls += "?" + params.Encode()
 
2948
        req, _ := http.NewRequest("GET", urls, body)
 
2949
        googleapi.Expand(req.URL, map[string]string{
 
2950
                "userId":    c.userId,
 
2951
                "messageId": c.messageId,
 
2952
                "id":        c.id,
 
2953
        })
 
2954
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
2955
        res, err := c.s.client.Do(req)
 
2956
        if err != nil {
 
2957
                return nil, err
 
2958
        }
 
2959
        defer googleapi.CloseBody(res)
 
2960
        if err := googleapi.CheckResponse(res); err != nil {
 
2961
                return nil, err
 
2962
        }
 
2963
        var ret *MessagePartBody
 
2964
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
2965
                return nil, err
 
2966
        }
 
2967
        return ret, nil
 
2968
        // {
 
2969
        //   "description": "Gets the specified message attachment.",
 
2970
        //   "httpMethod": "GET",
 
2971
        //   "id": "gmail.users.messages.attachments.get",
 
2972
        //   "parameterOrder": [
 
2973
        //     "userId",
 
2974
        //     "messageId",
 
2975
        //     "id"
 
2976
        //   ],
 
2977
        //   "parameters": {
 
2978
        //     "id": {
 
2979
        //       "description": "The ID of the attachment.",
 
2980
        //       "location": "path",
 
2981
        //       "required": true,
 
2982
        //       "type": "string"
 
2983
        //     },
 
2984
        //     "messageId": {
 
2985
        //       "description": "The ID of the message containing the attachment.",
 
2986
        //       "location": "path",
 
2987
        //       "required": true,
 
2988
        //       "type": "string"
 
2989
        //     },
 
2990
        //     "userId": {
 
2991
        //       "default": "me",
 
2992
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
2993
        //       "location": "path",
 
2994
        //       "required": true,
 
2995
        //       "type": "string"
 
2996
        //     }
 
2997
        //   },
 
2998
        //   "path": "{userId}/messages/{messageId}/attachments/{id}",
 
2999
        //   "response": {
 
3000
        //     "$ref": "MessagePartBody"
 
3001
        //   },
 
3002
        //   "scopes": [
 
3003
        //     "https://mail.google.com/",
 
3004
        //     "https://www.googleapis.com/auth/gmail.modify",
 
3005
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
3006
        //   ]
 
3007
        // }
 
3008
 
 
3009
}
 
3010
 
 
3011
// method id "gmail.users.threads.delete":
 
3012
 
 
3013
type UsersThreadsDeleteCall struct {
 
3014
        s      *Service
 
3015
        userId string
 
3016
        id     string
 
3017
        opt_   map[string]interface{}
 
3018
}
 
3019
 
 
3020
// Delete: Immediately and permanently deletes the specified thread.
 
3021
// This operation cannot be undone. Prefer threads.trash instead.
 
3022
func (r *UsersThreadsService) Delete(userId string, id string) *UsersThreadsDeleteCall {
 
3023
        c := &UsersThreadsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
 
3024
        c.userId = userId
 
3025
        c.id = id
 
3026
        return c
 
3027
}
 
3028
 
 
3029
// Fields allows partial responses to be retrieved.
 
3030
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
3031
// for more information.
 
3032
func (c *UsersThreadsDeleteCall) Fields(s ...googleapi.Field) *UsersThreadsDeleteCall {
 
3033
        c.opt_["fields"] = googleapi.CombineFields(s)
 
3034
        return c
 
3035
}
 
3036
 
 
3037
func (c *UsersThreadsDeleteCall) Do() error {
 
3038
        var body io.Reader = nil
 
3039
        params := make(url.Values)
 
3040
        params.Set("alt", "json")
 
3041
        if v, ok := c.opt_["fields"]; ok {
 
3042
                params.Set("fields", fmt.Sprintf("%v", v))
 
3043
        }
 
3044
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}")
 
3045
        urls += "?" + params.Encode()
 
3046
        req, _ := http.NewRequest("DELETE", urls, body)
 
3047
        googleapi.Expand(req.URL, map[string]string{
 
3048
                "userId": c.userId,
 
3049
                "id":     c.id,
 
3050
        })
 
3051
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
3052
        res, err := c.s.client.Do(req)
 
3053
        if err != nil {
 
3054
                return err
 
3055
        }
 
3056
        defer googleapi.CloseBody(res)
 
3057
        if err := googleapi.CheckResponse(res); err != nil {
 
3058
                return err
 
3059
        }
 
3060
        return nil
 
3061
        // {
 
3062
        //   "description": "Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead.",
 
3063
        //   "httpMethod": "DELETE",
 
3064
        //   "id": "gmail.users.threads.delete",
 
3065
        //   "parameterOrder": [
 
3066
        //     "userId",
 
3067
        //     "id"
 
3068
        //   ],
 
3069
        //   "parameters": {
 
3070
        //     "id": {
 
3071
        //       "description": "ID of the Thread to delete.",
 
3072
        //       "location": "path",
 
3073
        //       "required": true,
 
3074
        //       "type": "string"
 
3075
        //     },
 
3076
        //     "userId": {
 
3077
        //       "default": "me",
 
3078
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
3079
        //       "location": "path",
 
3080
        //       "required": true,
 
3081
        //       "type": "string"
 
3082
        //     }
 
3083
        //   },
 
3084
        //   "path": "{userId}/threads/{id}",
 
3085
        //   "scopes": [
 
3086
        //     "https://mail.google.com/"
 
3087
        //   ]
 
3088
        // }
 
3089
 
 
3090
}
 
3091
 
 
3092
// method id "gmail.users.threads.get":
 
3093
 
 
3094
type UsersThreadsGetCall struct {
 
3095
        s      *Service
 
3096
        userId string
 
3097
        id     string
 
3098
        opt_   map[string]interface{}
 
3099
}
 
3100
 
 
3101
// Get: Gets the specified thread.
 
3102
func (r *UsersThreadsService) Get(userId string, id string) *UsersThreadsGetCall {
 
3103
        c := &UsersThreadsGetCall{s: r.s, opt_: make(map[string]interface{})}
 
3104
        c.userId = userId
 
3105
        c.id = id
 
3106
        return c
 
3107
}
 
3108
 
 
3109
// Format sets the optional parameter "format": The format to return the
 
3110
// messages in.
 
3111
func (c *UsersThreadsGetCall) Format(format string) *UsersThreadsGetCall {
 
3112
        c.opt_["format"] = format
 
3113
        return c
 
3114
}
 
3115
 
 
3116
// MetadataHeaders sets the optional parameter "metadataHeaders": When
 
3117
// given and format is METADATA, only include headers specified.
 
3118
func (c *UsersThreadsGetCall) MetadataHeaders(metadataHeaders string) *UsersThreadsGetCall {
 
3119
        c.opt_["metadataHeaders"] = metadataHeaders
 
3120
        return c
 
3121
}
 
3122
 
 
3123
// Fields allows partial responses to be retrieved.
 
3124
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
3125
// for more information.
 
3126
func (c *UsersThreadsGetCall) Fields(s ...googleapi.Field) *UsersThreadsGetCall {
 
3127
        c.opt_["fields"] = googleapi.CombineFields(s)
 
3128
        return c
 
3129
}
 
3130
 
 
3131
func (c *UsersThreadsGetCall) Do() (*Thread, error) {
 
3132
        var body io.Reader = nil
 
3133
        params := make(url.Values)
 
3134
        params.Set("alt", "json")
 
3135
        if v, ok := c.opt_["format"]; ok {
 
3136
                params.Set("format", fmt.Sprintf("%v", v))
 
3137
        }
 
3138
        if v, ok := c.opt_["metadataHeaders"]; ok {
 
3139
                params.Set("metadataHeaders", fmt.Sprintf("%v", v))
 
3140
        }
 
3141
        if v, ok := c.opt_["fields"]; ok {
 
3142
                params.Set("fields", fmt.Sprintf("%v", v))
 
3143
        }
 
3144
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}")
 
3145
        urls += "?" + params.Encode()
 
3146
        req, _ := http.NewRequest("GET", urls, body)
 
3147
        googleapi.Expand(req.URL, map[string]string{
 
3148
                "userId": c.userId,
 
3149
                "id":     c.id,
 
3150
        })
 
3151
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
3152
        res, err := c.s.client.Do(req)
 
3153
        if err != nil {
 
3154
                return nil, err
 
3155
        }
 
3156
        defer googleapi.CloseBody(res)
 
3157
        if err := googleapi.CheckResponse(res); err != nil {
 
3158
                return nil, err
 
3159
        }
 
3160
        var ret *Thread
 
3161
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
3162
                return nil, err
 
3163
        }
 
3164
        return ret, nil
 
3165
        // {
 
3166
        //   "description": "Gets the specified thread.",
 
3167
        //   "httpMethod": "GET",
 
3168
        //   "id": "gmail.users.threads.get",
 
3169
        //   "parameterOrder": [
 
3170
        //     "userId",
 
3171
        //     "id"
 
3172
        //   ],
 
3173
        //   "parameters": {
 
3174
        //     "format": {
 
3175
        //       "default": "full",
 
3176
        //       "description": "The format to return the messages in.",
 
3177
        //       "enum": [
 
3178
        //         "full",
 
3179
        //         "metadata",
 
3180
        //         "minimal"
 
3181
        //       ],
 
3182
        //       "enumDescriptions": [
 
3183
        //         "",
 
3184
        //         "",
 
3185
        //         ""
 
3186
        //       ],
 
3187
        //       "location": "query",
 
3188
        //       "type": "string"
 
3189
        //     },
 
3190
        //     "id": {
 
3191
        //       "description": "The ID of the thread to retrieve.",
 
3192
        //       "location": "path",
 
3193
        //       "required": true,
 
3194
        //       "type": "string"
 
3195
        //     },
 
3196
        //     "metadataHeaders": {
 
3197
        //       "description": "When given and format is METADATA, only include headers specified.",
 
3198
        //       "location": "query",
 
3199
        //       "repeated": true,
 
3200
        //       "type": "string"
 
3201
        //     },
 
3202
        //     "userId": {
 
3203
        //       "default": "me",
 
3204
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
3205
        //       "location": "path",
 
3206
        //       "required": true,
 
3207
        //       "type": "string"
 
3208
        //     }
 
3209
        //   },
 
3210
        //   "path": "{userId}/threads/{id}",
 
3211
        //   "response": {
 
3212
        //     "$ref": "Thread"
 
3213
        //   },
 
3214
        //   "scopes": [
 
3215
        //     "https://mail.google.com/",
 
3216
        //     "https://www.googleapis.com/auth/gmail.modify",
 
3217
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
3218
        //   ]
 
3219
        // }
 
3220
 
 
3221
}
 
3222
 
 
3223
// method id "gmail.users.threads.list":
 
3224
 
 
3225
type UsersThreadsListCall struct {
 
3226
        s      *Service
 
3227
        userId string
 
3228
        opt_   map[string]interface{}
 
3229
}
 
3230
 
 
3231
// List: Lists the threads in the user's mailbox.
 
3232
func (r *UsersThreadsService) List(userId string) *UsersThreadsListCall {
 
3233
        c := &UsersThreadsListCall{s: r.s, opt_: make(map[string]interface{})}
 
3234
        c.userId = userId
 
3235
        return c
 
3236
}
 
3237
 
 
3238
// IncludeSpamTrash sets the optional parameter "includeSpamTrash":
 
3239
// Include threads from SPAM and TRASH in the results.
 
3240
func (c *UsersThreadsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersThreadsListCall {
 
3241
        c.opt_["includeSpamTrash"] = includeSpamTrash
 
3242
        return c
 
3243
}
 
3244
 
 
3245
// LabelIds sets the optional parameter "labelIds": Only return threads
 
3246
// with labels that match all of the specified label IDs.
 
3247
func (c *UsersThreadsListCall) LabelIds(labelIds string) *UsersThreadsListCall {
 
3248
        c.opt_["labelIds"] = labelIds
 
3249
        return c
 
3250
}
 
3251
 
 
3252
// MaxResults sets the optional parameter "maxResults": Maximum number
 
3253
// of threads to return.
 
3254
func (c *UsersThreadsListCall) MaxResults(maxResults int64) *UsersThreadsListCall {
 
3255
        c.opt_["maxResults"] = maxResults
 
3256
        return c
 
3257
}
 
3258
 
 
3259
// PageToken sets the optional parameter "pageToken": Page token to
 
3260
// retrieve a specific page of results in the list.
 
3261
func (c *UsersThreadsListCall) PageToken(pageToken string) *UsersThreadsListCall {
 
3262
        c.opt_["pageToken"] = pageToken
 
3263
        return c
 
3264
}
 
3265
 
 
3266
// Q sets the optional parameter "q": Only return threads matching the
 
3267
// specified query. Supports the same query format as the Gmail search
 
3268
// box. For example, "from:someuser@example.com rfc822msgid: is:unread".
 
3269
func (c *UsersThreadsListCall) Q(q string) *UsersThreadsListCall {
 
3270
        c.opt_["q"] = q
 
3271
        return c
 
3272
}
 
3273
 
 
3274
// Fields allows partial responses to be retrieved.
 
3275
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
3276
// for more information.
 
3277
func (c *UsersThreadsListCall) Fields(s ...googleapi.Field) *UsersThreadsListCall {
 
3278
        c.opt_["fields"] = googleapi.CombineFields(s)
 
3279
        return c
 
3280
}
 
3281
 
 
3282
func (c *UsersThreadsListCall) Do() (*ListThreadsResponse, error) {
 
3283
        var body io.Reader = nil
 
3284
        params := make(url.Values)
 
3285
        params.Set("alt", "json")
 
3286
        if v, ok := c.opt_["includeSpamTrash"]; ok {
 
3287
                params.Set("includeSpamTrash", fmt.Sprintf("%v", v))
 
3288
        }
 
3289
        if v, ok := c.opt_["labelIds"]; ok {
 
3290
                params.Set("labelIds", fmt.Sprintf("%v", v))
 
3291
        }
 
3292
        if v, ok := c.opt_["maxResults"]; ok {
 
3293
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
3294
        }
 
3295
        if v, ok := c.opt_["pageToken"]; ok {
 
3296
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
3297
        }
 
3298
        if v, ok := c.opt_["q"]; ok {
 
3299
                params.Set("q", fmt.Sprintf("%v", v))
 
3300
        }
 
3301
        if v, ok := c.opt_["fields"]; ok {
 
3302
                params.Set("fields", fmt.Sprintf("%v", v))
 
3303
        }
 
3304
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads")
 
3305
        urls += "?" + params.Encode()
 
3306
        req, _ := http.NewRequest("GET", urls, body)
 
3307
        googleapi.Expand(req.URL, map[string]string{
 
3308
                "userId": c.userId,
 
3309
        })
 
3310
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
3311
        res, err := c.s.client.Do(req)
 
3312
        if err != nil {
 
3313
                return nil, err
 
3314
        }
 
3315
        defer googleapi.CloseBody(res)
 
3316
        if err := googleapi.CheckResponse(res); err != nil {
 
3317
                return nil, err
 
3318
        }
 
3319
        var ret *ListThreadsResponse
 
3320
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
3321
                return nil, err
 
3322
        }
 
3323
        return ret, nil
 
3324
        // {
 
3325
        //   "description": "Lists the threads in the user's mailbox.",
 
3326
        //   "httpMethod": "GET",
 
3327
        //   "id": "gmail.users.threads.list",
 
3328
        //   "parameterOrder": [
 
3329
        //     "userId"
 
3330
        //   ],
 
3331
        //   "parameters": {
 
3332
        //     "includeSpamTrash": {
 
3333
        //       "default": "false",
 
3334
        //       "description": "Include threads from SPAM and TRASH in the results.",
 
3335
        //       "location": "query",
 
3336
        //       "type": "boolean"
 
3337
        //     },
 
3338
        //     "labelIds": {
 
3339
        //       "description": "Only return threads with labels that match all of the specified label IDs.",
 
3340
        //       "location": "query",
 
3341
        //       "repeated": true,
 
3342
        //       "type": "string"
 
3343
        //     },
 
3344
        //     "maxResults": {
 
3345
        //       "default": "100",
 
3346
        //       "description": "Maximum number of threads to return.",
 
3347
        //       "format": "uint32",
 
3348
        //       "location": "query",
 
3349
        //       "type": "integer"
 
3350
        //     },
 
3351
        //     "pageToken": {
 
3352
        //       "description": "Page token to retrieve a specific page of results in the list.",
 
3353
        //       "location": "query",
 
3354
        //       "type": "string"
 
3355
        //     },
 
3356
        //     "q": {
 
3357
        //       "description": "Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\".",
 
3358
        //       "location": "query",
 
3359
        //       "type": "string"
 
3360
        //     },
 
3361
        //     "userId": {
 
3362
        //       "default": "me",
 
3363
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
3364
        //       "location": "path",
 
3365
        //       "required": true,
 
3366
        //       "type": "string"
 
3367
        //     }
 
3368
        //   },
 
3369
        //   "path": "{userId}/threads",
 
3370
        //   "response": {
 
3371
        //     "$ref": "ListThreadsResponse"
 
3372
        //   },
 
3373
        //   "scopes": [
 
3374
        //     "https://mail.google.com/",
 
3375
        //     "https://www.googleapis.com/auth/gmail.modify",
 
3376
        //     "https://www.googleapis.com/auth/gmail.readonly"
 
3377
        //   ]
 
3378
        // }
 
3379
 
 
3380
}
 
3381
 
 
3382
// method id "gmail.users.threads.modify":
 
3383
 
 
3384
type UsersThreadsModifyCall struct {
 
3385
        s                   *Service
 
3386
        userId              string
 
3387
        id                  string
 
3388
        modifythreadrequest *ModifyThreadRequest
 
3389
        opt_                map[string]interface{}
 
3390
}
 
3391
 
 
3392
// Modify: Modifies the labels applied to the thread. This applies to
 
3393
// all messages in the thread.
 
3394
func (r *UsersThreadsService) Modify(userId string, id string, modifythreadrequest *ModifyThreadRequest) *UsersThreadsModifyCall {
 
3395
        c := &UsersThreadsModifyCall{s: r.s, opt_: make(map[string]interface{})}
 
3396
        c.userId = userId
 
3397
        c.id = id
 
3398
        c.modifythreadrequest = modifythreadrequest
 
3399
        return c
 
3400
}
 
3401
 
 
3402
// Fields allows partial responses to be retrieved.
 
3403
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
3404
// for more information.
 
3405
func (c *UsersThreadsModifyCall) Fields(s ...googleapi.Field) *UsersThreadsModifyCall {
 
3406
        c.opt_["fields"] = googleapi.CombineFields(s)
 
3407
        return c
 
3408
}
 
3409
 
 
3410
func (c *UsersThreadsModifyCall) Do() (*Thread, error) {
 
3411
        var body io.Reader = nil
 
3412
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifythreadrequest)
 
3413
        if err != nil {
 
3414
                return nil, err
 
3415
        }
 
3416
        ctype := "application/json"
 
3417
        params := make(url.Values)
 
3418
        params.Set("alt", "json")
 
3419
        if v, ok := c.opt_["fields"]; ok {
 
3420
                params.Set("fields", fmt.Sprintf("%v", v))
 
3421
        }
 
3422
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}/modify")
 
3423
        urls += "?" + params.Encode()
 
3424
        req, _ := http.NewRequest("POST", urls, body)
 
3425
        googleapi.Expand(req.URL, map[string]string{
 
3426
                "userId": c.userId,
 
3427
                "id":     c.id,
 
3428
        })
 
3429
        req.Header.Set("Content-Type", ctype)
 
3430
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
3431
        res, err := c.s.client.Do(req)
 
3432
        if err != nil {
 
3433
                return nil, err
 
3434
        }
 
3435
        defer googleapi.CloseBody(res)
 
3436
        if err := googleapi.CheckResponse(res); err != nil {
 
3437
                return nil, err
 
3438
        }
 
3439
        var ret *Thread
 
3440
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
3441
                return nil, err
 
3442
        }
 
3443
        return ret, nil
 
3444
        // {
 
3445
        //   "description": "Modifies the labels applied to the thread. This applies to all messages in the thread.",
 
3446
        //   "httpMethod": "POST",
 
3447
        //   "id": "gmail.users.threads.modify",
 
3448
        //   "parameterOrder": [
 
3449
        //     "userId",
 
3450
        //     "id"
 
3451
        //   ],
 
3452
        //   "parameters": {
 
3453
        //     "id": {
 
3454
        //       "description": "The ID of the thread to modify.",
 
3455
        //       "location": "path",
 
3456
        //       "required": true,
 
3457
        //       "type": "string"
 
3458
        //     },
 
3459
        //     "userId": {
 
3460
        //       "default": "me",
 
3461
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
3462
        //       "location": "path",
 
3463
        //       "required": true,
 
3464
        //       "type": "string"
 
3465
        //     }
 
3466
        //   },
 
3467
        //   "path": "{userId}/threads/{id}/modify",
 
3468
        //   "request": {
 
3469
        //     "$ref": "ModifyThreadRequest"
 
3470
        //   },
 
3471
        //   "response": {
 
3472
        //     "$ref": "Thread"
 
3473
        //   },
 
3474
        //   "scopes": [
 
3475
        //     "https://mail.google.com/",
 
3476
        //     "https://www.googleapis.com/auth/gmail.modify"
 
3477
        //   ]
 
3478
        // }
 
3479
 
 
3480
}
 
3481
 
 
3482
// method id "gmail.users.threads.trash":
 
3483
 
 
3484
type UsersThreadsTrashCall struct {
 
3485
        s      *Service
 
3486
        userId string
 
3487
        id     string
 
3488
        opt_   map[string]interface{}
 
3489
}
 
3490
 
 
3491
// Trash: Moves the specified thread to the trash.
 
3492
func (r *UsersThreadsService) Trash(userId string, id string) *UsersThreadsTrashCall {
 
3493
        c := &UsersThreadsTrashCall{s: r.s, opt_: make(map[string]interface{})}
 
3494
        c.userId = userId
 
3495
        c.id = id
 
3496
        return c
 
3497
}
 
3498
 
 
3499
// Fields allows partial responses to be retrieved.
 
3500
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
3501
// for more information.
 
3502
func (c *UsersThreadsTrashCall) Fields(s ...googleapi.Field) *UsersThreadsTrashCall {
 
3503
        c.opt_["fields"] = googleapi.CombineFields(s)
 
3504
        return c
 
3505
}
 
3506
 
 
3507
func (c *UsersThreadsTrashCall) Do() (*Thread, error) {
 
3508
        var body io.Reader = nil
 
3509
        params := make(url.Values)
 
3510
        params.Set("alt", "json")
 
3511
        if v, ok := c.opt_["fields"]; ok {
 
3512
                params.Set("fields", fmt.Sprintf("%v", v))
 
3513
        }
 
3514
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}/trash")
 
3515
        urls += "?" + params.Encode()
 
3516
        req, _ := http.NewRequest("POST", urls, body)
 
3517
        googleapi.Expand(req.URL, map[string]string{
 
3518
                "userId": c.userId,
 
3519
                "id":     c.id,
 
3520
        })
 
3521
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
3522
        res, err := c.s.client.Do(req)
 
3523
        if err != nil {
 
3524
                return nil, err
 
3525
        }
 
3526
        defer googleapi.CloseBody(res)
 
3527
        if err := googleapi.CheckResponse(res); err != nil {
 
3528
                return nil, err
 
3529
        }
 
3530
        var ret *Thread
 
3531
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
3532
                return nil, err
 
3533
        }
 
3534
        return ret, nil
 
3535
        // {
 
3536
        //   "description": "Moves the specified thread to the trash.",
 
3537
        //   "httpMethod": "POST",
 
3538
        //   "id": "gmail.users.threads.trash",
 
3539
        //   "parameterOrder": [
 
3540
        //     "userId",
 
3541
        //     "id"
 
3542
        //   ],
 
3543
        //   "parameters": {
 
3544
        //     "id": {
 
3545
        //       "description": "The ID of the thread to Trash.",
 
3546
        //       "location": "path",
 
3547
        //       "required": true,
 
3548
        //       "type": "string"
 
3549
        //     },
 
3550
        //     "userId": {
 
3551
        //       "default": "me",
 
3552
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
3553
        //       "location": "path",
 
3554
        //       "required": true,
 
3555
        //       "type": "string"
 
3556
        //     }
 
3557
        //   },
 
3558
        //   "path": "{userId}/threads/{id}/trash",
 
3559
        //   "response": {
 
3560
        //     "$ref": "Thread"
 
3561
        //   },
 
3562
        //   "scopes": [
 
3563
        //     "https://mail.google.com/",
 
3564
        //     "https://www.googleapis.com/auth/gmail.modify"
 
3565
        //   ]
 
3566
        // }
 
3567
 
 
3568
}
 
3569
 
 
3570
// method id "gmail.users.threads.untrash":
 
3571
 
 
3572
type UsersThreadsUntrashCall struct {
 
3573
        s      *Service
 
3574
        userId string
 
3575
        id     string
 
3576
        opt_   map[string]interface{}
 
3577
}
 
3578
 
 
3579
// Untrash: Removes the specified thread from the trash.
 
3580
func (r *UsersThreadsService) Untrash(userId string, id string) *UsersThreadsUntrashCall {
 
3581
        c := &UsersThreadsUntrashCall{s: r.s, opt_: make(map[string]interface{})}
 
3582
        c.userId = userId
 
3583
        c.id = id
 
3584
        return c
 
3585
}
 
3586
 
 
3587
// Fields allows partial responses to be retrieved.
 
3588
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
3589
// for more information.
 
3590
func (c *UsersThreadsUntrashCall) Fields(s ...googleapi.Field) *UsersThreadsUntrashCall {
 
3591
        c.opt_["fields"] = googleapi.CombineFields(s)
 
3592
        return c
 
3593
}
 
3594
 
 
3595
func (c *UsersThreadsUntrashCall) Do() (*Thread, error) {
 
3596
        var body io.Reader = nil
 
3597
        params := make(url.Values)
 
3598
        params.Set("alt", "json")
 
3599
        if v, ok := c.opt_["fields"]; ok {
 
3600
                params.Set("fields", fmt.Sprintf("%v", v))
 
3601
        }
 
3602
        urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}/untrash")
 
3603
        urls += "?" + params.Encode()
 
3604
        req, _ := http.NewRequest("POST", urls, body)
 
3605
        googleapi.Expand(req.URL, map[string]string{
 
3606
                "userId": c.userId,
 
3607
                "id":     c.id,
 
3608
        })
 
3609
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
3610
        res, err := c.s.client.Do(req)
 
3611
        if err != nil {
 
3612
                return nil, err
 
3613
        }
 
3614
        defer googleapi.CloseBody(res)
 
3615
        if err := googleapi.CheckResponse(res); err != nil {
 
3616
                return nil, err
 
3617
        }
 
3618
        var ret *Thread
 
3619
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
3620
                return nil, err
 
3621
        }
 
3622
        return ret, nil
 
3623
        // {
 
3624
        //   "description": "Removes the specified thread from the trash.",
 
3625
        //   "httpMethod": "POST",
 
3626
        //   "id": "gmail.users.threads.untrash",
 
3627
        //   "parameterOrder": [
 
3628
        //     "userId",
 
3629
        //     "id"
 
3630
        //   ],
 
3631
        //   "parameters": {
 
3632
        //     "id": {
 
3633
        //       "description": "The ID of the thread to remove from Trash.",
 
3634
        //       "location": "path",
 
3635
        //       "required": true,
 
3636
        //       "type": "string"
 
3637
        //     },
 
3638
        //     "userId": {
 
3639
        //       "default": "me",
 
3640
        //       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
 
3641
        //       "location": "path",
 
3642
        //       "required": true,
 
3643
        //       "type": "string"
 
3644
        //     }
 
3645
        //   },
 
3646
        //   "path": "{userId}/threads/{id}/untrash",
 
3647
        //   "response": {
 
3648
        //     "$ref": "Thread"
 
3649
        //   },
 
3650
        //   "scopes": [
 
3651
        //     "https://mail.google.com/",
 
3652
        //     "https://www.googleapis.com/auth/gmail.modify"
 
3653
        //   ]
 
3654
        // }
 
3655
 
 
3656
}