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 package gmailpostmastertools
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "gmailpostmastertools:v1"
90 const apiName = "gmailpostmastertools"
91 const apiVersion = "v1"
92 const basePath = "https://gmailpostmastertools.googleapis.com/"
93 const basePathTemplate = "https://gmailpostmastertools.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://gmailpostmastertools.mtls.googleapis.com/"
95
96
97 const (
98
99
100 PostmasterReadonlyScope = "https://www.googleapis.com/auth/postmaster.readonly"
101 )
102
103
104 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
105 scopesOption := internaloption.WithDefaultScopes(
106 "https://www.googleapis.com/auth/postmaster.readonly",
107 )
108
109 opts = append([]option.ClientOption{scopesOption}, opts...)
110 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
111 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
112 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
113 opts = append(opts, internaloption.EnableNewAuthLibrary())
114 client, endpoint, err := htransport.NewClient(ctx, opts...)
115 if err != nil {
116 return nil, err
117 }
118 s, err := New(client)
119 if err != nil {
120 return nil, err
121 }
122 if endpoint != "" {
123 s.BasePath = endpoint
124 }
125 return s, nil
126 }
127
128
129
130
131
132
133 func New(client *http.Client) (*Service, error) {
134 if client == nil {
135 return nil, errors.New("client is nil")
136 }
137 s := &Service{client: client, BasePath: basePath}
138 s.Domains = NewDomainsService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 Domains *DomainsService
148 }
149
150 func (s *Service) userAgent() string {
151 if s.UserAgent == "" {
152 return googleapi.UserAgent
153 }
154 return googleapi.UserAgent + " " + s.UserAgent
155 }
156
157 func NewDomainsService(s *Service) *DomainsService {
158 rs := &DomainsService{s: s}
159 rs.TrafficStats = NewDomainsTrafficStatsService(s)
160 return rs
161 }
162
163 type DomainsService struct {
164 s *Service
165
166 TrafficStats *DomainsTrafficStatsService
167 }
168
169 func NewDomainsTrafficStatsService(s *Service) *DomainsTrafficStatsService {
170 rs := &DomainsTrafficStatsService{s: s}
171 return rs
172 }
173
174 type DomainsTrafficStatsService struct {
175 s *Service
176 }
177
178
179 type DeliveryError struct {
180
181
182
183
184
185
186
187
188 ErrorClass string `json:"errorClass,omitempty"`
189
190
191 ErrorRatio float64 `json:"errorRatio,omitempty"`
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219 ErrorType string `json:"errorType,omitempty"`
220
221
222
223
224
225 ForceSendFields []string `json:"-"`
226
227
228
229
230 NullFields []string `json:"-"`
231 }
232
233 func (s *DeliveryError) MarshalJSON() ([]byte, error) {
234 type NoMethod DeliveryError
235 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
236 }
237
238 func (s *DeliveryError) UnmarshalJSON(data []byte) error {
239 type NoMethod DeliveryError
240 var s1 struct {
241 ErrorRatio gensupport.JSONFloat64 `json:"errorRatio"`
242 *NoMethod
243 }
244 s1.NoMethod = (*NoMethod)(s)
245 if err := json.Unmarshal(data, &s1); err != nil {
246 return err
247 }
248 s.ErrorRatio = float64(s1.ErrorRatio)
249 return nil
250 }
251
252
253 type Domain struct {
254
255
256 CreateTime string `json:"createTime,omitempty"`
257
258
259
260 Name string `json:"name,omitempty"`
261
262
263
264
265
266
267
268
269
270
271
272 Permission string `json:"permission,omitempty"`
273
274
275 googleapi.ServerResponse `json:"-"`
276
277
278
279
280
281 ForceSendFields []string `json:"-"`
282
283
284
285
286 NullFields []string `json:"-"`
287 }
288
289 func (s *Domain) MarshalJSON() ([]byte, error) {
290 type NoMethod Domain
291 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
292 }
293
294
295
296 type FeedbackLoop struct {
297
298 Id string `json:"id,omitempty"`
299
300
301 SpamRatio float64 `json:"spamRatio,omitempty"`
302
303
304
305
306
307 ForceSendFields []string `json:"-"`
308
309
310
311
312 NullFields []string `json:"-"`
313 }
314
315 func (s *FeedbackLoop) MarshalJSON() ([]byte, error) {
316 type NoMethod FeedbackLoop
317 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
318 }
319
320 func (s *FeedbackLoop) UnmarshalJSON(data []byte) error {
321 type NoMethod FeedbackLoop
322 var s1 struct {
323 SpamRatio gensupport.JSONFloat64 `json:"spamRatio"`
324 *NoMethod
325 }
326 s1.NoMethod = (*NoMethod)(s)
327 if err := json.Unmarshal(data, &s1); err != nil {
328 return err
329 }
330 s.SpamRatio = float64(s1.SpamRatio)
331 return nil
332 }
333
334
335
336 type IpReputation struct {
337
338
339
340 IpCount int64 `json:"ipCount,omitempty,string"`
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358 Reputation string `json:"reputation,omitempty"`
359
360 SampleIps []string `json:"sampleIps,omitempty"`
361
362
363
364
365
366 ForceSendFields []string `json:"-"`
367
368
369
370
371 NullFields []string `json:"-"`
372 }
373
374 func (s *IpReputation) MarshalJSON() ([]byte, error) {
375 type NoMethod IpReputation
376 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
377 }
378
379
380 type ListDomainsResponse struct {
381
382 Domains []*Domain `json:"domains,omitempty"`
383
384
385 NextPageToken string `json:"nextPageToken,omitempty"`
386
387
388 googleapi.ServerResponse `json:"-"`
389
390
391
392
393
394 ForceSendFields []string `json:"-"`
395
396
397
398
399 NullFields []string `json:"-"`
400 }
401
402 func (s *ListDomainsResponse) MarshalJSON() ([]byte, error) {
403 type NoMethod ListDomainsResponse
404 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
405 }
406
407
408 type ListTrafficStatsResponse struct {
409
410
411 NextPageToken string `json:"nextPageToken,omitempty"`
412
413 TrafficStats []*TrafficStats `json:"trafficStats,omitempty"`
414
415
416 googleapi.ServerResponse `json:"-"`
417
418
419
420
421
422 ForceSendFields []string `json:"-"`
423
424
425
426
427 NullFields []string `json:"-"`
428 }
429
430 func (s *ListTrafficStatsResponse) MarshalJSON() ([]byte, error) {
431 type NoMethod ListTrafficStatsResponse
432 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
433 }
434
435
436 type TrafficStats struct {
437
438
439
440 DeliveryErrors []*DeliveryError `json:"deliveryErrors,omitempty"`
441
442
443
444 DkimSuccessRatio float64 `json:"dkimSuccessRatio,omitempty"`
445
446
447
448
449 DmarcSuccessRatio float64 `json:"dmarcSuccessRatio,omitempty"`
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467 DomainReputation string `json:"domainReputation,omitempty"`
468
469
470
471
472 InboundEncryptionRatio float64 `json:"inboundEncryptionRatio,omitempty"`
473
474
475
476 IpReputations []*IpReputation `json:"ipReputations,omitempty"`
477
478
479
480
481
482
483 Name string `json:"name,omitempty"`
484
485
486 OutboundEncryptionRatio float64 `json:"outboundEncryptionRatio,omitempty"`
487
488
489
490
491 SpammyFeedbackLoops []*FeedbackLoop `json:"spammyFeedbackLoops,omitempty"`
492
493
494
495 SpfSuccessRatio float64 `json:"spfSuccessRatio,omitempty"`
496
497
498
499
500
501 UserReportedSpamRatio float64 `json:"userReportedSpamRatio,omitempty"`
502
503
504
505
506
507
508 UserReportedSpamRatioLowerBound float64 `json:"userReportedSpamRatioLowerBound,omitempty"`
509
510
511
512
513
514
515 UserReportedSpamRatioUpperBound float64 `json:"userReportedSpamRatioUpperBound,omitempty"`
516
517
518 googleapi.ServerResponse `json:"-"`
519
520
521
522
523
524 ForceSendFields []string `json:"-"`
525
526
527
528
529 NullFields []string `json:"-"`
530 }
531
532 func (s *TrafficStats) MarshalJSON() ([]byte, error) {
533 type NoMethod TrafficStats
534 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
535 }
536
537 func (s *TrafficStats) UnmarshalJSON(data []byte) error {
538 type NoMethod TrafficStats
539 var s1 struct {
540 DkimSuccessRatio gensupport.JSONFloat64 `json:"dkimSuccessRatio"`
541 DmarcSuccessRatio gensupport.JSONFloat64 `json:"dmarcSuccessRatio"`
542 InboundEncryptionRatio gensupport.JSONFloat64 `json:"inboundEncryptionRatio"`
543 OutboundEncryptionRatio gensupport.JSONFloat64 `json:"outboundEncryptionRatio"`
544 SpfSuccessRatio gensupport.JSONFloat64 `json:"spfSuccessRatio"`
545 UserReportedSpamRatio gensupport.JSONFloat64 `json:"userReportedSpamRatio"`
546 UserReportedSpamRatioLowerBound gensupport.JSONFloat64 `json:"userReportedSpamRatioLowerBound"`
547 UserReportedSpamRatioUpperBound gensupport.JSONFloat64 `json:"userReportedSpamRatioUpperBound"`
548 *NoMethod
549 }
550 s1.NoMethod = (*NoMethod)(s)
551 if err := json.Unmarshal(data, &s1); err != nil {
552 return err
553 }
554 s.DkimSuccessRatio = float64(s1.DkimSuccessRatio)
555 s.DmarcSuccessRatio = float64(s1.DmarcSuccessRatio)
556 s.InboundEncryptionRatio = float64(s1.InboundEncryptionRatio)
557 s.OutboundEncryptionRatio = float64(s1.OutboundEncryptionRatio)
558 s.SpfSuccessRatio = float64(s1.SpfSuccessRatio)
559 s.UserReportedSpamRatio = float64(s1.UserReportedSpamRatio)
560 s.UserReportedSpamRatioLowerBound = float64(s1.UserReportedSpamRatioLowerBound)
561 s.UserReportedSpamRatioUpperBound = float64(s1.UserReportedSpamRatioUpperBound)
562 return nil
563 }
564
565 type DomainsGetCall struct {
566 s *Service
567 name string
568 urlParams_ gensupport.URLParams
569 ifNoneMatch_ string
570 ctx_ context.Context
571 header_ http.Header
572 }
573
574
575
576
577
578
579
580 func (r *DomainsService) Get(name string) *DomainsGetCall {
581 c := &DomainsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
582 c.name = name
583 return c
584 }
585
586
587
588
589 func (c *DomainsGetCall) Fields(s ...googleapi.Field) *DomainsGetCall {
590 c.urlParams_.Set("fields", googleapi.CombineFields(s))
591 return c
592 }
593
594
595
596
597 func (c *DomainsGetCall) IfNoneMatch(entityTag string) *DomainsGetCall {
598 c.ifNoneMatch_ = entityTag
599 return c
600 }
601
602
603 func (c *DomainsGetCall) Context(ctx context.Context) *DomainsGetCall {
604 c.ctx_ = ctx
605 return c
606 }
607
608
609
610 func (c *DomainsGetCall) Header() http.Header {
611 if c.header_ == nil {
612 c.header_ = make(http.Header)
613 }
614 return c.header_
615 }
616
617 func (c *DomainsGetCall) doRequest(alt string) (*http.Response, error) {
618 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
619 if c.ifNoneMatch_ != "" {
620 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
621 }
622 var body io.Reader = nil
623 c.urlParams_.Set("alt", alt)
624 c.urlParams_.Set("prettyPrint", "false")
625 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
626 urls += "?" + c.urlParams_.Encode()
627 req, err := http.NewRequest("GET", urls, body)
628 if err != nil {
629 return nil, err
630 }
631 req.Header = reqHeaders
632 googleapi.Expand(req.URL, map[string]string{
633 "name": c.name,
634 })
635 return gensupport.SendRequest(c.ctx_, c.s.client, req)
636 }
637
638
639
640
641
642
643 func (c *DomainsGetCall) Do(opts ...googleapi.CallOption) (*Domain, error) {
644 gensupport.SetOptions(c.urlParams_, opts...)
645 res, err := c.doRequest("json")
646 if res != nil && res.StatusCode == http.StatusNotModified {
647 if res.Body != nil {
648 res.Body.Close()
649 }
650 return nil, gensupport.WrapError(&googleapi.Error{
651 Code: res.StatusCode,
652 Header: res.Header,
653 })
654 }
655 if err != nil {
656 return nil, err
657 }
658 defer googleapi.CloseBody(res)
659 if err := googleapi.CheckResponse(res); err != nil {
660 return nil, gensupport.WrapError(err)
661 }
662 ret := &Domain{
663 ServerResponse: googleapi.ServerResponse{
664 Header: res.Header,
665 HTTPStatusCode: res.StatusCode,
666 },
667 }
668 target := &ret
669 if err := gensupport.DecodeResponse(target, res); err != nil {
670 return nil, err
671 }
672 return ret, nil
673 }
674
675 type DomainsListCall struct {
676 s *Service
677 urlParams_ gensupport.URLParams
678 ifNoneMatch_ string
679 ctx_ context.Context
680 header_ http.Header
681 }
682
683
684
685
686 func (r *DomainsService) List() *DomainsListCall {
687 c := &DomainsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
688 return c
689 }
690
691
692
693
694 func (c *DomainsListCall) PageSize(pageSize int64) *DomainsListCall {
695 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
696 return c
697 }
698
699
700
701
702
703 func (c *DomainsListCall) PageToken(pageToken string) *DomainsListCall {
704 c.urlParams_.Set("pageToken", pageToken)
705 return c
706 }
707
708
709
710
711 func (c *DomainsListCall) Fields(s ...googleapi.Field) *DomainsListCall {
712 c.urlParams_.Set("fields", googleapi.CombineFields(s))
713 return c
714 }
715
716
717
718
719 func (c *DomainsListCall) IfNoneMatch(entityTag string) *DomainsListCall {
720 c.ifNoneMatch_ = entityTag
721 return c
722 }
723
724
725 func (c *DomainsListCall) Context(ctx context.Context) *DomainsListCall {
726 c.ctx_ = ctx
727 return c
728 }
729
730
731
732 func (c *DomainsListCall) Header() http.Header {
733 if c.header_ == nil {
734 c.header_ = make(http.Header)
735 }
736 return c.header_
737 }
738
739 func (c *DomainsListCall) doRequest(alt string) (*http.Response, error) {
740 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
741 if c.ifNoneMatch_ != "" {
742 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
743 }
744 var body io.Reader = nil
745 c.urlParams_.Set("alt", alt)
746 c.urlParams_.Set("prettyPrint", "false")
747 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/domains")
748 urls += "?" + c.urlParams_.Encode()
749 req, err := http.NewRequest("GET", urls, body)
750 if err != nil {
751 return nil, err
752 }
753 req.Header = reqHeaders
754 return gensupport.SendRequest(c.ctx_, c.s.client, req)
755 }
756
757
758
759
760
761
762
763 func (c *DomainsListCall) Do(opts ...googleapi.CallOption) (*ListDomainsResponse, error) {
764 gensupport.SetOptions(c.urlParams_, opts...)
765 res, err := c.doRequest("json")
766 if res != nil && res.StatusCode == http.StatusNotModified {
767 if res.Body != nil {
768 res.Body.Close()
769 }
770 return nil, gensupport.WrapError(&googleapi.Error{
771 Code: res.StatusCode,
772 Header: res.Header,
773 })
774 }
775 if err != nil {
776 return nil, err
777 }
778 defer googleapi.CloseBody(res)
779 if err := googleapi.CheckResponse(res); err != nil {
780 return nil, gensupport.WrapError(err)
781 }
782 ret := &ListDomainsResponse{
783 ServerResponse: googleapi.ServerResponse{
784 Header: res.Header,
785 HTTPStatusCode: res.StatusCode,
786 },
787 }
788 target := &ret
789 if err := gensupport.DecodeResponse(target, res); err != nil {
790 return nil, err
791 }
792 return ret, nil
793 }
794
795
796
797
798 func (c *DomainsListCall) Pages(ctx context.Context, f func(*ListDomainsResponse) error) error {
799 c.ctx_ = ctx
800 defer c.PageToken(c.urlParams_.Get("pageToken"))
801 for {
802 x, err := c.Do()
803 if err != nil {
804 return err
805 }
806 if err := f(x); err != nil {
807 return err
808 }
809 if x.NextPageToken == "" {
810 return nil
811 }
812 c.PageToken(x.NextPageToken)
813 }
814 }
815
816 type DomainsTrafficStatsGetCall struct {
817 s *Service
818 name string
819 urlParams_ gensupport.URLParams
820 ifNoneMatch_ string
821 ctx_ context.Context
822 header_ http.Header
823 }
824
825
826
827
828
829
830
831 func (r *DomainsTrafficStatsService) Get(name string) *DomainsTrafficStatsGetCall {
832 c := &DomainsTrafficStatsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
833 c.name = name
834 return c
835 }
836
837
838
839
840 func (c *DomainsTrafficStatsGetCall) Fields(s ...googleapi.Field) *DomainsTrafficStatsGetCall {
841 c.urlParams_.Set("fields", googleapi.CombineFields(s))
842 return c
843 }
844
845
846
847
848 func (c *DomainsTrafficStatsGetCall) IfNoneMatch(entityTag string) *DomainsTrafficStatsGetCall {
849 c.ifNoneMatch_ = entityTag
850 return c
851 }
852
853
854 func (c *DomainsTrafficStatsGetCall) Context(ctx context.Context) *DomainsTrafficStatsGetCall {
855 c.ctx_ = ctx
856 return c
857 }
858
859
860
861 func (c *DomainsTrafficStatsGetCall) Header() http.Header {
862 if c.header_ == nil {
863 c.header_ = make(http.Header)
864 }
865 return c.header_
866 }
867
868 func (c *DomainsTrafficStatsGetCall) doRequest(alt string) (*http.Response, error) {
869 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
870 if c.ifNoneMatch_ != "" {
871 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
872 }
873 var body io.Reader = nil
874 c.urlParams_.Set("alt", alt)
875 c.urlParams_.Set("prettyPrint", "false")
876 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
877 urls += "?" + c.urlParams_.Encode()
878 req, err := http.NewRequest("GET", urls, body)
879 if err != nil {
880 return nil, err
881 }
882 req.Header = reqHeaders
883 googleapi.Expand(req.URL, map[string]string{
884 "name": c.name,
885 })
886 return gensupport.SendRequest(c.ctx_, c.s.client, req)
887 }
888
889
890
891
892
893
894 func (c *DomainsTrafficStatsGetCall) Do(opts ...googleapi.CallOption) (*TrafficStats, error) {
895 gensupport.SetOptions(c.urlParams_, opts...)
896 res, err := c.doRequest("json")
897 if res != nil && res.StatusCode == http.StatusNotModified {
898 if res.Body != nil {
899 res.Body.Close()
900 }
901 return nil, gensupport.WrapError(&googleapi.Error{
902 Code: res.StatusCode,
903 Header: res.Header,
904 })
905 }
906 if err != nil {
907 return nil, err
908 }
909 defer googleapi.CloseBody(res)
910 if err := googleapi.CheckResponse(res); err != nil {
911 return nil, gensupport.WrapError(err)
912 }
913 ret := &TrafficStats{
914 ServerResponse: googleapi.ServerResponse{
915 Header: res.Header,
916 HTTPStatusCode: res.StatusCode,
917 },
918 }
919 target := &ret
920 if err := gensupport.DecodeResponse(target, res); err != nil {
921 return nil, err
922 }
923 return ret, nil
924 }
925
926 type DomainsTrafficStatsListCall struct {
927 s *Service
928 parent string
929 urlParams_ gensupport.URLParams
930 ifNoneMatch_ string
931 ctx_ context.Context
932 header_ http.Header
933 }
934
935
936
937
938
939
940
941
942 func (r *DomainsTrafficStatsService) List(parent string) *DomainsTrafficStatsListCall {
943 c := &DomainsTrafficStatsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
944 c.parent = parent
945 return c
946 }
947
948
949
950
951 func (c *DomainsTrafficStatsListCall) EndDateDay(endDateDay int64) *DomainsTrafficStatsListCall {
952 c.urlParams_.Set("endDate.day", fmt.Sprint(endDateDay))
953 return c
954 }
955
956
957
958 func (c *DomainsTrafficStatsListCall) EndDateMonth(endDateMonth int64) *DomainsTrafficStatsListCall {
959 c.urlParams_.Set("endDate.month", fmt.Sprint(endDateMonth))
960 return c
961 }
962
963
964
965 func (c *DomainsTrafficStatsListCall) EndDateYear(endDateYear int64) *DomainsTrafficStatsListCall {
966 c.urlParams_.Set("endDate.year", fmt.Sprint(endDateYear))
967 return c
968 }
969
970
971
972
973 func (c *DomainsTrafficStatsListCall) PageSize(pageSize int64) *DomainsTrafficStatsListCall {
974 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
975 return c
976 }
977
978
979
980
981
982 func (c *DomainsTrafficStatsListCall) PageToken(pageToken string) *DomainsTrafficStatsListCall {
983 c.urlParams_.Set("pageToken", pageToken)
984 return c
985 }
986
987
988
989
990 func (c *DomainsTrafficStatsListCall) StartDateDay(startDateDay int64) *DomainsTrafficStatsListCall {
991 c.urlParams_.Set("startDate.day", fmt.Sprint(startDateDay))
992 return c
993 }
994
995
996
997 func (c *DomainsTrafficStatsListCall) StartDateMonth(startDateMonth int64) *DomainsTrafficStatsListCall {
998 c.urlParams_.Set("startDate.month", fmt.Sprint(startDateMonth))
999 return c
1000 }
1001
1002
1003
1004 func (c *DomainsTrafficStatsListCall) StartDateYear(startDateYear int64) *DomainsTrafficStatsListCall {
1005 c.urlParams_.Set("startDate.year", fmt.Sprint(startDateYear))
1006 return c
1007 }
1008
1009
1010
1011
1012 func (c *DomainsTrafficStatsListCall) Fields(s ...googleapi.Field) *DomainsTrafficStatsListCall {
1013 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1014 return c
1015 }
1016
1017
1018
1019
1020 func (c *DomainsTrafficStatsListCall) IfNoneMatch(entityTag string) *DomainsTrafficStatsListCall {
1021 c.ifNoneMatch_ = entityTag
1022 return c
1023 }
1024
1025
1026 func (c *DomainsTrafficStatsListCall) Context(ctx context.Context) *DomainsTrafficStatsListCall {
1027 c.ctx_ = ctx
1028 return c
1029 }
1030
1031
1032
1033 func (c *DomainsTrafficStatsListCall) Header() http.Header {
1034 if c.header_ == nil {
1035 c.header_ = make(http.Header)
1036 }
1037 return c.header_
1038 }
1039
1040 func (c *DomainsTrafficStatsListCall) doRequest(alt string) (*http.Response, error) {
1041 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1042 if c.ifNoneMatch_ != "" {
1043 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1044 }
1045 var body io.Reader = nil
1046 c.urlParams_.Set("alt", alt)
1047 c.urlParams_.Set("prettyPrint", "false")
1048 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/trafficStats")
1049 urls += "?" + c.urlParams_.Encode()
1050 req, err := http.NewRequest("GET", urls, body)
1051 if err != nil {
1052 return nil, err
1053 }
1054 req.Header = reqHeaders
1055 googleapi.Expand(req.URL, map[string]string{
1056 "parent": c.parent,
1057 })
1058 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1059 }
1060
1061
1062
1063
1064
1065
1066
1067 func (c *DomainsTrafficStatsListCall) Do(opts ...googleapi.CallOption) (*ListTrafficStatsResponse, error) {
1068 gensupport.SetOptions(c.urlParams_, opts...)
1069 res, err := c.doRequest("json")
1070 if res != nil && res.StatusCode == http.StatusNotModified {
1071 if res.Body != nil {
1072 res.Body.Close()
1073 }
1074 return nil, gensupport.WrapError(&googleapi.Error{
1075 Code: res.StatusCode,
1076 Header: res.Header,
1077 })
1078 }
1079 if err != nil {
1080 return nil, err
1081 }
1082 defer googleapi.CloseBody(res)
1083 if err := googleapi.CheckResponse(res); err != nil {
1084 return nil, gensupport.WrapError(err)
1085 }
1086 ret := &ListTrafficStatsResponse{
1087 ServerResponse: googleapi.ServerResponse{
1088 Header: res.Header,
1089 HTTPStatusCode: res.StatusCode,
1090 },
1091 }
1092 target := &ret
1093 if err := gensupport.DecodeResponse(target, res); err != nil {
1094 return nil, err
1095 }
1096 return ret, nil
1097 }
1098
1099
1100
1101
1102 func (c *DomainsTrafficStatsListCall) Pages(ctx context.Context, f func(*ListTrafficStatsResponse) error) error {
1103 c.ctx_ = ctx
1104 defer c.PageToken(c.urlParams_.Get("pageToken"))
1105 for {
1106 x, err := c.Do()
1107 if err != nil {
1108 return err
1109 }
1110 if err := f(x); err != nil {
1111 return err
1112 }
1113 if x.NextPageToken == "" {
1114 return nil
1115 }
1116 c.PageToken(x.NextPageToken)
1117 }
1118 }
1119
View as plain text