1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 package gmail
57
58 import (
59 "bytes"
60 "context"
61 "encoding/json"
62 "errors"
63 "fmt"
64 "io"
65 "net/http"
66 "net/url"
67 "strconv"
68 "strings"
69
70 googleapi "google.golang.org/api/googleapi"
71 internal "google.golang.org/api/internal"
72 gensupport "google.golang.org/api/internal/gensupport"
73 option "google.golang.org/api/option"
74 internaloption "google.golang.org/api/option/internaloption"
75 htransport "google.golang.org/api/transport/http"
76 )
77
78
79
80 var _ = bytes.NewBuffer
81 var _ = strconv.Itoa
82 var _ = fmt.Sprintf
83 var _ = json.NewDecoder
84 var _ = io.Copy
85 var _ = url.Parse
86 var _ = gensupport.MarshalJSON
87 var _ = googleapi.Version
88 var _ = errors.New
89 var _ = strings.Replace
90 var _ = context.Canceled
91 var _ = internaloption.WithDefaultEndpoint
92 var _ = internal.Version
93
94 const apiId = "gmail:v1"
95 const apiName = "gmail"
96 const apiVersion = "v1"
97 const basePath = "https://gmail.googleapis.com/"
98 const basePathTemplate = "https://gmail.UNIVERSE_DOMAIN/"
99 const mtlsBasePath = "https://gmail.mtls.googleapis.com/"
100
101
102 const (
103
104 MailGoogleComScope = "https://mail.google.com/"
105
106
107 GmailAddonsCurrentActionComposeScope = "https://www.googleapis.com/auth/gmail.addons.current.action.compose"
108
109
110 GmailAddonsCurrentMessageActionScope = "https://www.googleapis.com/auth/gmail.addons.current.message.action"
111
112
113 GmailAddonsCurrentMessageMetadataScope = "https://www.googleapis.com/auth/gmail.addons.current.message.metadata"
114
115
116 GmailAddonsCurrentMessageReadonlyScope = "https://www.googleapis.com/auth/gmail.addons.current.message.readonly"
117
118
119 GmailComposeScope = "https://www.googleapis.com/auth/gmail.compose"
120
121
122 GmailInsertScope = "https://www.googleapis.com/auth/gmail.insert"
123
124
125 GmailLabelsScope = "https://www.googleapis.com/auth/gmail.labels"
126
127
128
129 GmailMetadataScope = "https://www.googleapis.com/auth/gmail.metadata"
130
131
132 GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify"
133
134
135 GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.readonly"
136
137
138 GmailSendScope = "https://www.googleapis.com/auth/gmail.send"
139
140
141 GmailSettingsBasicScope = "https://www.googleapis.com/auth/gmail.settings.basic"
142
143
144 GmailSettingsSharingScope = "https://www.googleapis.com/auth/gmail.settings.sharing"
145 )
146
147
148 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
149 scopesOption := internaloption.WithDefaultScopes(
150 "https://mail.google.com/",
151 "https://www.googleapis.com/auth/gmail.addons.current.action.compose",
152 "https://www.googleapis.com/auth/gmail.addons.current.message.action",
153 "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
154 "https://www.googleapis.com/auth/gmail.addons.current.message.readonly",
155 "https://www.googleapis.com/auth/gmail.compose",
156 "https://www.googleapis.com/auth/gmail.insert",
157 "https://www.googleapis.com/auth/gmail.labels",
158 "https://www.googleapis.com/auth/gmail.metadata",
159 "https://www.googleapis.com/auth/gmail.modify",
160 "https://www.googleapis.com/auth/gmail.readonly",
161 "https://www.googleapis.com/auth/gmail.send",
162 "https://www.googleapis.com/auth/gmail.settings.basic",
163 "https://www.googleapis.com/auth/gmail.settings.sharing",
164 )
165
166 opts = append([]option.ClientOption{scopesOption}, opts...)
167 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
168 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
169 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
170 opts = append(opts, internaloption.EnableNewAuthLibrary())
171 client, endpoint, err := htransport.NewClient(ctx, opts...)
172 if err != nil {
173 return nil, err
174 }
175 s, err := New(client)
176 if err != nil {
177 return nil, err
178 }
179 if endpoint != "" {
180 s.BasePath = endpoint
181 }
182 return s, nil
183 }
184
185
186
187
188
189
190 func New(client *http.Client) (*Service, error) {
191 if client == nil {
192 return nil, errors.New("client is nil")
193 }
194 s := &Service{client: client, BasePath: basePath}
195 s.Users = NewUsersService(s)
196 return s, nil
197 }
198
199 type Service struct {
200 client *http.Client
201 BasePath string
202 UserAgent string
203
204 Users *UsersService
205 }
206
207 func (s *Service) userAgent() string {
208 if s.UserAgent == "" {
209 return googleapi.UserAgent
210 }
211 return googleapi.UserAgent + " " + s.UserAgent
212 }
213
214 func NewUsersService(s *Service) *UsersService {
215 rs := &UsersService{s: s}
216 rs.Drafts = NewUsersDraftsService(s)
217 rs.History = NewUsersHistoryService(s)
218 rs.Labels = NewUsersLabelsService(s)
219 rs.Messages = NewUsersMessagesService(s)
220 rs.Settings = NewUsersSettingsService(s)
221 rs.Threads = NewUsersThreadsService(s)
222 return rs
223 }
224
225 type UsersService struct {
226 s *Service
227
228 Drafts *UsersDraftsService
229
230 History *UsersHistoryService
231
232 Labels *UsersLabelsService
233
234 Messages *UsersMessagesService
235
236 Settings *UsersSettingsService
237
238 Threads *UsersThreadsService
239 }
240
241 func NewUsersDraftsService(s *Service) *UsersDraftsService {
242 rs := &UsersDraftsService{s: s}
243 return rs
244 }
245
246 type UsersDraftsService struct {
247 s *Service
248 }
249
250 func NewUsersHistoryService(s *Service) *UsersHistoryService {
251 rs := &UsersHistoryService{s: s}
252 return rs
253 }
254
255 type UsersHistoryService struct {
256 s *Service
257 }
258
259 func NewUsersLabelsService(s *Service) *UsersLabelsService {
260 rs := &UsersLabelsService{s: s}
261 return rs
262 }
263
264 type UsersLabelsService struct {
265 s *Service
266 }
267
268 func NewUsersMessagesService(s *Service) *UsersMessagesService {
269 rs := &UsersMessagesService{s: s}
270 rs.Attachments = NewUsersMessagesAttachmentsService(s)
271 return rs
272 }
273
274 type UsersMessagesService struct {
275 s *Service
276
277 Attachments *UsersMessagesAttachmentsService
278 }
279
280 func NewUsersMessagesAttachmentsService(s *Service) *UsersMessagesAttachmentsService {
281 rs := &UsersMessagesAttachmentsService{s: s}
282 return rs
283 }
284
285 type UsersMessagesAttachmentsService struct {
286 s *Service
287 }
288
289 func NewUsersSettingsService(s *Service) *UsersSettingsService {
290 rs := &UsersSettingsService{s: s}
291 rs.Cse = NewUsersSettingsCseService(s)
292 rs.Delegates = NewUsersSettingsDelegatesService(s)
293 rs.Filters = NewUsersSettingsFiltersService(s)
294 rs.ForwardingAddresses = NewUsersSettingsForwardingAddressesService(s)
295 rs.SendAs = NewUsersSettingsSendAsService(s)
296 return rs
297 }
298
299 type UsersSettingsService struct {
300 s *Service
301
302 Cse *UsersSettingsCseService
303
304 Delegates *UsersSettingsDelegatesService
305
306 Filters *UsersSettingsFiltersService
307
308 ForwardingAddresses *UsersSettingsForwardingAddressesService
309
310 SendAs *UsersSettingsSendAsService
311 }
312
313 func NewUsersSettingsCseService(s *Service) *UsersSettingsCseService {
314 rs := &UsersSettingsCseService{s: s}
315 rs.Identities = NewUsersSettingsCseIdentitiesService(s)
316 rs.Keypairs = NewUsersSettingsCseKeypairsService(s)
317 return rs
318 }
319
320 type UsersSettingsCseService struct {
321 s *Service
322
323 Identities *UsersSettingsCseIdentitiesService
324
325 Keypairs *UsersSettingsCseKeypairsService
326 }
327
328 func NewUsersSettingsCseIdentitiesService(s *Service) *UsersSettingsCseIdentitiesService {
329 rs := &UsersSettingsCseIdentitiesService{s: s}
330 return rs
331 }
332
333 type UsersSettingsCseIdentitiesService struct {
334 s *Service
335 }
336
337 func NewUsersSettingsCseKeypairsService(s *Service) *UsersSettingsCseKeypairsService {
338 rs := &UsersSettingsCseKeypairsService{s: s}
339 return rs
340 }
341
342 type UsersSettingsCseKeypairsService struct {
343 s *Service
344 }
345
346 func NewUsersSettingsDelegatesService(s *Service) *UsersSettingsDelegatesService {
347 rs := &UsersSettingsDelegatesService{s: s}
348 return rs
349 }
350
351 type UsersSettingsDelegatesService struct {
352 s *Service
353 }
354
355 func NewUsersSettingsFiltersService(s *Service) *UsersSettingsFiltersService {
356 rs := &UsersSettingsFiltersService{s: s}
357 return rs
358 }
359
360 type UsersSettingsFiltersService struct {
361 s *Service
362 }
363
364 func NewUsersSettingsForwardingAddressesService(s *Service) *UsersSettingsForwardingAddressesService {
365 rs := &UsersSettingsForwardingAddressesService{s: s}
366 return rs
367 }
368
369 type UsersSettingsForwardingAddressesService struct {
370 s *Service
371 }
372
373 func NewUsersSettingsSendAsService(s *Service) *UsersSettingsSendAsService {
374 rs := &UsersSettingsSendAsService{s: s}
375 rs.SmimeInfo = NewUsersSettingsSendAsSmimeInfoService(s)
376 return rs
377 }
378
379 type UsersSettingsSendAsService struct {
380 s *Service
381
382 SmimeInfo *UsersSettingsSendAsSmimeInfoService
383 }
384
385 func NewUsersSettingsSendAsSmimeInfoService(s *Service) *UsersSettingsSendAsSmimeInfoService {
386 rs := &UsersSettingsSendAsSmimeInfoService{s: s}
387 return rs
388 }
389
390 type UsersSettingsSendAsSmimeInfoService struct {
391 s *Service
392 }
393
394 func NewUsersThreadsService(s *Service) *UsersThreadsService {
395 rs := &UsersThreadsService{s: s}
396 return rs
397 }
398
399 type UsersThreadsService struct {
400 s *Service
401 }
402
403
404 type AutoForwarding struct {
405
406
407
408
409
410
411
412
413
414 Disposition string `json:"disposition,omitempty"`
415
416
417 EmailAddress string `json:"emailAddress,omitempty"`
418
419
420 Enabled bool `json:"enabled,omitempty"`
421
422
423 googleapi.ServerResponse `json:"-"`
424
425
426
427
428
429 ForceSendFields []string `json:"-"`
430
431
432
433
434 NullFields []string `json:"-"`
435 }
436
437 func (s *AutoForwarding) MarshalJSON() ([]byte, error) {
438 type NoMethod AutoForwarding
439 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
440 }
441
442 type BatchDeleteMessagesRequest struct {
443
444 Ids []string `json:"ids,omitempty"`
445
446
447
448
449
450 ForceSendFields []string `json:"-"`
451
452
453
454
455 NullFields []string `json:"-"`
456 }
457
458 func (s *BatchDeleteMessagesRequest) MarshalJSON() ([]byte, error) {
459 type NoMethod BatchDeleteMessagesRequest
460 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
461 }
462
463 type BatchModifyMessagesRequest struct {
464
465 AddLabelIds []string `json:"addLabelIds,omitempty"`
466
467
468 Ids []string `json:"ids,omitempty"`
469
470 RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
471
472
473
474
475
476 ForceSendFields []string `json:"-"`
477
478
479
480
481 NullFields []string `json:"-"`
482 }
483
484 func (s *BatchModifyMessagesRequest) MarshalJSON() ([]byte, error) {
485 type NoMethod BatchModifyMessagesRequest
486 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
487 }
488
489
490
491
492
493 type CseIdentity struct {
494
495
496 EmailAddress string `json:"emailAddress,omitempty"`
497
498
499 PrimaryKeyPairId string `json:"primaryKeyPairId,omitempty"`
500
501
502 SignAndEncryptKeyPairs *SignAndEncryptKeyPairs `json:"signAndEncryptKeyPairs,omitempty"`
503
504
505 googleapi.ServerResponse `json:"-"`
506
507
508
509
510
511 ForceSendFields []string `json:"-"`
512
513
514
515
516 NullFields []string `json:"-"`
517 }
518
519 func (s *CseIdentity) MarshalJSON() ([]byte, error) {
520 type NoMethod CseIdentity
521 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
522 }
523
524
525
526
527
528
529
530 type CseKeyPair struct {
531
532
533
534 DisableTime string `json:"disableTime,omitempty"`
535
536
537
538
539
540
541
542
543
544
545
546
547
548 EnablementState string `json:"enablementState,omitempty"`
549
550
551 KeyPairId string `json:"keyPairId,omitempty"`
552
553
554 Pem string `json:"pem,omitempty"`
555
556
557
558 Pkcs7 string `json:"pkcs7,omitempty"`
559
560 PrivateKeyMetadata []*CsePrivateKeyMetadata `json:"privateKeyMetadata,omitempty"`
561
562
563 SubjectEmailAddresses []string `json:"subjectEmailAddresses,omitempty"`
564
565
566 googleapi.ServerResponse `json:"-"`
567
568
569
570
571
572 ForceSendFields []string `json:"-"`
573
574
575
576
577 NullFields []string `json:"-"`
578 }
579
580 func (s *CseKeyPair) MarshalJSON() ([]byte, error) {
581 type NoMethod CseKeyPair
582 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
583 }
584
585
586 type CsePrivateKeyMetadata struct {
587
588 HardwareKeyMetadata *HardwareKeyMetadata `json:"hardwareKeyMetadata,omitempty"`
589
590
591 KaclsKeyMetadata *KaclsKeyMetadata `json:"kaclsKeyMetadata,omitempty"`
592
593
594 PrivateKeyMetadataId string `json:"privateKeyMetadataId,omitempty"`
595
596
597
598
599
600 ForceSendFields []string `json:"-"`
601
602
603
604
605 NullFields []string `json:"-"`
606 }
607
608 func (s *CsePrivateKeyMetadata) MarshalJSON() ([]byte, error) {
609 type NoMethod CsePrivateKeyMetadata
610 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
611 }
612
613
614
615
616 type Delegate struct {
617
618 DelegateEmail string `json:"delegateEmail,omitempty"`
619
620
621
622
623
624
625
626
627
628
629
630
631 VerificationStatus string `json:"verificationStatus,omitempty"`
632
633
634 googleapi.ServerResponse `json:"-"`
635
636
637
638
639
640 ForceSendFields []string `json:"-"`
641
642
643
644
645 NullFields []string `json:"-"`
646 }
647
648 func (s *Delegate) MarshalJSON() ([]byte, error) {
649 type NoMethod Delegate
650 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
651 }
652
653
654
655 type DisableCseKeyPairRequest struct {
656 }
657
658
659 type Draft struct {
660
661 Id string `json:"id,omitempty"`
662
663 Message *Message `json:"message,omitempty"`
664
665
666 googleapi.ServerResponse `json:"-"`
667
668
669
670
671
672 ForceSendFields []string `json:"-"`
673
674
675
676
677 NullFields []string `json:"-"`
678 }
679
680 func (s *Draft) MarshalJSON() ([]byte, error) {
681 type NoMethod Draft
682 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
683 }
684
685
686
687 type EnableCseKeyPairRequest struct {
688 }
689
690
691
692 type Filter struct {
693
694 Action *FilterAction `json:"action,omitempty"`
695
696 Criteria *FilterCriteria `json:"criteria,omitempty"`
697
698 Id string `json:"id,omitempty"`
699
700
701 googleapi.ServerResponse `json:"-"`
702
703
704
705
706
707 ForceSendFields []string `json:"-"`
708
709
710
711
712 NullFields []string `json:"-"`
713 }
714
715 func (s *Filter) MarshalJSON() ([]byte, error) {
716 type NoMethod Filter
717 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
718 }
719
720
721 type FilterAction struct {
722
723 AddLabelIds []string `json:"addLabelIds,omitempty"`
724
725 Forward string `json:"forward,omitempty"`
726
727 RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
728
729
730
731
732
733 ForceSendFields []string `json:"-"`
734
735
736
737
738 NullFields []string `json:"-"`
739 }
740
741 func (s *FilterAction) MarshalJSON() ([]byte, error) {
742 type NoMethod FilterAction
743 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
744 }
745
746
747 type FilterCriteria struct {
748
749 ExcludeChats bool `json:"excludeChats,omitempty"`
750
751 From string `json:"from,omitempty"`
752
753 HasAttachment bool `json:"hasAttachment,omitempty"`
754
755
756
757 NegatedQuery string `json:"negatedQuery,omitempty"`
758
759
760
761 Query string `json:"query,omitempty"`
762
763
764 Size int64 `json:"size,omitempty"`
765
766
767
768
769
770
771
772 SizeComparison string `json:"sizeComparison,omitempty"`
773
774
775 Subject string `json:"subject,omitempty"`
776
777
778
779
780 To string `json:"to,omitempty"`
781
782
783
784
785
786 ForceSendFields []string `json:"-"`
787
788
789
790
791 NullFields []string `json:"-"`
792 }
793
794 func (s *FilterCriteria) MarshalJSON() ([]byte, error) {
795 type NoMethod FilterCriteria
796 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
797 }
798
799
800 type ForwardingAddress struct {
801
802 ForwardingEmail string `json:"forwardingEmail,omitempty"`
803
804
805
806
807
808
809
810 VerificationStatus string `json:"verificationStatus,omitempty"`
811
812
813 googleapi.ServerResponse `json:"-"`
814
815
816
817
818
819 ForceSendFields []string `json:"-"`
820
821
822
823
824 NullFields []string `json:"-"`
825 }
826
827 func (s *ForwardingAddress) MarshalJSON() ([]byte, error) {
828 type NoMethod ForwardingAddress
829 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
830 }
831
832
833 type HardwareKeyMetadata struct {
834
835 Description string `json:"description,omitempty"`
836
837
838
839
840
841 ForceSendFields []string `json:"-"`
842
843
844
845
846 NullFields []string `json:"-"`
847 }
848
849 func (s *HardwareKeyMetadata) MarshalJSON() ([]byte, error) {
850 type NoMethod HardwareKeyMetadata
851 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
852 }
853
854
855
856 type History struct {
857
858 Id uint64 `json:"id,omitempty,string"`
859
860 LabelsAdded []*HistoryLabelAdded `json:"labelsAdded,omitempty"`
861
862 LabelsRemoved []*HistoryLabelRemoved `json:"labelsRemoved,omitempty"`
863
864
865
866
867 Messages []*Message `json:"messages,omitempty"`
868
869 MessagesAdded []*HistoryMessageAdded `json:"messagesAdded,omitempty"`
870
871
872 MessagesDeleted []*HistoryMessageDeleted `json:"messagesDeleted,omitempty"`
873
874
875
876
877
878 ForceSendFields []string `json:"-"`
879
880
881
882
883 NullFields []string `json:"-"`
884 }
885
886 func (s *History) MarshalJSON() ([]byte, error) {
887 type NoMethod History
888 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
889 }
890
891 type HistoryLabelAdded struct {
892
893 LabelIds []string `json:"labelIds,omitempty"`
894 Message *Message `json:"message,omitempty"`
895
896
897
898
899
900 ForceSendFields []string `json:"-"`
901
902
903
904
905 NullFields []string `json:"-"`
906 }
907
908 func (s *HistoryLabelAdded) MarshalJSON() ([]byte, error) {
909 type NoMethod HistoryLabelAdded
910 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
911 }
912
913 type HistoryLabelRemoved struct {
914
915 LabelIds []string `json:"labelIds,omitempty"`
916 Message *Message `json:"message,omitempty"`
917
918
919
920
921
922 ForceSendFields []string `json:"-"`
923
924
925
926
927 NullFields []string `json:"-"`
928 }
929
930 func (s *HistoryLabelRemoved) MarshalJSON() ([]byte, error) {
931 type NoMethod HistoryLabelRemoved
932 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
933 }
934
935 type HistoryMessageAdded struct {
936 Message *Message `json:"message,omitempty"`
937
938
939
940
941
942 ForceSendFields []string `json:"-"`
943
944
945
946
947 NullFields []string `json:"-"`
948 }
949
950 func (s *HistoryMessageAdded) MarshalJSON() ([]byte, error) {
951 type NoMethod HistoryMessageAdded
952 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
953 }
954
955 type HistoryMessageDeleted struct {
956 Message *Message `json:"message,omitempty"`
957
958
959
960
961
962 ForceSendFields []string `json:"-"`
963
964
965
966
967 NullFields []string `json:"-"`
968 }
969
970 func (s *HistoryMessageDeleted) MarshalJSON() ([]byte, error) {
971 type NoMethod HistoryMessageDeleted
972 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
973 }
974
975
976 type ImapSettings struct {
977
978
979
980 AutoExpunge bool `json:"autoExpunge,omitempty"`
981
982 Enabled bool `json:"enabled,omitempty"`
983
984
985
986
987
988
989
990
991
992 ExpungeBehavior string `json:"expungeBehavior,omitempty"`
993
994
995
996 MaxFolderSize int64 `json:"maxFolderSize,omitempty"`
997
998
999 googleapi.ServerResponse `json:"-"`
1000
1001
1002
1003
1004
1005 ForceSendFields []string `json:"-"`
1006
1007
1008
1009
1010 NullFields []string `json:"-"`
1011 }
1012
1013 func (s *ImapSettings) MarshalJSON() ([]byte, error) {
1014 type NoMethod ImapSettings
1015 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1016 }
1017
1018
1019
1020
1021
1022 type KaclsKeyMetadata struct {
1023
1024
1025 KaclsData string `json:"kaclsData,omitempty"`
1026
1027
1028 KaclsUri string `json:"kaclsUri,omitempty"`
1029
1030
1031
1032
1033
1034 ForceSendFields []string `json:"-"`
1035
1036
1037
1038
1039 NullFields []string `json:"-"`
1040 }
1041
1042 func (s *KaclsKeyMetadata) MarshalJSON() ([]byte, error) {
1043 type NoMethod KaclsKeyMetadata
1044 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1045 }
1046
1047
1048
1049
1050 type Label struct {
1051
1052
1053 Color *LabelColor `json:"color,omitempty"`
1054
1055 Id string `json:"id,omitempty"`
1056
1057
1058
1059
1060
1061
1062
1063
1064 LabelListVisibility string `json:"labelListVisibility,omitempty"`
1065
1066
1067
1068
1069
1070
1071 MessageListVisibility string `json:"messageListVisibility,omitempty"`
1072
1073 MessagesTotal int64 `json:"messagesTotal,omitempty"`
1074
1075 MessagesUnread int64 `json:"messagesUnread,omitempty"`
1076
1077 Name string `json:"name,omitempty"`
1078
1079 ThreadsTotal int64 `json:"threadsTotal,omitempty"`
1080
1081 ThreadsUnread int64 `json:"threadsUnread,omitempty"`
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094 Type string `json:"type,omitempty"`
1095
1096
1097 googleapi.ServerResponse `json:"-"`
1098
1099
1100
1101
1102
1103 ForceSendFields []string `json:"-"`
1104
1105
1106
1107
1108 NullFields []string `json:"-"`
1109 }
1110
1111 func (s *Label) MarshalJSON() ([]byte, error) {
1112 type NoMethod Label
1113 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1114 }
1115
1116 type LabelColor struct {
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133 BackgroundColor string `json:"backgroundColor,omitempty"`
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150 TextColor string `json:"textColor,omitempty"`
1151
1152
1153
1154
1155
1156 ForceSendFields []string `json:"-"`
1157
1158
1159
1160
1161 NullFields []string `json:"-"`
1162 }
1163
1164 func (s *LabelColor) MarshalJSON() ([]byte, error) {
1165 type NoMethod LabelColor
1166 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1167 }
1168
1169
1170
1171 type LanguageSettings struct {
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182 DisplayLanguage string `json:"displayLanguage,omitempty"`
1183
1184
1185 googleapi.ServerResponse `json:"-"`
1186
1187
1188
1189
1190
1191 ForceSendFields []string `json:"-"`
1192
1193
1194
1195
1196 NullFields []string `json:"-"`
1197 }
1198
1199 func (s *LanguageSettings) MarshalJSON() ([]byte, error) {
1200 type NoMethod LanguageSettings
1201 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1202 }
1203
1204 type ListCseIdentitiesResponse struct {
1205
1206
1207 CseIdentities []*CseIdentity `json:"cseIdentities,omitempty"`
1208
1209
1210
1211
1212 NextPageToken string `json:"nextPageToken,omitempty"`
1213
1214
1215 googleapi.ServerResponse `json:"-"`
1216
1217
1218
1219
1220
1221 ForceSendFields []string `json:"-"`
1222
1223
1224
1225
1226 NullFields []string `json:"-"`
1227 }
1228
1229 func (s *ListCseIdentitiesResponse) MarshalJSON() ([]byte, error) {
1230 type NoMethod ListCseIdentitiesResponse
1231 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1232 }
1233
1234 type ListCseKeyPairsResponse struct {
1235
1236 CseKeyPairs []*CseKeyPair `json:"cseKeyPairs,omitempty"`
1237
1238
1239
1240 NextPageToken string `json:"nextPageToken,omitempty"`
1241
1242
1243 googleapi.ServerResponse `json:"-"`
1244
1245
1246
1247
1248
1249 ForceSendFields []string `json:"-"`
1250
1251
1252
1253
1254 NullFields []string `json:"-"`
1255 }
1256
1257 func (s *ListCseKeyPairsResponse) MarshalJSON() ([]byte, error) {
1258 type NoMethod ListCseKeyPairsResponse
1259 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1260 }
1261
1262
1263 type ListDelegatesResponse struct {
1264
1265
1266 Delegates []*Delegate `json:"delegates,omitempty"`
1267
1268
1269 googleapi.ServerResponse `json:"-"`
1270
1271
1272
1273
1274
1275 ForceSendFields []string `json:"-"`
1276
1277
1278
1279
1280 NullFields []string `json:"-"`
1281 }
1282
1283 func (s *ListDelegatesResponse) MarshalJSON() ([]byte, error) {
1284 type NoMethod ListDelegatesResponse
1285 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1286 }
1287
1288 type ListDraftsResponse struct {
1289
1290
1291
1292 Drafts []*Draft `json:"drafts,omitempty"`
1293
1294 NextPageToken string `json:"nextPageToken,omitempty"`
1295
1296 ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
1297
1298
1299 googleapi.ServerResponse `json:"-"`
1300
1301
1302
1303
1304
1305 ForceSendFields []string `json:"-"`
1306
1307
1308
1309
1310 NullFields []string `json:"-"`
1311 }
1312
1313 func (s *ListDraftsResponse) MarshalJSON() ([]byte, error) {
1314 type NoMethod ListDraftsResponse
1315 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1316 }
1317
1318
1319 type ListFiltersResponse struct {
1320
1321 Filter []*Filter `json:"filter,omitempty"`
1322
1323
1324 googleapi.ServerResponse `json:"-"`
1325
1326
1327
1328
1329
1330 ForceSendFields []string `json:"-"`
1331
1332
1333
1334
1335 NullFields []string `json:"-"`
1336 }
1337
1338 func (s *ListFiltersResponse) MarshalJSON() ([]byte, error) {
1339 type NoMethod ListFiltersResponse
1340 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1341 }
1342
1343
1344
1345 type ListForwardingAddressesResponse struct {
1346
1347 ForwardingAddresses []*ForwardingAddress `json:"forwardingAddresses,omitempty"`
1348
1349
1350 googleapi.ServerResponse `json:"-"`
1351
1352
1353
1354
1355
1356 ForceSendFields []string `json:"-"`
1357
1358
1359
1360
1361 NullFields []string `json:"-"`
1362 }
1363
1364 func (s *ListForwardingAddressesResponse) MarshalJSON() ([]byte, error) {
1365 type NoMethod ListForwardingAddressesResponse
1366 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1367 }
1368
1369 type ListHistoryResponse struct {
1370
1371
1372 History []*History `json:"history,omitempty"`
1373
1374 HistoryId uint64 `json:"historyId,omitempty,string"`
1375
1376 NextPageToken string `json:"nextPageToken,omitempty"`
1377
1378
1379 googleapi.ServerResponse `json:"-"`
1380
1381
1382
1383
1384
1385 ForceSendFields []string `json:"-"`
1386
1387
1388
1389
1390 NullFields []string `json:"-"`
1391 }
1392
1393 func (s *ListHistoryResponse) MarshalJSON() ([]byte, error) {
1394 type NoMethod ListHistoryResponse
1395 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1396 }
1397
1398 type ListLabelsResponse struct {
1399
1400
1401
1402 Labels []*Label `json:"labels,omitempty"`
1403
1404
1405 googleapi.ServerResponse `json:"-"`
1406
1407
1408
1409
1410
1411 ForceSendFields []string `json:"-"`
1412
1413
1414
1415
1416 NullFields []string `json:"-"`
1417 }
1418
1419 func (s *ListLabelsResponse) MarshalJSON() ([]byte, error) {
1420 type NoMethod ListLabelsResponse
1421 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1422 }
1423
1424 type ListMessagesResponse struct {
1425
1426
1427
1428 Messages []*Message `json:"messages,omitempty"`
1429
1430 NextPageToken string `json:"nextPageToken,omitempty"`
1431
1432 ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
1433
1434
1435 googleapi.ServerResponse `json:"-"`
1436
1437
1438
1439
1440
1441 ForceSendFields []string `json:"-"`
1442
1443
1444
1445
1446 NullFields []string `json:"-"`
1447 }
1448
1449 func (s *ListMessagesResponse) MarshalJSON() ([]byte, error) {
1450 type NoMethod ListMessagesResponse
1451 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1452 }
1453
1454
1455 type ListSendAsResponse struct {
1456
1457 SendAs []*SendAs `json:"sendAs,omitempty"`
1458
1459
1460 googleapi.ServerResponse `json:"-"`
1461
1462
1463
1464
1465
1466 ForceSendFields []string `json:"-"`
1467
1468
1469
1470
1471 NullFields []string `json:"-"`
1472 }
1473
1474 func (s *ListSendAsResponse) MarshalJSON() ([]byte, error) {
1475 type NoMethod ListSendAsResponse
1476 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1477 }
1478
1479 type ListSmimeInfoResponse struct {
1480
1481 SmimeInfo []*SmimeInfo `json:"smimeInfo,omitempty"`
1482
1483
1484 googleapi.ServerResponse `json:"-"`
1485
1486
1487
1488
1489
1490 ForceSendFields []string `json:"-"`
1491
1492
1493
1494
1495 NullFields []string `json:"-"`
1496 }
1497
1498 func (s *ListSmimeInfoResponse) MarshalJSON() ([]byte, error) {
1499 type NoMethod ListSmimeInfoResponse
1500 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1501 }
1502
1503 type ListThreadsResponse struct {
1504
1505 NextPageToken string `json:"nextPageToken,omitempty"`
1506
1507 ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
1508
1509
1510
1511 Threads []*Thread `json:"threads,omitempty"`
1512
1513
1514 googleapi.ServerResponse `json:"-"`
1515
1516
1517
1518
1519
1520 ForceSendFields []string `json:"-"`
1521
1522
1523
1524
1525 NullFields []string `json:"-"`
1526 }
1527
1528 func (s *ListThreadsResponse) MarshalJSON() ([]byte, error) {
1529 type NoMethod ListThreadsResponse
1530 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1531 }
1532
1533
1534 type Message struct {
1535
1536 HistoryId uint64 `json:"historyId,omitempty,string"`
1537
1538 Id string `json:"id,omitempty"`
1539
1540
1541
1542
1543
1544 InternalDate int64 `json:"internalDate,omitempty,string"`
1545
1546 LabelIds []string `json:"labelIds,omitempty"`
1547
1548 Payload *MessagePart `json:"payload,omitempty"`
1549
1550
1551
1552 Raw string `json:"raw,omitempty"`
1553
1554 SizeEstimate int64 `json:"sizeEstimate,omitempty"`
1555
1556 Snippet string `json:"snippet,omitempty"`
1557
1558
1559
1560
1561
1562
1563 ThreadId string `json:"threadId,omitempty"`
1564
1565
1566 googleapi.ServerResponse `json:"-"`
1567
1568
1569
1570
1571
1572 ForceSendFields []string `json:"-"`
1573
1574
1575
1576
1577 NullFields []string `json:"-"`
1578 }
1579
1580 func (s *Message) MarshalJSON() ([]byte, error) {
1581 type NoMethod Message
1582 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1583 }
1584
1585
1586 type MessagePart struct {
1587
1588
1589 Body *MessagePartBody `json:"body,omitempty"`
1590
1591
1592 Filename string `json:"filename,omitempty"`
1593
1594
1595
1596 Headers []*MessagePartHeader `json:"headers,omitempty"`
1597
1598 MimeType string `json:"mimeType,omitempty"`
1599
1600 PartId string `json:"partId,omitempty"`
1601
1602
1603
1604
1605 Parts []*MessagePart `json:"parts,omitempty"`
1606
1607
1608
1609
1610
1611 ForceSendFields []string `json:"-"`
1612
1613
1614
1615
1616 NullFields []string `json:"-"`
1617 }
1618
1619 func (s *MessagePart) MarshalJSON() ([]byte, error) {
1620 type NoMethod MessagePart
1621 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1622 }
1623
1624
1625 type MessagePartBody struct {
1626
1627
1628
1629
1630 AttachmentId string `json:"attachmentId,omitempty"`
1631
1632
1633
1634
1635 Data string `json:"data,omitempty"`
1636
1637 Size int64 `json:"size,omitempty"`
1638
1639
1640 googleapi.ServerResponse `json:"-"`
1641
1642
1643
1644
1645
1646 ForceSendFields []string `json:"-"`
1647
1648
1649
1650
1651 NullFields []string `json:"-"`
1652 }
1653
1654 func (s *MessagePartBody) MarshalJSON() ([]byte, error) {
1655 type NoMethod MessagePartBody
1656 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1657 }
1658
1659 type MessagePartHeader struct {
1660
1661 Name string `json:"name,omitempty"`
1662
1663
1664 Value string `json:"value,omitempty"`
1665
1666
1667
1668
1669
1670 ForceSendFields []string `json:"-"`
1671
1672
1673
1674
1675 NullFields []string `json:"-"`
1676 }
1677
1678 func (s *MessagePartHeader) MarshalJSON() ([]byte, error) {
1679 type NoMethod MessagePartHeader
1680 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1681 }
1682
1683 type ModifyMessageRequest struct {
1684
1685
1686 AddLabelIds []string `json:"addLabelIds,omitempty"`
1687
1688
1689 RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
1690
1691
1692
1693
1694
1695 ForceSendFields []string `json:"-"`
1696
1697
1698
1699
1700 NullFields []string `json:"-"`
1701 }
1702
1703 func (s *ModifyMessageRequest) MarshalJSON() ([]byte, error) {
1704 type NoMethod ModifyMessageRequest
1705 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1706 }
1707
1708 type ModifyThreadRequest struct {
1709
1710
1711 AddLabelIds []string `json:"addLabelIds,omitempty"`
1712
1713
1714 RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
1715
1716
1717
1718
1719
1720 ForceSendFields []string `json:"-"`
1721
1722
1723
1724
1725 NullFields []string `json:"-"`
1726 }
1727
1728 func (s *ModifyThreadRequest) MarshalJSON() ([]byte, error) {
1729 type NoMethod ModifyThreadRequest
1730 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1731 }
1732
1733
1734 type ObliterateCseKeyPairRequest struct {
1735 }
1736
1737
1738 type PopSettings struct {
1739
1740
1741
1742
1743
1744
1745
1746
1747 AccessWindow string `json:"accessWindow,omitempty"`
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757 Disposition string `json:"disposition,omitempty"`
1758
1759
1760 googleapi.ServerResponse `json:"-"`
1761
1762
1763
1764
1765
1766 ForceSendFields []string `json:"-"`
1767
1768
1769
1770
1771 NullFields []string `json:"-"`
1772 }
1773
1774 func (s *PopSettings) MarshalJSON() ([]byte, error) {
1775 type NoMethod PopSettings
1776 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1777 }
1778
1779
1780 type Profile struct {
1781
1782 EmailAddress string `json:"emailAddress,omitempty"`
1783
1784 HistoryId uint64 `json:"historyId,omitempty,string"`
1785
1786 MessagesTotal int64 `json:"messagesTotal,omitempty"`
1787
1788 ThreadsTotal int64 `json:"threadsTotal,omitempty"`
1789
1790
1791 googleapi.ServerResponse `json:"-"`
1792
1793
1794
1795
1796
1797 ForceSendFields []string `json:"-"`
1798
1799
1800
1801
1802 NullFields []string `json:"-"`
1803 }
1804
1805 func (s *Profile) MarshalJSON() ([]byte, error) {
1806 type NoMethod Profile
1807 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1808 }
1809
1810
1811
1812
1813
1814 type SendAs struct {
1815
1816
1817
1818
1819
1820
1821 DisplayName string `json:"displayName,omitempty"`
1822
1823
1824
1825
1826
1827
1828 IsDefault bool `json:"isDefault,omitempty"`
1829
1830
1831
1832 IsPrimary bool `json:"isPrimary,omitempty"`
1833
1834
1835
1836 ReplyToAddress string `json:"replyToAddress,omitempty"`
1837
1838
1839 SendAsEmail string `json:"sendAsEmail,omitempty"`
1840
1841
1842
1843 Signature string `json:"signature,omitempty"`
1844
1845
1846
1847
1848 SmtpMsa *SmtpMsa `json:"smtpMsa,omitempty"`
1849
1850
1851
1852 TreatAsAlias bool `json:"treatAsAlias,omitempty"`
1853
1854
1855
1856
1857
1858
1859
1860
1861 VerificationStatus string `json:"verificationStatus,omitempty"`
1862
1863
1864 googleapi.ServerResponse `json:"-"`
1865
1866
1867
1868
1869
1870 ForceSendFields []string `json:"-"`
1871
1872
1873
1874
1875 NullFields []string `json:"-"`
1876 }
1877
1878 func (s *SendAs) MarshalJSON() ([]byte, error) {
1879 type NoMethod SendAs
1880 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1881 }
1882
1883
1884
1885 type SignAndEncryptKeyPairs struct {
1886
1887
1888 EncryptionKeyPairId string `json:"encryptionKeyPairId,omitempty"`
1889
1890 SigningKeyPairId string `json:"signingKeyPairId,omitempty"`
1891
1892
1893
1894
1895
1896 ForceSendFields []string `json:"-"`
1897
1898
1899
1900
1901 NullFields []string `json:"-"`
1902 }
1903
1904 func (s *SignAndEncryptKeyPairs) MarshalJSON() ([]byte, error) {
1905 type NoMethod SignAndEncryptKeyPairs
1906 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1907 }
1908
1909
1910 type SmimeInfo struct {
1911
1912 EncryptedKeyPassword string `json:"encryptedKeyPassword,omitempty"`
1913
1914 Expiration int64 `json:"expiration,omitempty,string"`
1915
1916 Id string `json:"id,omitempty"`
1917
1918
1919 IsDefault bool `json:"isDefault,omitempty"`
1920
1921 IssuerCn string `json:"issuerCn,omitempty"`
1922
1923
1924
1925 Pem string `json:"pem,omitempty"`
1926
1927
1928
1929
1930
1931 Pkcs12 string `json:"pkcs12,omitempty"`
1932
1933
1934 googleapi.ServerResponse `json:"-"`
1935
1936
1937
1938
1939
1940 ForceSendFields []string `json:"-"`
1941
1942
1943
1944
1945 NullFields []string `json:"-"`
1946 }
1947
1948 func (s *SmimeInfo) MarshalJSON() ([]byte, error) {
1949 type NoMethod SmimeInfo
1950 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1951 }
1952
1953
1954 type SmtpMsa struct {
1955
1956 Host string `json:"host,omitempty"`
1957
1958
1959
1960 Password string `json:"password,omitempty"`
1961
1962 Port int64 `json:"port,omitempty"`
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973 SecurityMode string `json:"securityMode,omitempty"`
1974
1975
1976
1977 Username string `json:"username,omitempty"`
1978
1979
1980
1981
1982
1983 ForceSendFields []string `json:"-"`
1984
1985
1986
1987
1988 NullFields []string `json:"-"`
1989 }
1990
1991 func (s *SmtpMsa) MarshalJSON() ([]byte, error) {
1992 type NoMethod SmtpMsa
1993 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1994 }
1995
1996
1997 type Thread struct {
1998
1999 HistoryId uint64 `json:"historyId,omitempty,string"`
2000
2001 Id string `json:"id,omitempty"`
2002
2003 Messages []*Message `json:"messages,omitempty"`
2004
2005 Snippet string `json:"snippet,omitempty"`
2006
2007
2008 googleapi.ServerResponse `json:"-"`
2009
2010
2011
2012
2013
2014 ForceSendFields []string `json:"-"`
2015
2016
2017
2018
2019 NullFields []string `json:"-"`
2020 }
2021
2022 func (s *Thread) MarshalJSON() ([]byte, error) {
2023 type NoMethod Thread
2024 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
2025 }
2026
2027
2028
2029
2030 type VacationSettings struct {
2031
2032
2033 EnableAutoReply bool `json:"enableAutoReply,omitempty"`
2034
2035
2036
2037
2038 EndTime int64 `json:"endTime,omitempty,string"`
2039
2040
2041
2042 ResponseBodyHtml string `json:"responseBodyHtml,omitempty"`
2043
2044
2045
2046 ResponseBodyPlainText string `json:"responseBodyPlainText,omitempty"`
2047
2048
2049
2050 ResponseSubject string `json:"responseSubject,omitempty"`
2051
2052
2053 RestrictToContacts bool `json:"restrictToContacts,omitempty"`
2054
2055
2056
2057 RestrictToDomain bool `json:"restrictToDomain,omitempty"`
2058
2059
2060
2061
2062 StartTime int64 `json:"startTime,omitempty,string"`
2063
2064
2065 googleapi.ServerResponse `json:"-"`
2066
2067
2068
2069
2070
2071 ForceSendFields []string `json:"-"`
2072
2073
2074
2075
2076 NullFields []string `json:"-"`
2077 }
2078
2079 func (s *VacationSettings) MarshalJSON() ([]byte, error) {
2080 type NoMethod VacationSettings
2081 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
2082 }
2083
2084
2085
2086 type WatchRequest struct {
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096 LabelFilterAction string `json:"labelFilterAction,omitempty"`
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106 LabelFilterBehavior string `json:"labelFilterBehavior,omitempty"`
2107
2108
2109
2110 LabelIds []string `json:"labelIds,omitempty"`
2111
2112
2113
2114
2115
2116
2117
2118 TopicName string `json:"topicName,omitempty"`
2119
2120
2121
2122
2123
2124 ForceSendFields []string `json:"-"`
2125
2126
2127
2128
2129 NullFields []string `json:"-"`
2130 }
2131
2132 func (s *WatchRequest) MarshalJSON() ([]byte, error) {
2133 type NoMethod WatchRequest
2134 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
2135 }
2136
2137
2138 type WatchResponse struct {
2139
2140
2141 Expiration int64 `json:"expiration,omitempty,string"`
2142
2143 HistoryId uint64 `json:"historyId,omitempty,string"`
2144
2145
2146 googleapi.ServerResponse `json:"-"`
2147
2148
2149
2150
2151
2152 ForceSendFields []string `json:"-"`
2153
2154
2155
2156
2157 NullFields []string `json:"-"`
2158 }
2159
2160 func (s *WatchResponse) MarshalJSON() ([]byte, error) {
2161 type NoMethod WatchResponse
2162 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
2163 }
2164
2165 type UsersGetProfileCall struct {
2166 s *Service
2167 userId string
2168 urlParams_ gensupport.URLParams
2169 ifNoneMatch_ string
2170 ctx_ context.Context
2171 header_ http.Header
2172 }
2173
2174
2175
2176
2177
2178 func (r *UsersService) GetProfile(userId string) *UsersGetProfileCall {
2179 c := &UsersGetProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2180 c.userId = userId
2181 return c
2182 }
2183
2184
2185 func (c *UsersGetProfileCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersGetProfileCall {
2186 c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
2187 return c
2188 }
2189
2190
2191
2192
2193 func (c *UsersGetProfileCall) Fields(s ...googleapi.Field) *UsersGetProfileCall {
2194 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2195 return c
2196 }
2197
2198
2199
2200
2201 func (c *UsersGetProfileCall) IfNoneMatch(entityTag string) *UsersGetProfileCall {
2202 c.ifNoneMatch_ = entityTag
2203 return c
2204 }
2205
2206
2207 func (c *UsersGetProfileCall) Context(ctx context.Context) *UsersGetProfileCall {
2208 c.ctx_ = ctx
2209 return c
2210 }
2211
2212
2213
2214 func (c *UsersGetProfileCall) Header() http.Header {
2215 if c.header_ == nil {
2216 c.header_ = make(http.Header)
2217 }
2218 return c.header_
2219 }
2220
2221 func (c *UsersGetProfileCall) doRequest(alt string) (*http.Response, error) {
2222 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2223 if c.ifNoneMatch_ != "" {
2224 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2225 }
2226 var body io.Reader = nil
2227 c.urlParams_.Set("alt", alt)
2228 c.urlParams_.Set("prettyPrint", "false")
2229 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/profile")
2230 urls += "?" + c.urlParams_.Encode()
2231 req, err := http.NewRequest("GET", urls, body)
2232 if err != nil {
2233 return nil, err
2234 }
2235 req.Header = reqHeaders
2236 googleapi.Expand(req.URL, map[string]string{
2237 "userId": c.userId,
2238 })
2239 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2240 }
2241
2242
2243
2244
2245
2246
2247 func (c *UsersGetProfileCall) Do(opts ...googleapi.CallOption) (*Profile, error) {
2248 gensupport.SetOptions(c.urlParams_, opts...)
2249 res, err := c.doRequest("json")
2250 if res != nil && res.StatusCode == http.StatusNotModified {
2251 if res.Body != nil {
2252 res.Body.Close()
2253 }
2254 return nil, gensupport.WrapError(&googleapi.Error{
2255 Code: res.StatusCode,
2256 Header: res.Header,
2257 })
2258 }
2259 if err != nil {
2260 return nil, err
2261 }
2262 defer googleapi.CloseBody(res)
2263 if err := googleapi.CheckResponse(res); err != nil {
2264 return nil, gensupport.WrapError(err)
2265 }
2266 ret := &Profile{
2267 ServerResponse: googleapi.ServerResponse{
2268 Header: res.Header,
2269 HTTPStatusCode: res.StatusCode,
2270 },
2271 }
2272 target := &ret
2273 if err := gensupport.DecodeResponse(target, res); err != nil {
2274 return nil, err
2275 }
2276 return ret, nil
2277 }
2278
2279 type UsersStopCall struct {
2280 s *Service
2281 userId string
2282 urlParams_ gensupport.URLParams
2283 ctx_ context.Context
2284 header_ http.Header
2285 }
2286
2287
2288
2289
2290
2291 func (r *UsersService) Stop(userId string) *UsersStopCall {
2292 c := &UsersStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2293 c.userId = userId
2294 return c
2295 }
2296
2297
2298
2299
2300 func (c *UsersStopCall) Fields(s ...googleapi.Field) *UsersStopCall {
2301 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2302 return c
2303 }
2304
2305
2306 func (c *UsersStopCall) Context(ctx context.Context) *UsersStopCall {
2307 c.ctx_ = ctx
2308 return c
2309 }
2310
2311
2312
2313 func (c *UsersStopCall) Header() http.Header {
2314 if c.header_ == nil {
2315 c.header_ = make(http.Header)
2316 }
2317 return c.header_
2318 }
2319
2320 func (c *UsersStopCall) doRequest(alt string) (*http.Response, error) {
2321 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2322 var body io.Reader = nil
2323 c.urlParams_.Set("alt", alt)
2324 c.urlParams_.Set("prettyPrint", "false")
2325 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/stop")
2326 urls += "?" + c.urlParams_.Encode()
2327 req, err := http.NewRequest("POST", urls, body)
2328 if err != nil {
2329 return nil, err
2330 }
2331 req.Header = reqHeaders
2332 googleapi.Expand(req.URL, map[string]string{
2333 "userId": c.userId,
2334 })
2335 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2336 }
2337
2338
2339 func (c *UsersStopCall) Do(opts ...googleapi.CallOption) error {
2340 gensupport.SetOptions(c.urlParams_, opts...)
2341 res, err := c.doRequest("json")
2342 if err != nil {
2343 return err
2344 }
2345 defer googleapi.CloseBody(res)
2346 if err := googleapi.CheckResponse(res); err != nil {
2347 return gensupport.WrapError(err)
2348 }
2349 return nil
2350 }
2351
2352 type UsersWatchCall struct {
2353 s *Service
2354 userId string
2355 watchrequest *WatchRequest
2356 urlParams_ gensupport.URLParams
2357 ctx_ context.Context
2358 header_ http.Header
2359 }
2360
2361
2362
2363
2364
2365 func (r *UsersService) Watch(userId string, watchrequest *WatchRequest) *UsersWatchCall {
2366 c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2367 c.userId = userId
2368 c.watchrequest = watchrequest
2369 return c
2370 }
2371
2372
2373
2374
2375 func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall {
2376 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2377 return c
2378 }
2379
2380
2381 func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall {
2382 c.ctx_ = ctx
2383 return c
2384 }
2385
2386
2387
2388 func (c *UsersWatchCall) Header() http.Header {
2389 if c.header_ == nil {
2390 c.header_ = make(http.Header)
2391 }
2392 return c.header_
2393 }
2394
2395 func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) {
2396 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2397 var body io.Reader = nil
2398 body, err := googleapi.WithoutDataWrapper.JSONReader(c.watchrequest)
2399 if err != nil {
2400 return nil, err
2401 }
2402 c.urlParams_.Set("alt", alt)
2403 c.urlParams_.Set("prettyPrint", "false")
2404 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/watch")
2405 urls += "?" + c.urlParams_.Encode()
2406 req, err := http.NewRequest("POST", urls, body)
2407 if err != nil {
2408 return nil, err
2409 }
2410 req.Header = reqHeaders
2411 googleapi.Expand(req.URL, map[string]string{
2412 "userId": c.userId,
2413 })
2414 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2415 }
2416
2417
2418
2419
2420
2421
2422 func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*WatchResponse, error) {
2423 gensupport.SetOptions(c.urlParams_, opts...)
2424 res, err := c.doRequest("json")
2425 if res != nil && res.StatusCode == http.StatusNotModified {
2426 if res.Body != nil {
2427 res.Body.Close()
2428 }
2429 return nil, gensupport.WrapError(&googleapi.Error{
2430 Code: res.StatusCode,
2431 Header: res.Header,
2432 })
2433 }
2434 if err != nil {
2435 return nil, err
2436 }
2437 defer googleapi.CloseBody(res)
2438 if err := googleapi.CheckResponse(res); err != nil {
2439 return nil, gensupport.WrapError(err)
2440 }
2441 ret := &WatchResponse{
2442 ServerResponse: googleapi.ServerResponse{
2443 Header: res.Header,
2444 HTTPStatusCode: res.StatusCode,
2445 },
2446 }
2447 target := &ret
2448 if err := gensupport.DecodeResponse(target, res); err != nil {
2449 return nil, err
2450 }
2451 return ret, nil
2452 }
2453
2454 type UsersDraftsCreateCall struct {
2455 s *Service
2456 userId string
2457 draft *Draft
2458 urlParams_ gensupport.URLParams
2459 mediaInfo_ *gensupport.MediaInfo
2460 ctx_ context.Context
2461 header_ http.Header
2462 }
2463
2464
2465
2466
2467
2468 func (r *UsersDraftsService) Create(userId string, draft *Draft) *UsersDraftsCreateCall {
2469 c := &UsersDraftsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2470 c.userId = userId
2471 c.draft = draft
2472 return c
2473 }
2474
2475
2476
2477
2478
2479
2480
2481
2482 func (c *UsersDraftsCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsCreateCall {
2483 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
2484 return c
2485 }
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496 func (c *UsersDraftsCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsCreateCall {
2497 c.ctx_ = ctx
2498 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
2499 return c
2500 }
2501
2502
2503
2504
2505
2506 func (c *UsersDraftsCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsCreateCall {
2507 c.mediaInfo_.SetProgressUpdater(pu)
2508 return c
2509 }
2510
2511
2512
2513
2514 func (c *UsersDraftsCreateCall) Fields(s ...googleapi.Field) *UsersDraftsCreateCall {
2515 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2516 return c
2517 }
2518
2519
2520
2521
2522 func (c *UsersDraftsCreateCall) Context(ctx context.Context) *UsersDraftsCreateCall {
2523 c.ctx_ = ctx
2524 return c
2525 }
2526
2527
2528
2529 func (c *UsersDraftsCreateCall) Header() http.Header {
2530 if c.header_ == nil {
2531 c.header_ = make(http.Header)
2532 }
2533 return c.header_
2534 }
2535
2536 func (c *UsersDraftsCreateCall) doRequest(alt string) (*http.Response, error) {
2537 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2538 var body io.Reader = nil
2539 body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
2540 if err != nil {
2541 return nil, err
2542 }
2543 c.urlParams_.Set("alt", alt)
2544 c.urlParams_.Set("prettyPrint", "false")
2545 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts")
2546 if c.mediaInfo_ != nil {
2547 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts")
2548 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
2549 }
2550 if body == nil {
2551 body = new(bytes.Buffer)
2552 reqHeaders.Set("Content-Type", "application/json")
2553 }
2554 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
2555 defer cleanup()
2556 urls += "?" + c.urlParams_.Encode()
2557 req, err := http.NewRequest("POST", urls, body)
2558 if err != nil {
2559 return nil, err
2560 }
2561 req.Header = reqHeaders
2562 req.GetBody = getBody
2563 googleapi.Expand(req.URL, map[string]string{
2564 "userId": c.userId,
2565 })
2566 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2567 }
2568
2569
2570
2571
2572
2573
2574 func (c *UsersDraftsCreateCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
2575 gensupport.SetOptions(c.urlParams_, opts...)
2576 res, err := c.doRequest("json")
2577 if res != nil && res.StatusCode == http.StatusNotModified {
2578 if res.Body != nil {
2579 res.Body.Close()
2580 }
2581 return nil, gensupport.WrapError(&googleapi.Error{
2582 Code: res.StatusCode,
2583 Header: res.Header,
2584 })
2585 }
2586 if err != nil {
2587 return nil, err
2588 }
2589 defer googleapi.CloseBody(res)
2590 if err := googleapi.CheckResponse(res); err != nil {
2591 return nil, gensupport.WrapError(err)
2592 }
2593 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
2594 if rx != nil {
2595 rx.Client = c.s.client
2596 rx.UserAgent = c.s.userAgent()
2597 ctx := c.ctx_
2598 if ctx == nil {
2599 ctx = context.TODO()
2600 }
2601 res, err = rx.Upload(ctx)
2602 if err != nil {
2603 return nil, err
2604 }
2605 defer res.Body.Close()
2606 if err := googleapi.CheckResponse(res); err != nil {
2607 return nil, gensupport.WrapError(err)
2608 }
2609 }
2610 ret := &Draft{
2611 ServerResponse: googleapi.ServerResponse{
2612 Header: res.Header,
2613 HTTPStatusCode: res.StatusCode,
2614 },
2615 }
2616 target := &ret
2617 if err := gensupport.DecodeResponse(target, res); err != nil {
2618 return nil, err
2619 }
2620 return ret, nil
2621 }
2622
2623 type UsersDraftsDeleteCall struct {
2624 s *Service
2625 userId string
2626 id string
2627 urlParams_ gensupport.URLParams
2628 ctx_ context.Context
2629 header_ http.Header
2630 }
2631
2632
2633
2634
2635
2636
2637
2638 func (r *UsersDraftsService) Delete(userId string, id string) *UsersDraftsDeleteCall {
2639 c := &UsersDraftsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2640 c.userId = userId
2641 c.id = id
2642 return c
2643 }
2644
2645
2646
2647
2648 func (c *UsersDraftsDeleteCall) Fields(s ...googleapi.Field) *UsersDraftsDeleteCall {
2649 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2650 return c
2651 }
2652
2653
2654 func (c *UsersDraftsDeleteCall) Context(ctx context.Context) *UsersDraftsDeleteCall {
2655 c.ctx_ = ctx
2656 return c
2657 }
2658
2659
2660
2661 func (c *UsersDraftsDeleteCall) Header() http.Header {
2662 if c.header_ == nil {
2663 c.header_ = make(http.Header)
2664 }
2665 return c.header_
2666 }
2667
2668 func (c *UsersDraftsDeleteCall) doRequest(alt string) (*http.Response, error) {
2669 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2670 var body io.Reader = nil
2671 c.urlParams_.Set("alt", alt)
2672 c.urlParams_.Set("prettyPrint", "false")
2673 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}")
2674 urls += "?" + c.urlParams_.Encode()
2675 req, err := http.NewRequest("DELETE", urls, body)
2676 if err != nil {
2677 return nil, err
2678 }
2679 req.Header = reqHeaders
2680 googleapi.Expand(req.URL, map[string]string{
2681 "userId": c.userId,
2682 "id": c.id,
2683 })
2684 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2685 }
2686
2687
2688 func (c *UsersDraftsDeleteCall) Do(opts ...googleapi.CallOption) error {
2689 gensupport.SetOptions(c.urlParams_, opts...)
2690 res, err := c.doRequest("json")
2691 if err != nil {
2692 return err
2693 }
2694 defer googleapi.CloseBody(res)
2695 if err := googleapi.CheckResponse(res); err != nil {
2696 return gensupport.WrapError(err)
2697 }
2698 return nil
2699 }
2700
2701 type UsersDraftsGetCall struct {
2702 s *Service
2703 userId string
2704 id string
2705 urlParams_ gensupport.URLParams
2706 ifNoneMatch_ string
2707 ctx_ context.Context
2708 header_ http.Header
2709 }
2710
2711
2712
2713
2714
2715
2716 func (r *UsersDraftsService) Get(userId string, id string) *UsersDraftsGetCall {
2717 c := &UsersDraftsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2718 c.userId = userId
2719 c.id = id
2720 return c
2721 }
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743 func (c *UsersDraftsGetCall) Format(format string) *UsersDraftsGetCall {
2744 c.urlParams_.Set("format", format)
2745 return c
2746 }
2747
2748
2749
2750
2751 func (c *UsersDraftsGetCall) Fields(s ...googleapi.Field) *UsersDraftsGetCall {
2752 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2753 return c
2754 }
2755
2756
2757
2758
2759 func (c *UsersDraftsGetCall) IfNoneMatch(entityTag string) *UsersDraftsGetCall {
2760 c.ifNoneMatch_ = entityTag
2761 return c
2762 }
2763
2764
2765 func (c *UsersDraftsGetCall) Context(ctx context.Context) *UsersDraftsGetCall {
2766 c.ctx_ = ctx
2767 return c
2768 }
2769
2770
2771
2772 func (c *UsersDraftsGetCall) Header() http.Header {
2773 if c.header_ == nil {
2774 c.header_ = make(http.Header)
2775 }
2776 return c.header_
2777 }
2778
2779 func (c *UsersDraftsGetCall) doRequest(alt string) (*http.Response, error) {
2780 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2781 if c.ifNoneMatch_ != "" {
2782 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2783 }
2784 var body io.Reader = nil
2785 c.urlParams_.Set("alt", alt)
2786 c.urlParams_.Set("prettyPrint", "false")
2787 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}")
2788 urls += "?" + c.urlParams_.Encode()
2789 req, err := http.NewRequest("GET", urls, body)
2790 if err != nil {
2791 return nil, err
2792 }
2793 req.Header = reqHeaders
2794 googleapi.Expand(req.URL, map[string]string{
2795 "userId": c.userId,
2796 "id": c.id,
2797 })
2798 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2799 }
2800
2801
2802
2803
2804
2805
2806 func (c *UsersDraftsGetCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
2807 gensupport.SetOptions(c.urlParams_, opts...)
2808 res, err := c.doRequest("json")
2809 if res != nil && res.StatusCode == http.StatusNotModified {
2810 if res.Body != nil {
2811 res.Body.Close()
2812 }
2813 return nil, gensupport.WrapError(&googleapi.Error{
2814 Code: res.StatusCode,
2815 Header: res.Header,
2816 })
2817 }
2818 if err != nil {
2819 return nil, err
2820 }
2821 defer googleapi.CloseBody(res)
2822 if err := googleapi.CheckResponse(res); err != nil {
2823 return nil, gensupport.WrapError(err)
2824 }
2825 ret := &Draft{
2826 ServerResponse: googleapi.ServerResponse{
2827 Header: res.Header,
2828 HTTPStatusCode: res.StatusCode,
2829 },
2830 }
2831 target := &ret
2832 if err := gensupport.DecodeResponse(target, res); err != nil {
2833 return nil, err
2834 }
2835 return ret, nil
2836 }
2837
2838 type UsersDraftsListCall struct {
2839 s *Service
2840 userId string
2841 urlParams_ gensupport.URLParams
2842 ifNoneMatch_ string
2843 ctx_ context.Context
2844 header_ http.Header
2845 }
2846
2847
2848
2849
2850
2851 func (r *UsersDraftsService) List(userId string) *UsersDraftsListCall {
2852 c := &UsersDraftsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2853 c.userId = userId
2854 return c
2855 }
2856
2857
2858
2859 func (c *UsersDraftsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersDraftsListCall {
2860 c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
2861 return c
2862 }
2863
2864
2865
2866
2867 func (c *UsersDraftsListCall) MaxResults(maxResults int64) *UsersDraftsListCall {
2868 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
2869 return c
2870 }
2871
2872
2873
2874 func (c *UsersDraftsListCall) PageToken(pageToken string) *UsersDraftsListCall {
2875 c.urlParams_.Set("pageToken", pageToken)
2876 return c
2877 }
2878
2879
2880
2881
2882 func (c *UsersDraftsListCall) Q(q string) *UsersDraftsListCall {
2883 c.urlParams_.Set("q", q)
2884 return c
2885 }
2886
2887
2888
2889
2890 func (c *UsersDraftsListCall) Fields(s ...googleapi.Field) *UsersDraftsListCall {
2891 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2892 return c
2893 }
2894
2895
2896
2897
2898 func (c *UsersDraftsListCall) IfNoneMatch(entityTag string) *UsersDraftsListCall {
2899 c.ifNoneMatch_ = entityTag
2900 return c
2901 }
2902
2903
2904 func (c *UsersDraftsListCall) Context(ctx context.Context) *UsersDraftsListCall {
2905 c.ctx_ = ctx
2906 return c
2907 }
2908
2909
2910
2911 func (c *UsersDraftsListCall) Header() http.Header {
2912 if c.header_ == nil {
2913 c.header_ = make(http.Header)
2914 }
2915 return c.header_
2916 }
2917
2918 func (c *UsersDraftsListCall) doRequest(alt string) (*http.Response, error) {
2919 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2920 if c.ifNoneMatch_ != "" {
2921 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2922 }
2923 var body io.Reader = nil
2924 c.urlParams_.Set("alt", alt)
2925 c.urlParams_.Set("prettyPrint", "false")
2926 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts")
2927 urls += "?" + c.urlParams_.Encode()
2928 req, err := http.NewRequest("GET", urls, body)
2929 if err != nil {
2930 return nil, err
2931 }
2932 req.Header = reqHeaders
2933 googleapi.Expand(req.URL, map[string]string{
2934 "userId": c.userId,
2935 })
2936 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2937 }
2938
2939
2940
2941
2942
2943
2944
2945 func (c *UsersDraftsListCall) Do(opts ...googleapi.CallOption) (*ListDraftsResponse, error) {
2946 gensupport.SetOptions(c.urlParams_, opts...)
2947 res, err := c.doRequest("json")
2948 if res != nil && res.StatusCode == http.StatusNotModified {
2949 if res.Body != nil {
2950 res.Body.Close()
2951 }
2952 return nil, gensupport.WrapError(&googleapi.Error{
2953 Code: res.StatusCode,
2954 Header: res.Header,
2955 })
2956 }
2957 if err != nil {
2958 return nil, err
2959 }
2960 defer googleapi.CloseBody(res)
2961 if err := googleapi.CheckResponse(res); err != nil {
2962 return nil, gensupport.WrapError(err)
2963 }
2964 ret := &ListDraftsResponse{
2965 ServerResponse: googleapi.ServerResponse{
2966 Header: res.Header,
2967 HTTPStatusCode: res.StatusCode,
2968 },
2969 }
2970 target := &ret
2971 if err := gensupport.DecodeResponse(target, res); err != nil {
2972 return nil, err
2973 }
2974 return ret, nil
2975 }
2976
2977
2978
2979
2980 func (c *UsersDraftsListCall) Pages(ctx context.Context, f func(*ListDraftsResponse) error) error {
2981 c.ctx_ = ctx
2982 defer c.PageToken(c.urlParams_.Get("pageToken"))
2983 for {
2984 x, err := c.Do()
2985 if err != nil {
2986 return err
2987 }
2988 if err := f(x); err != nil {
2989 return err
2990 }
2991 if x.NextPageToken == "" {
2992 return nil
2993 }
2994 c.PageToken(x.NextPageToken)
2995 }
2996 }
2997
2998 type UsersDraftsSendCall struct {
2999 s *Service
3000 userId string
3001 draft *Draft
3002 urlParams_ gensupport.URLParams
3003 mediaInfo_ *gensupport.MediaInfo
3004 ctx_ context.Context
3005 header_ http.Header
3006 }
3007
3008
3009
3010
3011
3012
3013 func (r *UsersDraftsService) Send(userId string, draft *Draft) *UsersDraftsSendCall {
3014 c := &UsersDraftsSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3015 c.userId = userId
3016 c.draft = draft
3017 return c
3018 }
3019
3020
3021
3022
3023
3024
3025
3026
3027 func (c *UsersDraftsSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsSendCall {
3028 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
3029 return c
3030 }
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041 func (c *UsersDraftsSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsSendCall {
3042 c.ctx_ = ctx
3043 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
3044 return c
3045 }
3046
3047
3048
3049
3050
3051 func (c *UsersDraftsSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsSendCall {
3052 c.mediaInfo_.SetProgressUpdater(pu)
3053 return c
3054 }
3055
3056
3057
3058
3059 func (c *UsersDraftsSendCall) Fields(s ...googleapi.Field) *UsersDraftsSendCall {
3060 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3061 return c
3062 }
3063
3064
3065
3066
3067 func (c *UsersDraftsSendCall) Context(ctx context.Context) *UsersDraftsSendCall {
3068 c.ctx_ = ctx
3069 return c
3070 }
3071
3072
3073
3074 func (c *UsersDraftsSendCall) Header() http.Header {
3075 if c.header_ == nil {
3076 c.header_ = make(http.Header)
3077 }
3078 return c.header_
3079 }
3080
3081 func (c *UsersDraftsSendCall) doRequest(alt string) (*http.Response, error) {
3082 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3083 var body io.Reader = nil
3084 body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
3085 if err != nil {
3086 return nil, err
3087 }
3088 c.urlParams_.Set("alt", alt)
3089 c.urlParams_.Set("prettyPrint", "false")
3090 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/send")
3091 if c.mediaInfo_ != nil {
3092 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/send")
3093 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
3094 }
3095 if body == nil {
3096 body = new(bytes.Buffer)
3097 reqHeaders.Set("Content-Type", "application/json")
3098 }
3099 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
3100 defer cleanup()
3101 urls += "?" + c.urlParams_.Encode()
3102 req, err := http.NewRequest("POST", urls, body)
3103 if err != nil {
3104 return nil, err
3105 }
3106 req.Header = reqHeaders
3107 req.GetBody = getBody
3108 googleapi.Expand(req.URL, map[string]string{
3109 "userId": c.userId,
3110 })
3111 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3112 }
3113
3114
3115
3116
3117
3118
3119 func (c *UsersDraftsSendCall) Do(opts ...googleapi.CallOption) (*Message, error) {
3120 gensupport.SetOptions(c.urlParams_, opts...)
3121 res, err := c.doRequest("json")
3122 if res != nil && res.StatusCode == http.StatusNotModified {
3123 if res.Body != nil {
3124 res.Body.Close()
3125 }
3126 return nil, gensupport.WrapError(&googleapi.Error{
3127 Code: res.StatusCode,
3128 Header: res.Header,
3129 })
3130 }
3131 if err != nil {
3132 return nil, err
3133 }
3134 defer googleapi.CloseBody(res)
3135 if err := googleapi.CheckResponse(res); err != nil {
3136 return nil, gensupport.WrapError(err)
3137 }
3138 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
3139 if rx != nil {
3140 rx.Client = c.s.client
3141 rx.UserAgent = c.s.userAgent()
3142 ctx := c.ctx_
3143 if ctx == nil {
3144 ctx = context.TODO()
3145 }
3146 res, err = rx.Upload(ctx)
3147 if err != nil {
3148 return nil, err
3149 }
3150 defer res.Body.Close()
3151 if err := googleapi.CheckResponse(res); err != nil {
3152 return nil, gensupport.WrapError(err)
3153 }
3154 }
3155 ret := &Message{
3156 ServerResponse: googleapi.ServerResponse{
3157 Header: res.Header,
3158 HTTPStatusCode: res.StatusCode,
3159 },
3160 }
3161 target := &ret
3162 if err := gensupport.DecodeResponse(target, res); err != nil {
3163 return nil, err
3164 }
3165 return ret, nil
3166 }
3167
3168 type UsersDraftsUpdateCall struct {
3169 s *Service
3170 userId string
3171 id string
3172 draft *Draft
3173 urlParams_ gensupport.URLParams
3174 mediaInfo_ *gensupport.MediaInfo
3175 ctx_ context.Context
3176 header_ http.Header
3177 }
3178
3179
3180
3181
3182
3183
3184 func (r *UsersDraftsService) Update(userId string, id string, draft *Draft) *UsersDraftsUpdateCall {
3185 c := &UsersDraftsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3186 c.userId = userId
3187 c.id = id
3188 c.draft = draft
3189 return c
3190 }
3191
3192
3193
3194
3195
3196
3197
3198
3199 func (c *UsersDraftsUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsUpdateCall {
3200 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
3201 return c
3202 }
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213 func (c *UsersDraftsUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsUpdateCall {
3214 c.ctx_ = ctx
3215 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
3216 return c
3217 }
3218
3219
3220
3221
3222
3223 func (c *UsersDraftsUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsUpdateCall {
3224 c.mediaInfo_.SetProgressUpdater(pu)
3225 return c
3226 }
3227
3228
3229
3230
3231 func (c *UsersDraftsUpdateCall) Fields(s ...googleapi.Field) *UsersDraftsUpdateCall {
3232 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3233 return c
3234 }
3235
3236
3237
3238
3239 func (c *UsersDraftsUpdateCall) Context(ctx context.Context) *UsersDraftsUpdateCall {
3240 c.ctx_ = ctx
3241 return c
3242 }
3243
3244
3245
3246 func (c *UsersDraftsUpdateCall) Header() http.Header {
3247 if c.header_ == nil {
3248 c.header_ = make(http.Header)
3249 }
3250 return c.header_
3251 }
3252
3253 func (c *UsersDraftsUpdateCall) doRequest(alt string) (*http.Response, error) {
3254 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3255 var body io.Reader = nil
3256 body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
3257 if err != nil {
3258 return nil, err
3259 }
3260 c.urlParams_.Set("alt", alt)
3261 c.urlParams_.Set("prettyPrint", "false")
3262 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}")
3263 if c.mediaInfo_ != nil {
3264 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/{id}")
3265 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
3266 }
3267 if body == nil {
3268 body = new(bytes.Buffer)
3269 reqHeaders.Set("Content-Type", "application/json")
3270 }
3271 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
3272 defer cleanup()
3273 urls += "?" + c.urlParams_.Encode()
3274 req, err := http.NewRequest("PUT", urls, body)
3275 if err != nil {
3276 return nil, err
3277 }
3278 req.Header = reqHeaders
3279 req.GetBody = getBody
3280 googleapi.Expand(req.URL, map[string]string{
3281 "userId": c.userId,
3282 "id": c.id,
3283 })
3284 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3285 }
3286
3287
3288
3289
3290
3291
3292 func (c *UsersDraftsUpdateCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
3293 gensupport.SetOptions(c.urlParams_, opts...)
3294 res, err := c.doRequest("json")
3295 if res != nil && res.StatusCode == http.StatusNotModified {
3296 if res.Body != nil {
3297 res.Body.Close()
3298 }
3299 return nil, gensupport.WrapError(&googleapi.Error{
3300 Code: res.StatusCode,
3301 Header: res.Header,
3302 })
3303 }
3304 if err != nil {
3305 return nil, err
3306 }
3307 defer googleapi.CloseBody(res)
3308 if err := googleapi.CheckResponse(res); err != nil {
3309 return nil, gensupport.WrapError(err)
3310 }
3311 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
3312 if rx != nil {
3313 rx.Client = c.s.client
3314 rx.UserAgent = c.s.userAgent()
3315 ctx := c.ctx_
3316 if ctx == nil {
3317 ctx = context.TODO()
3318 }
3319 res, err = rx.Upload(ctx)
3320 if err != nil {
3321 return nil, err
3322 }
3323 defer res.Body.Close()
3324 if err := googleapi.CheckResponse(res); err != nil {
3325 return nil, gensupport.WrapError(err)
3326 }
3327 }
3328 ret := &Draft{
3329 ServerResponse: googleapi.ServerResponse{
3330 Header: res.Header,
3331 HTTPStatusCode: res.StatusCode,
3332 },
3333 }
3334 target := &ret
3335 if err := gensupport.DecodeResponse(target, res); err != nil {
3336 return nil, err
3337 }
3338 return ret, nil
3339 }
3340
3341 type UsersHistoryListCall struct {
3342 s *Service
3343 userId string
3344 urlParams_ gensupport.URLParams
3345 ifNoneMatch_ string
3346 ctx_ context.Context
3347 header_ http.Header
3348 }
3349
3350
3351
3352
3353
3354
3355 func (r *UsersHistoryService) List(userId string) *UsersHistoryListCall {
3356 c := &UsersHistoryListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3357 c.userId = userId
3358 return c
3359 }
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370 func (c *UsersHistoryListCall) HistoryTypes(historyTypes ...string) *UsersHistoryListCall {
3371 c.urlParams_.SetMulti("historyTypes", append([]string{}, historyTypes...))
3372 return c
3373 }
3374
3375
3376
3377 func (c *UsersHistoryListCall) LabelId(labelId string) *UsersHistoryListCall {
3378 c.urlParams_.Set("labelId", labelId)
3379 return c
3380 }
3381
3382
3383
3384
3385 func (c *UsersHistoryListCall) MaxResults(maxResults int64) *UsersHistoryListCall {
3386 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3387 return c
3388 }
3389
3390
3391
3392 func (c *UsersHistoryListCall) PageToken(pageToken string) *UsersHistoryListCall {
3393 c.urlParams_.Set("pageToken", pageToken)
3394 return c
3395 }
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408 func (c *UsersHistoryListCall) StartHistoryId(startHistoryId uint64) *UsersHistoryListCall {
3409 c.urlParams_.Set("startHistoryId", fmt.Sprint(startHistoryId))
3410 return c
3411 }
3412
3413
3414
3415
3416 func (c *UsersHistoryListCall) Fields(s ...googleapi.Field) *UsersHistoryListCall {
3417 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3418 return c
3419 }
3420
3421
3422
3423
3424 func (c *UsersHistoryListCall) IfNoneMatch(entityTag string) *UsersHistoryListCall {
3425 c.ifNoneMatch_ = entityTag
3426 return c
3427 }
3428
3429
3430 func (c *UsersHistoryListCall) Context(ctx context.Context) *UsersHistoryListCall {
3431 c.ctx_ = ctx
3432 return c
3433 }
3434
3435
3436
3437 func (c *UsersHistoryListCall) Header() http.Header {
3438 if c.header_ == nil {
3439 c.header_ = make(http.Header)
3440 }
3441 return c.header_
3442 }
3443
3444 func (c *UsersHistoryListCall) doRequest(alt string) (*http.Response, error) {
3445 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3446 if c.ifNoneMatch_ != "" {
3447 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3448 }
3449 var body io.Reader = nil
3450 c.urlParams_.Set("alt", alt)
3451 c.urlParams_.Set("prettyPrint", "false")
3452 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/history")
3453 urls += "?" + c.urlParams_.Encode()
3454 req, err := http.NewRequest("GET", urls, body)
3455 if err != nil {
3456 return nil, err
3457 }
3458 req.Header = reqHeaders
3459 googleapi.Expand(req.URL, map[string]string{
3460 "userId": c.userId,
3461 })
3462 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3463 }
3464
3465
3466
3467
3468
3469
3470
3471 func (c *UsersHistoryListCall) Do(opts ...googleapi.CallOption) (*ListHistoryResponse, error) {
3472 gensupport.SetOptions(c.urlParams_, opts...)
3473 res, err := c.doRequest("json")
3474 if res != nil && res.StatusCode == http.StatusNotModified {
3475 if res.Body != nil {
3476 res.Body.Close()
3477 }
3478 return nil, gensupport.WrapError(&googleapi.Error{
3479 Code: res.StatusCode,
3480 Header: res.Header,
3481 })
3482 }
3483 if err != nil {
3484 return nil, err
3485 }
3486 defer googleapi.CloseBody(res)
3487 if err := googleapi.CheckResponse(res); err != nil {
3488 return nil, gensupport.WrapError(err)
3489 }
3490 ret := &ListHistoryResponse{
3491 ServerResponse: googleapi.ServerResponse{
3492 Header: res.Header,
3493 HTTPStatusCode: res.StatusCode,
3494 },
3495 }
3496 target := &ret
3497 if err := gensupport.DecodeResponse(target, res); err != nil {
3498 return nil, err
3499 }
3500 return ret, nil
3501 }
3502
3503
3504
3505
3506 func (c *UsersHistoryListCall) Pages(ctx context.Context, f func(*ListHistoryResponse) error) error {
3507 c.ctx_ = ctx
3508 defer c.PageToken(c.urlParams_.Get("pageToken"))
3509 for {
3510 x, err := c.Do()
3511 if err != nil {
3512 return err
3513 }
3514 if err := f(x); err != nil {
3515 return err
3516 }
3517 if x.NextPageToken == "" {
3518 return nil
3519 }
3520 c.PageToken(x.NextPageToken)
3521 }
3522 }
3523
3524 type UsersLabelsCreateCall struct {
3525 s *Service
3526 userId string
3527 label *Label
3528 urlParams_ gensupport.URLParams
3529 ctx_ context.Context
3530 header_ http.Header
3531 }
3532
3533
3534
3535
3536
3537 func (r *UsersLabelsService) Create(userId string, label *Label) *UsersLabelsCreateCall {
3538 c := &UsersLabelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3539 c.userId = userId
3540 c.label = label
3541 return c
3542 }
3543
3544
3545
3546
3547 func (c *UsersLabelsCreateCall) Fields(s ...googleapi.Field) *UsersLabelsCreateCall {
3548 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3549 return c
3550 }
3551
3552
3553 func (c *UsersLabelsCreateCall) Context(ctx context.Context) *UsersLabelsCreateCall {
3554 c.ctx_ = ctx
3555 return c
3556 }
3557
3558
3559
3560 func (c *UsersLabelsCreateCall) Header() http.Header {
3561 if c.header_ == nil {
3562 c.header_ = make(http.Header)
3563 }
3564 return c.header_
3565 }
3566
3567 func (c *UsersLabelsCreateCall) doRequest(alt string) (*http.Response, error) {
3568 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3569 var body io.Reader = nil
3570 body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
3571 if err != nil {
3572 return nil, err
3573 }
3574 c.urlParams_.Set("alt", alt)
3575 c.urlParams_.Set("prettyPrint", "false")
3576 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels")
3577 urls += "?" + c.urlParams_.Encode()
3578 req, err := http.NewRequest("POST", urls, body)
3579 if err != nil {
3580 return nil, err
3581 }
3582 req.Header = reqHeaders
3583 googleapi.Expand(req.URL, map[string]string{
3584 "userId": c.userId,
3585 })
3586 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3587 }
3588
3589
3590
3591
3592
3593
3594 func (c *UsersLabelsCreateCall) Do(opts ...googleapi.CallOption) (*Label, error) {
3595 gensupport.SetOptions(c.urlParams_, opts...)
3596 res, err := c.doRequest("json")
3597 if res != nil && res.StatusCode == http.StatusNotModified {
3598 if res.Body != nil {
3599 res.Body.Close()
3600 }
3601 return nil, gensupport.WrapError(&googleapi.Error{
3602 Code: res.StatusCode,
3603 Header: res.Header,
3604 })
3605 }
3606 if err != nil {
3607 return nil, err
3608 }
3609 defer googleapi.CloseBody(res)
3610 if err := googleapi.CheckResponse(res); err != nil {
3611 return nil, gensupport.WrapError(err)
3612 }
3613 ret := &Label{
3614 ServerResponse: googleapi.ServerResponse{
3615 Header: res.Header,
3616 HTTPStatusCode: res.StatusCode,
3617 },
3618 }
3619 target := &ret
3620 if err := gensupport.DecodeResponse(target, res); err != nil {
3621 return nil, err
3622 }
3623 return ret, nil
3624 }
3625
3626 type UsersLabelsDeleteCall struct {
3627 s *Service
3628 userId string
3629 id string
3630 urlParams_ gensupport.URLParams
3631 ctx_ context.Context
3632 header_ http.Header
3633 }
3634
3635
3636
3637
3638
3639
3640
3641 func (r *UsersLabelsService) Delete(userId string, id string) *UsersLabelsDeleteCall {
3642 c := &UsersLabelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3643 c.userId = userId
3644 c.id = id
3645 return c
3646 }
3647
3648
3649
3650
3651 func (c *UsersLabelsDeleteCall) Fields(s ...googleapi.Field) *UsersLabelsDeleteCall {
3652 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3653 return c
3654 }
3655
3656
3657 func (c *UsersLabelsDeleteCall) Context(ctx context.Context) *UsersLabelsDeleteCall {
3658 c.ctx_ = ctx
3659 return c
3660 }
3661
3662
3663
3664 func (c *UsersLabelsDeleteCall) Header() http.Header {
3665 if c.header_ == nil {
3666 c.header_ = make(http.Header)
3667 }
3668 return c.header_
3669 }
3670
3671 func (c *UsersLabelsDeleteCall) doRequest(alt string) (*http.Response, error) {
3672 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3673 var body io.Reader = nil
3674 c.urlParams_.Set("alt", alt)
3675 c.urlParams_.Set("prettyPrint", "false")
3676 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
3677 urls += "?" + c.urlParams_.Encode()
3678 req, err := http.NewRequest("DELETE", urls, body)
3679 if err != nil {
3680 return nil, err
3681 }
3682 req.Header = reqHeaders
3683 googleapi.Expand(req.URL, map[string]string{
3684 "userId": c.userId,
3685 "id": c.id,
3686 })
3687 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3688 }
3689
3690
3691 func (c *UsersLabelsDeleteCall) Do(opts ...googleapi.CallOption) error {
3692 gensupport.SetOptions(c.urlParams_, opts...)
3693 res, err := c.doRequest("json")
3694 if err != nil {
3695 return err
3696 }
3697 defer googleapi.CloseBody(res)
3698 if err := googleapi.CheckResponse(res); err != nil {
3699 return gensupport.WrapError(err)
3700 }
3701 return nil
3702 }
3703
3704 type UsersLabelsGetCall struct {
3705 s *Service
3706 userId string
3707 id string
3708 urlParams_ gensupport.URLParams
3709 ifNoneMatch_ string
3710 ctx_ context.Context
3711 header_ http.Header
3712 }
3713
3714
3715
3716
3717
3718
3719 func (r *UsersLabelsService) Get(userId string, id string) *UsersLabelsGetCall {
3720 c := &UsersLabelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3721 c.userId = userId
3722 c.id = id
3723 return c
3724 }
3725
3726
3727
3728
3729 func (c *UsersLabelsGetCall) Fields(s ...googleapi.Field) *UsersLabelsGetCall {
3730 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3731 return c
3732 }
3733
3734
3735
3736
3737 func (c *UsersLabelsGetCall) IfNoneMatch(entityTag string) *UsersLabelsGetCall {
3738 c.ifNoneMatch_ = entityTag
3739 return c
3740 }
3741
3742
3743 func (c *UsersLabelsGetCall) Context(ctx context.Context) *UsersLabelsGetCall {
3744 c.ctx_ = ctx
3745 return c
3746 }
3747
3748
3749
3750 func (c *UsersLabelsGetCall) Header() http.Header {
3751 if c.header_ == nil {
3752 c.header_ = make(http.Header)
3753 }
3754 return c.header_
3755 }
3756
3757 func (c *UsersLabelsGetCall) doRequest(alt string) (*http.Response, error) {
3758 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3759 if c.ifNoneMatch_ != "" {
3760 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3761 }
3762 var body io.Reader = nil
3763 c.urlParams_.Set("alt", alt)
3764 c.urlParams_.Set("prettyPrint", "false")
3765 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
3766 urls += "?" + c.urlParams_.Encode()
3767 req, err := http.NewRequest("GET", urls, body)
3768 if err != nil {
3769 return nil, err
3770 }
3771 req.Header = reqHeaders
3772 googleapi.Expand(req.URL, map[string]string{
3773 "userId": c.userId,
3774 "id": c.id,
3775 })
3776 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3777 }
3778
3779
3780
3781
3782
3783
3784 func (c *UsersLabelsGetCall) Do(opts ...googleapi.CallOption) (*Label, error) {
3785 gensupport.SetOptions(c.urlParams_, opts...)
3786 res, err := c.doRequest("json")
3787 if res != nil && res.StatusCode == http.StatusNotModified {
3788 if res.Body != nil {
3789 res.Body.Close()
3790 }
3791 return nil, gensupport.WrapError(&googleapi.Error{
3792 Code: res.StatusCode,
3793 Header: res.Header,
3794 })
3795 }
3796 if err != nil {
3797 return nil, err
3798 }
3799 defer googleapi.CloseBody(res)
3800 if err := googleapi.CheckResponse(res); err != nil {
3801 return nil, gensupport.WrapError(err)
3802 }
3803 ret := &Label{
3804 ServerResponse: googleapi.ServerResponse{
3805 Header: res.Header,
3806 HTTPStatusCode: res.StatusCode,
3807 },
3808 }
3809 target := &ret
3810 if err := gensupport.DecodeResponse(target, res); err != nil {
3811 return nil, err
3812 }
3813 return ret, nil
3814 }
3815
3816 type UsersLabelsListCall struct {
3817 s *Service
3818 userId string
3819 urlParams_ gensupport.URLParams
3820 ifNoneMatch_ string
3821 ctx_ context.Context
3822 header_ http.Header
3823 }
3824
3825
3826
3827
3828
3829 func (r *UsersLabelsService) List(userId string) *UsersLabelsListCall {
3830 c := &UsersLabelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3831 c.userId = userId
3832 return c
3833 }
3834
3835
3836
3837
3838 func (c *UsersLabelsListCall) Fields(s ...googleapi.Field) *UsersLabelsListCall {
3839 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3840 return c
3841 }
3842
3843
3844
3845
3846 func (c *UsersLabelsListCall) IfNoneMatch(entityTag string) *UsersLabelsListCall {
3847 c.ifNoneMatch_ = entityTag
3848 return c
3849 }
3850
3851
3852 func (c *UsersLabelsListCall) Context(ctx context.Context) *UsersLabelsListCall {
3853 c.ctx_ = ctx
3854 return c
3855 }
3856
3857
3858
3859 func (c *UsersLabelsListCall) Header() http.Header {
3860 if c.header_ == nil {
3861 c.header_ = make(http.Header)
3862 }
3863 return c.header_
3864 }
3865
3866 func (c *UsersLabelsListCall) doRequest(alt string) (*http.Response, error) {
3867 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3868 if c.ifNoneMatch_ != "" {
3869 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3870 }
3871 var body io.Reader = nil
3872 c.urlParams_.Set("alt", alt)
3873 c.urlParams_.Set("prettyPrint", "false")
3874 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels")
3875 urls += "?" + c.urlParams_.Encode()
3876 req, err := http.NewRequest("GET", urls, body)
3877 if err != nil {
3878 return nil, err
3879 }
3880 req.Header = reqHeaders
3881 googleapi.Expand(req.URL, map[string]string{
3882 "userId": c.userId,
3883 })
3884 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3885 }
3886
3887
3888
3889
3890
3891
3892
3893 func (c *UsersLabelsListCall) Do(opts ...googleapi.CallOption) (*ListLabelsResponse, error) {
3894 gensupport.SetOptions(c.urlParams_, opts...)
3895 res, err := c.doRequest("json")
3896 if res != nil && res.StatusCode == http.StatusNotModified {
3897 if res.Body != nil {
3898 res.Body.Close()
3899 }
3900 return nil, gensupport.WrapError(&googleapi.Error{
3901 Code: res.StatusCode,
3902 Header: res.Header,
3903 })
3904 }
3905 if err != nil {
3906 return nil, err
3907 }
3908 defer googleapi.CloseBody(res)
3909 if err := googleapi.CheckResponse(res); err != nil {
3910 return nil, gensupport.WrapError(err)
3911 }
3912 ret := &ListLabelsResponse{
3913 ServerResponse: googleapi.ServerResponse{
3914 Header: res.Header,
3915 HTTPStatusCode: res.StatusCode,
3916 },
3917 }
3918 target := &ret
3919 if err := gensupport.DecodeResponse(target, res); err != nil {
3920 return nil, err
3921 }
3922 return ret, nil
3923 }
3924
3925 type UsersLabelsPatchCall struct {
3926 s *Service
3927 userId string
3928 id string
3929 label *Label
3930 urlParams_ gensupport.URLParams
3931 ctx_ context.Context
3932 header_ http.Header
3933 }
3934
3935
3936
3937
3938
3939
3940 func (r *UsersLabelsService) Patch(userId string, id string, label *Label) *UsersLabelsPatchCall {
3941 c := &UsersLabelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3942 c.userId = userId
3943 c.id = id
3944 c.label = label
3945 return c
3946 }
3947
3948
3949
3950
3951 func (c *UsersLabelsPatchCall) Fields(s ...googleapi.Field) *UsersLabelsPatchCall {
3952 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3953 return c
3954 }
3955
3956
3957 func (c *UsersLabelsPatchCall) Context(ctx context.Context) *UsersLabelsPatchCall {
3958 c.ctx_ = ctx
3959 return c
3960 }
3961
3962
3963
3964 func (c *UsersLabelsPatchCall) Header() http.Header {
3965 if c.header_ == nil {
3966 c.header_ = make(http.Header)
3967 }
3968 return c.header_
3969 }
3970
3971 func (c *UsersLabelsPatchCall) doRequest(alt string) (*http.Response, error) {
3972 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3973 var body io.Reader = nil
3974 body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
3975 if err != nil {
3976 return nil, err
3977 }
3978 c.urlParams_.Set("alt", alt)
3979 c.urlParams_.Set("prettyPrint", "false")
3980 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
3981 urls += "?" + c.urlParams_.Encode()
3982 req, err := http.NewRequest("PATCH", urls, body)
3983 if err != nil {
3984 return nil, err
3985 }
3986 req.Header = reqHeaders
3987 googleapi.Expand(req.URL, map[string]string{
3988 "userId": c.userId,
3989 "id": c.id,
3990 })
3991 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3992 }
3993
3994
3995
3996
3997
3998
3999 func (c *UsersLabelsPatchCall) Do(opts ...googleapi.CallOption) (*Label, error) {
4000 gensupport.SetOptions(c.urlParams_, opts...)
4001 res, err := c.doRequest("json")
4002 if res != nil && res.StatusCode == http.StatusNotModified {
4003 if res.Body != nil {
4004 res.Body.Close()
4005 }
4006 return nil, gensupport.WrapError(&googleapi.Error{
4007 Code: res.StatusCode,
4008 Header: res.Header,
4009 })
4010 }
4011 if err != nil {
4012 return nil, err
4013 }
4014 defer googleapi.CloseBody(res)
4015 if err := googleapi.CheckResponse(res); err != nil {
4016 return nil, gensupport.WrapError(err)
4017 }
4018 ret := &Label{
4019 ServerResponse: googleapi.ServerResponse{
4020 Header: res.Header,
4021 HTTPStatusCode: res.StatusCode,
4022 },
4023 }
4024 target := &ret
4025 if err := gensupport.DecodeResponse(target, res); err != nil {
4026 return nil, err
4027 }
4028 return ret, nil
4029 }
4030
4031 type UsersLabelsUpdateCall struct {
4032 s *Service
4033 userId string
4034 id string
4035 label *Label
4036 urlParams_ gensupport.URLParams
4037 ctx_ context.Context
4038 header_ http.Header
4039 }
4040
4041
4042
4043
4044
4045
4046 func (r *UsersLabelsService) Update(userId string, id string, label *Label) *UsersLabelsUpdateCall {
4047 c := &UsersLabelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4048 c.userId = userId
4049 c.id = id
4050 c.label = label
4051 return c
4052 }
4053
4054
4055
4056
4057 func (c *UsersLabelsUpdateCall) Fields(s ...googleapi.Field) *UsersLabelsUpdateCall {
4058 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4059 return c
4060 }
4061
4062
4063 func (c *UsersLabelsUpdateCall) Context(ctx context.Context) *UsersLabelsUpdateCall {
4064 c.ctx_ = ctx
4065 return c
4066 }
4067
4068
4069
4070 func (c *UsersLabelsUpdateCall) Header() http.Header {
4071 if c.header_ == nil {
4072 c.header_ = make(http.Header)
4073 }
4074 return c.header_
4075 }
4076
4077 func (c *UsersLabelsUpdateCall) doRequest(alt string) (*http.Response, error) {
4078 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4079 var body io.Reader = nil
4080 body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
4081 if err != nil {
4082 return nil, err
4083 }
4084 c.urlParams_.Set("alt", alt)
4085 c.urlParams_.Set("prettyPrint", "false")
4086 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
4087 urls += "?" + c.urlParams_.Encode()
4088 req, err := http.NewRequest("PUT", urls, body)
4089 if err != nil {
4090 return nil, err
4091 }
4092 req.Header = reqHeaders
4093 googleapi.Expand(req.URL, map[string]string{
4094 "userId": c.userId,
4095 "id": c.id,
4096 })
4097 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4098 }
4099
4100
4101
4102
4103
4104
4105 func (c *UsersLabelsUpdateCall) Do(opts ...googleapi.CallOption) (*Label, error) {
4106 gensupport.SetOptions(c.urlParams_, opts...)
4107 res, err := c.doRequest("json")
4108 if res != nil && res.StatusCode == http.StatusNotModified {
4109 if res.Body != nil {
4110 res.Body.Close()
4111 }
4112 return nil, gensupport.WrapError(&googleapi.Error{
4113 Code: res.StatusCode,
4114 Header: res.Header,
4115 })
4116 }
4117 if err != nil {
4118 return nil, err
4119 }
4120 defer googleapi.CloseBody(res)
4121 if err := googleapi.CheckResponse(res); err != nil {
4122 return nil, gensupport.WrapError(err)
4123 }
4124 ret := &Label{
4125 ServerResponse: googleapi.ServerResponse{
4126 Header: res.Header,
4127 HTTPStatusCode: res.StatusCode,
4128 },
4129 }
4130 target := &ret
4131 if err := gensupport.DecodeResponse(target, res); err != nil {
4132 return nil, err
4133 }
4134 return ret, nil
4135 }
4136
4137 type UsersMessagesBatchDeleteCall struct {
4138 s *Service
4139 userId string
4140 batchdeletemessagesrequest *BatchDeleteMessagesRequest
4141 urlParams_ gensupport.URLParams
4142 ctx_ context.Context
4143 header_ http.Header
4144 }
4145
4146
4147
4148
4149
4150
4151 func (r *UsersMessagesService) BatchDelete(userId string, batchdeletemessagesrequest *BatchDeleteMessagesRequest) *UsersMessagesBatchDeleteCall {
4152 c := &UsersMessagesBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4153 c.userId = userId
4154 c.batchdeletemessagesrequest = batchdeletemessagesrequest
4155 return c
4156 }
4157
4158
4159
4160
4161 func (c *UsersMessagesBatchDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesBatchDeleteCall {
4162 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4163 return c
4164 }
4165
4166
4167 func (c *UsersMessagesBatchDeleteCall) Context(ctx context.Context) *UsersMessagesBatchDeleteCall {
4168 c.ctx_ = ctx
4169 return c
4170 }
4171
4172
4173
4174 func (c *UsersMessagesBatchDeleteCall) Header() http.Header {
4175 if c.header_ == nil {
4176 c.header_ = make(http.Header)
4177 }
4178 return c.header_
4179 }
4180
4181 func (c *UsersMessagesBatchDeleteCall) doRequest(alt string) (*http.Response, error) {
4182 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4183 var body io.Reader = nil
4184 body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchdeletemessagesrequest)
4185 if err != nil {
4186 return nil, err
4187 }
4188 c.urlParams_.Set("alt", alt)
4189 c.urlParams_.Set("prettyPrint", "false")
4190 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/batchDelete")
4191 urls += "?" + c.urlParams_.Encode()
4192 req, err := http.NewRequest("POST", urls, body)
4193 if err != nil {
4194 return nil, err
4195 }
4196 req.Header = reqHeaders
4197 googleapi.Expand(req.URL, map[string]string{
4198 "userId": c.userId,
4199 })
4200 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4201 }
4202
4203
4204 func (c *UsersMessagesBatchDeleteCall) Do(opts ...googleapi.CallOption) error {
4205 gensupport.SetOptions(c.urlParams_, opts...)
4206 res, err := c.doRequest("json")
4207 if err != nil {
4208 return err
4209 }
4210 defer googleapi.CloseBody(res)
4211 if err := googleapi.CheckResponse(res); err != nil {
4212 return gensupport.WrapError(err)
4213 }
4214 return nil
4215 }
4216
4217 type UsersMessagesBatchModifyCall struct {
4218 s *Service
4219 userId string
4220 batchmodifymessagesrequest *BatchModifyMessagesRequest
4221 urlParams_ gensupport.URLParams
4222 ctx_ context.Context
4223 header_ http.Header
4224 }
4225
4226
4227
4228
4229
4230 func (r *UsersMessagesService) BatchModify(userId string, batchmodifymessagesrequest *BatchModifyMessagesRequest) *UsersMessagesBatchModifyCall {
4231 c := &UsersMessagesBatchModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4232 c.userId = userId
4233 c.batchmodifymessagesrequest = batchmodifymessagesrequest
4234 return c
4235 }
4236
4237
4238
4239
4240 func (c *UsersMessagesBatchModifyCall) Fields(s ...googleapi.Field) *UsersMessagesBatchModifyCall {
4241 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4242 return c
4243 }
4244
4245
4246 func (c *UsersMessagesBatchModifyCall) Context(ctx context.Context) *UsersMessagesBatchModifyCall {
4247 c.ctx_ = ctx
4248 return c
4249 }
4250
4251
4252
4253 func (c *UsersMessagesBatchModifyCall) Header() http.Header {
4254 if c.header_ == nil {
4255 c.header_ = make(http.Header)
4256 }
4257 return c.header_
4258 }
4259
4260 func (c *UsersMessagesBatchModifyCall) doRequest(alt string) (*http.Response, error) {
4261 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4262 var body io.Reader = nil
4263 body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchmodifymessagesrequest)
4264 if err != nil {
4265 return nil, err
4266 }
4267 c.urlParams_.Set("alt", alt)
4268 c.urlParams_.Set("prettyPrint", "false")
4269 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/batchModify")
4270 urls += "?" + c.urlParams_.Encode()
4271 req, err := http.NewRequest("POST", urls, body)
4272 if err != nil {
4273 return nil, err
4274 }
4275 req.Header = reqHeaders
4276 googleapi.Expand(req.URL, map[string]string{
4277 "userId": c.userId,
4278 })
4279 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4280 }
4281
4282
4283 func (c *UsersMessagesBatchModifyCall) Do(opts ...googleapi.CallOption) error {
4284 gensupport.SetOptions(c.urlParams_, opts...)
4285 res, err := c.doRequest("json")
4286 if err != nil {
4287 return err
4288 }
4289 defer googleapi.CloseBody(res)
4290 if err := googleapi.CheckResponse(res); err != nil {
4291 return gensupport.WrapError(err)
4292 }
4293 return nil
4294 }
4295
4296 type UsersMessagesDeleteCall struct {
4297 s *Service
4298 userId string
4299 id string
4300 urlParams_ gensupport.URLParams
4301 ctx_ context.Context
4302 header_ http.Header
4303 }
4304
4305
4306
4307
4308
4309
4310
4311 func (r *UsersMessagesService) Delete(userId string, id string) *UsersMessagesDeleteCall {
4312 c := &UsersMessagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4313 c.userId = userId
4314 c.id = id
4315 return c
4316 }
4317
4318
4319
4320
4321 func (c *UsersMessagesDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesDeleteCall {
4322 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4323 return c
4324 }
4325
4326
4327 func (c *UsersMessagesDeleteCall) Context(ctx context.Context) *UsersMessagesDeleteCall {
4328 c.ctx_ = ctx
4329 return c
4330 }
4331
4332
4333
4334 func (c *UsersMessagesDeleteCall) Header() http.Header {
4335 if c.header_ == nil {
4336 c.header_ = make(http.Header)
4337 }
4338 return c.header_
4339 }
4340
4341 func (c *UsersMessagesDeleteCall) doRequest(alt string) (*http.Response, error) {
4342 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
4343 var body io.Reader = nil
4344 c.urlParams_.Set("alt", alt)
4345 c.urlParams_.Set("prettyPrint", "false")
4346 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}")
4347 urls += "?" + c.urlParams_.Encode()
4348 req, err := http.NewRequest("DELETE", urls, body)
4349 if err != nil {
4350 return nil, err
4351 }
4352 req.Header = reqHeaders
4353 googleapi.Expand(req.URL, map[string]string{
4354 "userId": c.userId,
4355 "id": c.id,
4356 })
4357 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4358 }
4359
4360
4361 func (c *UsersMessagesDeleteCall) Do(opts ...googleapi.CallOption) error {
4362 gensupport.SetOptions(c.urlParams_, opts...)
4363 res, err := c.doRequest("json")
4364 if err != nil {
4365 return err
4366 }
4367 defer googleapi.CloseBody(res)
4368 if err := googleapi.CheckResponse(res); err != nil {
4369 return gensupport.WrapError(err)
4370 }
4371 return nil
4372 }
4373
4374 type UsersMessagesGetCall struct {
4375 s *Service
4376 userId string
4377 id string
4378 urlParams_ gensupport.URLParams
4379 ifNoneMatch_ string
4380 ctx_ context.Context
4381 header_ http.Header
4382 }
4383
4384
4385
4386
4387
4388
4389
4390
4391 func (r *UsersMessagesService) Get(userId string, id string) *UsersMessagesGetCall {
4392 c := &UsersMessagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4393 c.userId = userId
4394 c.id = id
4395 return c
4396 }
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418 func (c *UsersMessagesGetCall) Format(format string) *UsersMessagesGetCall {
4419 c.urlParams_.Set("format", format)
4420 return c
4421 }
4422
4423
4424
4425 func (c *UsersMessagesGetCall) MetadataHeaders(metadataHeaders ...string) *UsersMessagesGetCall {
4426 c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...))
4427 return c
4428 }
4429
4430
4431 func (c *UsersMessagesGetCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersMessagesGetCall {
4432 c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
4433 return c
4434 }
4435
4436
4437
4438
4439 func (c *UsersMessagesGetCall) Fields(s ...googleapi.Field) *UsersMessagesGetCall {
4440 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4441 return c
4442 }
4443
4444
4445
4446
4447 func (c *UsersMessagesGetCall) IfNoneMatch(entityTag string) *UsersMessagesGetCall {
4448 c.ifNoneMatch_ = entityTag
4449 return c
4450 }
4451
4452
4453 func (c *UsersMessagesGetCall) Context(ctx context.Context) *UsersMessagesGetCall {
4454 c.ctx_ = ctx
4455 return c
4456 }
4457
4458
4459
4460 func (c *UsersMessagesGetCall) Header() http.Header {
4461 if c.header_ == nil {
4462 c.header_ = make(http.Header)
4463 }
4464 return c.header_
4465 }
4466
4467 func (c *UsersMessagesGetCall) doRequest(alt string) (*http.Response, error) {
4468 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
4469 if c.ifNoneMatch_ != "" {
4470 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
4471 }
4472 var body io.Reader = nil
4473 c.urlParams_.Set("alt", alt)
4474 c.urlParams_.Set("prettyPrint", "false")
4475 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}")
4476 urls += "?" + c.urlParams_.Encode()
4477 req, err := http.NewRequest("GET", urls, body)
4478 if err != nil {
4479 return nil, err
4480 }
4481 req.Header = reqHeaders
4482 googleapi.Expand(req.URL, map[string]string{
4483 "userId": c.userId,
4484 "id": c.id,
4485 })
4486 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4487 }
4488
4489
4490
4491
4492
4493
4494 func (c *UsersMessagesGetCall) Do(opts ...googleapi.CallOption) (*Message, error) {
4495 gensupport.SetOptions(c.urlParams_, opts...)
4496 res, err := c.doRequest("json")
4497 if res != nil && res.StatusCode == http.StatusNotModified {
4498 if res.Body != nil {
4499 res.Body.Close()
4500 }
4501 return nil, gensupport.WrapError(&googleapi.Error{
4502 Code: res.StatusCode,
4503 Header: res.Header,
4504 })
4505 }
4506 if err != nil {
4507 return nil, err
4508 }
4509 defer googleapi.CloseBody(res)
4510 if err := googleapi.CheckResponse(res); err != nil {
4511 return nil, gensupport.WrapError(err)
4512 }
4513 ret := &Message{
4514 ServerResponse: googleapi.ServerResponse{
4515 Header: res.Header,
4516 HTTPStatusCode: res.StatusCode,
4517 },
4518 }
4519 target := &ret
4520 if err := gensupport.DecodeResponse(target, res); err != nil {
4521 return nil, err
4522 }
4523 return ret, nil
4524 }
4525
4526 type UsersMessagesImportCall struct {
4527 s *Service
4528 userId string
4529 message *Message
4530 urlParams_ gensupport.URLParams
4531 mediaInfo_ *gensupport.MediaInfo
4532 ctx_ context.Context
4533 header_ http.Header
4534 }
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544 func (r *UsersMessagesService) Import(userId string, message *Message) *UsersMessagesImportCall {
4545 c := &UsersMessagesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4546 c.userId = userId
4547 c.message = message
4548 return c
4549 }
4550
4551
4552
4553
4554 func (c *UsersMessagesImportCall) Deleted(deleted bool) *UsersMessagesImportCall {
4555 c.urlParams_.Set("deleted", fmt.Sprint(deleted))
4556 return c
4557 }
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571 func (c *UsersMessagesImportCall) InternalDateSource(internalDateSource string) *UsersMessagesImportCall {
4572 c.urlParams_.Set("internalDateSource", internalDateSource)
4573 return c
4574 }
4575
4576
4577
4578 func (c *UsersMessagesImportCall) NeverMarkSpam(neverMarkSpam bool) *UsersMessagesImportCall {
4579 c.urlParams_.Set("neverMarkSpam", fmt.Sprint(neverMarkSpam))
4580 return c
4581 }
4582
4583
4584
4585
4586 func (c *UsersMessagesImportCall) ProcessForCalendar(processForCalendar bool) *UsersMessagesImportCall {
4587 c.urlParams_.Set("processForCalendar", fmt.Sprint(processForCalendar))
4588 return c
4589 }
4590
4591
4592
4593
4594
4595
4596
4597
4598 func (c *UsersMessagesImportCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesImportCall {
4599 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
4600 return c
4601 }
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612 func (c *UsersMessagesImportCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesImportCall {
4613 c.ctx_ = ctx
4614 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
4615 return c
4616 }
4617
4618
4619
4620
4621
4622 func (c *UsersMessagesImportCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesImportCall {
4623 c.mediaInfo_.SetProgressUpdater(pu)
4624 return c
4625 }
4626
4627
4628
4629
4630 func (c *UsersMessagesImportCall) Fields(s ...googleapi.Field) *UsersMessagesImportCall {
4631 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4632 return c
4633 }
4634
4635
4636
4637
4638 func (c *UsersMessagesImportCall) Context(ctx context.Context) *UsersMessagesImportCall {
4639 c.ctx_ = ctx
4640 return c
4641 }
4642
4643
4644
4645 func (c *UsersMessagesImportCall) Header() http.Header {
4646 if c.header_ == nil {
4647 c.header_ = make(http.Header)
4648 }
4649 return c.header_
4650 }
4651
4652 func (c *UsersMessagesImportCall) doRequest(alt string) (*http.Response, error) {
4653 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4654 var body io.Reader = nil
4655 body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
4656 if err != nil {
4657 return nil, err
4658 }
4659 c.urlParams_.Set("alt", alt)
4660 c.urlParams_.Set("prettyPrint", "false")
4661 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/import")
4662 if c.mediaInfo_ != nil {
4663 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages/import")
4664 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
4665 }
4666 if body == nil {
4667 body = new(bytes.Buffer)
4668 reqHeaders.Set("Content-Type", "application/json")
4669 }
4670 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
4671 defer cleanup()
4672 urls += "?" + c.urlParams_.Encode()
4673 req, err := http.NewRequest("POST", urls, body)
4674 if err != nil {
4675 return nil, err
4676 }
4677 req.Header = reqHeaders
4678 req.GetBody = getBody
4679 googleapi.Expand(req.URL, map[string]string{
4680 "userId": c.userId,
4681 })
4682 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4683 }
4684
4685
4686
4687
4688
4689
4690 func (c *UsersMessagesImportCall) Do(opts ...googleapi.CallOption) (*Message, error) {
4691 gensupport.SetOptions(c.urlParams_, opts...)
4692 res, err := c.doRequest("json")
4693 if res != nil && res.StatusCode == http.StatusNotModified {
4694 if res.Body != nil {
4695 res.Body.Close()
4696 }
4697 return nil, gensupport.WrapError(&googleapi.Error{
4698 Code: res.StatusCode,
4699 Header: res.Header,
4700 })
4701 }
4702 if err != nil {
4703 return nil, err
4704 }
4705 defer googleapi.CloseBody(res)
4706 if err := googleapi.CheckResponse(res); err != nil {
4707 return nil, gensupport.WrapError(err)
4708 }
4709 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
4710 if rx != nil {
4711 rx.Client = c.s.client
4712 rx.UserAgent = c.s.userAgent()
4713 ctx := c.ctx_
4714 if ctx == nil {
4715 ctx = context.TODO()
4716 }
4717 res, err = rx.Upload(ctx)
4718 if err != nil {
4719 return nil, err
4720 }
4721 defer res.Body.Close()
4722 if err := googleapi.CheckResponse(res); err != nil {
4723 return nil, gensupport.WrapError(err)
4724 }
4725 }
4726 ret := &Message{
4727 ServerResponse: googleapi.ServerResponse{
4728 Header: res.Header,
4729 HTTPStatusCode: res.StatusCode,
4730 },
4731 }
4732 target := &ret
4733 if err := gensupport.DecodeResponse(target, res); err != nil {
4734 return nil, err
4735 }
4736 return ret, nil
4737 }
4738
4739 type UsersMessagesInsertCall struct {
4740 s *Service
4741 userId string
4742 message *Message
4743 urlParams_ gensupport.URLParams
4744 mediaInfo_ *gensupport.MediaInfo
4745 ctx_ context.Context
4746 header_ http.Header
4747 }
4748
4749
4750
4751
4752
4753
4754
4755 func (r *UsersMessagesService) Insert(userId string, message *Message) *UsersMessagesInsertCall {
4756 c := &UsersMessagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4757 c.userId = userId
4758 c.message = message
4759 return c
4760 }
4761
4762
4763
4764
4765 func (c *UsersMessagesInsertCall) Deleted(deleted bool) *UsersMessagesInsertCall {
4766 c.urlParams_.Set("deleted", fmt.Sprint(deleted))
4767 return c
4768 }
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782 func (c *UsersMessagesInsertCall) InternalDateSource(internalDateSource string) *UsersMessagesInsertCall {
4783 c.urlParams_.Set("internalDateSource", internalDateSource)
4784 return c
4785 }
4786
4787
4788
4789
4790
4791
4792
4793
4794 func (c *UsersMessagesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesInsertCall {
4795 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
4796 return c
4797 }
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808 func (c *UsersMessagesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesInsertCall {
4809 c.ctx_ = ctx
4810 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
4811 return c
4812 }
4813
4814
4815
4816
4817
4818 func (c *UsersMessagesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesInsertCall {
4819 c.mediaInfo_.SetProgressUpdater(pu)
4820 return c
4821 }
4822
4823
4824
4825
4826 func (c *UsersMessagesInsertCall) Fields(s ...googleapi.Field) *UsersMessagesInsertCall {
4827 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4828 return c
4829 }
4830
4831
4832
4833
4834 func (c *UsersMessagesInsertCall) Context(ctx context.Context) *UsersMessagesInsertCall {
4835 c.ctx_ = ctx
4836 return c
4837 }
4838
4839
4840
4841 func (c *UsersMessagesInsertCall) Header() http.Header {
4842 if c.header_ == nil {
4843 c.header_ = make(http.Header)
4844 }
4845 return c.header_
4846 }
4847
4848 func (c *UsersMessagesInsertCall) doRequest(alt string) (*http.Response, error) {
4849 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4850 var body io.Reader = nil
4851 body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
4852 if err != nil {
4853 return nil, err
4854 }
4855 c.urlParams_.Set("alt", alt)
4856 c.urlParams_.Set("prettyPrint", "false")
4857 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages")
4858 if c.mediaInfo_ != nil {
4859 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages")
4860 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
4861 }
4862 if body == nil {
4863 body = new(bytes.Buffer)
4864 reqHeaders.Set("Content-Type", "application/json")
4865 }
4866 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
4867 defer cleanup()
4868 urls += "?" + c.urlParams_.Encode()
4869 req, err := http.NewRequest("POST", urls, body)
4870 if err != nil {
4871 return nil, err
4872 }
4873 req.Header = reqHeaders
4874 req.GetBody = getBody
4875 googleapi.Expand(req.URL, map[string]string{
4876 "userId": c.userId,
4877 })
4878 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4879 }
4880
4881
4882
4883
4884
4885
4886 func (c *UsersMessagesInsertCall) Do(opts ...googleapi.CallOption) (*Message, error) {
4887 gensupport.SetOptions(c.urlParams_, opts...)
4888 res, err := c.doRequest("json")
4889 if res != nil && res.StatusCode == http.StatusNotModified {
4890 if res.Body != nil {
4891 res.Body.Close()
4892 }
4893 return nil, gensupport.WrapError(&googleapi.Error{
4894 Code: res.StatusCode,
4895 Header: res.Header,
4896 })
4897 }
4898 if err != nil {
4899 return nil, err
4900 }
4901 defer googleapi.CloseBody(res)
4902 if err := googleapi.CheckResponse(res); err != nil {
4903 return nil, gensupport.WrapError(err)
4904 }
4905 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
4906 if rx != nil {
4907 rx.Client = c.s.client
4908 rx.UserAgent = c.s.userAgent()
4909 ctx := c.ctx_
4910 if ctx == nil {
4911 ctx = context.TODO()
4912 }
4913 res, err = rx.Upload(ctx)
4914 if err != nil {
4915 return nil, err
4916 }
4917 defer res.Body.Close()
4918 if err := googleapi.CheckResponse(res); err != nil {
4919 return nil, gensupport.WrapError(err)
4920 }
4921 }
4922 ret := &Message{
4923 ServerResponse: googleapi.ServerResponse{
4924 Header: res.Header,
4925 HTTPStatusCode: res.StatusCode,
4926 },
4927 }
4928 target := &ret
4929 if err := gensupport.DecodeResponse(target, res); err != nil {
4930 return nil, err
4931 }
4932 return ret, nil
4933 }
4934
4935 type UsersMessagesListCall struct {
4936 s *Service
4937 userId string
4938 urlParams_ gensupport.URLParams
4939 ifNoneMatch_ string
4940 ctx_ context.Context
4941 header_ http.Header
4942 }
4943
4944
4945
4946
4947
4948 func (r *UsersMessagesService) List(userId string) *UsersMessagesListCall {
4949 c := &UsersMessagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4950 c.userId = userId
4951 return c
4952 }
4953
4954
4955
4956 func (c *UsersMessagesListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersMessagesListCall {
4957 c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
4958 return c
4959 }
4960
4961
4962
4963
4964
4965
4966 func (c *UsersMessagesListCall) LabelIds(labelIds ...string) *UsersMessagesListCall {
4967 c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...))
4968 return c
4969 }
4970
4971
4972
4973
4974 func (c *UsersMessagesListCall) MaxResults(maxResults int64) *UsersMessagesListCall {
4975 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
4976 return c
4977 }
4978
4979
4980
4981 func (c *UsersMessagesListCall) PageToken(pageToken string) *UsersMessagesListCall {
4982 c.urlParams_.Set("pageToken", pageToken)
4983 return c
4984 }
4985
4986
4987
4988
4989
4990 func (c *UsersMessagesListCall) Q(q string) *UsersMessagesListCall {
4991 c.urlParams_.Set("q", q)
4992 return c
4993 }
4994
4995
4996 func (c *UsersMessagesListCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersMessagesListCall {
4997 c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
4998 return c
4999 }
5000
5001
5002
5003
5004 func (c *UsersMessagesListCall) Fields(s ...googleapi.Field) *UsersMessagesListCall {
5005 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5006 return c
5007 }
5008
5009
5010
5011
5012 func (c *UsersMessagesListCall) IfNoneMatch(entityTag string) *UsersMessagesListCall {
5013 c.ifNoneMatch_ = entityTag
5014 return c
5015 }
5016
5017
5018 func (c *UsersMessagesListCall) Context(ctx context.Context) *UsersMessagesListCall {
5019 c.ctx_ = ctx
5020 return c
5021 }
5022
5023
5024
5025 func (c *UsersMessagesListCall) Header() http.Header {
5026 if c.header_ == nil {
5027 c.header_ = make(http.Header)
5028 }
5029 return c.header_
5030 }
5031
5032 func (c *UsersMessagesListCall) doRequest(alt string) (*http.Response, error) {
5033 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5034 if c.ifNoneMatch_ != "" {
5035 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5036 }
5037 var body io.Reader = nil
5038 c.urlParams_.Set("alt", alt)
5039 c.urlParams_.Set("prettyPrint", "false")
5040 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages")
5041 urls += "?" + c.urlParams_.Encode()
5042 req, err := http.NewRequest("GET", urls, body)
5043 if err != nil {
5044 return nil, err
5045 }
5046 req.Header = reqHeaders
5047 googleapi.Expand(req.URL, map[string]string{
5048 "userId": c.userId,
5049 })
5050 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5051 }
5052
5053
5054
5055
5056
5057
5058
5059 func (c *UsersMessagesListCall) Do(opts ...googleapi.CallOption) (*ListMessagesResponse, error) {
5060 gensupport.SetOptions(c.urlParams_, opts...)
5061 res, err := c.doRequest("json")
5062 if res != nil && res.StatusCode == http.StatusNotModified {
5063 if res.Body != nil {
5064 res.Body.Close()
5065 }
5066 return nil, gensupport.WrapError(&googleapi.Error{
5067 Code: res.StatusCode,
5068 Header: res.Header,
5069 })
5070 }
5071 if err != nil {
5072 return nil, err
5073 }
5074 defer googleapi.CloseBody(res)
5075 if err := googleapi.CheckResponse(res); err != nil {
5076 return nil, gensupport.WrapError(err)
5077 }
5078 ret := &ListMessagesResponse{
5079 ServerResponse: googleapi.ServerResponse{
5080 Header: res.Header,
5081 HTTPStatusCode: res.StatusCode,
5082 },
5083 }
5084 target := &ret
5085 if err := gensupport.DecodeResponse(target, res); err != nil {
5086 return nil, err
5087 }
5088 return ret, nil
5089 }
5090
5091
5092
5093
5094 func (c *UsersMessagesListCall) Pages(ctx context.Context, f func(*ListMessagesResponse) error) error {
5095 c.ctx_ = ctx
5096 defer c.PageToken(c.urlParams_.Get("pageToken"))
5097 for {
5098 x, err := c.Do()
5099 if err != nil {
5100 return err
5101 }
5102 if err := f(x); err != nil {
5103 return err
5104 }
5105 if x.NextPageToken == "" {
5106 return nil
5107 }
5108 c.PageToken(x.NextPageToken)
5109 }
5110 }
5111
5112 type UsersMessagesModifyCall struct {
5113 s *Service
5114 userId string
5115 id string
5116 modifymessagerequest *ModifyMessageRequest
5117 urlParams_ gensupport.URLParams
5118 ctx_ context.Context
5119 header_ http.Header
5120 }
5121
5122
5123
5124
5125
5126
5127 func (r *UsersMessagesService) Modify(userId string, id string, modifymessagerequest *ModifyMessageRequest) *UsersMessagesModifyCall {
5128 c := &UsersMessagesModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5129 c.userId = userId
5130 c.id = id
5131 c.modifymessagerequest = modifymessagerequest
5132 return c
5133 }
5134
5135
5136
5137
5138 func (c *UsersMessagesModifyCall) Fields(s ...googleapi.Field) *UsersMessagesModifyCall {
5139 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5140 return c
5141 }
5142
5143
5144 func (c *UsersMessagesModifyCall) Context(ctx context.Context) *UsersMessagesModifyCall {
5145 c.ctx_ = ctx
5146 return c
5147 }
5148
5149
5150
5151 func (c *UsersMessagesModifyCall) Header() http.Header {
5152 if c.header_ == nil {
5153 c.header_ = make(http.Header)
5154 }
5155 return c.header_
5156 }
5157
5158 func (c *UsersMessagesModifyCall) doRequest(alt string) (*http.Response, error) {
5159 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
5160 var body io.Reader = nil
5161 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifymessagerequest)
5162 if err != nil {
5163 return nil, err
5164 }
5165 c.urlParams_.Set("alt", alt)
5166 c.urlParams_.Set("prettyPrint", "false")
5167 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/modify")
5168 urls += "?" + c.urlParams_.Encode()
5169 req, err := http.NewRequest("POST", urls, body)
5170 if err != nil {
5171 return nil, err
5172 }
5173 req.Header = reqHeaders
5174 googleapi.Expand(req.URL, map[string]string{
5175 "userId": c.userId,
5176 "id": c.id,
5177 })
5178 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5179 }
5180
5181
5182
5183
5184
5185
5186 func (c *UsersMessagesModifyCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5187 gensupport.SetOptions(c.urlParams_, opts...)
5188 res, err := c.doRequest("json")
5189 if res != nil && res.StatusCode == http.StatusNotModified {
5190 if res.Body != nil {
5191 res.Body.Close()
5192 }
5193 return nil, gensupport.WrapError(&googleapi.Error{
5194 Code: res.StatusCode,
5195 Header: res.Header,
5196 })
5197 }
5198 if err != nil {
5199 return nil, err
5200 }
5201 defer googleapi.CloseBody(res)
5202 if err := googleapi.CheckResponse(res); err != nil {
5203 return nil, gensupport.WrapError(err)
5204 }
5205 ret := &Message{
5206 ServerResponse: googleapi.ServerResponse{
5207 Header: res.Header,
5208 HTTPStatusCode: res.StatusCode,
5209 },
5210 }
5211 target := &ret
5212 if err := gensupport.DecodeResponse(target, res); err != nil {
5213 return nil, err
5214 }
5215 return ret, nil
5216 }
5217
5218 type UsersMessagesSendCall struct {
5219 s *Service
5220 userId string
5221 message *Message
5222 urlParams_ gensupport.URLParams
5223 mediaInfo_ *gensupport.MediaInfo
5224 ctx_ context.Context
5225 header_ http.Header
5226 }
5227
5228
5229
5230
5231
5232
5233
5234 func (r *UsersMessagesService) Send(userId string, message *Message) *UsersMessagesSendCall {
5235 c := &UsersMessagesSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5236 c.userId = userId
5237 c.message = message
5238 return c
5239 }
5240
5241
5242
5243
5244
5245
5246
5247
5248 func (c *UsersMessagesSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesSendCall {
5249 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
5250 return c
5251 }
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262 func (c *UsersMessagesSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesSendCall {
5263 c.ctx_ = ctx
5264 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
5265 return c
5266 }
5267
5268
5269
5270
5271
5272 func (c *UsersMessagesSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesSendCall {
5273 c.mediaInfo_.SetProgressUpdater(pu)
5274 return c
5275 }
5276
5277
5278
5279
5280 func (c *UsersMessagesSendCall) Fields(s ...googleapi.Field) *UsersMessagesSendCall {
5281 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5282 return c
5283 }
5284
5285
5286
5287
5288 func (c *UsersMessagesSendCall) Context(ctx context.Context) *UsersMessagesSendCall {
5289 c.ctx_ = ctx
5290 return c
5291 }
5292
5293
5294
5295 func (c *UsersMessagesSendCall) Header() http.Header {
5296 if c.header_ == nil {
5297 c.header_ = make(http.Header)
5298 }
5299 return c.header_
5300 }
5301
5302 func (c *UsersMessagesSendCall) doRequest(alt string) (*http.Response, error) {
5303 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
5304 var body io.Reader = nil
5305 body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
5306 if err != nil {
5307 return nil, err
5308 }
5309 c.urlParams_.Set("alt", alt)
5310 c.urlParams_.Set("prettyPrint", "false")
5311 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/send")
5312 if c.mediaInfo_ != nil {
5313 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages/send")
5314 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
5315 }
5316 if body == nil {
5317 body = new(bytes.Buffer)
5318 reqHeaders.Set("Content-Type", "application/json")
5319 }
5320 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
5321 defer cleanup()
5322 urls += "?" + c.urlParams_.Encode()
5323 req, err := http.NewRequest("POST", urls, body)
5324 if err != nil {
5325 return nil, err
5326 }
5327 req.Header = reqHeaders
5328 req.GetBody = getBody
5329 googleapi.Expand(req.URL, map[string]string{
5330 "userId": c.userId,
5331 })
5332 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5333 }
5334
5335
5336
5337
5338
5339
5340 func (c *UsersMessagesSendCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5341 gensupport.SetOptions(c.urlParams_, opts...)
5342 res, err := c.doRequest("json")
5343 if res != nil && res.StatusCode == http.StatusNotModified {
5344 if res.Body != nil {
5345 res.Body.Close()
5346 }
5347 return nil, gensupport.WrapError(&googleapi.Error{
5348 Code: res.StatusCode,
5349 Header: res.Header,
5350 })
5351 }
5352 if err != nil {
5353 return nil, err
5354 }
5355 defer googleapi.CloseBody(res)
5356 if err := googleapi.CheckResponse(res); err != nil {
5357 return nil, gensupport.WrapError(err)
5358 }
5359 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
5360 if rx != nil {
5361 rx.Client = c.s.client
5362 rx.UserAgent = c.s.userAgent()
5363 ctx := c.ctx_
5364 if ctx == nil {
5365 ctx = context.TODO()
5366 }
5367 res, err = rx.Upload(ctx)
5368 if err != nil {
5369 return nil, err
5370 }
5371 defer res.Body.Close()
5372 if err := googleapi.CheckResponse(res); err != nil {
5373 return nil, gensupport.WrapError(err)
5374 }
5375 }
5376 ret := &Message{
5377 ServerResponse: googleapi.ServerResponse{
5378 Header: res.Header,
5379 HTTPStatusCode: res.StatusCode,
5380 },
5381 }
5382 target := &ret
5383 if err := gensupport.DecodeResponse(target, res); err != nil {
5384 return nil, err
5385 }
5386 return ret, nil
5387 }
5388
5389 type UsersMessagesTrashCall struct {
5390 s *Service
5391 userId string
5392 id string
5393 urlParams_ gensupport.URLParams
5394 ctx_ context.Context
5395 header_ http.Header
5396 }
5397
5398
5399
5400
5401
5402
5403 func (r *UsersMessagesService) Trash(userId string, id string) *UsersMessagesTrashCall {
5404 c := &UsersMessagesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5405 c.userId = userId
5406 c.id = id
5407 return c
5408 }
5409
5410
5411
5412
5413 func (c *UsersMessagesTrashCall) Fields(s ...googleapi.Field) *UsersMessagesTrashCall {
5414 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5415 return c
5416 }
5417
5418
5419 func (c *UsersMessagesTrashCall) Context(ctx context.Context) *UsersMessagesTrashCall {
5420 c.ctx_ = ctx
5421 return c
5422 }
5423
5424
5425
5426 func (c *UsersMessagesTrashCall) Header() http.Header {
5427 if c.header_ == nil {
5428 c.header_ = make(http.Header)
5429 }
5430 return c.header_
5431 }
5432
5433 func (c *UsersMessagesTrashCall) doRequest(alt string) (*http.Response, error) {
5434 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5435 var body io.Reader = nil
5436 c.urlParams_.Set("alt", alt)
5437 c.urlParams_.Set("prettyPrint", "false")
5438 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/trash")
5439 urls += "?" + c.urlParams_.Encode()
5440 req, err := http.NewRequest("POST", urls, body)
5441 if err != nil {
5442 return nil, err
5443 }
5444 req.Header = reqHeaders
5445 googleapi.Expand(req.URL, map[string]string{
5446 "userId": c.userId,
5447 "id": c.id,
5448 })
5449 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5450 }
5451
5452
5453
5454
5455
5456
5457 func (c *UsersMessagesTrashCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5458 gensupport.SetOptions(c.urlParams_, opts...)
5459 res, err := c.doRequest("json")
5460 if res != nil && res.StatusCode == http.StatusNotModified {
5461 if res.Body != nil {
5462 res.Body.Close()
5463 }
5464 return nil, gensupport.WrapError(&googleapi.Error{
5465 Code: res.StatusCode,
5466 Header: res.Header,
5467 })
5468 }
5469 if err != nil {
5470 return nil, err
5471 }
5472 defer googleapi.CloseBody(res)
5473 if err := googleapi.CheckResponse(res); err != nil {
5474 return nil, gensupport.WrapError(err)
5475 }
5476 ret := &Message{
5477 ServerResponse: googleapi.ServerResponse{
5478 Header: res.Header,
5479 HTTPStatusCode: res.StatusCode,
5480 },
5481 }
5482 target := &ret
5483 if err := gensupport.DecodeResponse(target, res); err != nil {
5484 return nil, err
5485 }
5486 return ret, nil
5487 }
5488
5489 type UsersMessagesUntrashCall struct {
5490 s *Service
5491 userId string
5492 id string
5493 urlParams_ gensupport.URLParams
5494 ctx_ context.Context
5495 header_ http.Header
5496 }
5497
5498
5499
5500
5501
5502
5503 func (r *UsersMessagesService) Untrash(userId string, id string) *UsersMessagesUntrashCall {
5504 c := &UsersMessagesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5505 c.userId = userId
5506 c.id = id
5507 return c
5508 }
5509
5510
5511
5512
5513 func (c *UsersMessagesUntrashCall) Fields(s ...googleapi.Field) *UsersMessagesUntrashCall {
5514 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5515 return c
5516 }
5517
5518
5519 func (c *UsersMessagesUntrashCall) Context(ctx context.Context) *UsersMessagesUntrashCall {
5520 c.ctx_ = ctx
5521 return c
5522 }
5523
5524
5525
5526 func (c *UsersMessagesUntrashCall) Header() http.Header {
5527 if c.header_ == nil {
5528 c.header_ = make(http.Header)
5529 }
5530 return c.header_
5531 }
5532
5533 func (c *UsersMessagesUntrashCall) doRequest(alt string) (*http.Response, error) {
5534 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5535 var body io.Reader = nil
5536 c.urlParams_.Set("alt", alt)
5537 c.urlParams_.Set("prettyPrint", "false")
5538 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/untrash")
5539 urls += "?" + c.urlParams_.Encode()
5540 req, err := http.NewRequest("POST", urls, body)
5541 if err != nil {
5542 return nil, err
5543 }
5544 req.Header = reqHeaders
5545 googleapi.Expand(req.URL, map[string]string{
5546 "userId": c.userId,
5547 "id": c.id,
5548 })
5549 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5550 }
5551
5552
5553
5554
5555
5556
5557 func (c *UsersMessagesUntrashCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5558 gensupport.SetOptions(c.urlParams_, opts...)
5559 res, err := c.doRequest("json")
5560 if res != nil && res.StatusCode == http.StatusNotModified {
5561 if res.Body != nil {
5562 res.Body.Close()
5563 }
5564 return nil, gensupport.WrapError(&googleapi.Error{
5565 Code: res.StatusCode,
5566 Header: res.Header,
5567 })
5568 }
5569 if err != nil {
5570 return nil, err
5571 }
5572 defer googleapi.CloseBody(res)
5573 if err := googleapi.CheckResponse(res); err != nil {
5574 return nil, gensupport.WrapError(err)
5575 }
5576 ret := &Message{
5577 ServerResponse: googleapi.ServerResponse{
5578 Header: res.Header,
5579 HTTPStatusCode: res.StatusCode,
5580 },
5581 }
5582 target := &ret
5583 if err := gensupport.DecodeResponse(target, res); err != nil {
5584 return nil, err
5585 }
5586 return ret, nil
5587 }
5588
5589 type UsersMessagesAttachmentsGetCall struct {
5590 s *Service
5591 userId string
5592 messageId string
5593 id string
5594 urlParams_ gensupport.URLParams
5595 ifNoneMatch_ string
5596 ctx_ context.Context
5597 header_ http.Header
5598 }
5599
5600
5601
5602
5603
5604
5605
5606 func (r *UsersMessagesAttachmentsService) Get(userId string, messageId string, id string) *UsersMessagesAttachmentsGetCall {
5607 c := &UsersMessagesAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5608 c.userId = userId
5609 c.messageId = messageId
5610 c.id = id
5611 return c
5612 }
5613
5614
5615 func (c *UsersMessagesAttachmentsGetCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersMessagesAttachmentsGetCall {
5616 c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
5617 return c
5618 }
5619
5620
5621
5622
5623 func (c *UsersMessagesAttachmentsGetCall) Fields(s ...googleapi.Field) *UsersMessagesAttachmentsGetCall {
5624 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5625 return c
5626 }
5627
5628
5629
5630
5631 func (c *UsersMessagesAttachmentsGetCall) IfNoneMatch(entityTag string) *UsersMessagesAttachmentsGetCall {
5632 c.ifNoneMatch_ = entityTag
5633 return c
5634 }
5635
5636
5637 func (c *UsersMessagesAttachmentsGetCall) Context(ctx context.Context) *UsersMessagesAttachmentsGetCall {
5638 c.ctx_ = ctx
5639 return c
5640 }
5641
5642
5643
5644 func (c *UsersMessagesAttachmentsGetCall) Header() http.Header {
5645 if c.header_ == nil {
5646 c.header_ = make(http.Header)
5647 }
5648 return c.header_
5649 }
5650
5651 func (c *UsersMessagesAttachmentsGetCall) doRequest(alt string) (*http.Response, error) {
5652 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5653 if c.ifNoneMatch_ != "" {
5654 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5655 }
5656 var body io.Reader = nil
5657 c.urlParams_.Set("alt", alt)
5658 c.urlParams_.Set("prettyPrint", "false")
5659 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}")
5660 urls += "?" + c.urlParams_.Encode()
5661 req, err := http.NewRequest("GET", urls, body)
5662 if err != nil {
5663 return nil, err
5664 }
5665 req.Header = reqHeaders
5666 googleapi.Expand(req.URL, map[string]string{
5667 "userId": c.userId,
5668 "messageId": c.messageId,
5669 "id": c.id,
5670 })
5671 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5672 }
5673
5674
5675
5676
5677
5678
5679
5680 func (c *UsersMessagesAttachmentsGetCall) Do(opts ...googleapi.CallOption) (*MessagePartBody, error) {
5681 gensupport.SetOptions(c.urlParams_, opts...)
5682 res, err := c.doRequest("json")
5683 if res != nil && res.StatusCode == http.StatusNotModified {
5684 if res.Body != nil {
5685 res.Body.Close()
5686 }
5687 return nil, gensupport.WrapError(&googleapi.Error{
5688 Code: res.StatusCode,
5689 Header: res.Header,
5690 })
5691 }
5692 if err != nil {
5693 return nil, err
5694 }
5695 defer googleapi.CloseBody(res)
5696 if err := googleapi.CheckResponse(res); err != nil {
5697 return nil, gensupport.WrapError(err)
5698 }
5699 ret := &MessagePartBody{
5700 ServerResponse: googleapi.ServerResponse{
5701 Header: res.Header,
5702 HTTPStatusCode: res.StatusCode,
5703 },
5704 }
5705 target := &ret
5706 if err := gensupport.DecodeResponse(target, res); err != nil {
5707 return nil, err
5708 }
5709 return ret, nil
5710 }
5711
5712 type UsersSettingsGetAutoForwardingCall struct {
5713 s *Service
5714 userId string
5715 urlParams_ gensupport.URLParams
5716 ifNoneMatch_ string
5717 ctx_ context.Context
5718 header_ http.Header
5719 }
5720
5721
5722
5723
5724
5725
5726 func (r *UsersSettingsService) GetAutoForwarding(userId string) *UsersSettingsGetAutoForwardingCall {
5727 c := &UsersSettingsGetAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5728 c.userId = userId
5729 return c
5730 }
5731
5732
5733
5734
5735 func (c *UsersSettingsGetAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsGetAutoForwardingCall {
5736 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5737 return c
5738 }
5739
5740
5741
5742
5743 func (c *UsersSettingsGetAutoForwardingCall) IfNoneMatch(entityTag string) *UsersSettingsGetAutoForwardingCall {
5744 c.ifNoneMatch_ = entityTag
5745 return c
5746 }
5747
5748
5749 func (c *UsersSettingsGetAutoForwardingCall) Context(ctx context.Context) *UsersSettingsGetAutoForwardingCall {
5750 c.ctx_ = ctx
5751 return c
5752 }
5753
5754
5755
5756 func (c *UsersSettingsGetAutoForwardingCall) Header() http.Header {
5757 if c.header_ == nil {
5758 c.header_ = make(http.Header)
5759 }
5760 return c.header_
5761 }
5762
5763 func (c *UsersSettingsGetAutoForwardingCall) doRequest(alt string) (*http.Response, error) {
5764 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5765 if c.ifNoneMatch_ != "" {
5766 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5767 }
5768 var body io.Reader = nil
5769 c.urlParams_.Set("alt", alt)
5770 c.urlParams_.Set("prettyPrint", "false")
5771 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/autoForwarding")
5772 urls += "?" + c.urlParams_.Encode()
5773 req, err := http.NewRequest("GET", urls, body)
5774 if err != nil {
5775 return nil, err
5776 }
5777 req.Header = reqHeaders
5778 googleapi.Expand(req.URL, map[string]string{
5779 "userId": c.userId,
5780 })
5781 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5782 }
5783
5784
5785
5786
5787
5788
5789 func (c *UsersSettingsGetAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) {
5790 gensupport.SetOptions(c.urlParams_, opts...)
5791 res, err := c.doRequest("json")
5792 if res != nil && res.StatusCode == http.StatusNotModified {
5793 if res.Body != nil {
5794 res.Body.Close()
5795 }
5796 return nil, gensupport.WrapError(&googleapi.Error{
5797 Code: res.StatusCode,
5798 Header: res.Header,
5799 })
5800 }
5801 if err != nil {
5802 return nil, err
5803 }
5804 defer googleapi.CloseBody(res)
5805 if err := googleapi.CheckResponse(res); err != nil {
5806 return nil, gensupport.WrapError(err)
5807 }
5808 ret := &AutoForwarding{
5809 ServerResponse: googleapi.ServerResponse{
5810 Header: res.Header,
5811 HTTPStatusCode: res.StatusCode,
5812 },
5813 }
5814 target := &ret
5815 if err := gensupport.DecodeResponse(target, res); err != nil {
5816 return nil, err
5817 }
5818 return ret, nil
5819 }
5820
5821 type UsersSettingsGetImapCall struct {
5822 s *Service
5823 userId string
5824 urlParams_ gensupport.URLParams
5825 ifNoneMatch_ string
5826 ctx_ context.Context
5827 header_ http.Header
5828 }
5829
5830
5831
5832
5833
5834 func (r *UsersSettingsService) GetImap(userId string) *UsersSettingsGetImapCall {
5835 c := &UsersSettingsGetImapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5836 c.userId = userId
5837 return c
5838 }
5839
5840
5841
5842
5843 func (c *UsersSettingsGetImapCall) Fields(s ...googleapi.Field) *UsersSettingsGetImapCall {
5844 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5845 return c
5846 }
5847
5848
5849
5850
5851 func (c *UsersSettingsGetImapCall) IfNoneMatch(entityTag string) *UsersSettingsGetImapCall {
5852 c.ifNoneMatch_ = entityTag
5853 return c
5854 }
5855
5856
5857 func (c *UsersSettingsGetImapCall) Context(ctx context.Context) *UsersSettingsGetImapCall {
5858 c.ctx_ = ctx
5859 return c
5860 }
5861
5862
5863
5864 func (c *UsersSettingsGetImapCall) Header() http.Header {
5865 if c.header_ == nil {
5866 c.header_ = make(http.Header)
5867 }
5868 return c.header_
5869 }
5870
5871 func (c *UsersSettingsGetImapCall) doRequest(alt string) (*http.Response, error) {
5872 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5873 if c.ifNoneMatch_ != "" {
5874 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5875 }
5876 var body io.Reader = nil
5877 c.urlParams_.Set("alt", alt)
5878 c.urlParams_.Set("prettyPrint", "false")
5879 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/imap")
5880 urls += "?" + c.urlParams_.Encode()
5881 req, err := http.NewRequest("GET", urls, body)
5882 if err != nil {
5883 return nil, err
5884 }
5885 req.Header = reqHeaders
5886 googleapi.Expand(req.URL, map[string]string{
5887 "userId": c.userId,
5888 })
5889 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5890 }
5891
5892
5893
5894
5895
5896
5897 func (c *UsersSettingsGetImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) {
5898 gensupport.SetOptions(c.urlParams_, opts...)
5899 res, err := c.doRequest("json")
5900 if res != nil && res.StatusCode == http.StatusNotModified {
5901 if res.Body != nil {
5902 res.Body.Close()
5903 }
5904 return nil, gensupport.WrapError(&googleapi.Error{
5905 Code: res.StatusCode,
5906 Header: res.Header,
5907 })
5908 }
5909 if err != nil {
5910 return nil, err
5911 }
5912 defer googleapi.CloseBody(res)
5913 if err := googleapi.CheckResponse(res); err != nil {
5914 return nil, gensupport.WrapError(err)
5915 }
5916 ret := &ImapSettings{
5917 ServerResponse: googleapi.ServerResponse{
5918 Header: res.Header,
5919 HTTPStatusCode: res.StatusCode,
5920 },
5921 }
5922 target := &ret
5923 if err := gensupport.DecodeResponse(target, res); err != nil {
5924 return nil, err
5925 }
5926 return ret, nil
5927 }
5928
5929 type UsersSettingsGetLanguageCall struct {
5930 s *Service
5931 userId string
5932 urlParams_ gensupport.URLParams
5933 ifNoneMatch_ string
5934 ctx_ context.Context
5935 header_ http.Header
5936 }
5937
5938
5939
5940
5941
5942 func (r *UsersSettingsService) GetLanguage(userId string) *UsersSettingsGetLanguageCall {
5943 c := &UsersSettingsGetLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5944 c.userId = userId
5945 return c
5946 }
5947
5948
5949
5950
5951 func (c *UsersSettingsGetLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsGetLanguageCall {
5952 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5953 return c
5954 }
5955
5956
5957
5958
5959 func (c *UsersSettingsGetLanguageCall) IfNoneMatch(entityTag string) *UsersSettingsGetLanguageCall {
5960 c.ifNoneMatch_ = entityTag
5961 return c
5962 }
5963
5964
5965 func (c *UsersSettingsGetLanguageCall) Context(ctx context.Context) *UsersSettingsGetLanguageCall {
5966 c.ctx_ = ctx
5967 return c
5968 }
5969
5970
5971
5972 func (c *UsersSettingsGetLanguageCall) Header() http.Header {
5973 if c.header_ == nil {
5974 c.header_ = make(http.Header)
5975 }
5976 return c.header_
5977 }
5978
5979 func (c *UsersSettingsGetLanguageCall) doRequest(alt string) (*http.Response, error) {
5980 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5981 if c.ifNoneMatch_ != "" {
5982 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5983 }
5984 var body io.Reader = nil
5985 c.urlParams_.Set("alt", alt)
5986 c.urlParams_.Set("prettyPrint", "false")
5987 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/language")
5988 urls += "?" + c.urlParams_.Encode()
5989 req, err := http.NewRequest("GET", urls, body)
5990 if err != nil {
5991 return nil, err
5992 }
5993 req.Header = reqHeaders
5994 googleapi.Expand(req.URL, map[string]string{
5995 "userId": c.userId,
5996 })
5997 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5998 }
5999
6000
6001
6002
6003
6004
6005
6006 func (c *UsersSettingsGetLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) {
6007 gensupport.SetOptions(c.urlParams_, opts...)
6008 res, err := c.doRequest("json")
6009 if res != nil && res.StatusCode == http.StatusNotModified {
6010 if res.Body != nil {
6011 res.Body.Close()
6012 }
6013 return nil, gensupport.WrapError(&googleapi.Error{
6014 Code: res.StatusCode,
6015 Header: res.Header,
6016 })
6017 }
6018 if err != nil {
6019 return nil, err
6020 }
6021 defer googleapi.CloseBody(res)
6022 if err := googleapi.CheckResponse(res); err != nil {
6023 return nil, gensupport.WrapError(err)
6024 }
6025 ret := &LanguageSettings{
6026 ServerResponse: googleapi.ServerResponse{
6027 Header: res.Header,
6028 HTTPStatusCode: res.StatusCode,
6029 },
6030 }
6031 target := &ret
6032 if err := gensupport.DecodeResponse(target, res); err != nil {
6033 return nil, err
6034 }
6035 return ret, nil
6036 }
6037
6038 type UsersSettingsGetPopCall struct {
6039 s *Service
6040 userId string
6041 urlParams_ gensupport.URLParams
6042 ifNoneMatch_ string
6043 ctx_ context.Context
6044 header_ http.Header
6045 }
6046
6047
6048
6049
6050
6051 func (r *UsersSettingsService) GetPop(userId string) *UsersSettingsGetPopCall {
6052 c := &UsersSettingsGetPopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6053 c.userId = userId
6054 return c
6055 }
6056
6057
6058
6059
6060 func (c *UsersSettingsGetPopCall) Fields(s ...googleapi.Field) *UsersSettingsGetPopCall {
6061 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6062 return c
6063 }
6064
6065
6066
6067
6068 func (c *UsersSettingsGetPopCall) IfNoneMatch(entityTag string) *UsersSettingsGetPopCall {
6069 c.ifNoneMatch_ = entityTag
6070 return c
6071 }
6072
6073
6074 func (c *UsersSettingsGetPopCall) Context(ctx context.Context) *UsersSettingsGetPopCall {
6075 c.ctx_ = ctx
6076 return c
6077 }
6078
6079
6080
6081 func (c *UsersSettingsGetPopCall) Header() http.Header {
6082 if c.header_ == nil {
6083 c.header_ = make(http.Header)
6084 }
6085 return c.header_
6086 }
6087
6088 func (c *UsersSettingsGetPopCall) doRequest(alt string) (*http.Response, error) {
6089 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6090 if c.ifNoneMatch_ != "" {
6091 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6092 }
6093 var body io.Reader = nil
6094 c.urlParams_.Set("alt", alt)
6095 c.urlParams_.Set("prettyPrint", "false")
6096 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/pop")
6097 urls += "?" + c.urlParams_.Encode()
6098 req, err := http.NewRequest("GET", urls, body)
6099 if err != nil {
6100 return nil, err
6101 }
6102 req.Header = reqHeaders
6103 googleapi.Expand(req.URL, map[string]string{
6104 "userId": c.userId,
6105 })
6106 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6107 }
6108
6109
6110
6111
6112
6113
6114 func (c *UsersSettingsGetPopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) {
6115 gensupport.SetOptions(c.urlParams_, opts...)
6116 res, err := c.doRequest("json")
6117 if res != nil && res.StatusCode == http.StatusNotModified {
6118 if res.Body != nil {
6119 res.Body.Close()
6120 }
6121 return nil, gensupport.WrapError(&googleapi.Error{
6122 Code: res.StatusCode,
6123 Header: res.Header,
6124 })
6125 }
6126 if err != nil {
6127 return nil, err
6128 }
6129 defer googleapi.CloseBody(res)
6130 if err := googleapi.CheckResponse(res); err != nil {
6131 return nil, gensupport.WrapError(err)
6132 }
6133 ret := &PopSettings{
6134 ServerResponse: googleapi.ServerResponse{
6135 Header: res.Header,
6136 HTTPStatusCode: res.StatusCode,
6137 },
6138 }
6139 target := &ret
6140 if err := gensupport.DecodeResponse(target, res); err != nil {
6141 return nil, err
6142 }
6143 return ret, nil
6144 }
6145
6146 type UsersSettingsGetVacationCall struct {
6147 s *Service
6148 userId string
6149 urlParams_ gensupport.URLParams
6150 ifNoneMatch_ string
6151 ctx_ context.Context
6152 header_ http.Header
6153 }
6154
6155
6156
6157
6158
6159 func (r *UsersSettingsService) GetVacation(userId string) *UsersSettingsGetVacationCall {
6160 c := &UsersSettingsGetVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6161 c.userId = userId
6162 return c
6163 }
6164
6165
6166
6167
6168 func (c *UsersSettingsGetVacationCall) Fields(s ...googleapi.Field) *UsersSettingsGetVacationCall {
6169 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6170 return c
6171 }
6172
6173
6174
6175
6176 func (c *UsersSettingsGetVacationCall) IfNoneMatch(entityTag string) *UsersSettingsGetVacationCall {
6177 c.ifNoneMatch_ = entityTag
6178 return c
6179 }
6180
6181
6182 func (c *UsersSettingsGetVacationCall) Context(ctx context.Context) *UsersSettingsGetVacationCall {
6183 c.ctx_ = ctx
6184 return c
6185 }
6186
6187
6188
6189 func (c *UsersSettingsGetVacationCall) Header() http.Header {
6190 if c.header_ == nil {
6191 c.header_ = make(http.Header)
6192 }
6193 return c.header_
6194 }
6195
6196 func (c *UsersSettingsGetVacationCall) doRequest(alt string) (*http.Response, error) {
6197 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6198 if c.ifNoneMatch_ != "" {
6199 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6200 }
6201 var body io.Reader = nil
6202 c.urlParams_.Set("alt", alt)
6203 c.urlParams_.Set("prettyPrint", "false")
6204 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/vacation")
6205 urls += "?" + c.urlParams_.Encode()
6206 req, err := http.NewRequest("GET", urls, body)
6207 if err != nil {
6208 return nil, err
6209 }
6210 req.Header = reqHeaders
6211 googleapi.Expand(req.URL, map[string]string{
6212 "userId": c.userId,
6213 })
6214 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6215 }
6216
6217
6218
6219
6220
6221
6222
6223 func (c *UsersSettingsGetVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) {
6224 gensupport.SetOptions(c.urlParams_, opts...)
6225 res, err := c.doRequest("json")
6226 if res != nil && res.StatusCode == http.StatusNotModified {
6227 if res.Body != nil {
6228 res.Body.Close()
6229 }
6230 return nil, gensupport.WrapError(&googleapi.Error{
6231 Code: res.StatusCode,
6232 Header: res.Header,
6233 })
6234 }
6235 if err != nil {
6236 return nil, err
6237 }
6238 defer googleapi.CloseBody(res)
6239 if err := googleapi.CheckResponse(res); err != nil {
6240 return nil, gensupport.WrapError(err)
6241 }
6242 ret := &VacationSettings{
6243 ServerResponse: googleapi.ServerResponse{
6244 Header: res.Header,
6245 HTTPStatusCode: res.StatusCode,
6246 },
6247 }
6248 target := &ret
6249 if err := gensupport.DecodeResponse(target, res); err != nil {
6250 return nil, err
6251 }
6252 return ret, nil
6253 }
6254
6255 type UsersSettingsUpdateAutoForwardingCall struct {
6256 s *Service
6257 userId string
6258 autoforwarding *AutoForwarding
6259 urlParams_ gensupport.URLParams
6260 ctx_ context.Context
6261 header_ http.Header
6262 }
6263
6264
6265
6266
6267
6268
6269
6270
6271 func (r *UsersSettingsService) UpdateAutoForwarding(userId string, autoforwarding *AutoForwarding) *UsersSettingsUpdateAutoForwardingCall {
6272 c := &UsersSettingsUpdateAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6273 c.userId = userId
6274 c.autoforwarding = autoforwarding
6275 return c
6276 }
6277
6278
6279
6280
6281 func (c *UsersSettingsUpdateAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateAutoForwardingCall {
6282 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6283 return c
6284 }
6285
6286
6287 func (c *UsersSettingsUpdateAutoForwardingCall) Context(ctx context.Context) *UsersSettingsUpdateAutoForwardingCall {
6288 c.ctx_ = ctx
6289 return c
6290 }
6291
6292
6293
6294 func (c *UsersSettingsUpdateAutoForwardingCall) Header() http.Header {
6295 if c.header_ == nil {
6296 c.header_ = make(http.Header)
6297 }
6298 return c.header_
6299 }
6300
6301 func (c *UsersSettingsUpdateAutoForwardingCall) doRequest(alt string) (*http.Response, error) {
6302 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6303 var body io.Reader = nil
6304 body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoforwarding)
6305 if err != nil {
6306 return nil, err
6307 }
6308 c.urlParams_.Set("alt", alt)
6309 c.urlParams_.Set("prettyPrint", "false")
6310 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/autoForwarding")
6311 urls += "?" + c.urlParams_.Encode()
6312 req, err := http.NewRequest("PUT", urls, body)
6313 if err != nil {
6314 return nil, err
6315 }
6316 req.Header = reqHeaders
6317 googleapi.Expand(req.URL, map[string]string{
6318 "userId": c.userId,
6319 })
6320 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6321 }
6322
6323
6324
6325
6326
6327
6328 func (c *UsersSettingsUpdateAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) {
6329 gensupport.SetOptions(c.urlParams_, opts...)
6330 res, err := c.doRequest("json")
6331 if res != nil && res.StatusCode == http.StatusNotModified {
6332 if res.Body != nil {
6333 res.Body.Close()
6334 }
6335 return nil, gensupport.WrapError(&googleapi.Error{
6336 Code: res.StatusCode,
6337 Header: res.Header,
6338 })
6339 }
6340 if err != nil {
6341 return nil, err
6342 }
6343 defer googleapi.CloseBody(res)
6344 if err := googleapi.CheckResponse(res); err != nil {
6345 return nil, gensupport.WrapError(err)
6346 }
6347 ret := &AutoForwarding{
6348 ServerResponse: googleapi.ServerResponse{
6349 Header: res.Header,
6350 HTTPStatusCode: res.StatusCode,
6351 },
6352 }
6353 target := &ret
6354 if err := gensupport.DecodeResponse(target, res); err != nil {
6355 return nil, err
6356 }
6357 return ret, nil
6358 }
6359
6360 type UsersSettingsUpdateImapCall struct {
6361 s *Service
6362 userId string
6363 imapsettings *ImapSettings
6364 urlParams_ gensupport.URLParams
6365 ctx_ context.Context
6366 header_ http.Header
6367 }
6368
6369
6370
6371
6372
6373 func (r *UsersSettingsService) UpdateImap(userId string, imapsettings *ImapSettings) *UsersSettingsUpdateImapCall {
6374 c := &UsersSettingsUpdateImapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6375 c.userId = userId
6376 c.imapsettings = imapsettings
6377 return c
6378 }
6379
6380
6381
6382
6383 func (c *UsersSettingsUpdateImapCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateImapCall {
6384 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6385 return c
6386 }
6387
6388
6389 func (c *UsersSettingsUpdateImapCall) Context(ctx context.Context) *UsersSettingsUpdateImapCall {
6390 c.ctx_ = ctx
6391 return c
6392 }
6393
6394
6395
6396 func (c *UsersSettingsUpdateImapCall) Header() http.Header {
6397 if c.header_ == nil {
6398 c.header_ = make(http.Header)
6399 }
6400 return c.header_
6401 }
6402
6403 func (c *UsersSettingsUpdateImapCall) doRequest(alt string) (*http.Response, error) {
6404 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6405 var body io.Reader = nil
6406 body, err := googleapi.WithoutDataWrapper.JSONReader(c.imapsettings)
6407 if err != nil {
6408 return nil, err
6409 }
6410 c.urlParams_.Set("alt", alt)
6411 c.urlParams_.Set("prettyPrint", "false")
6412 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/imap")
6413 urls += "?" + c.urlParams_.Encode()
6414 req, err := http.NewRequest("PUT", urls, body)
6415 if err != nil {
6416 return nil, err
6417 }
6418 req.Header = reqHeaders
6419 googleapi.Expand(req.URL, map[string]string{
6420 "userId": c.userId,
6421 })
6422 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6423 }
6424
6425
6426
6427
6428
6429
6430 func (c *UsersSettingsUpdateImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) {
6431 gensupport.SetOptions(c.urlParams_, opts...)
6432 res, err := c.doRequest("json")
6433 if res != nil && res.StatusCode == http.StatusNotModified {
6434 if res.Body != nil {
6435 res.Body.Close()
6436 }
6437 return nil, gensupport.WrapError(&googleapi.Error{
6438 Code: res.StatusCode,
6439 Header: res.Header,
6440 })
6441 }
6442 if err != nil {
6443 return nil, err
6444 }
6445 defer googleapi.CloseBody(res)
6446 if err := googleapi.CheckResponse(res); err != nil {
6447 return nil, gensupport.WrapError(err)
6448 }
6449 ret := &ImapSettings{
6450 ServerResponse: googleapi.ServerResponse{
6451 Header: res.Header,
6452 HTTPStatusCode: res.StatusCode,
6453 },
6454 }
6455 target := &ret
6456 if err := gensupport.DecodeResponse(target, res); err != nil {
6457 return nil, err
6458 }
6459 return ret, nil
6460 }
6461
6462 type UsersSettingsUpdateLanguageCall struct {
6463 s *Service
6464 userId string
6465 languagesettings *LanguageSettings
6466 urlParams_ gensupport.URLParams
6467 ctx_ context.Context
6468 header_ http.Header
6469 }
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479 func (r *UsersSettingsService) UpdateLanguage(userId string, languagesettings *LanguageSettings) *UsersSettingsUpdateLanguageCall {
6480 c := &UsersSettingsUpdateLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6481 c.userId = userId
6482 c.languagesettings = languagesettings
6483 return c
6484 }
6485
6486
6487
6488
6489 func (c *UsersSettingsUpdateLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateLanguageCall {
6490 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6491 return c
6492 }
6493
6494
6495 func (c *UsersSettingsUpdateLanguageCall) Context(ctx context.Context) *UsersSettingsUpdateLanguageCall {
6496 c.ctx_ = ctx
6497 return c
6498 }
6499
6500
6501
6502 func (c *UsersSettingsUpdateLanguageCall) Header() http.Header {
6503 if c.header_ == nil {
6504 c.header_ = make(http.Header)
6505 }
6506 return c.header_
6507 }
6508
6509 func (c *UsersSettingsUpdateLanguageCall) doRequest(alt string) (*http.Response, error) {
6510 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6511 var body io.Reader = nil
6512 body, err := googleapi.WithoutDataWrapper.JSONReader(c.languagesettings)
6513 if err != nil {
6514 return nil, err
6515 }
6516 c.urlParams_.Set("alt", alt)
6517 c.urlParams_.Set("prettyPrint", "false")
6518 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/language")
6519 urls += "?" + c.urlParams_.Encode()
6520 req, err := http.NewRequest("PUT", urls, body)
6521 if err != nil {
6522 return nil, err
6523 }
6524 req.Header = reqHeaders
6525 googleapi.Expand(req.URL, map[string]string{
6526 "userId": c.userId,
6527 })
6528 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6529 }
6530
6531
6532
6533
6534
6535
6536
6537 func (c *UsersSettingsUpdateLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) {
6538 gensupport.SetOptions(c.urlParams_, opts...)
6539 res, err := c.doRequest("json")
6540 if res != nil && res.StatusCode == http.StatusNotModified {
6541 if res.Body != nil {
6542 res.Body.Close()
6543 }
6544 return nil, gensupport.WrapError(&googleapi.Error{
6545 Code: res.StatusCode,
6546 Header: res.Header,
6547 })
6548 }
6549 if err != nil {
6550 return nil, err
6551 }
6552 defer googleapi.CloseBody(res)
6553 if err := googleapi.CheckResponse(res); err != nil {
6554 return nil, gensupport.WrapError(err)
6555 }
6556 ret := &LanguageSettings{
6557 ServerResponse: googleapi.ServerResponse{
6558 Header: res.Header,
6559 HTTPStatusCode: res.StatusCode,
6560 },
6561 }
6562 target := &ret
6563 if err := gensupport.DecodeResponse(target, res); err != nil {
6564 return nil, err
6565 }
6566 return ret, nil
6567 }
6568
6569 type UsersSettingsUpdatePopCall struct {
6570 s *Service
6571 userId string
6572 popsettings *PopSettings
6573 urlParams_ gensupport.URLParams
6574 ctx_ context.Context
6575 header_ http.Header
6576 }
6577
6578
6579
6580
6581
6582 func (r *UsersSettingsService) UpdatePop(userId string, popsettings *PopSettings) *UsersSettingsUpdatePopCall {
6583 c := &UsersSettingsUpdatePopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6584 c.userId = userId
6585 c.popsettings = popsettings
6586 return c
6587 }
6588
6589
6590
6591
6592 func (c *UsersSettingsUpdatePopCall) Fields(s ...googleapi.Field) *UsersSettingsUpdatePopCall {
6593 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6594 return c
6595 }
6596
6597
6598 func (c *UsersSettingsUpdatePopCall) Context(ctx context.Context) *UsersSettingsUpdatePopCall {
6599 c.ctx_ = ctx
6600 return c
6601 }
6602
6603
6604
6605 func (c *UsersSettingsUpdatePopCall) Header() http.Header {
6606 if c.header_ == nil {
6607 c.header_ = make(http.Header)
6608 }
6609 return c.header_
6610 }
6611
6612 func (c *UsersSettingsUpdatePopCall) doRequest(alt string) (*http.Response, error) {
6613 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6614 var body io.Reader = nil
6615 body, err := googleapi.WithoutDataWrapper.JSONReader(c.popsettings)
6616 if err != nil {
6617 return nil, err
6618 }
6619 c.urlParams_.Set("alt", alt)
6620 c.urlParams_.Set("prettyPrint", "false")
6621 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/pop")
6622 urls += "?" + c.urlParams_.Encode()
6623 req, err := http.NewRequest("PUT", urls, body)
6624 if err != nil {
6625 return nil, err
6626 }
6627 req.Header = reqHeaders
6628 googleapi.Expand(req.URL, map[string]string{
6629 "userId": c.userId,
6630 })
6631 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6632 }
6633
6634
6635
6636
6637
6638
6639 func (c *UsersSettingsUpdatePopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) {
6640 gensupport.SetOptions(c.urlParams_, opts...)
6641 res, err := c.doRequest("json")
6642 if res != nil && res.StatusCode == http.StatusNotModified {
6643 if res.Body != nil {
6644 res.Body.Close()
6645 }
6646 return nil, gensupport.WrapError(&googleapi.Error{
6647 Code: res.StatusCode,
6648 Header: res.Header,
6649 })
6650 }
6651 if err != nil {
6652 return nil, err
6653 }
6654 defer googleapi.CloseBody(res)
6655 if err := googleapi.CheckResponse(res); err != nil {
6656 return nil, gensupport.WrapError(err)
6657 }
6658 ret := &PopSettings{
6659 ServerResponse: googleapi.ServerResponse{
6660 Header: res.Header,
6661 HTTPStatusCode: res.StatusCode,
6662 },
6663 }
6664 target := &ret
6665 if err := gensupport.DecodeResponse(target, res); err != nil {
6666 return nil, err
6667 }
6668 return ret, nil
6669 }
6670
6671 type UsersSettingsUpdateVacationCall struct {
6672 s *Service
6673 userId string
6674 vacationsettings *VacationSettings
6675 urlParams_ gensupport.URLParams
6676 ctx_ context.Context
6677 header_ http.Header
6678 }
6679
6680
6681
6682
6683
6684 func (r *UsersSettingsService) UpdateVacation(userId string, vacationsettings *VacationSettings) *UsersSettingsUpdateVacationCall {
6685 c := &UsersSettingsUpdateVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6686 c.userId = userId
6687 c.vacationsettings = vacationsettings
6688 return c
6689 }
6690
6691
6692
6693
6694 func (c *UsersSettingsUpdateVacationCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateVacationCall {
6695 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6696 return c
6697 }
6698
6699
6700 func (c *UsersSettingsUpdateVacationCall) Context(ctx context.Context) *UsersSettingsUpdateVacationCall {
6701 c.ctx_ = ctx
6702 return c
6703 }
6704
6705
6706
6707 func (c *UsersSettingsUpdateVacationCall) Header() http.Header {
6708 if c.header_ == nil {
6709 c.header_ = make(http.Header)
6710 }
6711 return c.header_
6712 }
6713
6714 func (c *UsersSettingsUpdateVacationCall) doRequest(alt string) (*http.Response, error) {
6715 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6716 var body io.Reader = nil
6717 body, err := googleapi.WithoutDataWrapper.JSONReader(c.vacationsettings)
6718 if err != nil {
6719 return nil, err
6720 }
6721 c.urlParams_.Set("alt", alt)
6722 c.urlParams_.Set("prettyPrint", "false")
6723 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/vacation")
6724 urls += "?" + c.urlParams_.Encode()
6725 req, err := http.NewRequest("PUT", urls, body)
6726 if err != nil {
6727 return nil, err
6728 }
6729 req.Header = reqHeaders
6730 googleapi.Expand(req.URL, map[string]string{
6731 "userId": c.userId,
6732 })
6733 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6734 }
6735
6736
6737
6738
6739
6740
6741
6742 func (c *UsersSettingsUpdateVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) {
6743 gensupport.SetOptions(c.urlParams_, opts...)
6744 res, err := c.doRequest("json")
6745 if res != nil && res.StatusCode == http.StatusNotModified {
6746 if res.Body != nil {
6747 res.Body.Close()
6748 }
6749 return nil, gensupport.WrapError(&googleapi.Error{
6750 Code: res.StatusCode,
6751 Header: res.Header,
6752 })
6753 }
6754 if err != nil {
6755 return nil, err
6756 }
6757 defer googleapi.CloseBody(res)
6758 if err := googleapi.CheckResponse(res); err != nil {
6759 return nil, gensupport.WrapError(err)
6760 }
6761 ret := &VacationSettings{
6762 ServerResponse: googleapi.ServerResponse{
6763 Header: res.Header,
6764 HTTPStatusCode: res.StatusCode,
6765 },
6766 }
6767 target := &ret
6768 if err := gensupport.DecodeResponse(target, res); err != nil {
6769 return nil, err
6770 }
6771 return ret, nil
6772 }
6773
6774 type UsersSettingsCseIdentitiesCreateCall struct {
6775 s *Service
6776 userId string
6777 cseidentity *CseIdentity
6778 urlParams_ gensupport.URLParams
6779 ctx_ context.Context
6780 header_ http.Header
6781 }
6782
6783
6784
6785
6786
6787
6788
6789
6790 func (r *UsersSettingsCseIdentitiesService) Create(userId string, cseidentity *CseIdentity) *UsersSettingsCseIdentitiesCreateCall {
6791 c := &UsersSettingsCseIdentitiesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6792 c.userId = userId
6793 c.cseidentity = cseidentity
6794 return c
6795 }
6796
6797
6798
6799
6800 func (c *UsersSettingsCseIdentitiesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesCreateCall {
6801 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6802 return c
6803 }
6804
6805
6806 func (c *UsersSettingsCseIdentitiesCreateCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesCreateCall {
6807 c.ctx_ = ctx
6808 return c
6809 }
6810
6811
6812
6813 func (c *UsersSettingsCseIdentitiesCreateCall) Header() http.Header {
6814 if c.header_ == nil {
6815 c.header_ = make(http.Header)
6816 }
6817 return c.header_
6818 }
6819
6820 func (c *UsersSettingsCseIdentitiesCreateCall) doRequest(alt string) (*http.Response, error) {
6821 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6822 var body io.Reader = nil
6823 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cseidentity)
6824 if err != nil {
6825 return nil, err
6826 }
6827 c.urlParams_.Set("alt", alt)
6828 c.urlParams_.Set("prettyPrint", "false")
6829 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities")
6830 urls += "?" + c.urlParams_.Encode()
6831 req, err := http.NewRequest("POST", urls, body)
6832 if err != nil {
6833 return nil, err
6834 }
6835 req.Header = reqHeaders
6836 googleapi.Expand(req.URL, map[string]string{
6837 "userId": c.userId,
6838 })
6839 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6840 }
6841
6842
6843
6844
6845
6846
6847 func (c *UsersSettingsCseIdentitiesCreateCall) Do(opts ...googleapi.CallOption) (*CseIdentity, error) {
6848 gensupport.SetOptions(c.urlParams_, opts...)
6849 res, err := c.doRequest("json")
6850 if res != nil && res.StatusCode == http.StatusNotModified {
6851 if res.Body != nil {
6852 res.Body.Close()
6853 }
6854 return nil, gensupport.WrapError(&googleapi.Error{
6855 Code: res.StatusCode,
6856 Header: res.Header,
6857 })
6858 }
6859 if err != nil {
6860 return nil, err
6861 }
6862 defer googleapi.CloseBody(res)
6863 if err := googleapi.CheckResponse(res); err != nil {
6864 return nil, gensupport.WrapError(err)
6865 }
6866 ret := &CseIdentity{
6867 ServerResponse: googleapi.ServerResponse{
6868 Header: res.Header,
6869 HTTPStatusCode: res.StatusCode,
6870 },
6871 }
6872 target := &ret
6873 if err := gensupport.DecodeResponse(target, res); err != nil {
6874 return nil, err
6875 }
6876 return ret, nil
6877 }
6878
6879 type UsersSettingsCseIdentitiesDeleteCall struct {
6880 s *Service
6881 userId string
6882 cseEmailAddress string
6883 urlParams_ gensupport.URLParams
6884 ctx_ context.Context
6885 header_ http.Header
6886 }
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897 func (r *UsersSettingsCseIdentitiesService) Delete(userId string, cseEmailAddress string) *UsersSettingsCseIdentitiesDeleteCall {
6898 c := &UsersSettingsCseIdentitiesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6899 c.userId = userId
6900 c.cseEmailAddress = cseEmailAddress
6901 return c
6902 }
6903
6904
6905
6906
6907 func (c *UsersSettingsCseIdentitiesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesDeleteCall {
6908 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6909 return c
6910 }
6911
6912
6913 func (c *UsersSettingsCseIdentitiesDeleteCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesDeleteCall {
6914 c.ctx_ = ctx
6915 return c
6916 }
6917
6918
6919
6920 func (c *UsersSettingsCseIdentitiesDeleteCall) Header() http.Header {
6921 if c.header_ == nil {
6922 c.header_ = make(http.Header)
6923 }
6924 return c.header_
6925 }
6926
6927 func (c *UsersSettingsCseIdentitiesDeleteCall) doRequest(alt string) (*http.Response, error) {
6928 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6929 var body io.Reader = nil
6930 c.urlParams_.Set("alt", alt)
6931 c.urlParams_.Set("prettyPrint", "false")
6932 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}")
6933 urls += "?" + c.urlParams_.Encode()
6934 req, err := http.NewRequest("DELETE", urls, body)
6935 if err != nil {
6936 return nil, err
6937 }
6938 req.Header = reqHeaders
6939 googleapi.Expand(req.URL, map[string]string{
6940 "userId": c.userId,
6941 "cseEmailAddress": c.cseEmailAddress,
6942 })
6943 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6944 }
6945
6946
6947 func (c *UsersSettingsCseIdentitiesDeleteCall) Do(opts ...googleapi.CallOption) error {
6948 gensupport.SetOptions(c.urlParams_, opts...)
6949 res, err := c.doRequest("json")
6950 if err != nil {
6951 return err
6952 }
6953 defer googleapi.CloseBody(res)
6954 if err := googleapi.CheckResponse(res); err != nil {
6955 return gensupport.WrapError(err)
6956 }
6957 return nil
6958 }
6959
6960 type UsersSettingsCseIdentitiesGetCall struct {
6961 s *Service
6962 userId string
6963 cseEmailAddress string
6964 urlParams_ gensupport.URLParams
6965 ifNoneMatch_ string
6966 ctx_ context.Context
6967 header_ http.Header
6968 }
6969
6970
6971
6972
6973
6974
6975
6976 func (r *UsersSettingsCseIdentitiesService) Get(userId string, cseEmailAddress string) *UsersSettingsCseIdentitiesGetCall {
6977 c := &UsersSettingsCseIdentitiesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6978 c.userId = userId
6979 c.cseEmailAddress = cseEmailAddress
6980 return c
6981 }
6982
6983
6984
6985
6986 func (c *UsersSettingsCseIdentitiesGetCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesGetCall {
6987 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6988 return c
6989 }
6990
6991
6992
6993
6994 func (c *UsersSettingsCseIdentitiesGetCall) IfNoneMatch(entityTag string) *UsersSettingsCseIdentitiesGetCall {
6995 c.ifNoneMatch_ = entityTag
6996 return c
6997 }
6998
6999
7000 func (c *UsersSettingsCseIdentitiesGetCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesGetCall {
7001 c.ctx_ = ctx
7002 return c
7003 }
7004
7005
7006
7007 func (c *UsersSettingsCseIdentitiesGetCall) Header() http.Header {
7008 if c.header_ == nil {
7009 c.header_ = make(http.Header)
7010 }
7011 return c.header_
7012 }
7013
7014 func (c *UsersSettingsCseIdentitiesGetCall) doRequest(alt string) (*http.Response, error) {
7015 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7016 if c.ifNoneMatch_ != "" {
7017 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7018 }
7019 var body io.Reader = nil
7020 c.urlParams_.Set("alt", alt)
7021 c.urlParams_.Set("prettyPrint", "false")
7022 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}")
7023 urls += "?" + c.urlParams_.Encode()
7024 req, err := http.NewRequest("GET", urls, body)
7025 if err != nil {
7026 return nil, err
7027 }
7028 req.Header = reqHeaders
7029 googleapi.Expand(req.URL, map[string]string{
7030 "userId": c.userId,
7031 "cseEmailAddress": c.cseEmailAddress,
7032 })
7033 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7034 }
7035
7036
7037
7038
7039
7040
7041 func (c *UsersSettingsCseIdentitiesGetCall) Do(opts ...googleapi.CallOption) (*CseIdentity, error) {
7042 gensupport.SetOptions(c.urlParams_, opts...)
7043 res, err := c.doRequest("json")
7044 if res != nil && res.StatusCode == http.StatusNotModified {
7045 if res.Body != nil {
7046 res.Body.Close()
7047 }
7048 return nil, gensupport.WrapError(&googleapi.Error{
7049 Code: res.StatusCode,
7050 Header: res.Header,
7051 })
7052 }
7053 if err != nil {
7054 return nil, err
7055 }
7056 defer googleapi.CloseBody(res)
7057 if err := googleapi.CheckResponse(res); err != nil {
7058 return nil, gensupport.WrapError(err)
7059 }
7060 ret := &CseIdentity{
7061 ServerResponse: googleapi.ServerResponse{
7062 Header: res.Header,
7063 HTTPStatusCode: res.StatusCode,
7064 },
7065 }
7066 target := &ret
7067 if err := gensupport.DecodeResponse(target, res); err != nil {
7068 return nil, err
7069 }
7070 return ret, nil
7071 }
7072
7073 type UsersSettingsCseIdentitiesListCall struct {
7074 s *Service
7075 userId string
7076 urlParams_ gensupport.URLParams
7077 ifNoneMatch_ string
7078 ctx_ context.Context
7079 header_ http.Header
7080 }
7081
7082
7083
7084
7085
7086 func (r *UsersSettingsCseIdentitiesService) List(userId string) *UsersSettingsCseIdentitiesListCall {
7087 c := &UsersSettingsCseIdentitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7088 c.userId = userId
7089 return c
7090 }
7091
7092
7093
7094 func (c *UsersSettingsCseIdentitiesListCall) PageSize(pageSize int64) *UsersSettingsCseIdentitiesListCall {
7095 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
7096 return c
7097 }
7098
7099
7100
7101
7102 func (c *UsersSettingsCseIdentitiesListCall) PageToken(pageToken string) *UsersSettingsCseIdentitiesListCall {
7103 c.urlParams_.Set("pageToken", pageToken)
7104 return c
7105 }
7106
7107
7108
7109
7110 func (c *UsersSettingsCseIdentitiesListCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesListCall {
7111 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7112 return c
7113 }
7114
7115
7116
7117
7118 func (c *UsersSettingsCseIdentitiesListCall) IfNoneMatch(entityTag string) *UsersSettingsCseIdentitiesListCall {
7119 c.ifNoneMatch_ = entityTag
7120 return c
7121 }
7122
7123
7124 func (c *UsersSettingsCseIdentitiesListCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesListCall {
7125 c.ctx_ = ctx
7126 return c
7127 }
7128
7129
7130
7131 func (c *UsersSettingsCseIdentitiesListCall) Header() http.Header {
7132 if c.header_ == nil {
7133 c.header_ = make(http.Header)
7134 }
7135 return c.header_
7136 }
7137
7138 func (c *UsersSettingsCseIdentitiesListCall) doRequest(alt string) (*http.Response, error) {
7139 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7140 if c.ifNoneMatch_ != "" {
7141 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7142 }
7143 var body io.Reader = nil
7144 c.urlParams_.Set("alt", alt)
7145 c.urlParams_.Set("prettyPrint", "false")
7146 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities")
7147 urls += "?" + c.urlParams_.Encode()
7148 req, err := http.NewRequest("GET", urls, body)
7149 if err != nil {
7150 return nil, err
7151 }
7152 req.Header = reqHeaders
7153 googleapi.Expand(req.URL, map[string]string{
7154 "userId": c.userId,
7155 })
7156 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7157 }
7158
7159
7160
7161
7162
7163
7164
7165 func (c *UsersSettingsCseIdentitiesListCall) Do(opts ...googleapi.CallOption) (*ListCseIdentitiesResponse, error) {
7166 gensupport.SetOptions(c.urlParams_, opts...)
7167 res, err := c.doRequest("json")
7168 if res != nil && res.StatusCode == http.StatusNotModified {
7169 if res.Body != nil {
7170 res.Body.Close()
7171 }
7172 return nil, gensupport.WrapError(&googleapi.Error{
7173 Code: res.StatusCode,
7174 Header: res.Header,
7175 })
7176 }
7177 if err != nil {
7178 return nil, err
7179 }
7180 defer googleapi.CloseBody(res)
7181 if err := googleapi.CheckResponse(res); err != nil {
7182 return nil, gensupport.WrapError(err)
7183 }
7184 ret := &ListCseIdentitiesResponse{
7185 ServerResponse: googleapi.ServerResponse{
7186 Header: res.Header,
7187 HTTPStatusCode: res.StatusCode,
7188 },
7189 }
7190 target := &ret
7191 if err := gensupport.DecodeResponse(target, res); err != nil {
7192 return nil, err
7193 }
7194 return ret, nil
7195 }
7196
7197
7198
7199
7200 func (c *UsersSettingsCseIdentitiesListCall) Pages(ctx context.Context, f func(*ListCseIdentitiesResponse) error) error {
7201 c.ctx_ = ctx
7202 defer c.PageToken(c.urlParams_.Get("pageToken"))
7203 for {
7204 x, err := c.Do()
7205 if err != nil {
7206 return err
7207 }
7208 if err := f(x); err != nil {
7209 return err
7210 }
7211 if x.NextPageToken == "" {
7212 return nil
7213 }
7214 c.PageToken(x.NextPageToken)
7215 }
7216 }
7217
7218 type UsersSettingsCseIdentitiesPatchCall struct {
7219 s *Service
7220 userId string
7221 emailAddress string
7222 cseidentity *CseIdentity
7223 urlParams_ gensupport.URLParams
7224 ctx_ context.Context
7225 header_ http.Header
7226 }
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236 func (r *UsersSettingsCseIdentitiesService) Patch(userId string, emailAddress string, cseidentity *CseIdentity) *UsersSettingsCseIdentitiesPatchCall {
7237 c := &UsersSettingsCseIdentitiesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7238 c.userId = userId
7239 c.emailAddress = emailAddress
7240 c.cseidentity = cseidentity
7241 return c
7242 }
7243
7244
7245
7246
7247 func (c *UsersSettingsCseIdentitiesPatchCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesPatchCall {
7248 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7249 return c
7250 }
7251
7252
7253 func (c *UsersSettingsCseIdentitiesPatchCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesPatchCall {
7254 c.ctx_ = ctx
7255 return c
7256 }
7257
7258
7259
7260 func (c *UsersSettingsCseIdentitiesPatchCall) Header() http.Header {
7261 if c.header_ == nil {
7262 c.header_ = make(http.Header)
7263 }
7264 return c.header_
7265 }
7266
7267 func (c *UsersSettingsCseIdentitiesPatchCall) doRequest(alt string) (*http.Response, error) {
7268 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7269 var body io.Reader = nil
7270 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cseidentity)
7271 if err != nil {
7272 return nil, err
7273 }
7274 c.urlParams_.Set("alt", alt)
7275 c.urlParams_.Set("prettyPrint", "false")
7276 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities/{emailAddress}")
7277 urls += "?" + c.urlParams_.Encode()
7278 req, err := http.NewRequest("PATCH", urls, body)
7279 if err != nil {
7280 return nil, err
7281 }
7282 req.Header = reqHeaders
7283 googleapi.Expand(req.URL, map[string]string{
7284 "userId": c.userId,
7285 "emailAddress": c.emailAddress,
7286 })
7287 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7288 }
7289
7290
7291
7292
7293
7294
7295 func (c *UsersSettingsCseIdentitiesPatchCall) Do(opts ...googleapi.CallOption) (*CseIdentity, error) {
7296 gensupport.SetOptions(c.urlParams_, opts...)
7297 res, err := c.doRequest("json")
7298 if res != nil && res.StatusCode == http.StatusNotModified {
7299 if res.Body != nil {
7300 res.Body.Close()
7301 }
7302 return nil, gensupport.WrapError(&googleapi.Error{
7303 Code: res.StatusCode,
7304 Header: res.Header,
7305 })
7306 }
7307 if err != nil {
7308 return nil, err
7309 }
7310 defer googleapi.CloseBody(res)
7311 if err := googleapi.CheckResponse(res); err != nil {
7312 return nil, gensupport.WrapError(err)
7313 }
7314 ret := &CseIdentity{
7315 ServerResponse: googleapi.ServerResponse{
7316 Header: res.Header,
7317 HTTPStatusCode: res.StatusCode,
7318 },
7319 }
7320 target := &ret
7321 if err := gensupport.DecodeResponse(target, res); err != nil {
7322 return nil, err
7323 }
7324 return ret, nil
7325 }
7326
7327 type UsersSettingsCseKeypairsCreateCall struct {
7328 s *Service
7329 userId string
7330 csekeypair *CseKeyPair
7331 urlParams_ gensupport.URLParams
7332 ctx_ context.Context
7333 header_ http.Header
7334 }
7335
7336
7337
7338
7339
7340
7341 func (r *UsersSettingsCseKeypairsService) Create(userId string, csekeypair *CseKeyPair) *UsersSettingsCseKeypairsCreateCall {
7342 c := &UsersSettingsCseKeypairsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7343 c.userId = userId
7344 c.csekeypair = csekeypair
7345 return c
7346 }
7347
7348
7349
7350
7351 func (c *UsersSettingsCseKeypairsCreateCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsCreateCall {
7352 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7353 return c
7354 }
7355
7356
7357 func (c *UsersSettingsCseKeypairsCreateCall) Context(ctx context.Context) *UsersSettingsCseKeypairsCreateCall {
7358 c.ctx_ = ctx
7359 return c
7360 }
7361
7362
7363
7364 func (c *UsersSettingsCseKeypairsCreateCall) Header() http.Header {
7365 if c.header_ == nil {
7366 c.header_ = make(http.Header)
7367 }
7368 return c.header_
7369 }
7370
7371 func (c *UsersSettingsCseKeypairsCreateCall) doRequest(alt string) (*http.Response, error) {
7372 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7373 var body io.Reader = nil
7374 body, err := googleapi.WithoutDataWrapper.JSONReader(c.csekeypair)
7375 if err != nil {
7376 return nil, err
7377 }
7378 c.urlParams_.Set("alt", alt)
7379 c.urlParams_.Set("prettyPrint", "false")
7380 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs")
7381 urls += "?" + c.urlParams_.Encode()
7382 req, err := http.NewRequest("POST", urls, body)
7383 if err != nil {
7384 return nil, err
7385 }
7386 req.Header = reqHeaders
7387 googleapi.Expand(req.URL, map[string]string{
7388 "userId": c.userId,
7389 })
7390 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7391 }
7392
7393
7394
7395
7396
7397
7398 func (c *UsersSettingsCseKeypairsCreateCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
7399 gensupport.SetOptions(c.urlParams_, opts...)
7400 res, err := c.doRequest("json")
7401 if res != nil && res.StatusCode == http.StatusNotModified {
7402 if res.Body != nil {
7403 res.Body.Close()
7404 }
7405 return nil, gensupport.WrapError(&googleapi.Error{
7406 Code: res.StatusCode,
7407 Header: res.Header,
7408 })
7409 }
7410 if err != nil {
7411 return nil, err
7412 }
7413 defer googleapi.CloseBody(res)
7414 if err := googleapi.CheckResponse(res); err != nil {
7415 return nil, gensupport.WrapError(err)
7416 }
7417 ret := &CseKeyPair{
7418 ServerResponse: googleapi.ServerResponse{
7419 Header: res.Header,
7420 HTTPStatusCode: res.StatusCode,
7421 },
7422 }
7423 target := &ret
7424 if err := gensupport.DecodeResponse(target, res); err != nil {
7425 return nil, err
7426 }
7427 return ret, nil
7428 }
7429
7430 type UsersSettingsCseKeypairsDisableCall struct {
7431 s *Service
7432 userId string
7433 keyPairId string
7434 disablecsekeypairrequest *DisableCseKeyPairRequest
7435 urlParams_ gensupport.URLParams
7436 ctx_ context.Context
7437 header_ http.Header
7438 }
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449 func (r *UsersSettingsCseKeypairsService) Disable(userId string, keyPairId string, disablecsekeypairrequest *DisableCseKeyPairRequest) *UsersSettingsCseKeypairsDisableCall {
7450 c := &UsersSettingsCseKeypairsDisableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7451 c.userId = userId
7452 c.keyPairId = keyPairId
7453 c.disablecsekeypairrequest = disablecsekeypairrequest
7454 return c
7455 }
7456
7457
7458
7459
7460 func (c *UsersSettingsCseKeypairsDisableCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsDisableCall {
7461 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7462 return c
7463 }
7464
7465
7466 func (c *UsersSettingsCseKeypairsDisableCall) Context(ctx context.Context) *UsersSettingsCseKeypairsDisableCall {
7467 c.ctx_ = ctx
7468 return c
7469 }
7470
7471
7472
7473 func (c *UsersSettingsCseKeypairsDisableCall) Header() http.Header {
7474 if c.header_ == nil {
7475 c.header_ = make(http.Header)
7476 }
7477 return c.header_
7478 }
7479
7480 func (c *UsersSettingsCseKeypairsDisableCall) doRequest(alt string) (*http.Response, error) {
7481 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7482 var body io.Reader = nil
7483 body, err := googleapi.WithoutDataWrapper.JSONReader(c.disablecsekeypairrequest)
7484 if err != nil {
7485 return nil, err
7486 }
7487 c.urlParams_.Set("alt", alt)
7488 c.urlParams_.Set("prettyPrint", "false")
7489 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:disable")
7490 urls += "?" + c.urlParams_.Encode()
7491 req, err := http.NewRequest("POST", urls, body)
7492 if err != nil {
7493 return nil, err
7494 }
7495 req.Header = reqHeaders
7496 googleapi.Expand(req.URL, map[string]string{
7497 "userId": c.userId,
7498 "keyPairId": c.keyPairId,
7499 })
7500 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7501 }
7502
7503
7504
7505
7506
7507
7508 func (c *UsersSettingsCseKeypairsDisableCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
7509 gensupport.SetOptions(c.urlParams_, opts...)
7510 res, err := c.doRequest("json")
7511 if res != nil && res.StatusCode == http.StatusNotModified {
7512 if res.Body != nil {
7513 res.Body.Close()
7514 }
7515 return nil, gensupport.WrapError(&googleapi.Error{
7516 Code: res.StatusCode,
7517 Header: res.Header,
7518 })
7519 }
7520 if err != nil {
7521 return nil, err
7522 }
7523 defer googleapi.CloseBody(res)
7524 if err := googleapi.CheckResponse(res); err != nil {
7525 return nil, gensupport.WrapError(err)
7526 }
7527 ret := &CseKeyPair{
7528 ServerResponse: googleapi.ServerResponse{
7529 Header: res.Header,
7530 HTTPStatusCode: res.StatusCode,
7531 },
7532 }
7533 target := &ret
7534 if err := gensupport.DecodeResponse(target, res); err != nil {
7535 return nil, err
7536 }
7537 return ret, nil
7538 }
7539
7540 type UsersSettingsCseKeypairsEnableCall struct {
7541 s *Service
7542 userId string
7543 keyPairId string
7544 enablecsekeypairrequest *EnableCseKeyPairRequest
7545 urlParams_ gensupport.URLParams
7546 ctx_ context.Context
7547 header_ http.Header
7548 }
7549
7550
7551
7552
7553
7554
7555
7556
7557 func (r *UsersSettingsCseKeypairsService) Enable(userId string, keyPairId string, enablecsekeypairrequest *EnableCseKeyPairRequest) *UsersSettingsCseKeypairsEnableCall {
7558 c := &UsersSettingsCseKeypairsEnableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7559 c.userId = userId
7560 c.keyPairId = keyPairId
7561 c.enablecsekeypairrequest = enablecsekeypairrequest
7562 return c
7563 }
7564
7565
7566
7567
7568 func (c *UsersSettingsCseKeypairsEnableCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsEnableCall {
7569 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7570 return c
7571 }
7572
7573
7574 func (c *UsersSettingsCseKeypairsEnableCall) Context(ctx context.Context) *UsersSettingsCseKeypairsEnableCall {
7575 c.ctx_ = ctx
7576 return c
7577 }
7578
7579
7580
7581 func (c *UsersSettingsCseKeypairsEnableCall) Header() http.Header {
7582 if c.header_ == nil {
7583 c.header_ = make(http.Header)
7584 }
7585 return c.header_
7586 }
7587
7588 func (c *UsersSettingsCseKeypairsEnableCall) doRequest(alt string) (*http.Response, error) {
7589 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7590 var body io.Reader = nil
7591 body, err := googleapi.WithoutDataWrapper.JSONReader(c.enablecsekeypairrequest)
7592 if err != nil {
7593 return nil, err
7594 }
7595 c.urlParams_.Set("alt", alt)
7596 c.urlParams_.Set("prettyPrint", "false")
7597 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:enable")
7598 urls += "?" + c.urlParams_.Encode()
7599 req, err := http.NewRequest("POST", urls, body)
7600 if err != nil {
7601 return nil, err
7602 }
7603 req.Header = reqHeaders
7604 googleapi.Expand(req.URL, map[string]string{
7605 "userId": c.userId,
7606 "keyPairId": c.keyPairId,
7607 })
7608 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7609 }
7610
7611
7612
7613
7614
7615
7616 func (c *UsersSettingsCseKeypairsEnableCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
7617 gensupport.SetOptions(c.urlParams_, opts...)
7618 res, err := c.doRequest("json")
7619 if res != nil && res.StatusCode == http.StatusNotModified {
7620 if res.Body != nil {
7621 res.Body.Close()
7622 }
7623 return nil, gensupport.WrapError(&googleapi.Error{
7624 Code: res.StatusCode,
7625 Header: res.Header,
7626 })
7627 }
7628 if err != nil {
7629 return nil, err
7630 }
7631 defer googleapi.CloseBody(res)
7632 if err := googleapi.CheckResponse(res); err != nil {
7633 return nil, gensupport.WrapError(err)
7634 }
7635 ret := &CseKeyPair{
7636 ServerResponse: googleapi.ServerResponse{
7637 Header: res.Header,
7638 HTTPStatusCode: res.StatusCode,
7639 },
7640 }
7641 target := &ret
7642 if err := gensupport.DecodeResponse(target, res); err != nil {
7643 return nil, err
7644 }
7645 return ret, nil
7646 }
7647
7648 type UsersSettingsCseKeypairsGetCall struct {
7649 s *Service
7650 userId string
7651 keyPairId string
7652 urlParams_ gensupport.URLParams
7653 ifNoneMatch_ string
7654 ctx_ context.Context
7655 header_ http.Header
7656 }
7657
7658
7659
7660
7661
7662
7663 func (r *UsersSettingsCseKeypairsService) Get(userId string, keyPairId string) *UsersSettingsCseKeypairsGetCall {
7664 c := &UsersSettingsCseKeypairsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7665 c.userId = userId
7666 c.keyPairId = keyPairId
7667 return c
7668 }
7669
7670
7671
7672
7673 func (c *UsersSettingsCseKeypairsGetCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsGetCall {
7674 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7675 return c
7676 }
7677
7678
7679
7680
7681 func (c *UsersSettingsCseKeypairsGetCall) IfNoneMatch(entityTag string) *UsersSettingsCseKeypairsGetCall {
7682 c.ifNoneMatch_ = entityTag
7683 return c
7684 }
7685
7686
7687 func (c *UsersSettingsCseKeypairsGetCall) Context(ctx context.Context) *UsersSettingsCseKeypairsGetCall {
7688 c.ctx_ = ctx
7689 return c
7690 }
7691
7692
7693
7694 func (c *UsersSettingsCseKeypairsGetCall) Header() http.Header {
7695 if c.header_ == nil {
7696 c.header_ = make(http.Header)
7697 }
7698 return c.header_
7699 }
7700
7701 func (c *UsersSettingsCseKeypairsGetCall) doRequest(alt string) (*http.Response, error) {
7702 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7703 if c.ifNoneMatch_ != "" {
7704 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7705 }
7706 var body io.Reader = nil
7707 c.urlParams_.Set("alt", alt)
7708 c.urlParams_.Set("prettyPrint", "false")
7709 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}")
7710 urls += "?" + c.urlParams_.Encode()
7711 req, err := http.NewRequest("GET", urls, body)
7712 if err != nil {
7713 return nil, err
7714 }
7715 req.Header = reqHeaders
7716 googleapi.Expand(req.URL, map[string]string{
7717 "userId": c.userId,
7718 "keyPairId": c.keyPairId,
7719 })
7720 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7721 }
7722
7723
7724
7725
7726
7727
7728 func (c *UsersSettingsCseKeypairsGetCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
7729 gensupport.SetOptions(c.urlParams_, opts...)
7730 res, err := c.doRequest("json")
7731 if res != nil && res.StatusCode == http.StatusNotModified {
7732 if res.Body != nil {
7733 res.Body.Close()
7734 }
7735 return nil, gensupport.WrapError(&googleapi.Error{
7736 Code: res.StatusCode,
7737 Header: res.Header,
7738 })
7739 }
7740 if err != nil {
7741 return nil, err
7742 }
7743 defer googleapi.CloseBody(res)
7744 if err := googleapi.CheckResponse(res); err != nil {
7745 return nil, gensupport.WrapError(err)
7746 }
7747 ret := &CseKeyPair{
7748 ServerResponse: googleapi.ServerResponse{
7749 Header: res.Header,
7750 HTTPStatusCode: res.StatusCode,
7751 },
7752 }
7753 target := &ret
7754 if err := gensupport.DecodeResponse(target, res); err != nil {
7755 return nil, err
7756 }
7757 return ret, nil
7758 }
7759
7760 type UsersSettingsCseKeypairsListCall struct {
7761 s *Service
7762 userId string
7763 urlParams_ gensupport.URLParams
7764 ifNoneMatch_ string
7765 ctx_ context.Context
7766 header_ http.Header
7767 }
7768
7769
7770
7771
7772
7773 func (r *UsersSettingsCseKeypairsService) List(userId string) *UsersSettingsCseKeypairsListCall {
7774 c := &UsersSettingsCseKeypairsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7775 c.userId = userId
7776 return c
7777 }
7778
7779
7780
7781 func (c *UsersSettingsCseKeypairsListCall) PageSize(pageSize int64) *UsersSettingsCseKeypairsListCall {
7782 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
7783 return c
7784 }
7785
7786
7787
7788
7789 func (c *UsersSettingsCseKeypairsListCall) PageToken(pageToken string) *UsersSettingsCseKeypairsListCall {
7790 c.urlParams_.Set("pageToken", pageToken)
7791 return c
7792 }
7793
7794
7795
7796
7797 func (c *UsersSettingsCseKeypairsListCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsListCall {
7798 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7799 return c
7800 }
7801
7802
7803
7804
7805 func (c *UsersSettingsCseKeypairsListCall) IfNoneMatch(entityTag string) *UsersSettingsCseKeypairsListCall {
7806 c.ifNoneMatch_ = entityTag
7807 return c
7808 }
7809
7810
7811 func (c *UsersSettingsCseKeypairsListCall) Context(ctx context.Context) *UsersSettingsCseKeypairsListCall {
7812 c.ctx_ = ctx
7813 return c
7814 }
7815
7816
7817
7818 func (c *UsersSettingsCseKeypairsListCall) Header() http.Header {
7819 if c.header_ == nil {
7820 c.header_ = make(http.Header)
7821 }
7822 return c.header_
7823 }
7824
7825 func (c *UsersSettingsCseKeypairsListCall) doRequest(alt string) (*http.Response, error) {
7826 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7827 if c.ifNoneMatch_ != "" {
7828 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7829 }
7830 var body io.Reader = nil
7831 c.urlParams_.Set("alt", alt)
7832 c.urlParams_.Set("prettyPrint", "false")
7833 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs")
7834 urls += "?" + c.urlParams_.Encode()
7835 req, err := http.NewRequest("GET", urls, body)
7836 if err != nil {
7837 return nil, err
7838 }
7839 req.Header = reqHeaders
7840 googleapi.Expand(req.URL, map[string]string{
7841 "userId": c.userId,
7842 })
7843 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7844 }
7845
7846
7847
7848
7849
7850
7851
7852 func (c *UsersSettingsCseKeypairsListCall) Do(opts ...googleapi.CallOption) (*ListCseKeyPairsResponse, error) {
7853 gensupport.SetOptions(c.urlParams_, opts...)
7854 res, err := c.doRequest("json")
7855 if res != nil && res.StatusCode == http.StatusNotModified {
7856 if res.Body != nil {
7857 res.Body.Close()
7858 }
7859 return nil, gensupport.WrapError(&googleapi.Error{
7860 Code: res.StatusCode,
7861 Header: res.Header,
7862 })
7863 }
7864 if err != nil {
7865 return nil, err
7866 }
7867 defer googleapi.CloseBody(res)
7868 if err := googleapi.CheckResponse(res); err != nil {
7869 return nil, gensupport.WrapError(err)
7870 }
7871 ret := &ListCseKeyPairsResponse{
7872 ServerResponse: googleapi.ServerResponse{
7873 Header: res.Header,
7874 HTTPStatusCode: res.StatusCode,
7875 },
7876 }
7877 target := &ret
7878 if err := gensupport.DecodeResponse(target, res); err != nil {
7879 return nil, err
7880 }
7881 return ret, nil
7882 }
7883
7884
7885
7886
7887 func (c *UsersSettingsCseKeypairsListCall) Pages(ctx context.Context, f func(*ListCseKeyPairsResponse) error) error {
7888 c.ctx_ = ctx
7889 defer c.PageToken(c.urlParams_.Get("pageToken"))
7890 for {
7891 x, err := c.Do()
7892 if err != nil {
7893 return err
7894 }
7895 if err := f(x); err != nil {
7896 return err
7897 }
7898 if x.NextPageToken == "" {
7899 return nil
7900 }
7901 c.PageToken(x.NextPageToken)
7902 }
7903 }
7904
7905 type UsersSettingsCseKeypairsObliterateCall struct {
7906 s *Service
7907 userId string
7908 keyPairId string
7909 obliteratecsekeypairrequest *ObliterateCseKeyPairRequest
7910 urlParams_ gensupport.URLParams
7911 ctx_ context.Context
7912 header_ http.Header
7913 }
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925 func (r *UsersSettingsCseKeypairsService) Obliterate(userId string, keyPairId string, obliteratecsekeypairrequest *ObliterateCseKeyPairRequest) *UsersSettingsCseKeypairsObliterateCall {
7926 c := &UsersSettingsCseKeypairsObliterateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7927 c.userId = userId
7928 c.keyPairId = keyPairId
7929 c.obliteratecsekeypairrequest = obliteratecsekeypairrequest
7930 return c
7931 }
7932
7933
7934
7935
7936 func (c *UsersSettingsCseKeypairsObliterateCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsObliterateCall {
7937 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7938 return c
7939 }
7940
7941
7942 func (c *UsersSettingsCseKeypairsObliterateCall) Context(ctx context.Context) *UsersSettingsCseKeypairsObliterateCall {
7943 c.ctx_ = ctx
7944 return c
7945 }
7946
7947
7948
7949 func (c *UsersSettingsCseKeypairsObliterateCall) Header() http.Header {
7950 if c.header_ == nil {
7951 c.header_ = make(http.Header)
7952 }
7953 return c.header_
7954 }
7955
7956 func (c *UsersSettingsCseKeypairsObliterateCall) doRequest(alt string) (*http.Response, error) {
7957 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7958 var body io.Reader = nil
7959 body, err := googleapi.WithoutDataWrapper.JSONReader(c.obliteratecsekeypairrequest)
7960 if err != nil {
7961 return nil, err
7962 }
7963 c.urlParams_.Set("alt", alt)
7964 c.urlParams_.Set("prettyPrint", "false")
7965 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:obliterate")
7966 urls += "?" + c.urlParams_.Encode()
7967 req, err := http.NewRequest("POST", urls, body)
7968 if err != nil {
7969 return nil, err
7970 }
7971 req.Header = reqHeaders
7972 googleapi.Expand(req.URL, map[string]string{
7973 "userId": c.userId,
7974 "keyPairId": c.keyPairId,
7975 })
7976 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7977 }
7978
7979
7980 func (c *UsersSettingsCseKeypairsObliterateCall) Do(opts ...googleapi.CallOption) error {
7981 gensupport.SetOptions(c.urlParams_, opts...)
7982 res, err := c.doRequest("json")
7983 if err != nil {
7984 return err
7985 }
7986 defer googleapi.CloseBody(res)
7987 if err := googleapi.CheckResponse(res); err != nil {
7988 return gensupport.WrapError(err)
7989 }
7990 return nil
7991 }
7992
7993 type UsersSettingsDelegatesCreateCall struct {
7994 s *Service
7995 userId string
7996 delegate *Delegate
7997 urlParams_ gensupport.URLParams
7998 ctx_ context.Context
7999 header_ http.Header
8000 }
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016 func (r *UsersSettingsDelegatesService) Create(userId string, delegate *Delegate) *UsersSettingsDelegatesCreateCall {
8017 c := &UsersSettingsDelegatesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8018 c.userId = userId
8019 c.delegate = delegate
8020 return c
8021 }
8022
8023
8024
8025
8026 func (c *UsersSettingsDelegatesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesCreateCall {
8027 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8028 return c
8029 }
8030
8031
8032 func (c *UsersSettingsDelegatesCreateCall) Context(ctx context.Context) *UsersSettingsDelegatesCreateCall {
8033 c.ctx_ = ctx
8034 return c
8035 }
8036
8037
8038
8039 func (c *UsersSettingsDelegatesCreateCall) Header() http.Header {
8040 if c.header_ == nil {
8041 c.header_ = make(http.Header)
8042 }
8043 return c.header_
8044 }
8045
8046 func (c *UsersSettingsDelegatesCreateCall) doRequest(alt string) (*http.Response, error) {
8047 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
8048 var body io.Reader = nil
8049 body, err := googleapi.WithoutDataWrapper.JSONReader(c.delegate)
8050 if err != nil {
8051 return nil, err
8052 }
8053 c.urlParams_.Set("alt", alt)
8054 c.urlParams_.Set("prettyPrint", "false")
8055 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates")
8056 urls += "?" + c.urlParams_.Encode()
8057 req, err := http.NewRequest("POST", urls, body)
8058 if err != nil {
8059 return nil, err
8060 }
8061 req.Header = reqHeaders
8062 googleapi.Expand(req.URL, map[string]string{
8063 "userId": c.userId,
8064 })
8065 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8066 }
8067
8068
8069
8070
8071
8072
8073 func (c *UsersSettingsDelegatesCreateCall) Do(opts ...googleapi.CallOption) (*Delegate, error) {
8074 gensupport.SetOptions(c.urlParams_, opts...)
8075 res, err := c.doRequest("json")
8076 if res != nil && res.StatusCode == http.StatusNotModified {
8077 if res.Body != nil {
8078 res.Body.Close()
8079 }
8080 return nil, gensupport.WrapError(&googleapi.Error{
8081 Code: res.StatusCode,
8082 Header: res.Header,
8083 })
8084 }
8085 if err != nil {
8086 return nil, err
8087 }
8088 defer googleapi.CloseBody(res)
8089 if err := googleapi.CheckResponse(res); err != nil {
8090 return nil, gensupport.WrapError(err)
8091 }
8092 ret := &Delegate{
8093 ServerResponse: googleapi.ServerResponse{
8094 Header: res.Header,
8095 HTTPStatusCode: res.StatusCode,
8096 },
8097 }
8098 target := &ret
8099 if err := gensupport.DecodeResponse(target, res); err != nil {
8100 return nil, err
8101 }
8102 return ret, nil
8103 }
8104
8105 type UsersSettingsDelegatesDeleteCall struct {
8106 s *Service
8107 userId string
8108 delegateEmail string
8109 urlParams_ gensupport.URLParams
8110 ctx_ context.Context
8111 header_ http.Header
8112 }
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123 func (r *UsersSettingsDelegatesService) Delete(userId string, delegateEmail string) *UsersSettingsDelegatesDeleteCall {
8124 c := &UsersSettingsDelegatesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8125 c.userId = userId
8126 c.delegateEmail = delegateEmail
8127 return c
8128 }
8129
8130
8131
8132
8133 func (c *UsersSettingsDelegatesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesDeleteCall {
8134 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8135 return c
8136 }
8137
8138
8139 func (c *UsersSettingsDelegatesDeleteCall) Context(ctx context.Context) *UsersSettingsDelegatesDeleteCall {
8140 c.ctx_ = ctx
8141 return c
8142 }
8143
8144
8145
8146 func (c *UsersSettingsDelegatesDeleteCall) Header() http.Header {
8147 if c.header_ == nil {
8148 c.header_ = make(http.Header)
8149 }
8150 return c.header_
8151 }
8152
8153 func (c *UsersSettingsDelegatesDeleteCall) doRequest(alt string) (*http.Response, error) {
8154 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8155 var body io.Reader = nil
8156 c.urlParams_.Set("alt", alt)
8157 c.urlParams_.Set("prettyPrint", "false")
8158 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}")
8159 urls += "?" + c.urlParams_.Encode()
8160 req, err := http.NewRequest("DELETE", urls, body)
8161 if err != nil {
8162 return nil, err
8163 }
8164 req.Header = reqHeaders
8165 googleapi.Expand(req.URL, map[string]string{
8166 "userId": c.userId,
8167 "delegateEmail": c.delegateEmail,
8168 })
8169 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8170 }
8171
8172
8173 func (c *UsersSettingsDelegatesDeleteCall) Do(opts ...googleapi.CallOption) error {
8174 gensupport.SetOptions(c.urlParams_, opts...)
8175 res, err := c.doRequest("json")
8176 if err != nil {
8177 return err
8178 }
8179 defer googleapi.CloseBody(res)
8180 if err := googleapi.CheckResponse(res); err != nil {
8181 return gensupport.WrapError(err)
8182 }
8183 return nil
8184 }
8185
8186 type UsersSettingsDelegatesGetCall struct {
8187 s *Service
8188 userId string
8189 delegateEmail string
8190 urlParams_ gensupport.URLParams
8191 ifNoneMatch_ string
8192 ctx_ context.Context
8193 header_ http.Header
8194 }
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205 func (r *UsersSettingsDelegatesService) Get(userId string, delegateEmail string) *UsersSettingsDelegatesGetCall {
8206 c := &UsersSettingsDelegatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8207 c.userId = userId
8208 c.delegateEmail = delegateEmail
8209 return c
8210 }
8211
8212
8213
8214
8215 func (c *UsersSettingsDelegatesGetCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesGetCall {
8216 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8217 return c
8218 }
8219
8220
8221
8222
8223 func (c *UsersSettingsDelegatesGetCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesGetCall {
8224 c.ifNoneMatch_ = entityTag
8225 return c
8226 }
8227
8228
8229 func (c *UsersSettingsDelegatesGetCall) Context(ctx context.Context) *UsersSettingsDelegatesGetCall {
8230 c.ctx_ = ctx
8231 return c
8232 }
8233
8234
8235
8236 func (c *UsersSettingsDelegatesGetCall) Header() http.Header {
8237 if c.header_ == nil {
8238 c.header_ = make(http.Header)
8239 }
8240 return c.header_
8241 }
8242
8243 func (c *UsersSettingsDelegatesGetCall) doRequest(alt string) (*http.Response, error) {
8244 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8245 if c.ifNoneMatch_ != "" {
8246 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8247 }
8248 var body io.Reader = nil
8249 c.urlParams_.Set("alt", alt)
8250 c.urlParams_.Set("prettyPrint", "false")
8251 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}")
8252 urls += "?" + c.urlParams_.Encode()
8253 req, err := http.NewRequest("GET", urls, body)
8254 if err != nil {
8255 return nil, err
8256 }
8257 req.Header = reqHeaders
8258 googleapi.Expand(req.URL, map[string]string{
8259 "userId": c.userId,
8260 "delegateEmail": c.delegateEmail,
8261 })
8262 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8263 }
8264
8265
8266
8267
8268
8269
8270 func (c *UsersSettingsDelegatesGetCall) Do(opts ...googleapi.CallOption) (*Delegate, error) {
8271 gensupport.SetOptions(c.urlParams_, opts...)
8272 res, err := c.doRequest("json")
8273 if res != nil && res.StatusCode == http.StatusNotModified {
8274 if res.Body != nil {
8275 res.Body.Close()
8276 }
8277 return nil, gensupport.WrapError(&googleapi.Error{
8278 Code: res.StatusCode,
8279 Header: res.Header,
8280 })
8281 }
8282 if err != nil {
8283 return nil, err
8284 }
8285 defer googleapi.CloseBody(res)
8286 if err := googleapi.CheckResponse(res); err != nil {
8287 return nil, gensupport.WrapError(err)
8288 }
8289 ret := &Delegate{
8290 ServerResponse: googleapi.ServerResponse{
8291 Header: res.Header,
8292 HTTPStatusCode: res.StatusCode,
8293 },
8294 }
8295 target := &ret
8296 if err := gensupport.DecodeResponse(target, res); err != nil {
8297 return nil, err
8298 }
8299 return ret, nil
8300 }
8301
8302 type UsersSettingsDelegatesListCall struct {
8303 s *Service
8304 userId string
8305 urlParams_ gensupport.URLParams
8306 ifNoneMatch_ string
8307 ctx_ context.Context
8308 header_ http.Header
8309 }
8310
8311
8312
8313
8314
8315
8316
8317 func (r *UsersSettingsDelegatesService) List(userId string) *UsersSettingsDelegatesListCall {
8318 c := &UsersSettingsDelegatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8319 c.userId = userId
8320 return c
8321 }
8322
8323
8324
8325
8326 func (c *UsersSettingsDelegatesListCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesListCall {
8327 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8328 return c
8329 }
8330
8331
8332
8333
8334 func (c *UsersSettingsDelegatesListCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesListCall {
8335 c.ifNoneMatch_ = entityTag
8336 return c
8337 }
8338
8339
8340 func (c *UsersSettingsDelegatesListCall) Context(ctx context.Context) *UsersSettingsDelegatesListCall {
8341 c.ctx_ = ctx
8342 return c
8343 }
8344
8345
8346
8347 func (c *UsersSettingsDelegatesListCall) Header() http.Header {
8348 if c.header_ == nil {
8349 c.header_ = make(http.Header)
8350 }
8351 return c.header_
8352 }
8353
8354 func (c *UsersSettingsDelegatesListCall) doRequest(alt string) (*http.Response, error) {
8355 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8356 if c.ifNoneMatch_ != "" {
8357 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8358 }
8359 var body io.Reader = nil
8360 c.urlParams_.Set("alt", alt)
8361 c.urlParams_.Set("prettyPrint", "false")
8362 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates")
8363 urls += "?" + c.urlParams_.Encode()
8364 req, err := http.NewRequest("GET", urls, body)
8365 if err != nil {
8366 return nil, err
8367 }
8368 req.Header = reqHeaders
8369 googleapi.Expand(req.URL, map[string]string{
8370 "userId": c.userId,
8371 })
8372 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8373 }
8374
8375
8376
8377
8378
8379
8380
8381 func (c *UsersSettingsDelegatesListCall) Do(opts ...googleapi.CallOption) (*ListDelegatesResponse, error) {
8382 gensupport.SetOptions(c.urlParams_, opts...)
8383 res, err := c.doRequest("json")
8384 if res != nil && res.StatusCode == http.StatusNotModified {
8385 if res.Body != nil {
8386 res.Body.Close()
8387 }
8388 return nil, gensupport.WrapError(&googleapi.Error{
8389 Code: res.StatusCode,
8390 Header: res.Header,
8391 })
8392 }
8393 if err != nil {
8394 return nil, err
8395 }
8396 defer googleapi.CloseBody(res)
8397 if err := googleapi.CheckResponse(res); err != nil {
8398 return nil, gensupport.WrapError(err)
8399 }
8400 ret := &ListDelegatesResponse{
8401 ServerResponse: googleapi.ServerResponse{
8402 Header: res.Header,
8403 HTTPStatusCode: res.StatusCode,
8404 },
8405 }
8406 target := &ret
8407 if err := gensupport.DecodeResponse(target, res); err != nil {
8408 return nil, err
8409 }
8410 return ret, nil
8411 }
8412
8413 type UsersSettingsFiltersCreateCall struct {
8414 s *Service
8415 userId string
8416 filter *Filter
8417 urlParams_ gensupport.URLParams
8418 ctx_ context.Context
8419 header_ http.Header
8420 }
8421
8422
8423
8424
8425
8426
8427 func (r *UsersSettingsFiltersService) Create(userId string, filter *Filter) *UsersSettingsFiltersCreateCall {
8428 c := &UsersSettingsFiltersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8429 c.userId = userId
8430 c.filter = filter
8431 return c
8432 }
8433
8434
8435
8436
8437 func (c *UsersSettingsFiltersCreateCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersCreateCall {
8438 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8439 return c
8440 }
8441
8442
8443 func (c *UsersSettingsFiltersCreateCall) Context(ctx context.Context) *UsersSettingsFiltersCreateCall {
8444 c.ctx_ = ctx
8445 return c
8446 }
8447
8448
8449
8450 func (c *UsersSettingsFiltersCreateCall) Header() http.Header {
8451 if c.header_ == nil {
8452 c.header_ = make(http.Header)
8453 }
8454 return c.header_
8455 }
8456
8457 func (c *UsersSettingsFiltersCreateCall) doRequest(alt string) (*http.Response, error) {
8458 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
8459 var body io.Reader = nil
8460 body, err := googleapi.WithoutDataWrapper.JSONReader(c.filter)
8461 if err != nil {
8462 return nil, err
8463 }
8464 c.urlParams_.Set("alt", alt)
8465 c.urlParams_.Set("prettyPrint", "false")
8466 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters")
8467 urls += "?" + c.urlParams_.Encode()
8468 req, err := http.NewRequest("POST", urls, body)
8469 if err != nil {
8470 return nil, err
8471 }
8472 req.Header = reqHeaders
8473 googleapi.Expand(req.URL, map[string]string{
8474 "userId": c.userId,
8475 })
8476 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8477 }
8478
8479
8480
8481
8482
8483
8484 func (c *UsersSettingsFiltersCreateCall) Do(opts ...googleapi.CallOption) (*Filter, error) {
8485 gensupport.SetOptions(c.urlParams_, opts...)
8486 res, err := c.doRequest("json")
8487 if res != nil && res.StatusCode == http.StatusNotModified {
8488 if res.Body != nil {
8489 res.Body.Close()
8490 }
8491 return nil, gensupport.WrapError(&googleapi.Error{
8492 Code: res.StatusCode,
8493 Header: res.Header,
8494 })
8495 }
8496 if err != nil {
8497 return nil, err
8498 }
8499 defer googleapi.CloseBody(res)
8500 if err := googleapi.CheckResponse(res); err != nil {
8501 return nil, gensupport.WrapError(err)
8502 }
8503 ret := &Filter{
8504 ServerResponse: googleapi.ServerResponse{
8505 Header: res.Header,
8506 HTTPStatusCode: res.StatusCode,
8507 },
8508 }
8509 target := &ret
8510 if err := gensupport.DecodeResponse(target, res); err != nil {
8511 return nil, err
8512 }
8513 return ret, nil
8514 }
8515
8516 type UsersSettingsFiltersDeleteCall struct {
8517 s *Service
8518 userId string
8519 id string
8520 urlParams_ gensupport.URLParams
8521 ctx_ context.Context
8522 header_ http.Header
8523 }
8524
8525
8526
8527
8528
8529
8530 func (r *UsersSettingsFiltersService) Delete(userId string, id string) *UsersSettingsFiltersDeleteCall {
8531 c := &UsersSettingsFiltersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8532 c.userId = userId
8533 c.id = id
8534 return c
8535 }
8536
8537
8538
8539
8540 func (c *UsersSettingsFiltersDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersDeleteCall {
8541 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8542 return c
8543 }
8544
8545
8546 func (c *UsersSettingsFiltersDeleteCall) Context(ctx context.Context) *UsersSettingsFiltersDeleteCall {
8547 c.ctx_ = ctx
8548 return c
8549 }
8550
8551
8552
8553 func (c *UsersSettingsFiltersDeleteCall) Header() http.Header {
8554 if c.header_ == nil {
8555 c.header_ = make(http.Header)
8556 }
8557 return c.header_
8558 }
8559
8560 func (c *UsersSettingsFiltersDeleteCall) doRequest(alt string) (*http.Response, error) {
8561 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8562 var body io.Reader = nil
8563 c.urlParams_.Set("alt", alt)
8564 c.urlParams_.Set("prettyPrint", "false")
8565 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters/{id}")
8566 urls += "?" + c.urlParams_.Encode()
8567 req, err := http.NewRequest("DELETE", urls, body)
8568 if err != nil {
8569 return nil, err
8570 }
8571 req.Header = reqHeaders
8572 googleapi.Expand(req.URL, map[string]string{
8573 "userId": c.userId,
8574 "id": c.id,
8575 })
8576 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8577 }
8578
8579
8580 func (c *UsersSettingsFiltersDeleteCall) Do(opts ...googleapi.CallOption) error {
8581 gensupport.SetOptions(c.urlParams_, opts...)
8582 res, err := c.doRequest("json")
8583 if err != nil {
8584 return err
8585 }
8586 defer googleapi.CloseBody(res)
8587 if err := googleapi.CheckResponse(res); err != nil {
8588 return gensupport.WrapError(err)
8589 }
8590 return nil
8591 }
8592
8593 type UsersSettingsFiltersGetCall struct {
8594 s *Service
8595 userId string
8596 id string
8597 urlParams_ gensupport.URLParams
8598 ifNoneMatch_ string
8599 ctx_ context.Context
8600 header_ http.Header
8601 }
8602
8603
8604
8605
8606
8607
8608 func (r *UsersSettingsFiltersService) Get(userId string, id string) *UsersSettingsFiltersGetCall {
8609 c := &UsersSettingsFiltersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8610 c.userId = userId
8611 c.id = id
8612 return c
8613 }
8614
8615
8616
8617
8618 func (c *UsersSettingsFiltersGetCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersGetCall {
8619 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8620 return c
8621 }
8622
8623
8624
8625
8626 func (c *UsersSettingsFiltersGetCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersGetCall {
8627 c.ifNoneMatch_ = entityTag
8628 return c
8629 }
8630
8631
8632 func (c *UsersSettingsFiltersGetCall) Context(ctx context.Context) *UsersSettingsFiltersGetCall {
8633 c.ctx_ = ctx
8634 return c
8635 }
8636
8637
8638
8639 func (c *UsersSettingsFiltersGetCall) Header() http.Header {
8640 if c.header_ == nil {
8641 c.header_ = make(http.Header)
8642 }
8643 return c.header_
8644 }
8645
8646 func (c *UsersSettingsFiltersGetCall) doRequest(alt string) (*http.Response, error) {
8647 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8648 if c.ifNoneMatch_ != "" {
8649 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8650 }
8651 var body io.Reader = nil
8652 c.urlParams_.Set("alt", alt)
8653 c.urlParams_.Set("prettyPrint", "false")
8654 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters/{id}")
8655 urls += "?" + c.urlParams_.Encode()
8656 req, err := http.NewRequest("GET", urls, body)
8657 if err != nil {
8658 return nil, err
8659 }
8660 req.Header = reqHeaders
8661 googleapi.Expand(req.URL, map[string]string{
8662 "userId": c.userId,
8663 "id": c.id,
8664 })
8665 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8666 }
8667
8668
8669
8670
8671
8672
8673 func (c *UsersSettingsFiltersGetCall) Do(opts ...googleapi.CallOption) (*Filter, error) {
8674 gensupport.SetOptions(c.urlParams_, opts...)
8675 res, err := c.doRequest("json")
8676 if res != nil && res.StatusCode == http.StatusNotModified {
8677 if res.Body != nil {
8678 res.Body.Close()
8679 }
8680 return nil, gensupport.WrapError(&googleapi.Error{
8681 Code: res.StatusCode,
8682 Header: res.Header,
8683 })
8684 }
8685 if err != nil {
8686 return nil, err
8687 }
8688 defer googleapi.CloseBody(res)
8689 if err := googleapi.CheckResponse(res); err != nil {
8690 return nil, gensupport.WrapError(err)
8691 }
8692 ret := &Filter{
8693 ServerResponse: googleapi.ServerResponse{
8694 Header: res.Header,
8695 HTTPStatusCode: res.StatusCode,
8696 },
8697 }
8698 target := &ret
8699 if err := gensupport.DecodeResponse(target, res); err != nil {
8700 return nil, err
8701 }
8702 return ret, nil
8703 }
8704
8705 type UsersSettingsFiltersListCall struct {
8706 s *Service
8707 userId string
8708 urlParams_ gensupport.URLParams
8709 ifNoneMatch_ string
8710 ctx_ context.Context
8711 header_ http.Header
8712 }
8713
8714
8715
8716
8717
8718 func (r *UsersSettingsFiltersService) List(userId string) *UsersSettingsFiltersListCall {
8719 c := &UsersSettingsFiltersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8720 c.userId = userId
8721 return c
8722 }
8723
8724
8725
8726
8727 func (c *UsersSettingsFiltersListCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersListCall {
8728 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8729 return c
8730 }
8731
8732
8733
8734
8735 func (c *UsersSettingsFiltersListCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersListCall {
8736 c.ifNoneMatch_ = entityTag
8737 return c
8738 }
8739
8740
8741 func (c *UsersSettingsFiltersListCall) Context(ctx context.Context) *UsersSettingsFiltersListCall {
8742 c.ctx_ = ctx
8743 return c
8744 }
8745
8746
8747
8748 func (c *UsersSettingsFiltersListCall) Header() http.Header {
8749 if c.header_ == nil {
8750 c.header_ = make(http.Header)
8751 }
8752 return c.header_
8753 }
8754
8755 func (c *UsersSettingsFiltersListCall) doRequest(alt string) (*http.Response, error) {
8756 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8757 if c.ifNoneMatch_ != "" {
8758 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8759 }
8760 var body io.Reader = nil
8761 c.urlParams_.Set("alt", alt)
8762 c.urlParams_.Set("prettyPrint", "false")
8763 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters")
8764 urls += "?" + c.urlParams_.Encode()
8765 req, err := http.NewRequest("GET", urls, body)
8766 if err != nil {
8767 return nil, err
8768 }
8769 req.Header = reqHeaders
8770 googleapi.Expand(req.URL, map[string]string{
8771 "userId": c.userId,
8772 })
8773 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8774 }
8775
8776
8777
8778
8779
8780
8781
8782 func (c *UsersSettingsFiltersListCall) Do(opts ...googleapi.CallOption) (*ListFiltersResponse, error) {
8783 gensupport.SetOptions(c.urlParams_, opts...)
8784 res, err := c.doRequest("json")
8785 if res != nil && res.StatusCode == http.StatusNotModified {
8786 if res.Body != nil {
8787 res.Body.Close()
8788 }
8789 return nil, gensupport.WrapError(&googleapi.Error{
8790 Code: res.StatusCode,
8791 Header: res.Header,
8792 })
8793 }
8794 if err != nil {
8795 return nil, err
8796 }
8797 defer googleapi.CloseBody(res)
8798 if err := googleapi.CheckResponse(res); err != nil {
8799 return nil, gensupport.WrapError(err)
8800 }
8801 ret := &ListFiltersResponse{
8802 ServerResponse: googleapi.ServerResponse{
8803 Header: res.Header,
8804 HTTPStatusCode: res.StatusCode,
8805 },
8806 }
8807 target := &ret
8808 if err := gensupport.DecodeResponse(target, res); err != nil {
8809 return nil, err
8810 }
8811 return ret, nil
8812 }
8813
8814 type UsersSettingsForwardingAddressesCreateCall struct {
8815 s *Service
8816 userId string
8817 forwardingaddress *ForwardingAddress
8818 urlParams_ gensupport.URLParams
8819 ctx_ context.Context
8820 header_ http.Header
8821 }
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831 func (r *UsersSettingsForwardingAddressesService) Create(userId string, forwardingaddress *ForwardingAddress) *UsersSettingsForwardingAddressesCreateCall {
8832 c := &UsersSettingsForwardingAddressesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8833 c.userId = userId
8834 c.forwardingaddress = forwardingaddress
8835 return c
8836 }
8837
8838
8839
8840
8841 func (c *UsersSettingsForwardingAddressesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesCreateCall {
8842 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8843 return c
8844 }
8845
8846
8847 func (c *UsersSettingsForwardingAddressesCreateCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesCreateCall {
8848 c.ctx_ = ctx
8849 return c
8850 }
8851
8852
8853
8854 func (c *UsersSettingsForwardingAddressesCreateCall) Header() http.Header {
8855 if c.header_ == nil {
8856 c.header_ = make(http.Header)
8857 }
8858 return c.header_
8859 }
8860
8861 func (c *UsersSettingsForwardingAddressesCreateCall) doRequest(alt string) (*http.Response, error) {
8862 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
8863 var body io.Reader = nil
8864 body, err := googleapi.WithoutDataWrapper.JSONReader(c.forwardingaddress)
8865 if err != nil {
8866 return nil, err
8867 }
8868 c.urlParams_.Set("alt", alt)
8869 c.urlParams_.Set("prettyPrint", "false")
8870 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses")
8871 urls += "?" + c.urlParams_.Encode()
8872 req, err := http.NewRequest("POST", urls, body)
8873 if err != nil {
8874 return nil, err
8875 }
8876 req.Header = reqHeaders
8877 googleapi.Expand(req.URL, map[string]string{
8878 "userId": c.userId,
8879 })
8880 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8881 }
8882
8883
8884
8885
8886
8887
8888
8889 func (c *UsersSettingsForwardingAddressesCreateCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) {
8890 gensupport.SetOptions(c.urlParams_, opts...)
8891 res, err := c.doRequest("json")
8892 if res != nil && res.StatusCode == http.StatusNotModified {
8893 if res.Body != nil {
8894 res.Body.Close()
8895 }
8896 return nil, gensupport.WrapError(&googleapi.Error{
8897 Code: res.StatusCode,
8898 Header: res.Header,
8899 })
8900 }
8901 if err != nil {
8902 return nil, err
8903 }
8904 defer googleapi.CloseBody(res)
8905 if err := googleapi.CheckResponse(res); err != nil {
8906 return nil, gensupport.WrapError(err)
8907 }
8908 ret := &ForwardingAddress{
8909 ServerResponse: googleapi.ServerResponse{
8910 Header: res.Header,
8911 HTTPStatusCode: res.StatusCode,
8912 },
8913 }
8914 target := &ret
8915 if err := gensupport.DecodeResponse(target, res); err != nil {
8916 return nil, err
8917 }
8918 return ret, nil
8919 }
8920
8921 type UsersSettingsForwardingAddressesDeleteCall struct {
8922 s *Service
8923 userId string
8924 forwardingEmail string
8925 urlParams_ gensupport.URLParams
8926 ctx_ context.Context
8927 header_ http.Header
8928 }
8929
8930
8931
8932
8933
8934
8935
8936
8937 func (r *UsersSettingsForwardingAddressesService) Delete(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesDeleteCall {
8938 c := &UsersSettingsForwardingAddressesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8939 c.userId = userId
8940 c.forwardingEmail = forwardingEmail
8941 return c
8942 }
8943
8944
8945
8946
8947 func (c *UsersSettingsForwardingAddressesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesDeleteCall {
8948 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8949 return c
8950 }
8951
8952
8953 func (c *UsersSettingsForwardingAddressesDeleteCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesDeleteCall {
8954 c.ctx_ = ctx
8955 return c
8956 }
8957
8958
8959
8960 func (c *UsersSettingsForwardingAddressesDeleteCall) Header() http.Header {
8961 if c.header_ == nil {
8962 c.header_ = make(http.Header)
8963 }
8964 return c.header_
8965 }
8966
8967 func (c *UsersSettingsForwardingAddressesDeleteCall) doRequest(alt string) (*http.Response, error) {
8968 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8969 var body io.Reader = nil
8970 c.urlParams_.Set("alt", alt)
8971 c.urlParams_.Set("prettyPrint", "false")
8972 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}")
8973 urls += "?" + c.urlParams_.Encode()
8974 req, err := http.NewRequest("DELETE", urls, body)
8975 if err != nil {
8976 return nil, err
8977 }
8978 req.Header = reqHeaders
8979 googleapi.Expand(req.URL, map[string]string{
8980 "userId": c.userId,
8981 "forwardingEmail": c.forwardingEmail,
8982 })
8983 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8984 }
8985
8986
8987 func (c *UsersSettingsForwardingAddressesDeleteCall) Do(opts ...googleapi.CallOption) error {
8988 gensupport.SetOptions(c.urlParams_, opts...)
8989 res, err := c.doRequest("json")
8990 if err != nil {
8991 return err
8992 }
8993 defer googleapi.CloseBody(res)
8994 if err := googleapi.CheckResponse(res); err != nil {
8995 return gensupport.WrapError(err)
8996 }
8997 return nil
8998 }
8999
9000 type UsersSettingsForwardingAddressesGetCall struct {
9001 s *Service
9002 userId string
9003 forwardingEmail string
9004 urlParams_ gensupport.URLParams
9005 ifNoneMatch_ string
9006 ctx_ context.Context
9007 header_ http.Header
9008 }
9009
9010
9011
9012
9013
9014
9015 func (r *UsersSettingsForwardingAddressesService) Get(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesGetCall {
9016 c := &UsersSettingsForwardingAddressesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9017 c.userId = userId
9018 c.forwardingEmail = forwardingEmail
9019 return c
9020 }
9021
9022
9023
9024
9025 func (c *UsersSettingsForwardingAddressesGetCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesGetCall {
9026 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9027 return c
9028 }
9029
9030
9031
9032
9033 func (c *UsersSettingsForwardingAddressesGetCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesGetCall {
9034 c.ifNoneMatch_ = entityTag
9035 return c
9036 }
9037
9038
9039 func (c *UsersSettingsForwardingAddressesGetCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesGetCall {
9040 c.ctx_ = ctx
9041 return c
9042 }
9043
9044
9045
9046 func (c *UsersSettingsForwardingAddressesGetCall) Header() http.Header {
9047 if c.header_ == nil {
9048 c.header_ = make(http.Header)
9049 }
9050 return c.header_
9051 }
9052
9053 func (c *UsersSettingsForwardingAddressesGetCall) doRequest(alt string) (*http.Response, error) {
9054 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9055 if c.ifNoneMatch_ != "" {
9056 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9057 }
9058 var body io.Reader = nil
9059 c.urlParams_.Set("alt", alt)
9060 c.urlParams_.Set("prettyPrint", "false")
9061 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}")
9062 urls += "?" + c.urlParams_.Encode()
9063 req, err := http.NewRequest("GET", urls, body)
9064 if err != nil {
9065 return nil, err
9066 }
9067 req.Header = reqHeaders
9068 googleapi.Expand(req.URL, map[string]string{
9069 "userId": c.userId,
9070 "forwardingEmail": c.forwardingEmail,
9071 })
9072 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9073 }
9074
9075
9076
9077
9078
9079
9080
9081 func (c *UsersSettingsForwardingAddressesGetCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) {
9082 gensupport.SetOptions(c.urlParams_, opts...)
9083 res, err := c.doRequest("json")
9084 if res != nil && res.StatusCode == http.StatusNotModified {
9085 if res.Body != nil {
9086 res.Body.Close()
9087 }
9088 return nil, gensupport.WrapError(&googleapi.Error{
9089 Code: res.StatusCode,
9090 Header: res.Header,
9091 })
9092 }
9093 if err != nil {
9094 return nil, err
9095 }
9096 defer googleapi.CloseBody(res)
9097 if err := googleapi.CheckResponse(res); err != nil {
9098 return nil, gensupport.WrapError(err)
9099 }
9100 ret := &ForwardingAddress{
9101 ServerResponse: googleapi.ServerResponse{
9102 Header: res.Header,
9103 HTTPStatusCode: res.StatusCode,
9104 },
9105 }
9106 target := &ret
9107 if err := gensupport.DecodeResponse(target, res); err != nil {
9108 return nil, err
9109 }
9110 return ret, nil
9111 }
9112
9113 type UsersSettingsForwardingAddressesListCall struct {
9114 s *Service
9115 userId string
9116 urlParams_ gensupport.URLParams
9117 ifNoneMatch_ string
9118 ctx_ context.Context
9119 header_ http.Header
9120 }
9121
9122
9123
9124
9125
9126 func (r *UsersSettingsForwardingAddressesService) List(userId string) *UsersSettingsForwardingAddressesListCall {
9127 c := &UsersSettingsForwardingAddressesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9128 c.userId = userId
9129 return c
9130 }
9131
9132
9133
9134
9135 func (c *UsersSettingsForwardingAddressesListCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesListCall {
9136 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9137 return c
9138 }
9139
9140
9141
9142
9143 func (c *UsersSettingsForwardingAddressesListCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesListCall {
9144 c.ifNoneMatch_ = entityTag
9145 return c
9146 }
9147
9148
9149 func (c *UsersSettingsForwardingAddressesListCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesListCall {
9150 c.ctx_ = ctx
9151 return c
9152 }
9153
9154
9155
9156 func (c *UsersSettingsForwardingAddressesListCall) Header() http.Header {
9157 if c.header_ == nil {
9158 c.header_ = make(http.Header)
9159 }
9160 return c.header_
9161 }
9162
9163 func (c *UsersSettingsForwardingAddressesListCall) doRequest(alt string) (*http.Response, error) {
9164 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9165 if c.ifNoneMatch_ != "" {
9166 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9167 }
9168 var body io.Reader = nil
9169 c.urlParams_.Set("alt", alt)
9170 c.urlParams_.Set("prettyPrint", "false")
9171 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses")
9172 urls += "?" + c.urlParams_.Encode()
9173 req, err := http.NewRequest("GET", urls, body)
9174 if err != nil {
9175 return nil, err
9176 }
9177 req.Header = reqHeaders
9178 googleapi.Expand(req.URL, map[string]string{
9179 "userId": c.userId,
9180 })
9181 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9182 }
9183
9184
9185
9186
9187
9188
9189
9190 func (c *UsersSettingsForwardingAddressesListCall) Do(opts ...googleapi.CallOption) (*ListForwardingAddressesResponse, error) {
9191 gensupport.SetOptions(c.urlParams_, opts...)
9192 res, err := c.doRequest("json")
9193 if res != nil && res.StatusCode == http.StatusNotModified {
9194 if res.Body != nil {
9195 res.Body.Close()
9196 }
9197 return nil, gensupport.WrapError(&googleapi.Error{
9198 Code: res.StatusCode,
9199 Header: res.Header,
9200 })
9201 }
9202 if err != nil {
9203 return nil, err
9204 }
9205 defer googleapi.CloseBody(res)
9206 if err := googleapi.CheckResponse(res); err != nil {
9207 return nil, gensupport.WrapError(err)
9208 }
9209 ret := &ListForwardingAddressesResponse{
9210 ServerResponse: googleapi.ServerResponse{
9211 Header: res.Header,
9212 HTTPStatusCode: res.StatusCode,
9213 },
9214 }
9215 target := &ret
9216 if err := gensupport.DecodeResponse(target, res); err != nil {
9217 return nil, err
9218 }
9219 return ret, nil
9220 }
9221
9222 type UsersSettingsSendAsCreateCall struct {
9223 s *Service
9224 userId string
9225 sendas *SendAs
9226 urlParams_ gensupport.URLParams
9227 ctx_ context.Context
9228 header_ http.Header
9229 }
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243 func (r *UsersSettingsSendAsService) Create(userId string, sendas *SendAs) *UsersSettingsSendAsCreateCall {
9244 c := &UsersSettingsSendAsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9245 c.userId = userId
9246 c.sendas = sendas
9247 return c
9248 }
9249
9250
9251
9252
9253 func (c *UsersSettingsSendAsCreateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsCreateCall {
9254 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9255 return c
9256 }
9257
9258
9259 func (c *UsersSettingsSendAsCreateCall) Context(ctx context.Context) *UsersSettingsSendAsCreateCall {
9260 c.ctx_ = ctx
9261 return c
9262 }
9263
9264
9265
9266 func (c *UsersSettingsSendAsCreateCall) Header() http.Header {
9267 if c.header_ == nil {
9268 c.header_ = make(http.Header)
9269 }
9270 return c.header_
9271 }
9272
9273 func (c *UsersSettingsSendAsCreateCall) doRequest(alt string) (*http.Response, error) {
9274 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
9275 var body io.Reader = nil
9276 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
9277 if err != nil {
9278 return nil, err
9279 }
9280 c.urlParams_.Set("alt", alt)
9281 c.urlParams_.Set("prettyPrint", "false")
9282 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs")
9283 urls += "?" + c.urlParams_.Encode()
9284 req, err := http.NewRequest("POST", urls, body)
9285 if err != nil {
9286 return nil, err
9287 }
9288 req.Header = reqHeaders
9289 googleapi.Expand(req.URL, map[string]string{
9290 "userId": c.userId,
9291 })
9292 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9293 }
9294
9295
9296
9297
9298
9299
9300 func (c *UsersSettingsSendAsCreateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
9301 gensupport.SetOptions(c.urlParams_, opts...)
9302 res, err := c.doRequest("json")
9303 if res != nil && res.StatusCode == http.StatusNotModified {
9304 if res.Body != nil {
9305 res.Body.Close()
9306 }
9307 return nil, gensupport.WrapError(&googleapi.Error{
9308 Code: res.StatusCode,
9309 Header: res.Header,
9310 })
9311 }
9312 if err != nil {
9313 return nil, err
9314 }
9315 defer googleapi.CloseBody(res)
9316 if err := googleapi.CheckResponse(res); err != nil {
9317 return nil, gensupport.WrapError(err)
9318 }
9319 ret := &SendAs{
9320 ServerResponse: googleapi.ServerResponse{
9321 Header: res.Header,
9322 HTTPStatusCode: res.StatusCode,
9323 },
9324 }
9325 target := &ret
9326 if err := gensupport.DecodeResponse(target, res); err != nil {
9327 return nil, err
9328 }
9329 return ret, nil
9330 }
9331
9332 type UsersSettingsSendAsDeleteCall struct {
9333 s *Service
9334 userId string
9335 sendAsEmail string
9336 urlParams_ gensupport.URLParams
9337 ctx_ context.Context
9338 header_ http.Header
9339 }
9340
9341
9342
9343
9344
9345
9346
9347
9348 func (r *UsersSettingsSendAsService) Delete(userId string, sendAsEmail string) *UsersSettingsSendAsDeleteCall {
9349 c := &UsersSettingsSendAsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9350 c.userId = userId
9351 c.sendAsEmail = sendAsEmail
9352 return c
9353 }
9354
9355
9356
9357
9358 func (c *UsersSettingsSendAsDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsDeleteCall {
9359 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9360 return c
9361 }
9362
9363
9364 func (c *UsersSettingsSendAsDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsDeleteCall {
9365 c.ctx_ = ctx
9366 return c
9367 }
9368
9369
9370
9371 func (c *UsersSettingsSendAsDeleteCall) Header() http.Header {
9372 if c.header_ == nil {
9373 c.header_ = make(http.Header)
9374 }
9375 return c.header_
9376 }
9377
9378 func (c *UsersSettingsSendAsDeleteCall) doRequest(alt string) (*http.Response, error) {
9379 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9380 var body io.Reader = nil
9381 c.urlParams_.Set("alt", alt)
9382 c.urlParams_.Set("prettyPrint", "false")
9383 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
9384 urls += "?" + c.urlParams_.Encode()
9385 req, err := http.NewRequest("DELETE", urls, body)
9386 if err != nil {
9387 return nil, err
9388 }
9389 req.Header = reqHeaders
9390 googleapi.Expand(req.URL, map[string]string{
9391 "userId": c.userId,
9392 "sendAsEmail": c.sendAsEmail,
9393 })
9394 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9395 }
9396
9397
9398 func (c *UsersSettingsSendAsDeleteCall) Do(opts ...googleapi.CallOption) error {
9399 gensupport.SetOptions(c.urlParams_, opts...)
9400 res, err := c.doRequest("json")
9401 if err != nil {
9402 return err
9403 }
9404 defer googleapi.CloseBody(res)
9405 if err := googleapi.CheckResponse(res); err != nil {
9406 return gensupport.WrapError(err)
9407 }
9408 return nil
9409 }
9410
9411 type UsersSettingsSendAsGetCall struct {
9412 s *Service
9413 userId string
9414 sendAsEmail string
9415 urlParams_ gensupport.URLParams
9416 ifNoneMatch_ string
9417 ctx_ context.Context
9418 header_ http.Header
9419 }
9420
9421
9422
9423
9424
9425
9426
9427 func (r *UsersSettingsSendAsService) Get(userId string, sendAsEmail string) *UsersSettingsSendAsGetCall {
9428 c := &UsersSettingsSendAsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9429 c.userId = userId
9430 c.sendAsEmail = sendAsEmail
9431 return c
9432 }
9433
9434
9435
9436
9437 func (c *UsersSettingsSendAsGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsGetCall {
9438 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9439 return c
9440 }
9441
9442
9443
9444
9445 func (c *UsersSettingsSendAsGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsGetCall {
9446 c.ifNoneMatch_ = entityTag
9447 return c
9448 }
9449
9450
9451 func (c *UsersSettingsSendAsGetCall) Context(ctx context.Context) *UsersSettingsSendAsGetCall {
9452 c.ctx_ = ctx
9453 return c
9454 }
9455
9456
9457
9458 func (c *UsersSettingsSendAsGetCall) Header() http.Header {
9459 if c.header_ == nil {
9460 c.header_ = make(http.Header)
9461 }
9462 return c.header_
9463 }
9464
9465 func (c *UsersSettingsSendAsGetCall) doRequest(alt string) (*http.Response, error) {
9466 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9467 if c.ifNoneMatch_ != "" {
9468 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9469 }
9470 var body io.Reader = nil
9471 c.urlParams_.Set("alt", alt)
9472 c.urlParams_.Set("prettyPrint", "false")
9473 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
9474 urls += "?" + c.urlParams_.Encode()
9475 req, err := http.NewRequest("GET", urls, body)
9476 if err != nil {
9477 return nil, err
9478 }
9479 req.Header = reqHeaders
9480 googleapi.Expand(req.URL, map[string]string{
9481 "userId": c.userId,
9482 "sendAsEmail": c.sendAsEmail,
9483 })
9484 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9485 }
9486
9487
9488
9489
9490
9491
9492 func (c *UsersSettingsSendAsGetCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
9493 gensupport.SetOptions(c.urlParams_, opts...)
9494 res, err := c.doRequest("json")
9495 if res != nil && res.StatusCode == http.StatusNotModified {
9496 if res.Body != nil {
9497 res.Body.Close()
9498 }
9499 return nil, gensupport.WrapError(&googleapi.Error{
9500 Code: res.StatusCode,
9501 Header: res.Header,
9502 })
9503 }
9504 if err != nil {
9505 return nil, err
9506 }
9507 defer googleapi.CloseBody(res)
9508 if err := googleapi.CheckResponse(res); err != nil {
9509 return nil, gensupport.WrapError(err)
9510 }
9511 ret := &SendAs{
9512 ServerResponse: googleapi.ServerResponse{
9513 Header: res.Header,
9514 HTTPStatusCode: res.StatusCode,
9515 },
9516 }
9517 target := &ret
9518 if err := gensupport.DecodeResponse(target, res); err != nil {
9519 return nil, err
9520 }
9521 return ret, nil
9522 }
9523
9524 type UsersSettingsSendAsListCall struct {
9525 s *Service
9526 userId string
9527 urlParams_ gensupport.URLParams
9528 ifNoneMatch_ string
9529 ctx_ context.Context
9530 header_ http.Header
9531 }
9532
9533
9534
9535
9536
9537
9538
9539 func (r *UsersSettingsSendAsService) List(userId string) *UsersSettingsSendAsListCall {
9540 c := &UsersSettingsSendAsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9541 c.userId = userId
9542 return c
9543 }
9544
9545
9546
9547
9548 func (c *UsersSettingsSendAsListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsListCall {
9549 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9550 return c
9551 }
9552
9553
9554
9555
9556 func (c *UsersSettingsSendAsListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsListCall {
9557 c.ifNoneMatch_ = entityTag
9558 return c
9559 }
9560
9561
9562 func (c *UsersSettingsSendAsListCall) Context(ctx context.Context) *UsersSettingsSendAsListCall {
9563 c.ctx_ = ctx
9564 return c
9565 }
9566
9567
9568
9569 func (c *UsersSettingsSendAsListCall) Header() http.Header {
9570 if c.header_ == nil {
9571 c.header_ = make(http.Header)
9572 }
9573 return c.header_
9574 }
9575
9576 func (c *UsersSettingsSendAsListCall) doRequest(alt string) (*http.Response, error) {
9577 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9578 if c.ifNoneMatch_ != "" {
9579 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9580 }
9581 var body io.Reader = nil
9582 c.urlParams_.Set("alt", alt)
9583 c.urlParams_.Set("prettyPrint", "false")
9584 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs")
9585 urls += "?" + c.urlParams_.Encode()
9586 req, err := http.NewRequest("GET", urls, body)
9587 if err != nil {
9588 return nil, err
9589 }
9590 req.Header = reqHeaders
9591 googleapi.Expand(req.URL, map[string]string{
9592 "userId": c.userId,
9593 })
9594 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9595 }
9596
9597
9598
9599
9600
9601
9602
9603 func (c *UsersSettingsSendAsListCall) Do(opts ...googleapi.CallOption) (*ListSendAsResponse, error) {
9604 gensupport.SetOptions(c.urlParams_, opts...)
9605 res, err := c.doRequest("json")
9606 if res != nil && res.StatusCode == http.StatusNotModified {
9607 if res.Body != nil {
9608 res.Body.Close()
9609 }
9610 return nil, gensupport.WrapError(&googleapi.Error{
9611 Code: res.StatusCode,
9612 Header: res.Header,
9613 })
9614 }
9615 if err != nil {
9616 return nil, err
9617 }
9618 defer googleapi.CloseBody(res)
9619 if err := googleapi.CheckResponse(res); err != nil {
9620 return nil, gensupport.WrapError(err)
9621 }
9622 ret := &ListSendAsResponse{
9623 ServerResponse: googleapi.ServerResponse{
9624 Header: res.Header,
9625 HTTPStatusCode: res.StatusCode,
9626 },
9627 }
9628 target := &ret
9629 if err := gensupport.DecodeResponse(target, res); err != nil {
9630 return nil, err
9631 }
9632 return ret, nil
9633 }
9634
9635 type UsersSettingsSendAsPatchCall struct {
9636 s *Service
9637 userId string
9638 sendAsEmail string
9639 sendas *SendAs
9640 urlParams_ gensupport.URLParams
9641 ctx_ context.Context
9642 header_ http.Header
9643 }
9644
9645
9646
9647
9648
9649
9650 func (r *UsersSettingsSendAsService) Patch(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsPatchCall {
9651 c := &UsersSettingsSendAsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9652 c.userId = userId
9653 c.sendAsEmail = sendAsEmail
9654 c.sendas = sendas
9655 return c
9656 }
9657
9658
9659
9660
9661 func (c *UsersSettingsSendAsPatchCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsPatchCall {
9662 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9663 return c
9664 }
9665
9666
9667 func (c *UsersSettingsSendAsPatchCall) Context(ctx context.Context) *UsersSettingsSendAsPatchCall {
9668 c.ctx_ = ctx
9669 return c
9670 }
9671
9672
9673
9674 func (c *UsersSettingsSendAsPatchCall) Header() http.Header {
9675 if c.header_ == nil {
9676 c.header_ = make(http.Header)
9677 }
9678 return c.header_
9679 }
9680
9681 func (c *UsersSettingsSendAsPatchCall) doRequest(alt string) (*http.Response, error) {
9682 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
9683 var body io.Reader = nil
9684 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
9685 if err != nil {
9686 return nil, err
9687 }
9688 c.urlParams_.Set("alt", alt)
9689 c.urlParams_.Set("prettyPrint", "false")
9690 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
9691 urls += "?" + c.urlParams_.Encode()
9692 req, err := http.NewRequest("PATCH", urls, body)
9693 if err != nil {
9694 return nil, err
9695 }
9696 req.Header = reqHeaders
9697 googleapi.Expand(req.URL, map[string]string{
9698 "userId": c.userId,
9699 "sendAsEmail": c.sendAsEmail,
9700 })
9701 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9702 }
9703
9704
9705
9706
9707
9708
9709 func (c *UsersSettingsSendAsPatchCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
9710 gensupport.SetOptions(c.urlParams_, opts...)
9711 res, err := c.doRequest("json")
9712 if res != nil && res.StatusCode == http.StatusNotModified {
9713 if res.Body != nil {
9714 res.Body.Close()
9715 }
9716 return nil, gensupport.WrapError(&googleapi.Error{
9717 Code: res.StatusCode,
9718 Header: res.Header,
9719 })
9720 }
9721 if err != nil {
9722 return nil, err
9723 }
9724 defer googleapi.CloseBody(res)
9725 if err := googleapi.CheckResponse(res); err != nil {
9726 return nil, gensupport.WrapError(err)
9727 }
9728 ret := &SendAs{
9729 ServerResponse: googleapi.ServerResponse{
9730 Header: res.Header,
9731 HTTPStatusCode: res.StatusCode,
9732 },
9733 }
9734 target := &ret
9735 if err := gensupport.DecodeResponse(target, res); err != nil {
9736 return nil, err
9737 }
9738 return ret, nil
9739 }
9740
9741 type UsersSettingsSendAsUpdateCall struct {
9742 s *Service
9743 userId string
9744 sendAsEmail string
9745 sendas *SendAs
9746 urlParams_ gensupport.URLParams
9747 ctx_ context.Context
9748 header_ http.Header
9749 }
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759 func (r *UsersSettingsSendAsService) Update(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsUpdateCall {
9760 c := &UsersSettingsSendAsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9761 c.userId = userId
9762 c.sendAsEmail = sendAsEmail
9763 c.sendas = sendas
9764 return c
9765 }
9766
9767
9768
9769
9770 func (c *UsersSettingsSendAsUpdateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsUpdateCall {
9771 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9772 return c
9773 }
9774
9775
9776 func (c *UsersSettingsSendAsUpdateCall) Context(ctx context.Context) *UsersSettingsSendAsUpdateCall {
9777 c.ctx_ = ctx
9778 return c
9779 }
9780
9781
9782
9783 func (c *UsersSettingsSendAsUpdateCall) Header() http.Header {
9784 if c.header_ == nil {
9785 c.header_ = make(http.Header)
9786 }
9787 return c.header_
9788 }
9789
9790 func (c *UsersSettingsSendAsUpdateCall) doRequest(alt string) (*http.Response, error) {
9791 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
9792 var body io.Reader = nil
9793 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
9794 if err != nil {
9795 return nil, err
9796 }
9797 c.urlParams_.Set("alt", alt)
9798 c.urlParams_.Set("prettyPrint", "false")
9799 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
9800 urls += "?" + c.urlParams_.Encode()
9801 req, err := http.NewRequest("PUT", urls, body)
9802 if err != nil {
9803 return nil, err
9804 }
9805 req.Header = reqHeaders
9806 googleapi.Expand(req.URL, map[string]string{
9807 "userId": c.userId,
9808 "sendAsEmail": c.sendAsEmail,
9809 })
9810 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9811 }
9812
9813
9814
9815
9816
9817
9818 func (c *UsersSettingsSendAsUpdateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
9819 gensupport.SetOptions(c.urlParams_, opts...)
9820 res, err := c.doRequest("json")
9821 if res != nil && res.StatusCode == http.StatusNotModified {
9822 if res.Body != nil {
9823 res.Body.Close()
9824 }
9825 return nil, gensupport.WrapError(&googleapi.Error{
9826 Code: res.StatusCode,
9827 Header: res.Header,
9828 })
9829 }
9830 if err != nil {
9831 return nil, err
9832 }
9833 defer googleapi.CloseBody(res)
9834 if err := googleapi.CheckResponse(res); err != nil {
9835 return nil, gensupport.WrapError(err)
9836 }
9837 ret := &SendAs{
9838 ServerResponse: googleapi.ServerResponse{
9839 Header: res.Header,
9840 HTTPStatusCode: res.StatusCode,
9841 },
9842 }
9843 target := &ret
9844 if err := gensupport.DecodeResponse(target, res); err != nil {
9845 return nil, err
9846 }
9847 return ret, nil
9848 }
9849
9850 type UsersSettingsSendAsVerifyCall struct {
9851 s *Service
9852 userId string
9853 sendAsEmail string
9854 urlParams_ gensupport.URLParams
9855 ctx_ context.Context
9856 header_ http.Header
9857 }
9858
9859
9860
9861
9862
9863
9864
9865
9866 func (r *UsersSettingsSendAsService) Verify(userId string, sendAsEmail string) *UsersSettingsSendAsVerifyCall {
9867 c := &UsersSettingsSendAsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9868 c.userId = userId
9869 c.sendAsEmail = sendAsEmail
9870 return c
9871 }
9872
9873
9874
9875
9876 func (c *UsersSettingsSendAsVerifyCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsVerifyCall {
9877 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9878 return c
9879 }
9880
9881
9882 func (c *UsersSettingsSendAsVerifyCall) Context(ctx context.Context) *UsersSettingsSendAsVerifyCall {
9883 c.ctx_ = ctx
9884 return c
9885 }
9886
9887
9888
9889 func (c *UsersSettingsSendAsVerifyCall) Header() http.Header {
9890 if c.header_ == nil {
9891 c.header_ = make(http.Header)
9892 }
9893 return c.header_
9894 }
9895
9896 func (c *UsersSettingsSendAsVerifyCall) doRequest(alt string) (*http.Response, error) {
9897 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9898 var body io.Reader = nil
9899 c.urlParams_.Set("alt", alt)
9900 c.urlParams_.Set("prettyPrint", "false")
9901 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify")
9902 urls += "?" + c.urlParams_.Encode()
9903 req, err := http.NewRequest("POST", urls, body)
9904 if err != nil {
9905 return nil, err
9906 }
9907 req.Header = reqHeaders
9908 googleapi.Expand(req.URL, map[string]string{
9909 "userId": c.userId,
9910 "sendAsEmail": c.sendAsEmail,
9911 })
9912 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9913 }
9914
9915
9916 func (c *UsersSettingsSendAsVerifyCall) Do(opts ...googleapi.CallOption) error {
9917 gensupport.SetOptions(c.urlParams_, opts...)
9918 res, err := c.doRequest("json")
9919 if err != nil {
9920 return err
9921 }
9922 defer googleapi.CloseBody(res)
9923 if err := googleapi.CheckResponse(res); err != nil {
9924 return gensupport.WrapError(err)
9925 }
9926 return nil
9927 }
9928
9929 type UsersSettingsSendAsSmimeInfoDeleteCall struct {
9930 s *Service
9931 userId string
9932 sendAsEmail string
9933 id string
9934 urlParams_ gensupport.URLParams
9935 ctx_ context.Context
9936 header_ http.Header
9937 }
9938
9939
9940
9941
9942
9943
9944
9945
9946 func (r *UsersSettingsSendAsSmimeInfoService) Delete(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoDeleteCall {
9947 c := &UsersSettingsSendAsSmimeInfoDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9948 c.userId = userId
9949 c.sendAsEmail = sendAsEmail
9950 c.id = id
9951 return c
9952 }
9953
9954
9955
9956
9957 func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoDeleteCall {
9958 c.urlParams_.Set("fields", googleapi.CombineFields(s))
9959 return c
9960 }
9961
9962
9963 func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoDeleteCall {
9964 c.ctx_ = ctx
9965 return c
9966 }
9967
9968
9969
9970 func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Header() http.Header {
9971 if c.header_ == nil {
9972 c.header_ = make(http.Header)
9973 }
9974 return c.header_
9975 }
9976
9977 func (c *UsersSettingsSendAsSmimeInfoDeleteCall) doRequest(alt string) (*http.Response, error) {
9978 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
9979 var body io.Reader = nil
9980 c.urlParams_.Set("alt", alt)
9981 c.urlParams_.Set("prettyPrint", "false")
9982 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}")
9983 urls += "?" + c.urlParams_.Encode()
9984 req, err := http.NewRequest("DELETE", urls, body)
9985 if err != nil {
9986 return nil, err
9987 }
9988 req.Header = reqHeaders
9989 googleapi.Expand(req.URL, map[string]string{
9990 "userId": c.userId,
9991 "sendAsEmail": c.sendAsEmail,
9992 "id": c.id,
9993 })
9994 return gensupport.SendRequest(c.ctx_, c.s.client, req)
9995 }
9996
9997
9998 func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Do(opts ...googleapi.CallOption) error {
9999 gensupport.SetOptions(c.urlParams_, opts...)
10000 res, err := c.doRequest("json")
10001 if err != nil {
10002 return err
10003 }
10004 defer googleapi.CloseBody(res)
10005 if err := googleapi.CheckResponse(res); err != nil {
10006 return gensupport.WrapError(err)
10007 }
10008 return nil
10009 }
10010
10011 type UsersSettingsSendAsSmimeInfoGetCall struct {
10012 s *Service
10013 userId string
10014 sendAsEmail string
10015 id string
10016 urlParams_ gensupport.URLParams
10017 ifNoneMatch_ string
10018 ctx_ context.Context
10019 header_ http.Header
10020 }
10021
10022
10023
10024
10025
10026
10027
10028
10029 func (r *UsersSettingsSendAsSmimeInfoService) Get(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoGetCall {
10030 c := &UsersSettingsSendAsSmimeInfoGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10031 c.userId = userId
10032 c.sendAsEmail = sendAsEmail
10033 c.id = id
10034 return c
10035 }
10036
10037
10038
10039
10040 func (c *UsersSettingsSendAsSmimeInfoGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoGetCall {
10041 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10042 return c
10043 }
10044
10045
10046
10047
10048 func (c *UsersSettingsSendAsSmimeInfoGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoGetCall {
10049 c.ifNoneMatch_ = entityTag
10050 return c
10051 }
10052
10053
10054 func (c *UsersSettingsSendAsSmimeInfoGetCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoGetCall {
10055 c.ctx_ = ctx
10056 return c
10057 }
10058
10059
10060
10061 func (c *UsersSettingsSendAsSmimeInfoGetCall) Header() http.Header {
10062 if c.header_ == nil {
10063 c.header_ = make(http.Header)
10064 }
10065 return c.header_
10066 }
10067
10068 func (c *UsersSettingsSendAsSmimeInfoGetCall) doRequest(alt string) (*http.Response, error) {
10069 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10070 if c.ifNoneMatch_ != "" {
10071 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10072 }
10073 var body io.Reader = nil
10074 c.urlParams_.Set("alt", alt)
10075 c.urlParams_.Set("prettyPrint", "false")
10076 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}")
10077 urls += "?" + c.urlParams_.Encode()
10078 req, err := http.NewRequest("GET", urls, body)
10079 if err != nil {
10080 return nil, err
10081 }
10082 req.Header = reqHeaders
10083 googleapi.Expand(req.URL, map[string]string{
10084 "userId": c.userId,
10085 "sendAsEmail": c.sendAsEmail,
10086 "id": c.id,
10087 })
10088 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10089 }
10090
10091
10092
10093
10094
10095
10096 func (c *UsersSettingsSendAsSmimeInfoGetCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) {
10097 gensupport.SetOptions(c.urlParams_, opts...)
10098 res, err := c.doRequest("json")
10099 if res != nil && res.StatusCode == http.StatusNotModified {
10100 if res.Body != nil {
10101 res.Body.Close()
10102 }
10103 return nil, gensupport.WrapError(&googleapi.Error{
10104 Code: res.StatusCode,
10105 Header: res.Header,
10106 })
10107 }
10108 if err != nil {
10109 return nil, err
10110 }
10111 defer googleapi.CloseBody(res)
10112 if err := googleapi.CheckResponse(res); err != nil {
10113 return nil, gensupport.WrapError(err)
10114 }
10115 ret := &SmimeInfo{
10116 ServerResponse: googleapi.ServerResponse{
10117 Header: res.Header,
10118 HTTPStatusCode: res.StatusCode,
10119 },
10120 }
10121 target := &ret
10122 if err := gensupport.DecodeResponse(target, res); err != nil {
10123 return nil, err
10124 }
10125 return ret, nil
10126 }
10127
10128 type UsersSettingsSendAsSmimeInfoInsertCall struct {
10129 s *Service
10130 userId string
10131 sendAsEmail string
10132 smimeinfo *SmimeInfo
10133 urlParams_ gensupport.URLParams
10134 ctx_ context.Context
10135 header_ http.Header
10136 }
10137
10138
10139
10140
10141
10142
10143
10144
10145 func (r *UsersSettingsSendAsSmimeInfoService) Insert(userId string, sendAsEmail string, smimeinfo *SmimeInfo) *UsersSettingsSendAsSmimeInfoInsertCall {
10146 c := &UsersSettingsSendAsSmimeInfoInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10147 c.userId = userId
10148 c.sendAsEmail = sendAsEmail
10149 c.smimeinfo = smimeinfo
10150 return c
10151 }
10152
10153
10154
10155
10156 func (c *UsersSettingsSendAsSmimeInfoInsertCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoInsertCall {
10157 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10158 return c
10159 }
10160
10161
10162 func (c *UsersSettingsSendAsSmimeInfoInsertCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoInsertCall {
10163 c.ctx_ = ctx
10164 return c
10165 }
10166
10167
10168
10169 func (c *UsersSettingsSendAsSmimeInfoInsertCall) Header() http.Header {
10170 if c.header_ == nil {
10171 c.header_ = make(http.Header)
10172 }
10173 return c.header_
10174 }
10175
10176 func (c *UsersSettingsSendAsSmimeInfoInsertCall) doRequest(alt string) (*http.Response, error) {
10177 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
10178 var body io.Reader = nil
10179 body, err := googleapi.WithoutDataWrapper.JSONReader(c.smimeinfo)
10180 if err != nil {
10181 return nil, err
10182 }
10183 c.urlParams_.Set("alt", alt)
10184 c.urlParams_.Set("prettyPrint", "false")
10185 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo")
10186 urls += "?" + c.urlParams_.Encode()
10187 req, err := http.NewRequest("POST", urls, body)
10188 if err != nil {
10189 return nil, err
10190 }
10191 req.Header = reqHeaders
10192 googleapi.Expand(req.URL, map[string]string{
10193 "userId": c.userId,
10194 "sendAsEmail": c.sendAsEmail,
10195 })
10196 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10197 }
10198
10199
10200
10201
10202
10203
10204 func (c *UsersSettingsSendAsSmimeInfoInsertCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) {
10205 gensupport.SetOptions(c.urlParams_, opts...)
10206 res, err := c.doRequest("json")
10207 if res != nil && res.StatusCode == http.StatusNotModified {
10208 if res.Body != nil {
10209 res.Body.Close()
10210 }
10211 return nil, gensupport.WrapError(&googleapi.Error{
10212 Code: res.StatusCode,
10213 Header: res.Header,
10214 })
10215 }
10216 if err != nil {
10217 return nil, err
10218 }
10219 defer googleapi.CloseBody(res)
10220 if err := googleapi.CheckResponse(res); err != nil {
10221 return nil, gensupport.WrapError(err)
10222 }
10223 ret := &SmimeInfo{
10224 ServerResponse: googleapi.ServerResponse{
10225 Header: res.Header,
10226 HTTPStatusCode: res.StatusCode,
10227 },
10228 }
10229 target := &ret
10230 if err := gensupport.DecodeResponse(target, res); err != nil {
10231 return nil, err
10232 }
10233 return ret, nil
10234 }
10235
10236 type UsersSettingsSendAsSmimeInfoListCall struct {
10237 s *Service
10238 userId string
10239 sendAsEmail string
10240 urlParams_ gensupport.URLParams
10241 ifNoneMatch_ string
10242 ctx_ context.Context
10243 header_ http.Header
10244 }
10245
10246
10247
10248
10249
10250
10251
10252 func (r *UsersSettingsSendAsSmimeInfoService) List(userId string, sendAsEmail string) *UsersSettingsSendAsSmimeInfoListCall {
10253 c := &UsersSettingsSendAsSmimeInfoListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10254 c.userId = userId
10255 c.sendAsEmail = sendAsEmail
10256 return c
10257 }
10258
10259
10260
10261
10262 func (c *UsersSettingsSendAsSmimeInfoListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoListCall {
10263 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10264 return c
10265 }
10266
10267
10268
10269
10270 func (c *UsersSettingsSendAsSmimeInfoListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoListCall {
10271 c.ifNoneMatch_ = entityTag
10272 return c
10273 }
10274
10275
10276 func (c *UsersSettingsSendAsSmimeInfoListCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoListCall {
10277 c.ctx_ = ctx
10278 return c
10279 }
10280
10281
10282
10283 func (c *UsersSettingsSendAsSmimeInfoListCall) Header() http.Header {
10284 if c.header_ == nil {
10285 c.header_ = make(http.Header)
10286 }
10287 return c.header_
10288 }
10289
10290 func (c *UsersSettingsSendAsSmimeInfoListCall) doRequest(alt string) (*http.Response, error) {
10291 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10292 if c.ifNoneMatch_ != "" {
10293 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10294 }
10295 var body io.Reader = nil
10296 c.urlParams_.Set("alt", alt)
10297 c.urlParams_.Set("prettyPrint", "false")
10298 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo")
10299 urls += "?" + c.urlParams_.Encode()
10300 req, err := http.NewRequest("GET", urls, body)
10301 if err != nil {
10302 return nil, err
10303 }
10304 req.Header = reqHeaders
10305 googleapi.Expand(req.URL, map[string]string{
10306 "userId": c.userId,
10307 "sendAsEmail": c.sendAsEmail,
10308 })
10309 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10310 }
10311
10312
10313
10314
10315
10316
10317
10318 func (c *UsersSettingsSendAsSmimeInfoListCall) Do(opts ...googleapi.CallOption) (*ListSmimeInfoResponse, error) {
10319 gensupport.SetOptions(c.urlParams_, opts...)
10320 res, err := c.doRequest("json")
10321 if res != nil && res.StatusCode == http.StatusNotModified {
10322 if res.Body != nil {
10323 res.Body.Close()
10324 }
10325 return nil, gensupport.WrapError(&googleapi.Error{
10326 Code: res.StatusCode,
10327 Header: res.Header,
10328 })
10329 }
10330 if err != nil {
10331 return nil, err
10332 }
10333 defer googleapi.CloseBody(res)
10334 if err := googleapi.CheckResponse(res); err != nil {
10335 return nil, gensupport.WrapError(err)
10336 }
10337 ret := &ListSmimeInfoResponse{
10338 ServerResponse: googleapi.ServerResponse{
10339 Header: res.Header,
10340 HTTPStatusCode: res.StatusCode,
10341 },
10342 }
10343 target := &ret
10344 if err := gensupport.DecodeResponse(target, res); err != nil {
10345 return nil, err
10346 }
10347 return ret, nil
10348 }
10349
10350 type UsersSettingsSendAsSmimeInfoSetDefaultCall struct {
10351 s *Service
10352 userId string
10353 sendAsEmail string
10354 id string
10355 urlParams_ gensupport.URLParams
10356 ctx_ context.Context
10357 header_ http.Header
10358 }
10359
10360
10361
10362
10363
10364
10365
10366
10367 func (r *UsersSettingsSendAsSmimeInfoService) SetDefault(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
10368 c := &UsersSettingsSendAsSmimeInfoSetDefaultCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10369 c.userId = userId
10370 c.sendAsEmail = sendAsEmail
10371 c.id = id
10372 return c
10373 }
10374
10375
10376
10377
10378 func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
10379 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10380 return c
10381 }
10382
10383
10384 func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
10385 c.ctx_ = ctx
10386 return c
10387 }
10388
10389
10390
10391 func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Header() http.Header {
10392 if c.header_ == nil {
10393 c.header_ = make(http.Header)
10394 }
10395 return c.header_
10396 }
10397
10398 func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) doRequest(alt string) (*http.Response, error) {
10399 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10400 var body io.Reader = nil
10401 c.urlParams_.Set("alt", alt)
10402 c.urlParams_.Set("prettyPrint", "false")
10403 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault")
10404 urls += "?" + c.urlParams_.Encode()
10405 req, err := http.NewRequest("POST", urls, body)
10406 if err != nil {
10407 return nil, err
10408 }
10409 req.Header = reqHeaders
10410 googleapi.Expand(req.URL, map[string]string{
10411 "userId": c.userId,
10412 "sendAsEmail": c.sendAsEmail,
10413 "id": c.id,
10414 })
10415 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10416 }
10417
10418
10419 func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Do(opts ...googleapi.CallOption) error {
10420 gensupport.SetOptions(c.urlParams_, opts...)
10421 res, err := c.doRequest("json")
10422 if err != nil {
10423 return err
10424 }
10425 defer googleapi.CloseBody(res)
10426 if err := googleapi.CheckResponse(res); err != nil {
10427 return gensupport.WrapError(err)
10428 }
10429 return nil
10430 }
10431
10432 type UsersThreadsDeleteCall struct {
10433 s *Service
10434 userId string
10435 id string
10436 urlParams_ gensupport.URLParams
10437 ctx_ context.Context
10438 header_ http.Header
10439 }
10440
10441
10442
10443
10444
10445
10446
10447
10448 func (r *UsersThreadsService) Delete(userId string, id string) *UsersThreadsDeleteCall {
10449 c := &UsersThreadsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10450 c.userId = userId
10451 c.id = id
10452 return c
10453 }
10454
10455
10456
10457
10458 func (c *UsersThreadsDeleteCall) Fields(s ...googleapi.Field) *UsersThreadsDeleteCall {
10459 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10460 return c
10461 }
10462
10463
10464 func (c *UsersThreadsDeleteCall) Context(ctx context.Context) *UsersThreadsDeleteCall {
10465 c.ctx_ = ctx
10466 return c
10467 }
10468
10469
10470
10471 func (c *UsersThreadsDeleteCall) Header() http.Header {
10472 if c.header_ == nil {
10473 c.header_ = make(http.Header)
10474 }
10475 return c.header_
10476 }
10477
10478 func (c *UsersThreadsDeleteCall) doRequest(alt string) (*http.Response, error) {
10479 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10480 var body io.Reader = nil
10481 c.urlParams_.Set("alt", alt)
10482 c.urlParams_.Set("prettyPrint", "false")
10483 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}")
10484 urls += "?" + c.urlParams_.Encode()
10485 req, err := http.NewRequest("DELETE", urls, body)
10486 if err != nil {
10487 return nil, err
10488 }
10489 req.Header = reqHeaders
10490 googleapi.Expand(req.URL, map[string]string{
10491 "userId": c.userId,
10492 "id": c.id,
10493 })
10494 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10495 }
10496
10497
10498 func (c *UsersThreadsDeleteCall) Do(opts ...googleapi.CallOption) error {
10499 gensupport.SetOptions(c.urlParams_, opts...)
10500 res, err := c.doRequest("json")
10501 if err != nil {
10502 return err
10503 }
10504 defer googleapi.CloseBody(res)
10505 if err := googleapi.CheckResponse(res); err != nil {
10506 return gensupport.WrapError(err)
10507 }
10508 return nil
10509 }
10510
10511 type UsersThreadsGetCall struct {
10512 s *Service
10513 userId string
10514 id string
10515 urlParams_ gensupport.URLParams
10516 ifNoneMatch_ string
10517 ctx_ context.Context
10518 header_ http.Header
10519 }
10520
10521
10522
10523
10524
10525
10526 func (r *UsersThreadsService) Get(userId string, id string) *UsersThreadsGetCall {
10527 c := &UsersThreadsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10528 c.userId = userId
10529 c.id = id
10530 return c
10531 }
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547 func (c *UsersThreadsGetCall) Format(format string) *UsersThreadsGetCall {
10548 c.urlParams_.Set("format", format)
10549 return c
10550 }
10551
10552
10553
10554 func (c *UsersThreadsGetCall) MetadataHeaders(metadataHeaders ...string) *UsersThreadsGetCall {
10555 c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...))
10556 return c
10557 }
10558
10559
10560 func (c *UsersThreadsGetCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersThreadsGetCall {
10561 c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
10562 return c
10563 }
10564
10565
10566
10567
10568 func (c *UsersThreadsGetCall) Fields(s ...googleapi.Field) *UsersThreadsGetCall {
10569 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10570 return c
10571 }
10572
10573
10574
10575
10576 func (c *UsersThreadsGetCall) IfNoneMatch(entityTag string) *UsersThreadsGetCall {
10577 c.ifNoneMatch_ = entityTag
10578 return c
10579 }
10580
10581
10582 func (c *UsersThreadsGetCall) Context(ctx context.Context) *UsersThreadsGetCall {
10583 c.ctx_ = ctx
10584 return c
10585 }
10586
10587
10588
10589 func (c *UsersThreadsGetCall) Header() http.Header {
10590 if c.header_ == nil {
10591 c.header_ = make(http.Header)
10592 }
10593 return c.header_
10594 }
10595
10596 func (c *UsersThreadsGetCall) doRequest(alt string) (*http.Response, error) {
10597 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10598 if c.ifNoneMatch_ != "" {
10599 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10600 }
10601 var body io.Reader = nil
10602 c.urlParams_.Set("alt", alt)
10603 c.urlParams_.Set("prettyPrint", "false")
10604 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}")
10605 urls += "?" + c.urlParams_.Encode()
10606 req, err := http.NewRequest("GET", urls, body)
10607 if err != nil {
10608 return nil, err
10609 }
10610 req.Header = reqHeaders
10611 googleapi.Expand(req.URL, map[string]string{
10612 "userId": c.userId,
10613 "id": c.id,
10614 })
10615 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10616 }
10617
10618
10619
10620
10621
10622
10623 func (c *UsersThreadsGetCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
10624 gensupport.SetOptions(c.urlParams_, opts...)
10625 res, err := c.doRequest("json")
10626 if res != nil && res.StatusCode == http.StatusNotModified {
10627 if res.Body != nil {
10628 res.Body.Close()
10629 }
10630 return nil, gensupport.WrapError(&googleapi.Error{
10631 Code: res.StatusCode,
10632 Header: res.Header,
10633 })
10634 }
10635 if err != nil {
10636 return nil, err
10637 }
10638 defer googleapi.CloseBody(res)
10639 if err := googleapi.CheckResponse(res); err != nil {
10640 return nil, gensupport.WrapError(err)
10641 }
10642 ret := &Thread{
10643 ServerResponse: googleapi.ServerResponse{
10644 Header: res.Header,
10645 HTTPStatusCode: res.StatusCode,
10646 },
10647 }
10648 target := &ret
10649 if err := gensupport.DecodeResponse(target, res); err != nil {
10650 return nil, err
10651 }
10652 return ret, nil
10653 }
10654
10655 type UsersThreadsListCall struct {
10656 s *Service
10657 userId string
10658 urlParams_ gensupport.URLParams
10659 ifNoneMatch_ string
10660 ctx_ context.Context
10661 header_ http.Header
10662 }
10663
10664
10665
10666
10667
10668 func (r *UsersThreadsService) List(userId string) *UsersThreadsListCall {
10669 c := &UsersThreadsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10670 c.userId = userId
10671 return c
10672 }
10673
10674
10675
10676 func (c *UsersThreadsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersThreadsListCall {
10677 c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
10678 return c
10679 }
10680
10681
10682
10683 func (c *UsersThreadsListCall) LabelIds(labelIds ...string) *UsersThreadsListCall {
10684 c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...))
10685 return c
10686 }
10687
10688
10689
10690
10691 func (c *UsersThreadsListCall) MaxResults(maxResults int64) *UsersThreadsListCall {
10692 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
10693 return c
10694 }
10695
10696
10697
10698 func (c *UsersThreadsListCall) PageToken(pageToken string) *UsersThreadsListCall {
10699 c.urlParams_.Set("pageToken", pageToken)
10700 return c
10701 }
10702
10703
10704
10705
10706
10707 func (c *UsersThreadsListCall) Q(q string) *UsersThreadsListCall {
10708 c.urlParams_.Set("q", q)
10709 return c
10710 }
10711
10712
10713 func (c *UsersThreadsListCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersThreadsListCall {
10714 c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
10715 return c
10716 }
10717
10718
10719
10720
10721 func (c *UsersThreadsListCall) Fields(s ...googleapi.Field) *UsersThreadsListCall {
10722 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10723 return c
10724 }
10725
10726
10727
10728
10729 func (c *UsersThreadsListCall) IfNoneMatch(entityTag string) *UsersThreadsListCall {
10730 c.ifNoneMatch_ = entityTag
10731 return c
10732 }
10733
10734
10735 func (c *UsersThreadsListCall) Context(ctx context.Context) *UsersThreadsListCall {
10736 c.ctx_ = ctx
10737 return c
10738 }
10739
10740
10741
10742 func (c *UsersThreadsListCall) Header() http.Header {
10743 if c.header_ == nil {
10744 c.header_ = make(http.Header)
10745 }
10746 return c.header_
10747 }
10748
10749 func (c *UsersThreadsListCall) doRequest(alt string) (*http.Response, error) {
10750 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10751 if c.ifNoneMatch_ != "" {
10752 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10753 }
10754 var body io.Reader = nil
10755 c.urlParams_.Set("alt", alt)
10756 c.urlParams_.Set("prettyPrint", "false")
10757 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads")
10758 urls += "?" + c.urlParams_.Encode()
10759 req, err := http.NewRequest("GET", urls, body)
10760 if err != nil {
10761 return nil, err
10762 }
10763 req.Header = reqHeaders
10764 googleapi.Expand(req.URL, map[string]string{
10765 "userId": c.userId,
10766 })
10767 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10768 }
10769
10770
10771
10772
10773
10774
10775
10776 func (c *UsersThreadsListCall) Do(opts ...googleapi.CallOption) (*ListThreadsResponse, error) {
10777 gensupport.SetOptions(c.urlParams_, opts...)
10778 res, err := c.doRequest("json")
10779 if res != nil && res.StatusCode == http.StatusNotModified {
10780 if res.Body != nil {
10781 res.Body.Close()
10782 }
10783 return nil, gensupport.WrapError(&googleapi.Error{
10784 Code: res.StatusCode,
10785 Header: res.Header,
10786 })
10787 }
10788 if err != nil {
10789 return nil, err
10790 }
10791 defer googleapi.CloseBody(res)
10792 if err := googleapi.CheckResponse(res); err != nil {
10793 return nil, gensupport.WrapError(err)
10794 }
10795 ret := &ListThreadsResponse{
10796 ServerResponse: googleapi.ServerResponse{
10797 Header: res.Header,
10798 HTTPStatusCode: res.StatusCode,
10799 },
10800 }
10801 target := &ret
10802 if err := gensupport.DecodeResponse(target, res); err != nil {
10803 return nil, err
10804 }
10805 return ret, nil
10806 }
10807
10808
10809
10810
10811 func (c *UsersThreadsListCall) Pages(ctx context.Context, f func(*ListThreadsResponse) error) error {
10812 c.ctx_ = ctx
10813 defer c.PageToken(c.urlParams_.Get("pageToken"))
10814 for {
10815 x, err := c.Do()
10816 if err != nil {
10817 return err
10818 }
10819 if err := f(x); err != nil {
10820 return err
10821 }
10822 if x.NextPageToken == "" {
10823 return nil
10824 }
10825 c.PageToken(x.NextPageToken)
10826 }
10827 }
10828
10829 type UsersThreadsModifyCall struct {
10830 s *Service
10831 userId string
10832 id string
10833 modifythreadrequest *ModifyThreadRequest
10834 urlParams_ gensupport.URLParams
10835 ctx_ context.Context
10836 header_ http.Header
10837 }
10838
10839
10840
10841
10842
10843
10844
10845 func (r *UsersThreadsService) Modify(userId string, id string, modifythreadrequest *ModifyThreadRequest) *UsersThreadsModifyCall {
10846 c := &UsersThreadsModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10847 c.userId = userId
10848 c.id = id
10849 c.modifythreadrequest = modifythreadrequest
10850 return c
10851 }
10852
10853
10854
10855
10856 func (c *UsersThreadsModifyCall) Fields(s ...googleapi.Field) *UsersThreadsModifyCall {
10857 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10858 return c
10859 }
10860
10861
10862 func (c *UsersThreadsModifyCall) Context(ctx context.Context) *UsersThreadsModifyCall {
10863 c.ctx_ = ctx
10864 return c
10865 }
10866
10867
10868
10869 func (c *UsersThreadsModifyCall) Header() http.Header {
10870 if c.header_ == nil {
10871 c.header_ = make(http.Header)
10872 }
10873 return c.header_
10874 }
10875
10876 func (c *UsersThreadsModifyCall) doRequest(alt string) (*http.Response, error) {
10877 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
10878 var body io.Reader = nil
10879 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifythreadrequest)
10880 if err != nil {
10881 return nil, err
10882 }
10883 c.urlParams_.Set("alt", alt)
10884 c.urlParams_.Set("prettyPrint", "false")
10885 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/modify")
10886 urls += "?" + c.urlParams_.Encode()
10887 req, err := http.NewRequest("POST", urls, body)
10888 if err != nil {
10889 return nil, err
10890 }
10891 req.Header = reqHeaders
10892 googleapi.Expand(req.URL, map[string]string{
10893 "userId": c.userId,
10894 "id": c.id,
10895 })
10896 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10897 }
10898
10899
10900
10901
10902
10903
10904 func (c *UsersThreadsModifyCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
10905 gensupport.SetOptions(c.urlParams_, opts...)
10906 res, err := c.doRequest("json")
10907 if res != nil && res.StatusCode == http.StatusNotModified {
10908 if res.Body != nil {
10909 res.Body.Close()
10910 }
10911 return nil, gensupport.WrapError(&googleapi.Error{
10912 Code: res.StatusCode,
10913 Header: res.Header,
10914 })
10915 }
10916 if err != nil {
10917 return nil, err
10918 }
10919 defer googleapi.CloseBody(res)
10920 if err := googleapi.CheckResponse(res); err != nil {
10921 return nil, gensupport.WrapError(err)
10922 }
10923 ret := &Thread{
10924 ServerResponse: googleapi.ServerResponse{
10925 Header: res.Header,
10926 HTTPStatusCode: res.StatusCode,
10927 },
10928 }
10929 target := &ret
10930 if err := gensupport.DecodeResponse(target, res); err != nil {
10931 return nil, err
10932 }
10933 return ret, nil
10934 }
10935
10936 type UsersThreadsTrashCall struct {
10937 s *Service
10938 userId string
10939 id string
10940 urlParams_ gensupport.URLParams
10941 ctx_ context.Context
10942 header_ http.Header
10943 }
10944
10945
10946
10947
10948
10949
10950
10951 func (r *UsersThreadsService) Trash(userId string, id string) *UsersThreadsTrashCall {
10952 c := &UsersThreadsTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10953 c.userId = userId
10954 c.id = id
10955 return c
10956 }
10957
10958
10959
10960
10961 func (c *UsersThreadsTrashCall) Fields(s ...googleapi.Field) *UsersThreadsTrashCall {
10962 c.urlParams_.Set("fields", googleapi.CombineFields(s))
10963 return c
10964 }
10965
10966
10967 func (c *UsersThreadsTrashCall) Context(ctx context.Context) *UsersThreadsTrashCall {
10968 c.ctx_ = ctx
10969 return c
10970 }
10971
10972
10973
10974 func (c *UsersThreadsTrashCall) Header() http.Header {
10975 if c.header_ == nil {
10976 c.header_ = make(http.Header)
10977 }
10978 return c.header_
10979 }
10980
10981 func (c *UsersThreadsTrashCall) doRequest(alt string) (*http.Response, error) {
10982 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
10983 var body io.Reader = nil
10984 c.urlParams_.Set("alt", alt)
10985 c.urlParams_.Set("prettyPrint", "false")
10986 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/trash")
10987 urls += "?" + c.urlParams_.Encode()
10988 req, err := http.NewRequest("POST", urls, body)
10989 if err != nil {
10990 return nil, err
10991 }
10992 req.Header = reqHeaders
10993 googleapi.Expand(req.URL, map[string]string{
10994 "userId": c.userId,
10995 "id": c.id,
10996 })
10997 return gensupport.SendRequest(c.ctx_, c.s.client, req)
10998 }
10999
11000
11001
11002
11003
11004
11005 func (c *UsersThreadsTrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
11006 gensupport.SetOptions(c.urlParams_, opts...)
11007 res, err := c.doRequest("json")
11008 if res != nil && res.StatusCode == http.StatusNotModified {
11009 if res.Body != nil {
11010 res.Body.Close()
11011 }
11012 return nil, gensupport.WrapError(&googleapi.Error{
11013 Code: res.StatusCode,
11014 Header: res.Header,
11015 })
11016 }
11017 if err != nil {
11018 return nil, err
11019 }
11020 defer googleapi.CloseBody(res)
11021 if err := googleapi.CheckResponse(res); err != nil {
11022 return nil, gensupport.WrapError(err)
11023 }
11024 ret := &Thread{
11025 ServerResponse: googleapi.ServerResponse{
11026 Header: res.Header,
11027 HTTPStatusCode: res.StatusCode,
11028 },
11029 }
11030 target := &ret
11031 if err := gensupport.DecodeResponse(target, res); err != nil {
11032 return nil, err
11033 }
11034 return ret, nil
11035 }
11036
11037 type UsersThreadsUntrashCall struct {
11038 s *Service
11039 userId string
11040 id string
11041 urlParams_ gensupport.URLParams
11042 ctx_ context.Context
11043 header_ http.Header
11044 }
11045
11046
11047
11048
11049
11050
11051
11052 func (r *UsersThreadsService) Untrash(userId string, id string) *UsersThreadsUntrashCall {
11053 c := &UsersThreadsUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11054 c.userId = userId
11055 c.id = id
11056 return c
11057 }
11058
11059
11060
11061
11062 func (c *UsersThreadsUntrashCall) Fields(s ...googleapi.Field) *UsersThreadsUntrashCall {
11063 c.urlParams_.Set("fields", googleapi.CombineFields(s))
11064 return c
11065 }
11066
11067
11068 func (c *UsersThreadsUntrashCall) Context(ctx context.Context) *UsersThreadsUntrashCall {
11069 c.ctx_ = ctx
11070 return c
11071 }
11072
11073
11074
11075 func (c *UsersThreadsUntrashCall) Header() http.Header {
11076 if c.header_ == nil {
11077 c.header_ = make(http.Header)
11078 }
11079 return c.header_
11080 }
11081
11082 func (c *UsersThreadsUntrashCall) doRequest(alt string) (*http.Response, error) {
11083 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
11084 var body io.Reader = nil
11085 c.urlParams_.Set("alt", alt)
11086 c.urlParams_.Set("prettyPrint", "false")
11087 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/untrash")
11088 urls += "?" + c.urlParams_.Encode()
11089 req, err := http.NewRequest("POST", urls, body)
11090 if err != nil {
11091 return nil, err
11092 }
11093 req.Header = reqHeaders
11094 googleapi.Expand(req.URL, map[string]string{
11095 "userId": c.userId,
11096 "id": c.id,
11097 })
11098 return gensupport.SendRequest(c.ctx_, c.s.client, req)
11099 }
11100
11101
11102
11103
11104
11105
11106 func (c *UsersThreadsUntrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
11107 gensupport.SetOptions(c.urlParams_, opts...)
11108 res, err := c.doRequest("json")
11109 if res != nil && res.StatusCode == http.StatusNotModified {
11110 if res.Body != nil {
11111 res.Body.Close()
11112 }
11113 return nil, gensupport.WrapError(&googleapi.Error{
11114 Code: res.StatusCode,
11115 Header: res.Header,
11116 })
11117 }
11118 if err != nil {
11119 return nil, err
11120 }
11121 defer googleapi.CloseBody(res)
11122 if err := googleapi.CheckResponse(res); err != nil {
11123 return nil, gensupport.WrapError(err)
11124 }
11125 ret := &Thread{
11126 ServerResponse: googleapi.ServerResponse{
11127 Header: res.Header,
11128 HTTPStatusCode: res.StatusCode,
11129 },
11130 }
11131 target := &ret
11132 if err := gensupport.DecodeResponse(target, res); err != nil {
11133 return nil, err
11134 }
11135 return ret, nil
11136 }
11137
View as plain text