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 adsensehost
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 = "adsensehost:v4.1"
90 const apiName = "adsensehost"
91 const apiVersion = "v4.1"
92 const basePath = "https://www.googleapis.com/adsensehost/v4.1/"
93 const basePathTemplate = "https://www.UNIVERSE_DOMAIN/adsensehost/v4.1/"
94
95
96 const (
97
98 AdsensehostScope = "https://www.googleapis.com/auth/adsensehost"
99 )
100
101
102 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
103 scopesOption := internaloption.WithDefaultScopes(
104 "https://www.googleapis.com/auth/adsensehost",
105 )
106
107 opts = append([]option.ClientOption{scopesOption}, opts...)
108 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
109 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
110 opts = append(opts, internaloption.EnableNewAuthLibrary())
111 client, endpoint, err := htransport.NewClient(ctx, opts...)
112 if err != nil {
113 return nil, err
114 }
115 s, err := New(client)
116 if err != nil {
117 return nil, err
118 }
119 if endpoint != "" {
120 s.BasePath = endpoint
121 }
122 return s, nil
123 }
124
125
126
127
128
129
130 func New(client *http.Client) (*Service, error) {
131 if client == nil {
132 return nil, errors.New("client is nil")
133 }
134 s := &Service{client: client, BasePath: basePath}
135 s.Accounts = NewAccountsService(s)
136 s.Adclients = NewAdclientsService(s)
137 s.Associationsessions = NewAssociationsessionsService(s)
138 s.Customchannels = NewCustomchannelsService(s)
139 s.Reports = NewReportsService(s)
140 s.Urlchannels = NewUrlchannelsService(s)
141 return s, nil
142 }
143
144 type Service struct {
145 client *http.Client
146 BasePath string
147 UserAgent string
148
149 Accounts *AccountsService
150
151 Adclients *AdclientsService
152
153 Associationsessions *AssociationsessionsService
154
155 Customchannels *CustomchannelsService
156
157 Reports *ReportsService
158
159 Urlchannels *UrlchannelsService
160 }
161
162 func (s *Service) userAgent() string {
163 if s.UserAgent == "" {
164 return googleapi.UserAgent
165 }
166 return googleapi.UserAgent + " " + s.UserAgent
167 }
168
169 func NewAccountsService(s *Service) *AccountsService {
170 rs := &AccountsService{s: s}
171 rs.Adclients = NewAccountsAdclientsService(s)
172 rs.Adunits = NewAccountsAdunitsService(s)
173 rs.Reports = NewAccountsReportsService(s)
174 return rs
175 }
176
177 type AccountsService struct {
178 s *Service
179
180 Adclients *AccountsAdclientsService
181
182 Adunits *AccountsAdunitsService
183
184 Reports *AccountsReportsService
185 }
186
187 func NewAccountsAdclientsService(s *Service) *AccountsAdclientsService {
188 rs := &AccountsAdclientsService{s: s}
189 return rs
190 }
191
192 type AccountsAdclientsService struct {
193 s *Service
194 }
195
196 func NewAccountsAdunitsService(s *Service) *AccountsAdunitsService {
197 rs := &AccountsAdunitsService{s: s}
198 return rs
199 }
200
201 type AccountsAdunitsService struct {
202 s *Service
203 }
204
205 func NewAccountsReportsService(s *Service) *AccountsReportsService {
206 rs := &AccountsReportsService{s: s}
207 return rs
208 }
209
210 type AccountsReportsService struct {
211 s *Service
212 }
213
214 func NewAdclientsService(s *Service) *AdclientsService {
215 rs := &AdclientsService{s: s}
216 return rs
217 }
218
219 type AdclientsService struct {
220 s *Service
221 }
222
223 func NewAssociationsessionsService(s *Service) *AssociationsessionsService {
224 rs := &AssociationsessionsService{s: s}
225 return rs
226 }
227
228 type AssociationsessionsService struct {
229 s *Service
230 }
231
232 func NewCustomchannelsService(s *Service) *CustomchannelsService {
233 rs := &CustomchannelsService{s: s}
234 return rs
235 }
236
237 type CustomchannelsService struct {
238 s *Service
239 }
240
241 func NewReportsService(s *Service) *ReportsService {
242 rs := &ReportsService{s: s}
243 return rs
244 }
245
246 type ReportsService struct {
247 s *Service
248 }
249
250 func NewUrlchannelsService(s *Service) *UrlchannelsService {
251 rs := &UrlchannelsService{s: s}
252 return rs
253 }
254
255 type UrlchannelsService struct {
256 s *Service
257 }
258
259 type Account struct {
260
261 Id string `json:"id,omitempty"`
262
263 Kind string `json:"kind,omitempty"`
264
265 Name string `json:"name,omitempty"`
266
267
268 Status string `json:"status,omitempty"`
269
270
271 googleapi.ServerResponse `json:"-"`
272
273
274
275
276
277 ForceSendFields []string `json:"-"`
278
279
280
281
282 NullFields []string `json:"-"`
283 }
284
285 func (s *Account) MarshalJSON() ([]byte, error) {
286 type NoMethod Account
287 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
288 }
289
290 type Accounts struct {
291
292 Etag string `json:"etag,omitempty"`
293
294 Items []*Account `json:"items,omitempty"`
295
296 Kind string `json:"kind,omitempty"`
297
298
299 googleapi.ServerResponse `json:"-"`
300
301
302
303
304
305 ForceSendFields []string `json:"-"`
306
307
308
309
310 NullFields []string `json:"-"`
311 }
312
313 func (s *Accounts) MarshalJSON() ([]byte, error) {
314 type NoMethod Accounts
315 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
316 }
317
318 type AdClient struct {
319
320 ArcOptIn bool `json:"arcOptIn,omitempty"`
321
322 Id string `json:"id,omitempty"`
323
324 Kind string `json:"kind,omitempty"`
325
326
327 ProductCode string `json:"productCode,omitempty"`
328
329 SupportsReporting bool `json:"supportsReporting,omitempty"`
330
331
332 googleapi.ServerResponse `json:"-"`
333
334
335
336
337
338 ForceSendFields []string `json:"-"`
339
340
341
342
343 NullFields []string `json:"-"`
344 }
345
346 func (s *AdClient) MarshalJSON() ([]byte, error) {
347 type NoMethod AdClient
348 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
349 }
350
351 type AdClients struct {
352
353 Etag string `json:"etag,omitempty"`
354
355 Items []*AdClient `json:"items,omitempty"`
356
357 Kind string `json:"kind,omitempty"`
358
359
360
361 NextPageToken string `json:"nextPageToken,omitempty"`
362
363
364 googleapi.ServerResponse `json:"-"`
365
366
367
368
369
370 ForceSendFields []string `json:"-"`
371
372
373
374
375 NullFields []string `json:"-"`
376 }
377
378 func (s *AdClients) MarshalJSON() ([]byte, error) {
379 type NoMethod AdClients
380 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
381 }
382
383 type AdCode struct {
384
385 AdCode string `json:"adCode,omitempty"`
386
387 Kind string `json:"kind,omitempty"`
388
389
390 googleapi.ServerResponse `json:"-"`
391
392
393
394
395
396 ForceSendFields []string `json:"-"`
397
398
399
400
401 NullFields []string `json:"-"`
402 }
403
404 func (s *AdCode) MarshalJSON() ([]byte, error) {
405 type NoMethod AdCode
406 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
407 }
408
409 type AdStyle struct {
410
411
412
413 Colors *AdStyleColors `json:"colors,omitempty"`
414
415
416 Corners string `json:"corners,omitempty"`
417
418 Font *AdStyleFont `json:"font,omitempty"`
419
420 Kind string `json:"kind,omitempty"`
421
422
423
424
425
426 ForceSendFields []string `json:"-"`
427
428
429
430
431 NullFields []string `json:"-"`
432 }
433
434 func (s *AdStyle) MarshalJSON() ([]byte, error) {
435 type NoMethod AdStyle
436 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
437 }
438
439
440
441
442 type AdStyleColors struct {
443
444 Background string `json:"background,omitempty"`
445
446 Border string `json:"border,omitempty"`
447
448 Text string `json:"text,omitempty"`
449
450 Title string `json:"title,omitempty"`
451
452 Url string `json:"url,omitempty"`
453
454
455
456
457
458 ForceSendFields []string `json:"-"`
459
460
461
462
463 NullFields []string `json:"-"`
464 }
465
466 func (s *AdStyleColors) MarshalJSON() ([]byte, error) {
467 type NoMethod AdStyleColors
468 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
469 }
470
471
472 type AdStyleFont struct {
473
474
475 Family string `json:"family,omitempty"`
476
477
478 Size string `json:"size,omitempty"`
479
480
481
482
483
484 ForceSendFields []string `json:"-"`
485
486
487
488
489 NullFields []string `json:"-"`
490 }
491
492 func (s *AdStyleFont) MarshalJSON() ([]byte, error) {
493 type NoMethod AdStyleFont
494 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
495 }
496
497 type AdUnit struct {
498
499
500 Code string `json:"code,omitempty"`
501
502
503 ContentAdsSettings *AdUnitContentAdsSettings `json:"contentAdsSettings,omitempty"`
504
505 CustomStyle *AdStyle `json:"customStyle,omitempty"`
506
507
508 Id string `json:"id,omitempty"`
509
510 Kind string `json:"kind,omitempty"`
511
512
513 MobileContentAdsSettings *AdUnitMobileContentAdsSettings `json:"mobileContentAdsSettings,omitempty"`
514
515 Name string `json:"name,omitempty"`
516
517
518
519
520
521
522
523
524
525 Status string `json:"status,omitempty"`
526
527
528 googleapi.ServerResponse `json:"-"`
529
530
531
532
533
534 ForceSendFields []string `json:"-"`
535
536
537
538
539 NullFields []string `json:"-"`
540 }
541
542 func (s *AdUnit) MarshalJSON() ([]byte, error) {
543 type NoMethod AdUnit
544 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
545 }
546
547
548
549 type AdUnitContentAdsSettings struct {
550
551
552 BackupOption *AdUnitContentAdsSettingsBackupOption `json:"backupOption,omitempty"`
553
554
555 Size string `json:"size,omitempty"`
556
557
558 Type string `json:"type,omitempty"`
559
560
561
562
563
564 ForceSendFields []string `json:"-"`
565
566
567
568
569 NullFields []string `json:"-"`
570 }
571
572 func (s *AdUnitContentAdsSettings) MarshalJSON() ([]byte, error) {
573 type NoMethod AdUnitContentAdsSettings
574 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
575 }
576
577
578
579 type AdUnitContentAdsSettingsBackupOption struct {
580
581
582
583 Color string `json:"color,omitempty"`
584
585 Type string `json:"type,omitempty"`
586
587 Url string `json:"url,omitempty"`
588
589
590
591
592
593 ForceSendFields []string `json:"-"`
594
595
596
597
598 NullFields []string `json:"-"`
599 }
600
601 func (s *AdUnitContentAdsSettingsBackupOption) MarshalJSON() ([]byte, error) {
602 type NoMethod AdUnitContentAdsSettingsBackupOption
603 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
604 }
605
606
607
608 type AdUnitMobileContentAdsSettings struct {
609
610 MarkupLanguage string `json:"markupLanguage,omitempty"`
611
612 ScriptingLanguage string `json:"scriptingLanguage,omitempty"`
613
614 Size string `json:"size,omitempty"`
615
616 Type string `json:"type,omitempty"`
617
618
619
620
621
622 ForceSendFields []string `json:"-"`
623
624
625
626
627 NullFields []string `json:"-"`
628 }
629
630 func (s *AdUnitMobileContentAdsSettings) MarshalJSON() ([]byte, error) {
631 type NoMethod AdUnitMobileContentAdsSettings
632 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
633 }
634
635 type AdUnits struct {
636
637 Etag string `json:"etag,omitempty"`
638
639 Items []*AdUnit `json:"items,omitempty"`
640
641 Kind string `json:"kind,omitempty"`
642
643
644 NextPageToken string `json:"nextPageToken,omitempty"`
645
646
647 googleapi.ServerResponse `json:"-"`
648
649
650
651
652
653 ForceSendFields []string `json:"-"`
654
655
656
657
658 NullFields []string `json:"-"`
659 }
660
661 func (s *AdUnits) MarshalJSON() ([]byte, error) {
662 type NoMethod AdUnits
663 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
664 }
665
666 type AssociationSession struct {
667
668
669 AccountId string `json:"accountId,omitempty"`
670
671 Id string `json:"id,omitempty"`
672
673 Kind string `json:"kind,omitempty"`
674
675
676 ProductCodes []string `json:"productCodes,omitempty"`
677
678
679 RedirectUrl string `json:"redirectUrl,omitempty"`
680
681
682 Status string `json:"status,omitempty"`
683
684
685 UserLocale string `json:"userLocale,omitempty"`
686
687 WebsiteLocale string `json:"websiteLocale,omitempty"`
688
689 WebsiteUrl string `json:"websiteUrl,omitempty"`
690
691
692 googleapi.ServerResponse `json:"-"`
693
694
695
696
697
698 ForceSendFields []string `json:"-"`
699
700
701
702
703 NullFields []string `json:"-"`
704 }
705
706 func (s *AssociationSession) MarshalJSON() ([]byte, error) {
707 type NoMethod AssociationSession
708 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
709 }
710
711 type CustomChannel struct {
712
713 Code string `json:"code,omitempty"`
714
715
716
717 Id string `json:"id,omitempty"`
718
719 Kind string `json:"kind,omitempty"`
720
721 Name string `json:"name,omitempty"`
722
723
724 googleapi.ServerResponse `json:"-"`
725
726
727
728
729
730 ForceSendFields []string `json:"-"`
731
732
733
734
735 NullFields []string `json:"-"`
736 }
737
738 func (s *CustomChannel) MarshalJSON() ([]byte, error) {
739 type NoMethod CustomChannel
740 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
741 }
742
743 type CustomChannels struct {
744
745 Etag string `json:"etag,omitempty"`
746
747 Items []*CustomChannel `json:"items,omitempty"`
748
749 Kind string `json:"kind,omitempty"`
750
751
752
753 NextPageToken string `json:"nextPageToken,omitempty"`
754
755
756 googleapi.ServerResponse `json:"-"`
757
758
759
760
761
762 ForceSendFields []string `json:"-"`
763
764
765
766
767 NullFields []string `json:"-"`
768 }
769
770 func (s *CustomChannels) MarshalJSON() ([]byte, error) {
771 type NoMethod CustomChannels
772 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
773 }
774
775 type Report struct {
776
777
778 Averages []string `json:"averages,omitempty"`
779
780
781
782 Headers []*ReportHeaders `json:"headers,omitempty"`
783
784 Kind string `json:"kind,omitempty"`
785
786
787
788
789 Rows [][]string `json:"rows,omitempty"`
790
791
792
793 TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"`
794
795
796 Totals []string `json:"totals,omitempty"`
797
798 Warnings []string `json:"warnings,omitempty"`
799
800
801 googleapi.ServerResponse `json:"-"`
802
803
804
805
806
807 ForceSendFields []string `json:"-"`
808
809
810
811
812 NullFields []string `json:"-"`
813 }
814
815 func (s *Report) MarshalJSON() ([]byte, error) {
816 type NoMethod Report
817 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
818 }
819
820 type ReportHeaders struct {
821
822
823 Currency string `json:"currency,omitempty"`
824
825 Name string `json:"name,omitempty"`
826
827
828 Type string `json:"type,omitempty"`
829
830
831
832
833
834 ForceSendFields []string `json:"-"`
835
836
837
838
839 NullFields []string `json:"-"`
840 }
841
842 func (s *ReportHeaders) MarshalJSON() ([]byte, error) {
843 type NoMethod ReportHeaders
844 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
845 }
846
847 type UrlChannel struct {
848
849
850
851 Id string `json:"id,omitempty"`
852
853 Kind string `json:"kind,omitempty"`
854
855
856 UrlPattern string `json:"urlPattern,omitempty"`
857
858
859 googleapi.ServerResponse `json:"-"`
860
861
862
863
864
865 ForceSendFields []string `json:"-"`
866
867
868
869
870 NullFields []string `json:"-"`
871 }
872
873 func (s *UrlChannel) MarshalJSON() ([]byte, error) {
874 type NoMethod UrlChannel
875 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
876 }
877
878 type UrlChannels struct {
879
880 Etag string `json:"etag,omitempty"`
881
882 Items []*UrlChannel `json:"items,omitempty"`
883
884 Kind string `json:"kind,omitempty"`
885
886
887
888 NextPageToken string `json:"nextPageToken,omitempty"`
889
890
891 googleapi.ServerResponse `json:"-"`
892
893
894
895
896
897 ForceSendFields []string `json:"-"`
898
899
900
901
902 NullFields []string `json:"-"`
903 }
904
905 func (s *UrlChannels) MarshalJSON() ([]byte, error) {
906 type NoMethod UrlChannels
907 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
908 }
909
910 type AccountsGetCall struct {
911 s *Service
912 accountId string
913 urlParams_ gensupport.URLParams
914 ifNoneMatch_ string
915 ctx_ context.Context
916 header_ http.Header
917 }
918
919
920
921
922 func (r *AccountsService) Get(accountId string) *AccountsGetCall {
923 c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
924 c.accountId = accountId
925 return c
926 }
927
928
929
930
931 func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
932 c.urlParams_.Set("fields", googleapi.CombineFields(s))
933 return c
934 }
935
936
937
938
939 func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
940 c.ifNoneMatch_ = entityTag
941 return c
942 }
943
944
945 func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
946 c.ctx_ = ctx
947 return c
948 }
949
950
951
952 func (c *AccountsGetCall) Header() http.Header {
953 if c.header_ == nil {
954 c.header_ = make(http.Header)
955 }
956 return c.header_
957 }
958
959 func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
960 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
961 if c.ifNoneMatch_ != "" {
962 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
963 }
964 var body io.Reader = nil
965 c.urlParams_.Set("alt", alt)
966 c.urlParams_.Set("prettyPrint", "false")
967 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}")
968 urls += "?" + c.urlParams_.Encode()
969 req, err := http.NewRequest("GET", urls, body)
970 if err != nil {
971 return nil, err
972 }
973 req.Header = reqHeaders
974 googleapi.Expand(req.URL, map[string]string{
975 "accountId": c.accountId,
976 })
977 return gensupport.SendRequest(c.ctx_, c.s.client, req)
978 }
979
980
981
982
983
984
985 func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
986 gensupport.SetOptions(c.urlParams_, opts...)
987 res, err := c.doRequest("json")
988 if res != nil && res.StatusCode == http.StatusNotModified {
989 if res.Body != nil {
990 res.Body.Close()
991 }
992 return nil, gensupport.WrapError(&googleapi.Error{
993 Code: res.StatusCode,
994 Header: res.Header,
995 })
996 }
997 if err != nil {
998 return nil, err
999 }
1000 defer googleapi.CloseBody(res)
1001 if err := googleapi.CheckResponse(res); err != nil {
1002 return nil, gensupport.WrapError(err)
1003 }
1004 ret := &Account{
1005 ServerResponse: googleapi.ServerResponse{
1006 Header: res.Header,
1007 HTTPStatusCode: res.StatusCode,
1008 },
1009 }
1010 target := &ret
1011 if err := gensupport.DecodeResponse(target, res); err != nil {
1012 return nil, err
1013 }
1014 return ret, nil
1015 }
1016
1017 type AccountsListCall struct {
1018 s *Service
1019 urlParams_ gensupport.URLParams
1020 ifNoneMatch_ string
1021 ctx_ context.Context
1022 header_ http.Header
1023 }
1024
1025
1026
1027
1028
1029 func (r *AccountsService) List(filterAdClientId []string) *AccountsListCall {
1030 c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1031 c.urlParams_.SetMulti("filterAdClientId", append([]string{}, filterAdClientId...))
1032 return c
1033 }
1034
1035
1036
1037
1038 func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
1039 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1040 return c
1041 }
1042
1043
1044
1045
1046 func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
1047 c.ifNoneMatch_ = entityTag
1048 return c
1049 }
1050
1051
1052 func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
1053 c.ctx_ = ctx
1054 return c
1055 }
1056
1057
1058
1059 func (c *AccountsListCall) Header() http.Header {
1060 if c.header_ == nil {
1061 c.header_ = make(http.Header)
1062 }
1063 return c.header_
1064 }
1065
1066 func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
1067 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1068 if c.ifNoneMatch_ != "" {
1069 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1070 }
1071 var body io.Reader = nil
1072 c.urlParams_.Set("alt", alt)
1073 c.urlParams_.Set("prettyPrint", "false")
1074 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
1075 urls += "?" + c.urlParams_.Encode()
1076 req, err := http.NewRequest("GET", urls, body)
1077 if err != nil {
1078 return nil, err
1079 }
1080 req.Header = reqHeaders
1081 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1082 }
1083
1084
1085
1086
1087
1088
1089 func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*Accounts, error) {
1090 gensupport.SetOptions(c.urlParams_, opts...)
1091 res, err := c.doRequest("json")
1092 if res != nil && res.StatusCode == http.StatusNotModified {
1093 if res.Body != nil {
1094 res.Body.Close()
1095 }
1096 return nil, gensupport.WrapError(&googleapi.Error{
1097 Code: res.StatusCode,
1098 Header: res.Header,
1099 })
1100 }
1101 if err != nil {
1102 return nil, err
1103 }
1104 defer googleapi.CloseBody(res)
1105 if err := googleapi.CheckResponse(res); err != nil {
1106 return nil, gensupport.WrapError(err)
1107 }
1108 ret := &Accounts{
1109 ServerResponse: googleapi.ServerResponse{
1110 Header: res.Header,
1111 HTTPStatusCode: res.StatusCode,
1112 },
1113 }
1114 target := &ret
1115 if err := gensupport.DecodeResponse(target, res); err != nil {
1116 return nil, err
1117 }
1118 return ret, nil
1119 }
1120
1121 type AccountsAdclientsGetCall struct {
1122 s *Service
1123 accountId string
1124 adClientId string
1125 urlParams_ gensupport.URLParams
1126 ifNoneMatch_ string
1127 ctx_ context.Context
1128 header_ http.Header
1129 }
1130
1131
1132
1133
1134
1135
1136 func (r *AccountsAdclientsService) Get(accountId string, adClientId string) *AccountsAdclientsGetCall {
1137 c := &AccountsAdclientsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1138 c.accountId = accountId
1139 c.adClientId = adClientId
1140 return c
1141 }
1142
1143
1144
1145
1146 func (c *AccountsAdclientsGetCall) Fields(s ...googleapi.Field) *AccountsAdclientsGetCall {
1147 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1148 return c
1149 }
1150
1151
1152
1153
1154 func (c *AccountsAdclientsGetCall) IfNoneMatch(entityTag string) *AccountsAdclientsGetCall {
1155 c.ifNoneMatch_ = entityTag
1156 return c
1157 }
1158
1159
1160 func (c *AccountsAdclientsGetCall) Context(ctx context.Context) *AccountsAdclientsGetCall {
1161 c.ctx_ = ctx
1162 return c
1163 }
1164
1165
1166
1167 func (c *AccountsAdclientsGetCall) Header() http.Header {
1168 if c.header_ == nil {
1169 c.header_ = make(http.Header)
1170 }
1171 return c.header_
1172 }
1173
1174 func (c *AccountsAdclientsGetCall) doRequest(alt string) (*http.Response, error) {
1175 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1176 if c.ifNoneMatch_ != "" {
1177 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1178 }
1179 var body io.Reader = nil
1180 c.urlParams_.Set("alt", alt)
1181 c.urlParams_.Set("prettyPrint", "false")
1182 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}")
1183 urls += "?" + c.urlParams_.Encode()
1184 req, err := http.NewRequest("GET", urls, body)
1185 if err != nil {
1186 return nil, err
1187 }
1188 req.Header = reqHeaders
1189 googleapi.Expand(req.URL, map[string]string{
1190 "accountId": c.accountId,
1191 "adClientId": c.adClientId,
1192 })
1193 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1194 }
1195
1196
1197
1198
1199
1200
1201 func (c *AccountsAdclientsGetCall) Do(opts ...googleapi.CallOption) (*AdClient, error) {
1202 gensupport.SetOptions(c.urlParams_, opts...)
1203 res, err := c.doRequest("json")
1204 if res != nil && res.StatusCode == http.StatusNotModified {
1205 if res.Body != nil {
1206 res.Body.Close()
1207 }
1208 return nil, gensupport.WrapError(&googleapi.Error{
1209 Code: res.StatusCode,
1210 Header: res.Header,
1211 })
1212 }
1213 if err != nil {
1214 return nil, err
1215 }
1216 defer googleapi.CloseBody(res)
1217 if err := googleapi.CheckResponse(res); err != nil {
1218 return nil, gensupport.WrapError(err)
1219 }
1220 ret := &AdClient{
1221 ServerResponse: googleapi.ServerResponse{
1222 Header: res.Header,
1223 HTTPStatusCode: res.StatusCode,
1224 },
1225 }
1226 target := &ret
1227 if err := gensupport.DecodeResponse(target, res); err != nil {
1228 return nil, err
1229 }
1230 return ret, nil
1231 }
1232
1233 type AccountsAdclientsListCall struct {
1234 s *Service
1235 accountId string
1236 urlParams_ gensupport.URLParams
1237 ifNoneMatch_ string
1238 ctx_ context.Context
1239 header_ http.Header
1240 }
1241
1242
1243
1244
1245 func (r *AccountsAdclientsService) List(accountId string) *AccountsAdclientsListCall {
1246 c := &AccountsAdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1247 c.accountId = accountId
1248 return c
1249 }
1250
1251
1252
1253 func (c *AccountsAdclientsListCall) MaxResults(maxResults int64) *AccountsAdclientsListCall {
1254 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1255 return c
1256 }
1257
1258
1259
1260
1261 func (c *AccountsAdclientsListCall) PageToken(pageToken string) *AccountsAdclientsListCall {
1262 c.urlParams_.Set("pageToken", pageToken)
1263 return c
1264 }
1265
1266
1267
1268
1269 func (c *AccountsAdclientsListCall) Fields(s ...googleapi.Field) *AccountsAdclientsListCall {
1270 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1271 return c
1272 }
1273
1274
1275
1276
1277 func (c *AccountsAdclientsListCall) IfNoneMatch(entityTag string) *AccountsAdclientsListCall {
1278 c.ifNoneMatch_ = entityTag
1279 return c
1280 }
1281
1282
1283 func (c *AccountsAdclientsListCall) Context(ctx context.Context) *AccountsAdclientsListCall {
1284 c.ctx_ = ctx
1285 return c
1286 }
1287
1288
1289
1290 func (c *AccountsAdclientsListCall) Header() http.Header {
1291 if c.header_ == nil {
1292 c.header_ = make(http.Header)
1293 }
1294 return c.header_
1295 }
1296
1297 func (c *AccountsAdclientsListCall) doRequest(alt string) (*http.Response, error) {
1298 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1299 if c.ifNoneMatch_ != "" {
1300 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1301 }
1302 var body io.Reader = nil
1303 c.urlParams_.Set("alt", alt)
1304 c.urlParams_.Set("prettyPrint", "false")
1305 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients")
1306 urls += "?" + c.urlParams_.Encode()
1307 req, err := http.NewRequest("GET", urls, body)
1308 if err != nil {
1309 return nil, err
1310 }
1311 req.Header = reqHeaders
1312 googleapi.Expand(req.URL, map[string]string{
1313 "accountId": c.accountId,
1314 })
1315 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1316 }
1317
1318
1319
1320
1321
1322
1323 func (c *AccountsAdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
1324 gensupport.SetOptions(c.urlParams_, opts...)
1325 res, err := c.doRequest("json")
1326 if res != nil && res.StatusCode == http.StatusNotModified {
1327 if res.Body != nil {
1328 res.Body.Close()
1329 }
1330 return nil, gensupport.WrapError(&googleapi.Error{
1331 Code: res.StatusCode,
1332 Header: res.Header,
1333 })
1334 }
1335 if err != nil {
1336 return nil, err
1337 }
1338 defer googleapi.CloseBody(res)
1339 if err := googleapi.CheckResponse(res); err != nil {
1340 return nil, gensupport.WrapError(err)
1341 }
1342 ret := &AdClients{
1343 ServerResponse: googleapi.ServerResponse{
1344 Header: res.Header,
1345 HTTPStatusCode: res.StatusCode,
1346 },
1347 }
1348 target := &ret
1349 if err := gensupport.DecodeResponse(target, res); err != nil {
1350 return nil, err
1351 }
1352 return ret, nil
1353 }
1354
1355
1356
1357
1358 func (c *AccountsAdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
1359 c.ctx_ = ctx
1360 defer c.PageToken(c.urlParams_.Get("pageToken"))
1361 for {
1362 x, err := c.Do()
1363 if err != nil {
1364 return err
1365 }
1366 if err := f(x); err != nil {
1367 return err
1368 }
1369 if x.NextPageToken == "" {
1370 return nil
1371 }
1372 c.PageToken(x.NextPageToken)
1373 }
1374 }
1375
1376 type AccountsAdunitsDeleteCall struct {
1377 s *Service
1378 accountId string
1379 adClientId string
1380 adUnitId string
1381 urlParams_ gensupport.URLParams
1382 ctx_ context.Context
1383 header_ http.Header
1384 }
1385
1386
1387
1388
1389
1390
1391
1392 func (r *AccountsAdunitsService) Delete(accountId string, adClientId string, adUnitId string) *AccountsAdunitsDeleteCall {
1393 c := &AccountsAdunitsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1394 c.accountId = accountId
1395 c.adClientId = adClientId
1396 c.adUnitId = adUnitId
1397 return c
1398 }
1399
1400
1401
1402
1403 func (c *AccountsAdunitsDeleteCall) Fields(s ...googleapi.Field) *AccountsAdunitsDeleteCall {
1404 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1405 return c
1406 }
1407
1408
1409 func (c *AccountsAdunitsDeleteCall) Context(ctx context.Context) *AccountsAdunitsDeleteCall {
1410 c.ctx_ = ctx
1411 return c
1412 }
1413
1414
1415
1416 func (c *AccountsAdunitsDeleteCall) Header() http.Header {
1417 if c.header_ == nil {
1418 c.header_ = make(http.Header)
1419 }
1420 return c.header_
1421 }
1422
1423 func (c *AccountsAdunitsDeleteCall) doRequest(alt string) (*http.Response, error) {
1424 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1425 var body io.Reader = nil
1426 c.urlParams_.Set("alt", alt)
1427 c.urlParams_.Set("prettyPrint", "false")
1428 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
1429 urls += "?" + c.urlParams_.Encode()
1430 req, err := http.NewRequest("DELETE", urls, body)
1431 if err != nil {
1432 return nil, err
1433 }
1434 req.Header = reqHeaders
1435 googleapi.Expand(req.URL, map[string]string{
1436 "accountId": c.accountId,
1437 "adClientId": c.adClientId,
1438 "adUnitId": c.adUnitId,
1439 })
1440 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1441 }
1442
1443
1444
1445
1446
1447
1448 func (c *AccountsAdunitsDeleteCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
1449 gensupport.SetOptions(c.urlParams_, opts...)
1450 res, err := c.doRequest("json")
1451 if res != nil && res.StatusCode == http.StatusNotModified {
1452 if res.Body != nil {
1453 res.Body.Close()
1454 }
1455 return nil, gensupport.WrapError(&googleapi.Error{
1456 Code: res.StatusCode,
1457 Header: res.Header,
1458 })
1459 }
1460 if err != nil {
1461 return nil, err
1462 }
1463 defer googleapi.CloseBody(res)
1464 if err := googleapi.CheckResponse(res); err != nil {
1465 return nil, gensupport.WrapError(err)
1466 }
1467 ret := &AdUnit{
1468 ServerResponse: googleapi.ServerResponse{
1469 Header: res.Header,
1470 HTTPStatusCode: res.StatusCode,
1471 },
1472 }
1473 target := &ret
1474 if err := gensupport.DecodeResponse(target, res); err != nil {
1475 return nil, err
1476 }
1477 return ret, nil
1478 }
1479
1480 type AccountsAdunitsGetCall struct {
1481 s *Service
1482 accountId string
1483 adClientId string
1484 adUnitId string
1485 urlParams_ gensupport.URLParams
1486 ifNoneMatch_ string
1487 ctx_ context.Context
1488 header_ http.Header
1489 }
1490
1491
1492
1493
1494
1495
1496 func (r *AccountsAdunitsService) Get(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetCall {
1497 c := &AccountsAdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1498 c.accountId = accountId
1499 c.adClientId = adClientId
1500 c.adUnitId = adUnitId
1501 return c
1502 }
1503
1504
1505
1506
1507 func (c *AccountsAdunitsGetCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetCall {
1508 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1509 return c
1510 }
1511
1512
1513
1514
1515 func (c *AccountsAdunitsGetCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetCall {
1516 c.ifNoneMatch_ = entityTag
1517 return c
1518 }
1519
1520
1521 func (c *AccountsAdunitsGetCall) Context(ctx context.Context) *AccountsAdunitsGetCall {
1522 c.ctx_ = ctx
1523 return c
1524 }
1525
1526
1527
1528 func (c *AccountsAdunitsGetCall) Header() http.Header {
1529 if c.header_ == nil {
1530 c.header_ = make(http.Header)
1531 }
1532 return c.header_
1533 }
1534
1535 func (c *AccountsAdunitsGetCall) doRequest(alt string) (*http.Response, error) {
1536 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1537 if c.ifNoneMatch_ != "" {
1538 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1539 }
1540 var body io.Reader = nil
1541 c.urlParams_.Set("alt", alt)
1542 c.urlParams_.Set("prettyPrint", "false")
1543 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
1544 urls += "?" + c.urlParams_.Encode()
1545 req, err := http.NewRequest("GET", urls, body)
1546 if err != nil {
1547 return nil, err
1548 }
1549 req.Header = reqHeaders
1550 googleapi.Expand(req.URL, map[string]string{
1551 "accountId": c.accountId,
1552 "adClientId": c.adClientId,
1553 "adUnitId": c.adUnitId,
1554 })
1555 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1556 }
1557
1558
1559
1560
1561
1562
1563 func (c *AccountsAdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
1564 gensupport.SetOptions(c.urlParams_, opts...)
1565 res, err := c.doRequest("json")
1566 if res != nil && res.StatusCode == http.StatusNotModified {
1567 if res.Body != nil {
1568 res.Body.Close()
1569 }
1570 return nil, gensupport.WrapError(&googleapi.Error{
1571 Code: res.StatusCode,
1572 Header: res.Header,
1573 })
1574 }
1575 if err != nil {
1576 return nil, err
1577 }
1578 defer googleapi.CloseBody(res)
1579 if err := googleapi.CheckResponse(res); err != nil {
1580 return nil, gensupport.WrapError(err)
1581 }
1582 ret := &AdUnit{
1583 ServerResponse: googleapi.ServerResponse{
1584 Header: res.Header,
1585 HTTPStatusCode: res.StatusCode,
1586 },
1587 }
1588 target := &ret
1589 if err := gensupport.DecodeResponse(target, res); err != nil {
1590 return nil, err
1591 }
1592 return ret, nil
1593 }
1594
1595 type AccountsAdunitsGetAdCodeCall struct {
1596 s *Service
1597 accountId string
1598 adClientId string
1599 adUnitId string
1600 urlParams_ gensupport.URLParams
1601 ifNoneMatch_ string
1602 ctx_ context.Context
1603 header_ http.Header
1604 }
1605
1606
1607
1608
1609
1610
1611
1612 func (r *AccountsAdunitsService) GetAdCode(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetAdCodeCall {
1613 c := &AccountsAdunitsGetAdCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1614 c.accountId = accountId
1615 c.adClientId = adClientId
1616 c.adUnitId = adUnitId
1617 return c
1618 }
1619
1620
1621
1622 func (c *AccountsAdunitsGetAdCodeCall) HostCustomChannelId(hostCustomChannelId ...string) *AccountsAdunitsGetAdCodeCall {
1623 c.urlParams_.SetMulti("hostCustomChannelId", append([]string{}, hostCustomChannelId...))
1624 return c
1625 }
1626
1627
1628
1629
1630 func (c *AccountsAdunitsGetAdCodeCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetAdCodeCall {
1631 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1632 return c
1633 }
1634
1635
1636
1637
1638 func (c *AccountsAdunitsGetAdCodeCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetAdCodeCall {
1639 c.ifNoneMatch_ = entityTag
1640 return c
1641 }
1642
1643
1644 func (c *AccountsAdunitsGetAdCodeCall) Context(ctx context.Context) *AccountsAdunitsGetAdCodeCall {
1645 c.ctx_ = ctx
1646 return c
1647 }
1648
1649
1650
1651 func (c *AccountsAdunitsGetAdCodeCall) Header() http.Header {
1652 if c.header_ == nil {
1653 c.header_ = make(http.Header)
1654 }
1655 return c.header_
1656 }
1657
1658 func (c *AccountsAdunitsGetAdCodeCall) doRequest(alt string) (*http.Response, error) {
1659 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1660 if c.ifNoneMatch_ != "" {
1661 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1662 }
1663 var body io.Reader = nil
1664 c.urlParams_.Set("alt", alt)
1665 c.urlParams_.Set("prettyPrint", "false")
1666 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode")
1667 urls += "?" + c.urlParams_.Encode()
1668 req, err := http.NewRequest("GET", urls, body)
1669 if err != nil {
1670 return nil, err
1671 }
1672 req.Header = reqHeaders
1673 googleapi.Expand(req.URL, map[string]string{
1674 "accountId": c.accountId,
1675 "adClientId": c.adClientId,
1676 "adUnitId": c.adUnitId,
1677 })
1678 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1679 }
1680
1681
1682
1683
1684
1685
1686 func (c *AccountsAdunitsGetAdCodeCall) Do(opts ...googleapi.CallOption) (*AdCode, error) {
1687 gensupport.SetOptions(c.urlParams_, opts...)
1688 res, err := c.doRequest("json")
1689 if res != nil && res.StatusCode == http.StatusNotModified {
1690 if res.Body != nil {
1691 res.Body.Close()
1692 }
1693 return nil, gensupport.WrapError(&googleapi.Error{
1694 Code: res.StatusCode,
1695 Header: res.Header,
1696 })
1697 }
1698 if err != nil {
1699 return nil, err
1700 }
1701 defer googleapi.CloseBody(res)
1702 if err := googleapi.CheckResponse(res); err != nil {
1703 return nil, gensupport.WrapError(err)
1704 }
1705 ret := &AdCode{
1706 ServerResponse: googleapi.ServerResponse{
1707 Header: res.Header,
1708 HTTPStatusCode: res.StatusCode,
1709 },
1710 }
1711 target := &ret
1712 if err := gensupport.DecodeResponse(target, res); err != nil {
1713 return nil, err
1714 }
1715 return ret, nil
1716 }
1717
1718 type AccountsAdunitsInsertCall struct {
1719 s *Service
1720 accountId string
1721 adClientId string
1722 adunit *AdUnit
1723 urlParams_ gensupport.URLParams
1724 ctx_ context.Context
1725 header_ http.Header
1726 }
1727
1728
1729
1730
1731
1732
1733 func (r *AccountsAdunitsService) Insert(accountId string, adClientId string, adunit *AdUnit) *AccountsAdunitsInsertCall {
1734 c := &AccountsAdunitsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1735 c.accountId = accountId
1736 c.adClientId = adClientId
1737 c.adunit = adunit
1738 return c
1739 }
1740
1741
1742
1743
1744 func (c *AccountsAdunitsInsertCall) Fields(s ...googleapi.Field) *AccountsAdunitsInsertCall {
1745 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1746 return c
1747 }
1748
1749
1750 func (c *AccountsAdunitsInsertCall) Context(ctx context.Context) *AccountsAdunitsInsertCall {
1751 c.ctx_ = ctx
1752 return c
1753 }
1754
1755
1756
1757 func (c *AccountsAdunitsInsertCall) Header() http.Header {
1758 if c.header_ == nil {
1759 c.header_ = make(http.Header)
1760 }
1761 return c.header_
1762 }
1763
1764 func (c *AccountsAdunitsInsertCall) doRequest(alt string) (*http.Response, error) {
1765 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1766 var body io.Reader = nil
1767 body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
1768 if err != nil {
1769 return nil, err
1770 }
1771 c.urlParams_.Set("alt", alt)
1772 c.urlParams_.Set("prettyPrint", "false")
1773 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
1774 urls += "?" + c.urlParams_.Encode()
1775 req, err := http.NewRequest("POST", urls, body)
1776 if err != nil {
1777 return nil, err
1778 }
1779 req.Header = reqHeaders
1780 googleapi.Expand(req.URL, map[string]string{
1781 "accountId": c.accountId,
1782 "adClientId": c.adClientId,
1783 })
1784 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1785 }
1786
1787
1788
1789
1790
1791
1792 func (c *AccountsAdunitsInsertCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
1793 gensupport.SetOptions(c.urlParams_, opts...)
1794 res, err := c.doRequest("json")
1795 if res != nil && res.StatusCode == http.StatusNotModified {
1796 if res.Body != nil {
1797 res.Body.Close()
1798 }
1799 return nil, gensupport.WrapError(&googleapi.Error{
1800 Code: res.StatusCode,
1801 Header: res.Header,
1802 })
1803 }
1804 if err != nil {
1805 return nil, err
1806 }
1807 defer googleapi.CloseBody(res)
1808 if err := googleapi.CheckResponse(res); err != nil {
1809 return nil, gensupport.WrapError(err)
1810 }
1811 ret := &AdUnit{
1812 ServerResponse: googleapi.ServerResponse{
1813 Header: res.Header,
1814 HTTPStatusCode: res.StatusCode,
1815 },
1816 }
1817 target := &ret
1818 if err := gensupport.DecodeResponse(target, res); err != nil {
1819 return nil, err
1820 }
1821 return ret, nil
1822 }
1823
1824 type AccountsAdunitsListCall struct {
1825 s *Service
1826 accountId string
1827 adClientId string
1828 urlParams_ gensupport.URLParams
1829 ifNoneMatch_ string
1830 ctx_ context.Context
1831 header_ http.Header
1832 }
1833
1834
1835
1836
1837
1838 func (r *AccountsAdunitsService) List(accountId string, adClientId string) *AccountsAdunitsListCall {
1839 c := &AccountsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1840 c.accountId = accountId
1841 c.adClientId = adClientId
1842 return c
1843 }
1844
1845
1846
1847 func (c *AccountsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsAdunitsListCall {
1848 c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
1849 return c
1850 }
1851
1852
1853
1854 func (c *AccountsAdunitsListCall) MaxResults(maxResults int64) *AccountsAdunitsListCall {
1855 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1856 return c
1857 }
1858
1859
1860
1861
1862 func (c *AccountsAdunitsListCall) PageToken(pageToken string) *AccountsAdunitsListCall {
1863 c.urlParams_.Set("pageToken", pageToken)
1864 return c
1865 }
1866
1867
1868
1869
1870 func (c *AccountsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsListCall {
1871 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1872 return c
1873 }
1874
1875
1876
1877
1878 func (c *AccountsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsListCall {
1879 c.ifNoneMatch_ = entityTag
1880 return c
1881 }
1882
1883
1884 func (c *AccountsAdunitsListCall) Context(ctx context.Context) *AccountsAdunitsListCall {
1885 c.ctx_ = ctx
1886 return c
1887 }
1888
1889
1890
1891 func (c *AccountsAdunitsListCall) Header() http.Header {
1892 if c.header_ == nil {
1893 c.header_ = make(http.Header)
1894 }
1895 return c.header_
1896 }
1897
1898 func (c *AccountsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
1899 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1900 if c.ifNoneMatch_ != "" {
1901 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1902 }
1903 var body io.Reader = nil
1904 c.urlParams_.Set("alt", alt)
1905 c.urlParams_.Set("prettyPrint", "false")
1906 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
1907 urls += "?" + c.urlParams_.Encode()
1908 req, err := http.NewRequest("GET", urls, body)
1909 if err != nil {
1910 return nil, err
1911 }
1912 req.Header = reqHeaders
1913 googleapi.Expand(req.URL, map[string]string{
1914 "accountId": c.accountId,
1915 "adClientId": c.adClientId,
1916 })
1917 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1918 }
1919
1920
1921
1922
1923
1924
1925 func (c *AccountsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
1926 gensupport.SetOptions(c.urlParams_, opts...)
1927 res, err := c.doRequest("json")
1928 if res != nil && res.StatusCode == http.StatusNotModified {
1929 if res.Body != nil {
1930 res.Body.Close()
1931 }
1932 return nil, gensupport.WrapError(&googleapi.Error{
1933 Code: res.StatusCode,
1934 Header: res.Header,
1935 })
1936 }
1937 if err != nil {
1938 return nil, err
1939 }
1940 defer googleapi.CloseBody(res)
1941 if err := googleapi.CheckResponse(res); err != nil {
1942 return nil, gensupport.WrapError(err)
1943 }
1944 ret := &AdUnits{
1945 ServerResponse: googleapi.ServerResponse{
1946 Header: res.Header,
1947 HTTPStatusCode: res.StatusCode,
1948 },
1949 }
1950 target := &ret
1951 if err := gensupport.DecodeResponse(target, res); err != nil {
1952 return nil, err
1953 }
1954 return ret, nil
1955 }
1956
1957
1958
1959
1960 func (c *AccountsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
1961 c.ctx_ = ctx
1962 defer c.PageToken(c.urlParams_.Get("pageToken"))
1963 for {
1964 x, err := c.Do()
1965 if err != nil {
1966 return err
1967 }
1968 if err := f(x); err != nil {
1969 return err
1970 }
1971 if x.NextPageToken == "" {
1972 return nil
1973 }
1974 c.PageToken(x.NextPageToken)
1975 }
1976 }
1977
1978 type AccountsAdunitsPatchCall struct {
1979 s *Service
1980 accountId string
1981 adClientId string
1982 adunit *AdUnit
1983 urlParams_ gensupport.URLParams
1984 ctx_ context.Context
1985 header_ http.Header
1986 }
1987
1988
1989
1990
1991
1992
1993
1994 func (r *AccountsAdunitsService) Patch(accountId string, adClientId string, adUnitId string, adunit *AdUnit) *AccountsAdunitsPatchCall {
1995 c := &AccountsAdunitsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1996 c.accountId = accountId
1997 c.adClientId = adClientId
1998 c.urlParams_.Set("adUnitId", adUnitId)
1999 c.adunit = adunit
2000 return c
2001 }
2002
2003
2004
2005
2006 func (c *AccountsAdunitsPatchCall) Fields(s ...googleapi.Field) *AccountsAdunitsPatchCall {
2007 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2008 return c
2009 }
2010
2011
2012 func (c *AccountsAdunitsPatchCall) Context(ctx context.Context) *AccountsAdunitsPatchCall {
2013 c.ctx_ = ctx
2014 return c
2015 }
2016
2017
2018
2019 func (c *AccountsAdunitsPatchCall) Header() http.Header {
2020 if c.header_ == nil {
2021 c.header_ = make(http.Header)
2022 }
2023 return c.header_
2024 }
2025
2026 func (c *AccountsAdunitsPatchCall) doRequest(alt string) (*http.Response, error) {
2027 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2028 var body io.Reader = nil
2029 body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
2030 if err != nil {
2031 return nil, err
2032 }
2033 c.urlParams_.Set("alt", alt)
2034 c.urlParams_.Set("prettyPrint", "false")
2035 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
2036 urls += "?" + c.urlParams_.Encode()
2037 req, err := http.NewRequest("PATCH", urls, body)
2038 if err != nil {
2039 return nil, err
2040 }
2041 req.Header = reqHeaders
2042 googleapi.Expand(req.URL, map[string]string{
2043 "accountId": c.accountId,
2044 "adClientId": c.adClientId,
2045 })
2046 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2047 }
2048
2049
2050
2051
2052
2053
2054 func (c *AccountsAdunitsPatchCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
2055 gensupport.SetOptions(c.urlParams_, opts...)
2056 res, err := c.doRequest("json")
2057 if res != nil && res.StatusCode == http.StatusNotModified {
2058 if res.Body != nil {
2059 res.Body.Close()
2060 }
2061 return nil, gensupport.WrapError(&googleapi.Error{
2062 Code: res.StatusCode,
2063 Header: res.Header,
2064 })
2065 }
2066 if err != nil {
2067 return nil, err
2068 }
2069 defer googleapi.CloseBody(res)
2070 if err := googleapi.CheckResponse(res); err != nil {
2071 return nil, gensupport.WrapError(err)
2072 }
2073 ret := &AdUnit{
2074 ServerResponse: googleapi.ServerResponse{
2075 Header: res.Header,
2076 HTTPStatusCode: res.StatusCode,
2077 },
2078 }
2079 target := &ret
2080 if err := gensupport.DecodeResponse(target, res); err != nil {
2081 return nil, err
2082 }
2083 return ret, nil
2084 }
2085
2086 type AccountsAdunitsUpdateCall struct {
2087 s *Service
2088 accountId string
2089 adClientId string
2090 adunit *AdUnit
2091 urlParams_ gensupport.URLParams
2092 ctx_ context.Context
2093 header_ http.Header
2094 }
2095
2096
2097
2098
2099
2100
2101 func (r *AccountsAdunitsService) Update(accountId string, adClientId string, adunit *AdUnit) *AccountsAdunitsUpdateCall {
2102 c := &AccountsAdunitsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2103 c.accountId = accountId
2104 c.adClientId = adClientId
2105 c.adunit = adunit
2106 return c
2107 }
2108
2109
2110
2111
2112 func (c *AccountsAdunitsUpdateCall) Fields(s ...googleapi.Field) *AccountsAdunitsUpdateCall {
2113 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2114 return c
2115 }
2116
2117
2118 func (c *AccountsAdunitsUpdateCall) Context(ctx context.Context) *AccountsAdunitsUpdateCall {
2119 c.ctx_ = ctx
2120 return c
2121 }
2122
2123
2124
2125 func (c *AccountsAdunitsUpdateCall) Header() http.Header {
2126 if c.header_ == nil {
2127 c.header_ = make(http.Header)
2128 }
2129 return c.header_
2130 }
2131
2132 func (c *AccountsAdunitsUpdateCall) doRequest(alt string) (*http.Response, error) {
2133 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2134 var body io.Reader = nil
2135 body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
2136 if err != nil {
2137 return nil, err
2138 }
2139 c.urlParams_.Set("alt", alt)
2140 c.urlParams_.Set("prettyPrint", "false")
2141 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
2142 urls += "?" + c.urlParams_.Encode()
2143 req, err := http.NewRequest("PUT", urls, body)
2144 if err != nil {
2145 return nil, err
2146 }
2147 req.Header = reqHeaders
2148 googleapi.Expand(req.URL, map[string]string{
2149 "accountId": c.accountId,
2150 "adClientId": c.adClientId,
2151 })
2152 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2153 }
2154
2155
2156
2157
2158
2159
2160 func (c *AccountsAdunitsUpdateCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
2161 gensupport.SetOptions(c.urlParams_, opts...)
2162 res, err := c.doRequest("json")
2163 if res != nil && res.StatusCode == http.StatusNotModified {
2164 if res.Body != nil {
2165 res.Body.Close()
2166 }
2167 return nil, gensupport.WrapError(&googleapi.Error{
2168 Code: res.StatusCode,
2169 Header: res.Header,
2170 })
2171 }
2172 if err != nil {
2173 return nil, err
2174 }
2175 defer googleapi.CloseBody(res)
2176 if err := googleapi.CheckResponse(res); err != nil {
2177 return nil, gensupport.WrapError(err)
2178 }
2179 ret := &AdUnit{
2180 ServerResponse: googleapi.ServerResponse{
2181 Header: res.Header,
2182 HTTPStatusCode: res.StatusCode,
2183 },
2184 }
2185 target := &ret
2186 if err := gensupport.DecodeResponse(target, res); err != nil {
2187 return nil, err
2188 }
2189 return ret, nil
2190 }
2191
2192 type AccountsReportsGenerateCall struct {
2193 s *Service
2194 accountId string
2195 urlParams_ gensupport.URLParams
2196 ifNoneMatch_ string
2197 ctx_ context.Context
2198 header_ http.Header
2199 }
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210 func (r *AccountsReportsService) Generate(accountId string, startDate string, endDate string) *AccountsReportsGenerateCall {
2211 c := &AccountsReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2212 c.accountId = accountId
2213 c.urlParams_.Set("startDate", startDate)
2214 c.urlParams_.Set("endDate", endDate)
2215 return c
2216 }
2217
2218
2219
2220 func (c *AccountsReportsGenerateCall) Dimension(dimension ...string) *AccountsReportsGenerateCall {
2221 c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
2222 return c
2223 }
2224
2225
2226
2227 func (c *AccountsReportsGenerateCall) Filter(filter ...string) *AccountsReportsGenerateCall {
2228 c.urlParams_.SetMulti("filter", append([]string{}, filter...))
2229 return c
2230 }
2231
2232
2233
2234
2235 func (c *AccountsReportsGenerateCall) Locale(locale string) *AccountsReportsGenerateCall {
2236 c.urlParams_.Set("locale", locale)
2237 return c
2238 }
2239
2240
2241
2242 func (c *AccountsReportsGenerateCall) MaxResults(maxResults int64) *AccountsReportsGenerateCall {
2243 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
2244 return c
2245 }
2246
2247
2248
2249 func (c *AccountsReportsGenerateCall) Metric(metric ...string) *AccountsReportsGenerateCall {
2250 c.urlParams_.SetMulti("metric", append([]string{}, metric...))
2251 return c
2252 }
2253
2254
2255
2256
2257
2258 func (c *AccountsReportsGenerateCall) Sort(sort ...string) *AccountsReportsGenerateCall {
2259 c.urlParams_.SetMulti("sort", append([]string{}, sort...))
2260 return c
2261 }
2262
2263
2264
2265 func (c *AccountsReportsGenerateCall) StartIndex(startIndex int64) *AccountsReportsGenerateCall {
2266 c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
2267 return c
2268 }
2269
2270
2271
2272
2273 func (c *AccountsReportsGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsGenerateCall {
2274 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2275 return c
2276 }
2277
2278
2279
2280
2281 func (c *AccountsReportsGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsGenerateCall {
2282 c.ifNoneMatch_ = entityTag
2283 return c
2284 }
2285
2286
2287 func (c *AccountsReportsGenerateCall) Context(ctx context.Context) *AccountsReportsGenerateCall {
2288 c.ctx_ = ctx
2289 return c
2290 }
2291
2292
2293
2294 func (c *AccountsReportsGenerateCall) Header() http.Header {
2295 if c.header_ == nil {
2296 c.header_ = make(http.Header)
2297 }
2298 return c.header_
2299 }
2300
2301 func (c *AccountsReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
2302 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2303 if c.ifNoneMatch_ != "" {
2304 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2305 }
2306 var body io.Reader = nil
2307 c.urlParams_.Set("alt", alt)
2308 c.urlParams_.Set("prettyPrint", "false")
2309 urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports")
2310 urls += "?" + c.urlParams_.Encode()
2311 req, err := http.NewRequest("GET", urls, body)
2312 if err != nil {
2313 return nil, err
2314 }
2315 req.Header = reqHeaders
2316 googleapi.Expand(req.URL, map[string]string{
2317 "accountId": c.accountId,
2318 })
2319 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2320 }
2321
2322
2323
2324
2325
2326
2327 func (c *AccountsReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
2328 gensupport.SetOptions(c.urlParams_, opts...)
2329 res, err := c.doRequest("json")
2330 if res != nil && res.StatusCode == http.StatusNotModified {
2331 if res.Body != nil {
2332 res.Body.Close()
2333 }
2334 return nil, gensupport.WrapError(&googleapi.Error{
2335 Code: res.StatusCode,
2336 Header: res.Header,
2337 })
2338 }
2339 if err != nil {
2340 return nil, err
2341 }
2342 defer googleapi.CloseBody(res)
2343 if err := googleapi.CheckResponse(res); err != nil {
2344 return nil, gensupport.WrapError(err)
2345 }
2346 ret := &Report{
2347 ServerResponse: googleapi.ServerResponse{
2348 Header: res.Header,
2349 HTTPStatusCode: res.StatusCode,
2350 },
2351 }
2352 target := &ret
2353 if err := gensupport.DecodeResponse(target, res); err != nil {
2354 return nil, err
2355 }
2356 return ret, nil
2357 }
2358
2359 type AdclientsGetCall struct {
2360 s *Service
2361 adClientId string
2362 urlParams_ gensupport.URLParams
2363 ifNoneMatch_ string
2364 ctx_ context.Context
2365 header_ http.Header
2366 }
2367
2368
2369
2370
2371
2372 func (r *AdclientsService) Get(adClientId string) *AdclientsGetCall {
2373 c := &AdclientsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2374 c.adClientId = adClientId
2375 return c
2376 }
2377
2378
2379
2380
2381 func (c *AdclientsGetCall) Fields(s ...googleapi.Field) *AdclientsGetCall {
2382 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2383 return c
2384 }
2385
2386
2387
2388
2389 func (c *AdclientsGetCall) IfNoneMatch(entityTag string) *AdclientsGetCall {
2390 c.ifNoneMatch_ = entityTag
2391 return c
2392 }
2393
2394
2395 func (c *AdclientsGetCall) Context(ctx context.Context) *AdclientsGetCall {
2396 c.ctx_ = ctx
2397 return c
2398 }
2399
2400
2401
2402 func (c *AdclientsGetCall) Header() http.Header {
2403 if c.header_ == nil {
2404 c.header_ = make(http.Header)
2405 }
2406 return c.header_
2407 }
2408
2409 func (c *AdclientsGetCall) doRequest(alt string) (*http.Response, error) {
2410 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2411 if c.ifNoneMatch_ != "" {
2412 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2413 }
2414 var body io.Reader = nil
2415 c.urlParams_.Set("alt", alt)
2416 c.urlParams_.Set("prettyPrint", "false")
2417 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}")
2418 urls += "?" + c.urlParams_.Encode()
2419 req, err := http.NewRequest("GET", urls, body)
2420 if err != nil {
2421 return nil, err
2422 }
2423 req.Header = reqHeaders
2424 googleapi.Expand(req.URL, map[string]string{
2425 "adClientId": c.adClientId,
2426 })
2427 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2428 }
2429
2430
2431
2432
2433
2434
2435 func (c *AdclientsGetCall) Do(opts ...googleapi.CallOption) (*AdClient, error) {
2436 gensupport.SetOptions(c.urlParams_, opts...)
2437 res, err := c.doRequest("json")
2438 if res != nil && res.StatusCode == http.StatusNotModified {
2439 if res.Body != nil {
2440 res.Body.Close()
2441 }
2442 return nil, gensupport.WrapError(&googleapi.Error{
2443 Code: res.StatusCode,
2444 Header: res.Header,
2445 })
2446 }
2447 if err != nil {
2448 return nil, err
2449 }
2450 defer googleapi.CloseBody(res)
2451 if err := googleapi.CheckResponse(res); err != nil {
2452 return nil, gensupport.WrapError(err)
2453 }
2454 ret := &AdClient{
2455 ServerResponse: googleapi.ServerResponse{
2456 Header: res.Header,
2457 HTTPStatusCode: res.StatusCode,
2458 },
2459 }
2460 target := &ret
2461 if err := gensupport.DecodeResponse(target, res); err != nil {
2462 return nil, err
2463 }
2464 return ret, nil
2465 }
2466
2467 type AdclientsListCall struct {
2468 s *Service
2469 urlParams_ gensupport.URLParams
2470 ifNoneMatch_ string
2471 ctx_ context.Context
2472 header_ http.Header
2473 }
2474
2475
2476 func (r *AdclientsService) List() *AdclientsListCall {
2477 c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2478 return c
2479 }
2480
2481
2482
2483 func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall {
2484 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
2485 return c
2486 }
2487
2488
2489
2490
2491 func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall {
2492 c.urlParams_.Set("pageToken", pageToken)
2493 return c
2494 }
2495
2496
2497
2498
2499 func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall {
2500 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2501 return c
2502 }
2503
2504
2505
2506
2507 func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall {
2508 c.ifNoneMatch_ = entityTag
2509 return c
2510 }
2511
2512
2513 func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall {
2514 c.ctx_ = ctx
2515 return c
2516 }
2517
2518
2519
2520 func (c *AdclientsListCall) Header() http.Header {
2521 if c.header_ == nil {
2522 c.header_ = make(http.Header)
2523 }
2524 return c.header_
2525 }
2526
2527 func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) {
2528 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2529 if c.ifNoneMatch_ != "" {
2530 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2531 }
2532 var body io.Reader = nil
2533 c.urlParams_.Set("alt", alt)
2534 c.urlParams_.Set("prettyPrint", "false")
2535 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients")
2536 urls += "?" + c.urlParams_.Encode()
2537 req, err := http.NewRequest("GET", urls, body)
2538 if err != nil {
2539 return nil, err
2540 }
2541 req.Header = reqHeaders
2542 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2543 }
2544
2545
2546
2547
2548
2549
2550 func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
2551 gensupport.SetOptions(c.urlParams_, opts...)
2552 res, err := c.doRequest("json")
2553 if res != nil && res.StatusCode == http.StatusNotModified {
2554 if res.Body != nil {
2555 res.Body.Close()
2556 }
2557 return nil, gensupport.WrapError(&googleapi.Error{
2558 Code: res.StatusCode,
2559 Header: res.Header,
2560 })
2561 }
2562 if err != nil {
2563 return nil, err
2564 }
2565 defer googleapi.CloseBody(res)
2566 if err := googleapi.CheckResponse(res); err != nil {
2567 return nil, gensupport.WrapError(err)
2568 }
2569 ret := &AdClients{
2570 ServerResponse: googleapi.ServerResponse{
2571 Header: res.Header,
2572 HTTPStatusCode: res.StatusCode,
2573 },
2574 }
2575 target := &ret
2576 if err := gensupport.DecodeResponse(target, res); err != nil {
2577 return nil, err
2578 }
2579 return ret, nil
2580 }
2581
2582
2583
2584
2585 func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
2586 c.ctx_ = ctx
2587 defer c.PageToken(c.urlParams_.Get("pageToken"))
2588 for {
2589 x, err := c.Do()
2590 if err != nil {
2591 return err
2592 }
2593 if err := f(x); err != nil {
2594 return err
2595 }
2596 if x.NextPageToken == "" {
2597 return nil
2598 }
2599 c.PageToken(x.NextPageToken)
2600 }
2601 }
2602
2603 type AssociationsessionsStartCall struct {
2604 s *Service
2605 urlParams_ gensupport.URLParams
2606 ifNoneMatch_ string
2607 ctx_ context.Context
2608 header_ http.Header
2609 }
2610
2611
2612
2613
2614
2615
2616 func (r *AssociationsessionsService) Start(productCode []string, websiteUrl string) *AssociationsessionsStartCall {
2617 c := &AssociationsessionsStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2618 c.urlParams_.SetMulti("productCode", append([]string{}, productCode...))
2619 c.urlParams_.Set("websiteUrl", websiteUrl)
2620 return c
2621 }
2622
2623
2624
2625
2626 func (c *AssociationsessionsStartCall) CallbackUrl(callbackUrl string) *AssociationsessionsStartCall {
2627 c.urlParams_.Set("callbackUrl", callbackUrl)
2628 return c
2629 }
2630
2631
2632
2633 func (c *AssociationsessionsStartCall) UserLocale(userLocale string) *AssociationsessionsStartCall {
2634 c.urlParams_.Set("userLocale", userLocale)
2635 return c
2636 }
2637
2638
2639
2640 func (c *AssociationsessionsStartCall) WebsiteLocale(websiteLocale string) *AssociationsessionsStartCall {
2641 c.urlParams_.Set("websiteLocale", websiteLocale)
2642 return c
2643 }
2644
2645
2646
2647
2648 func (c *AssociationsessionsStartCall) Fields(s ...googleapi.Field) *AssociationsessionsStartCall {
2649 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2650 return c
2651 }
2652
2653
2654
2655
2656 func (c *AssociationsessionsStartCall) IfNoneMatch(entityTag string) *AssociationsessionsStartCall {
2657 c.ifNoneMatch_ = entityTag
2658 return c
2659 }
2660
2661
2662 func (c *AssociationsessionsStartCall) Context(ctx context.Context) *AssociationsessionsStartCall {
2663 c.ctx_ = ctx
2664 return c
2665 }
2666
2667
2668
2669 func (c *AssociationsessionsStartCall) Header() http.Header {
2670 if c.header_ == nil {
2671 c.header_ = make(http.Header)
2672 }
2673 return c.header_
2674 }
2675
2676 func (c *AssociationsessionsStartCall) doRequest(alt string) (*http.Response, error) {
2677 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2678 if c.ifNoneMatch_ != "" {
2679 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2680 }
2681 var body io.Reader = nil
2682 c.urlParams_.Set("alt", alt)
2683 c.urlParams_.Set("prettyPrint", "false")
2684 urls := googleapi.ResolveRelative(c.s.BasePath, "associationsessions/start")
2685 urls += "?" + c.urlParams_.Encode()
2686 req, err := http.NewRequest("GET", urls, body)
2687 if err != nil {
2688 return nil, err
2689 }
2690 req.Header = reqHeaders
2691 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2692 }
2693
2694
2695
2696
2697
2698
2699
2700 func (c *AssociationsessionsStartCall) Do(opts ...googleapi.CallOption) (*AssociationSession, error) {
2701 gensupport.SetOptions(c.urlParams_, opts...)
2702 res, err := c.doRequest("json")
2703 if res != nil && res.StatusCode == http.StatusNotModified {
2704 if res.Body != nil {
2705 res.Body.Close()
2706 }
2707 return nil, gensupport.WrapError(&googleapi.Error{
2708 Code: res.StatusCode,
2709 Header: res.Header,
2710 })
2711 }
2712 if err != nil {
2713 return nil, err
2714 }
2715 defer googleapi.CloseBody(res)
2716 if err := googleapi.CheckResponse(res); err != nil {
2717 return nil, gensupport.WrapError(err)
2718 }
2719 ret := &AssociationSession{
2720 ServerResponse: googleapi.ServerResponse{
2721 Header: res.Header,
2722 HTTPStatusCode: res.StatusCode,
2723 },
2724 }
2725 target := &ret
2726 if err := gensupport.DecodeResponse(target, res); err != nil {
2727 return nil, err
2728 }
2729 return ret, nil
2730 }
2731
2732 type AssociationsessionsVerifyCall struct {
2733 s *Service
2734 urlParams_ gensupport.URLParams
2735 ifNoneMatch_ string
2736 ctx_ context.Context
2737 header_ http.Header
2738 }
2739
2740
2741
2742
2743
2744 func (r *AssociationsessionsService) Verify(token string) *AssociationsessionsVerifyCall {
2745 c := &AssociationsessionsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2746 c.urlParams_.Set("token", token)
2747 return c
2748 }
2749
2750
2751
2752
2753 func (c *AssociationsessionsVerifyCall) Fields(s ...googleapi.Field) *AssociationsessionsVerifyCall {
2754 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2755 return c
2756 }
2757
2758
2759
2760
2761 func (c *AssociationsessionsVerifyCall) IfNoneMatch(entityTag string) *AssociationsessionsVerifyCall {
2762 c.ifNoneMatch_ = entityTag
2763 return c
2764 }
2765
2766
2767 func (c *AssociationsessionsVerifyCall) Context(ctx context.Context) *AssociationsessionsVerifyCall {
2768 c.ctx_ = ctx
2769 return c
2770 }
2771
2772
2773
2774 func (c *AssociationsessionsVerifyCall) Header() http.Header {
2775 if c.header_ == nil {
2776 c.header_ = make(http.Header)
2777 }
2778 return c.header_
2779 }
2780
2781 func (c *AssociationsessionsVerifyCall) doRequest(alt string) (*http.Response, error) {
2782 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2783 if c.ifNoneMatch_ != "" {
2784 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2785 }
2786 var body io.Reader = nil
2787 c.urlParams_.Set("alt", alt)
2788 c.urlParams_.Set("prettyPrint", "false")
2789 urls := googleapi.ResolveRelative(c.s.BasePath, "associationsessions/verify")
2790 urls += "?" + c.urlParams_.Encode()
2791 req, err := http.NewRequest("GET", urls, body)
2792 if err != nil {
2793 return nil, err
2794 }
2795 req.Header = reqHeaders
2796 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2797 }
2798
2799
2800
2801
2802
2803
2804
2805 func (c *AssociationsessionsVerifyCall) Do(opts ...googleapi.CallOption) (*AssociationSession, error) {
2806 gensupport.SetOptions(c.urlParams_, opts...)
2807 res, err := c.doRequest("json")
2808 if res != nil && res.StatusCode == http.StatusNotModified {
2809 if res.Body != nil {
2810 res.Body.Close()
2811 }
2812 return nil, gensupport.WrapError(&googleapi.Error{
2813 Code: res.StatusCode,
2814 Header: res.Header,
2815 })
2816 }
2817 if err != nil {
2818 return nil, err
2819 }
2820 defer googleapi.CloseBody(res)
2821 if err := googleapi.CheckResponse(res); err != nil {
2822 return nil, gensupport.WrapError(err)
2823 }
2824 ret := &AssociationSession{
2825 ServerResponse: googleapi.ServerResponse{
2826 Header: res.Header,
2827 HTTPStatusCode: res.StatusCode,
2828 },
2829 }
2830 target := &ret
2831 if err := gensupport.DecodeResponse(target, res); err != nil {
2832 return nil, err
2833 }
2834 return ret, nil
2835 }
2836
2837 type CustomchannelsDeleteCall struct {
2838 s *Service
2839 adClientId string
2840 customChannelId string
2841 urlParams_ gensupport.URLParams
2842 ctx_ context.Context
2843 header_ http.Header
2844 }
2845
2846
2847
2848
2849
2850 func (r *CustomchannelsService) Delete(adClientId string, customChannelId string) *CustomchannelsDeleteCall {
2851 c := &CustomchannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2852 c.adClientId = adClientId
2853 c.customChannelId = customChannelId
2854 return c
2855 }
2856
2857
2858
2859
2860 func (c *CustomchannelsDeleteCall) Fields(s ...googleapi.Field) *CustomchannelsDeleteCall {
2861 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2862 return c
2863 }
2864
2865
2866 func (c *CustomchannelsDeleteCall) Context(ctx context.Context) *CustomchannelsDeleteCall {
2867 c.ctx_ = ctx
2868 return c
2869 }
2870
2871
2872
2873 func (c *CustomchannelsDeleteCall) Header() http.Header {
2874 if c.header_ == nil {
2875 c.header_ = make(http.Header)
2876 }
2877 return c.header_
2878 }
2879
2880 func (c *CustomchannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
2881 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2882 var body io.Reader = nil
2883 c.urlParams_.Set("alt", alt)
2884 c.urlParams_.Set("prettyPrint", "false")
2885 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
2886 urls += "?" + c.urlParams_.Encode()
2887 req, err := http.NewRequest("DELETE", urls, body)
2888 if err != nil {
2889 return nil, err
2890 }
2891 req.Header = reqHeaders
2892 googleapi.Expand(req.URL, map[string]string{
2893 "adClientId": c.adClientId,
2894 "customChannelId": c.customChannelId,
2895 })
2896 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2897 }
2898
2899
2900
2901
2902
2903
2904 func (c *CustomchannelsDeleteCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
2905 gensupport.SetOptions(c.urlParams_, opts...)
2906 res, err := c.doRequest("json")
2907 if res != nil && res.StatusCode == http.StatusNotModified {
2908 if res.Body != nil {
2909 res.Body.Close()
2910 }
2911 return nil, gensupport.WrapError(&googleapi.Error{
2912 Code: res.StatusCode,
2913 Header: res.Header,
2914 })
2915 }
2916 if err != nil {
2917 return nil, err
2918 }
2919 defer googleapi.CloseBody(res)
2920 if err := googleapi.CheckResponse(res); err != nil {
2921 return nil, gensupport.WrapError(err)
2922 }
2923 ret := &CustomChannel{
2924 ServerResponse: googleapi.ServerResponse{
2925 Header: res.Header,
2926 HTTPStatusCode: res.StatusCode,
2927 },
2928 }
2929 target := &ret
2930 if err := gensupport.DecodeResponse(target, res); err != nil {
2931 return nil, err
2932 }
2933 return ret, nil
2934 }
2935
2936 type CustomchannelsGetCall struct {
2937 s *Service
2938 adClientId string
2939 customChannelId string
2940 urlParams_ gensupport.URLParams
2941 ifNoneMatch_ string
2942 ctx_ context.Context
2943 header_ http.Header
2944 }
2945
2946
2947
2948
2949
2950 func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall {
2951 c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2952 c.adClientId = adClientId
2953 c.customChannelId = customChannelId
2954 return c
2955 }
2956
2957
2958
2959
2960 func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall {
2961 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2962 return c
2963 }
2964
2965
2966
2967
2968 func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall {
2969 c.ifNoneMatch_ = entityTag
2970 return c
2971 }
2972
2973
2974 func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall {
2975 c.ctx_ = ctx
2976 return c
2977 }
2978
2979
2980
2981 func (c *CustomchannelsGetCall) Header() http.Header {
2982 if c.header_ == nil {
2983 c.header_ = make(http.Header)
2984 }
2985 return c.header_
2986 }
2987
2988 func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
2989 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2990 if c.ifNoneMatch_ != "" {
2991 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2992 }
2993 var body io.Reader = nil
2994 c.urlParams_.Set("alt", alt)
2995 c.urlParams_.Set("prettyPrint", "false")
2996 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
2997 urls += "?" + c.urlParams_.Encode()
2998 req, err := http.NewRequest("GET", urls, body)
2999 if err != nil {
3000 return nil, err
3001 }
3002 req.Header = reqHeaders
3003 googleapi.Expand(req.URL, map[string]string{
3004 "adClientId": c.adClientId,
3005 "customChannelId": c.customChannelId,
3006 })
3007 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3008 }
3009
3010
3011
3012
3013
3014
3015 func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
3016 gensupport.SetOptions(c.urlParams_, opts...)
3017 res, err := c.doRequest("json")
3018 if res != nil && res.StatusCode == http.StatusNotModified {
3019 if res.Body != nil {
3020 res.Body.Close()
3021 }
3022 return nil, gensupport.WrapError(&googleapi.Error{
3023 Code: res.StatusCode,
3024 Header: res.Header,
3025 })
3026 }
3027 if err != nil {
3028 return nil, err
3029 }
3030 defer googleapi.CloseBody(res)
3031 if err := googleapi.CheckResponse(res); err != nil {
3032 return nil, gensupport.WrapError(err)
3033 }
3034 ret := &CustomChannel{
3035 ServerResponse: googleapi.ServerResponse{
3036 Header: res.Header,
3037 HTTPStatusCode: res.StatusCode,
3038 },
3039 }
3040 target := &ret
3041 if err := gensupport.DecodeResponse(target, res); err != nil {
3042 return nil, err
3043 }
3044 return ret, nil
3045 }
3046
3047 type CustomchannelsInsertCall struct {
3048 s *Service
3049 adClientId string
3050 customchannel *CustomChannel
3051 urlParams_ gensupport.URLParams
3052 ctx_ context.Context
3053 header_ http.Header
3054 }
3055
3056
3057
3058
3059 func (r *CustomchannelsService) Insert(adClientId string, customchannel *CustomChannel) *CustomchannelsInsertCall {
3060 c := &CustomchannelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3061 c.adClientId = adClientId
3062 c.customchannel = customchannel
3063 return c
3064 }
3065
3066
3067
3068
3069 func (c *CustomchannelsInsertCall) Fields(s ...googleapi.Field) *CustomchannelsInsertCall {
3070 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3071 return c
3072 }
3073
3074
3075 func (c *CustomchannelsInsertCall) Context(ctx context.Context) *CustomchannelsInsertCall {
3076 c.ctx_ = ctx
3077 return c
3078 }
3079
3080
3081
3082 func (c *CustomchannelsInsertCall) Header() http.Header {
3083 if c.header_ == nil {
3084 c.header_ = make(http.Header)
3085 }
3086 return c.header_
3087 }
3088
3089 func (c *CustomchannelsInsertCall) doRequest(alt string) (*http.Response, error) {
3090 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3091 var body io.Reader = nil
3092 body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
3093 if err != nil {
3094 return nil, err
3095 }
3096 c.urlParams_.Set("alt", alt)
3097 c.urlParams_.Set("prettyPrint", "false")
3098 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
3099 urls += "?" + c.urlParams_.Encode()
3100 req, err := http.NewRequest("POST", urls, body)
3101 if err != nil {
3102 return nil, err
3103 }
3104 req.Header = reqHeaders
3105 googleapi.Expand(req.URL, map[string]string{
3106 "adClientId": c.adClientId,
3107 })
3108 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3109 }
3110
3111
3112
3113
3114
3115
3116 func (c *CustomchannelsInsertCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
3117 gensupport.SetOptions(c.urlParams_, opts...)
3118 res, err := c.doRequest("json")
3119 if res != nil && res.StatusCode == http.StatusNotModified {
3120 if res.Body != nil {
3121 res.Body.Close()
3122 }
3123 return nil, gensupport.WrapError(&googleapi.Error{
3124 Code: res.StatusCode,
3125 Header: res.Header,
3126 })
3127 }
3128 if err != nil {
3129 return nil, err
3130 }
3131 defer googleapi.CloseBody(res)
3132 if err := googleapi.CheckResponse(res); err != nil {
3133 return nil, gensupport.WrapError(err)
3134 }
3135 ret := &CustomChannel{
3136 ServerResponse: googleapi.ServerResponse{
3137 Header: res.Header,
3138 HTTPStatusCode: res.StatusCode,
3139 },
3140 }
3141 target := &ret
3142 if err := gensupport.DecodeResponse(target, res); err != nil {
3143 return nil, err
3144 }
3145 return ret, nil
3146 }
3147
3148 type CustomchannelsListCall struct {
3149 s *Service
3150 adClientId string
3151 urlParams_ gensupport.URLParams
3152 ifNoneMatch_ string
3153 ctx_ context.Context
3154 header_ http.Header
3155 }
3156
3157
3158
3159
3160 func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall {
3161 c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3162 c.adClientId = adClientId
3163 return c
3164 }
3165
3166
3167
3168 func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall {
3169 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3170 return c
3171 }
3172
3173
3174
3175
3176 func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall {
3177 c.urlParams_.Set("pageToken", pageToken)
3178 return c
3179 }
3180
3181
3182
3183
3184 func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall {
3185 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3186 return c
3187 }
3188
3189
3190
3191
3192 func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall {
3193 c.ifNoneMatch_ = entityTag
3194 return c
3195 }
3196
3197
3198 func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall {
3199 c.ctx_ = ctx
3200 return c
3201 }
3202
3203
3204
3205 func (c *CustomchannelsListCall) Header() http.Header {
3206 if c.header_ == nil {
3207 c.header_ = make(http.Header)
3208 }
3209 return c.header_
3210 }
3211
3212 func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
3213 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3214 if c.ifNoneMatch_ != "" {
3215 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3216 }
3217 var body io.Reader = nil
3218 c.urlParams_.Set("alt", alt)
3219 c.urlParams_.Set("prettyPrint", "false")
3220 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
3221 urls += "?" + c.urlParams_.Encode()
3222 req, err := http.NewRequest("GET", urls, body)
3223 if err != nil {
3224 return nil, err
3225 }
3226 req.Header = reqHeaders
3227 googleapi.Expand(req.URL, map[string]string{
3228 "adClientId": c.adClientId,
3229 })
3230 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3231 }
3232
3233
3234
3235
3236
3237
3238 func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
3239 gensupport.SetOptions(c.urlParams_, opts...)
3240 res, err := c.doRequest("json")
3241 if res != nil && res.StatusCode == http.StatusNotModified {
3242 if res.Body != nil {
3243 res.Body.Close()
3244 }
3245 return nil, gensupport.WrapError(&googleapi.Error{
3246 Code: res.StatusCode,
3247 Header: res.Header,
3248 })
3249 }
3250 if err != nil {
3251 return nil, err
3252 }
3253 defer googleapi.CloseBody(res)
3254 if err := googleapi.CheckResponse(res); err != nil {
3255 return nil, gensupport.WrapError(err)
3256 }
3257 ret := &CustomChannels{
3258 ServerResponse: googleapi.ServerResponse{
3259 Header: res.Header,
3260 HTTPStatusCode: res.StatusCode,
3261 },
3262 }
3263 target := &ret
3264 if err := gensupport.DecodeResponse(target, res); err != nil {
3265 return nil, err
3266 }
3267 return ret, nil
3268 }
3269
3270
3271
3272
3273 func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
3274 c.ctx_ = ctx
3275 defer c.PageToken(c.urlParams_.Get("pageToken"))
3276 for {
3277 x, err := c.Do()
3278 if err != nil {
3279 return err
3280 }
3281 if err := f(x); err != nil {
3282 return err
3283 }
3284 if x.NextPageToken == "" {
3285 return nil
3286 }
3287 c.PageToken(x.NextPageToken)
3288 }
3289 }
3290
3291 type CustomchannelsPatchCall struct {
3292 s *Service
3293 adClientId string
3294 customchannel *CustomChannel
3295 urlParams_ gensupport.URLParams
3296 ctx_ context.Context
3297 header_ http.Header
3298 }
3299
3300
3301
3302
3303
3304
3305 func (r *CustomchannelsService) Patch(adClientId string, customChannelId string, customchannel *CustomChannel) *CustomchannelsPatchCall {
3306 c := &CustomchannelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3307 c.adClientId = adClientId
3308 c.urlParams_.Set("customChannelId", customChannelId)
3309 c.customchannel = customchannel
3310 return c
3311 }
3312
3313
3314
3315
3316 func (c *CustomchannelsPatchCall) Fields(s ...googleapi.Field) *CustomchannelsPatchCall {
3317 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3318 return c
3319 }
3320
3321
3322 func (c *CustomchannelsPatchCall) Context(ctx context.Context) *CustomchannelsPatchCall {
3323 c.ctx_ = ctx
3324 return c
3325 }
3326
3327
3328
3329 func (c *CustomchannelsPatchCall) Header() http.Header {
3330 if c.header_ == nil {
3331 c.header_ = make(http.Header)
3332 }
3333 return c.header_
3334 }
3335
3336 func (c *CustomchannelsPatchCall) doRequest(alt string) (*http.Response, error) {
3337 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3338 var body io.Reader = nil
3339 body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
3340 if err != nil {
3341 return nil, err
3342 }
3343 c.urlParams_.Set("alt", alt)
3344 c.urlParams_.Set("prettyPrint", "false")
3345 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
3346 urls += "?" + c.urlParams_.Encode()
3347 req, err := http.NewRequest("PATCH", urls, body)
3348 if err != nil {
3349 return nil, err
3350 }
3351 req.Header = reqHeaders
3352 googleapi.Expand(req.URL, map[string]string{
3353 "adClientId": c.adClientId,
3354 })
3355 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3356 }
3357
3358
3359
3360
3361
3362
3363 func (c *CustomchannelsPatchCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
3364 gensupport.SetOptions(c.urlParams_, opts...)
3365 res, err := c.doRequest("json")
3366 if res != nil && res.StatusCode == http.StatusNotModified {
3367 if res.Body != nil {
3368 res.Body.Close()
3369 }
3370 return nil, gensupport.WrapError(&googleapi.Error{
3371 Code: res.StatusCode,
3372 Header: res.Header,
3373 })
3374 }
3375 if err != nil {
3376 return nil, err
3377 }
3378 defer googleapi.CloseBody(res)
3379 if err := googleapi.CheckResponse(res); err != nil {
3380 return nil, gensupport.WrapError(err)
3381 }
3382 ret := &CustomChannel{
3383 ServerResponse: googleapi.ServerResponse{
3384 Header: res.Header,
3385 HTTPStatusCode: res.StatusCode,
3386 },
3387 }
3388 target := &ret
3389 if err := gensupport.DecodeResponse(target, res); err != nil {
3390 return nil, err
3391 }
3392 return ret, nil
3393 }
3394
3395 type CustomchannelsUpdateCall struct {
3396 s *Service
3397 adClientId string
3398 customchannel *CustomChannel
3399 urlParams_ gensupport.URLParams
3400 ctx_ context.Context
3401 header_ http.Header
3402 }
3403
3404
3405
3406
3407 func (r *CustomchannelsService) Update(adClientId string, customchannel *CustomChannel) *CustomchannelsUpdateCall {
3408 c := &CustomchannelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3409 c.adClientId = adClientId
3410 c.customchannel = customchannel
3411 return c
3412 }
3413
3414
3415
3416
3417 func (c *CustomchannelsUpdateCall) Fields(s ...googleapi.Field) *CustomchannelsUpdateCall {
3418 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3419 return c
3420 }
3421
3422
3423 func (c *CustomchannelsUpdateCall) Context(ctx context.Context) *CustomchannelsUpdateCall {
3424 c.ctx_ = ctx
3425 return c
3426 }
3427
3428
3429
3430 func (c *CustomchannelsUpdateCall) Header() http.Header {
3431 if c.header_ == nil {
3432 c.header_ = make(http.Header)
3433 }
3434 return c.header_
3435 }
3436
3437 func (c *CustomchannelsUpdateCall) doRequest(alt string) (*http.Response, error) {
3438 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3439 var body io.Reader = nil
3440 body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
3441 if err != nil {
3442 return nil, err
3443 }
3444 c.urlParams_.Set("alt", alt)
3445 c.urlParams_.Set("prettyPrint", "false")
3446 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
3447 urls += "?" + c.urlParams_.Encode()
3448 req, err := http.NewRequest("PUT", urls, body)
3449 if err != nil {
3450 return nil, err
3451 }
3452 req.Header = reqHeaders
3453 googleapi.Expand(req.URL, map[string]string{
3454 "adClientId": c.adClientId,
3455 })
3456 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3457 }
3458
3459
3460
3461
3462
3463
3464 func (c *CustomchannelsUpdateCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
3465 gensupport.SetOptions(c.urlParams_, opts...)
3466 res, err := c.doRequest("json")
3467 if res != nil && res.StatusCode == http.StatusNotModified {
3468 if res.Body != nil {
3469 res.Body.Close()
3470 }
3471 return nil, gensupport.WrapError(&googleapi.Error{
3472 Code: res.StatusCode,
3473 Header: res.Header,
3474 })
3475 }
3476 if err != nil {
3477 return nil, err
3478 }
3479 defer googleapi.CloseBody(res)
3480 if err := googleapi.CheckResponse(res); err != nil {
3481 return nil, gensupport.WrapError(err)
3482 }
3483 ret := &CustomChannel{
3484 ServerResponse: googleapi.ServerResponse{
3485 Header: res.Header,
3486 HTTPStatusCode: res.StatusCode,
3487 },
3488 }
3489 target := &ret
3490 if err := gensupport.DecodeResponse(target, res); err != nil {
3491 return nil, err
3492 }
3493 return ret, nil
3494 }
3495
3496 type ReportsGenerateCall struct {
3497 s *Service
3498 urlParams_ gensupport.URLParams
3499 ifNoneMatch_ string
3500 ctx_ context.Context
3501 header_ http.Header
3502 }
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512 func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall {
3513 c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3514 c.urlParams_.Set("startDate", startDate)
3515 c.urlParams_.Set("endDate", endDate)
3516 return c
3517 }
3518
3519
3520
3521 func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall {
3522 c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
3523 return c
3524 }
3525
3526
3527
3528 func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall {
3529 c.urlParams_.SetMulti("filter", append([]string{}, filter...))
3530 return c
3531 }
3532
3533
3534
3535
3536 func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall {
3537 c.urlParams_.Set("locale", locale)
3538 return c
3539 }
3540
3541
3542
3543 func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {
3544 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3545 return c
3546 }
3547
3548
3549
3550 func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall {
3551 c.urlParams_.SetMulti("metric", append([]string{}, metric...))
3552 return c
3553 }
3554
3555
3556
3557
3558
3559 func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall {
3560 c.urlParams_.SetMulti("sort", append([]string{}, sort...))
3561 return c
3562 }
3563
3564
3565
3566 func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall {
3567 c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
3568 return c
3569 }
3570
3571
3572
3573
3574 func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
3575 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3576 return c
3577 }
3578
3579
3580
3581
3582 func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall {
3583 c.ifNoneMatch_ = entityTag
3584 return c
3585 }
3586
3587
3588 func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
3589 c.ctx_ = ctx
3590 return c
3591 }
3592
3593
3594
3595 func (c *ReportsGenerateCall) Header() http.Header {
3596 if c.header_ == nil {
3597 c.header_ = make(http.Header)
3598 }
3599 return c.header_
3600 }
3601
3602 func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
3603 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3604 if c.ifNoneMatch_ != "" {
3605 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3606 }
3607 var body io.Reader = nil
3608 c.urlParams_.Set("alt", alt)
3609 c.urlParams_.Set("prettyPrint", "false")
3610 urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
3611 urls += "?" + c.urlParams_.Encode()
3612 req, err := http.NewRequest("GET", urls, body)
3613 if err != nil {
3614 return nil, err
3615 }
3616 req.Header = reqHeaders
3617 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3618 }
3619
3620
3621
3622
3623
3624
3625 func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
3626 gensupport.SetOptions(c.urlParams_, opts...)
3627 res, err := c.doRequest("json")
3628 if res != nil && res.StatusCode == http.StatusNotModified {
3629 if res.Body != nil {
3630 res.Body.Close()
3631 }
3632 return nil, gensupport.WrapError(&googleapi.Error{
3633 Code: res.StatusCode,
3634 Header: res.Header,
3635 })
3636 }
3637 if err != nil {
3638 return nil, err
3639 }
3640 defer googleapi.CloseBody(res)
3641 if err := googleapi.CheckResponse(res); err != nil {
3642 return nil, gensupport.WrapError(err)
3643 }
3644 ret := &Report{
3645 ServerResponse: googleapi.ServerResponse{
3646 Header: res.Header,
3647 HTTPStatusCode: res.StatusCode,
3648 },
3649 }
3650 target := &ret
3651 if err := gensupport.DecodeResponse(target, res); err != nil {
3652 return nil, err
3653 }
3654 return ret, nil
3655 }
3656
3657 type UrlchannelsDeleteCall struct {
3658 s *Service
3659 adClientId string
3660 urlChannelId string
3661 urlParams_ gensupport.URLParams
3662 ctx_ context.Context
3663 header_ http.Header
3664 }
3665
3666
3667
3668
3669
3670 func (r *UrlchannelsService) Delete(adClientId string, urlChannelId string) *UrlchannelsDeleteCall {
3671 c := &UrlchannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3672 c.adClientId = adClientId
3673 c.urlChannelId = urlChannelId
3674 return c
3675 }
3676
3677
3678
3679
3680 func (c *UrlchannelsDeleteCall) Fields(s ...googleapi.Field) *UrlchannelsDeleteCall {
3681 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3682 return c
3683 }
3684
3685
3686 func (c *UrlchannelsDeleteCall) Context(ctx context.Context) *UrlchannelsDeleteCall {
3687 c.ctx_ = ctx
3688 return c
3689 }
3690
3691
3692
3693 func (c *UrlchannelsDeleteCall) Header() http.Header {
3694 if c.header_ == nil {
3695 c.header_ = make(http.Header)
3696 }
3697 return c.header_
3698 }
3699
3700 func (c *UrlchannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
3701 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3702 var body io.Reader = nil
3703 c.urlParams_.Set("alt", alt)
3704 c.urlParams_.Set("prettyPrint", "false")
3705 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels/{urlChannelId}")
3706 urls += "?" + c.urlParams_.Encode()
3707 req, err := http.NewRequest("DELETE", urls, body)
3708 if err != nil {
3709 return nil, err
3710 }
3711 req.Header = reqHeaders
3712 googleapi.Expand(req.URL, map[string]string{
3713 "adClientId": c.adClientId,
3714 "urlChannelId": c.urlChannelId,
3715 })
3716 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3717 }
3718
3719
3720
3721
3722
3723
3724 func (c *UrlchannelsDeleteCall) Do(opts ...googleapi.CallOption) (*UrlChannel, error) {
3725 gensupport.SetOptions(c.urlParams_, opts...)
3726 res, err := c.doRequest("json")
3727 if res != nil && res.StatusCode == http.StatusNotModified {
3728 if res.Body != nil {
3729 res.Body.Close()
3730 }
3731 return nil, gensupport.WrapError(&googleapi.Error{
3732 Code: res.StatusCode,
3733 Header: res.Header,
3734 })
3735 }
3736 if err != nil {
3737 return nil, err
3738 }
3739 defer googleapi.CloseBody(res)
3740 if err := googleapi.CheckResponse(res); err != nil {
3741 return nil, gensupport.WrapError(err)
3742 }
3743 ret := &UrlChannel{
3744 ServerResponse: googleapi.ServerResponse{
3745 Header: res.Header,
3746 HTTPStatusCode: res.StatusCode,
3747 },
3748 }
3749 target := &ret
3750 if err := gensupport.DecodeResponse(target, res); err != nil {
3751 return nil, err
3752 }
3753 return ret, nil
3754 }
3755
3756 type UrlchannelsInsertCall struct {
3757 s *Service
3758 adClientId string
3759 urlchannel *UrlChannel
3760 urlParams_ gensupport.URLParams
3761 ctx_ context.Context
3762 header_ http.Header
3763 }
3764
3765
3766
3767
3768 func (r *UrlchannelsService) Insert(adClientId string, urlchannel *UrlChannel) *UrlchannelsInsertCall {
3769 c := &UrlchannelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3770 c.adClientId = adClientId
3771 c.urlchannel = urlchannel
3772 return c
3773 }
3774
3775
3776
3777
3778 func (c *UrlchannelsInsertCall) Fields(s ...googleapi.Field) *UrlchannelsInsertCall {
3779 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3780 return c
3781 }
3782
3783
3784 func (c *UrlchannelsInsertCall) Context(ctx context.Context) *UrlchannelsInsertCall {
3785 c.ctx_ = ctx
3786 return c
3787 }
3788
3789
3790
3791 func (c *UrlchannelsInsertCall) Header() http.Header {
3792 if c.header_ == nil {
3793 c.header_ = make(http.Header)
3794 }
3795 return c.header_
3796 }
3797
3798 func (c *UrlchannelsInsertCall) doRequest(alt string) (*http.Response, error) {
3799 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3800 var body io.Reader = nil
3801 body, err := googleapi.WithoutDataWrapper.JSONReader(c.urlchannel)
3802 if err != nil {
3803 return nil, err
3804 }
3805 c.urlParams_.Set("alt", alt)
3806 c.urlParams_.Set("prettyPrint", "false")
3807 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
3808 urls += "?" + c.urlParams_.Encode()
3809 req, err := http.NewRequest("POST", urls, body)
3810 if err != nil {
3811 return nil, err
3812 }
3813 req.Header = reqHeaders
3814 googleapi.Expand(req.URL, map[string]string{
3815 "adClientId": c.adClientId,
3816 })
3817 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3818 }
3819
3820
3821
3822
3823
3824
3825 func (c *UrlchannelsInsertCall) Do(opts ...googleapi.CallOption) (*UrlChannel, error) {
3826 gensupport.SetOptions(c.urlParams_, opts...)
3827 res, err := c.doRequest("json")
3828 if res != nil && res.StatusCode == http.StatusNotModified {
3829 if res.Body != nil {
3830 res.Body.Close()
3831 }
3832 return nil, gensupport.WrapError(&googleapi.Error{
3833 Code: res.StatusCode,
3834 Header: res.Header,
3835 })
3836 }
3837 if err != nil {
3838 return nil, err
3839 }
3840 defer googleapi.CloseBody(res)
3841 if err := googleapi.CheckResponse(res); err != nil {
3842 return nil, gensupport.WrapError(err)
3843 }
3844 ret := &UrlChannel{
3845 ServerResponse: googleapi.ServerResponse{
3846 Header: res.Header,
3847 HTTPStatusCode: res.StatusCode,
3848 },
3849 }
3850 target := &ret
3851 if err := gensupport.DecodeResponse(target, res); err != nil {
3852 return nil, err
3853 }
3854 return ret, nil
3855 }
3856
3857 type UrlchannelsListCall struct {
3858 s *Service
3859 adClientId string
3860 urlParams_ gensupport.URLParams
3861 ifNoneMatch_ string
3862 ctx_ context.Context
3863 header_ http.Header
3864 }
3865
3866
3867
3868
3869 func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall {
3870 c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3871 c.adClientId = adClientId
3872 return c
3873 }
3874
3875
3876
3877 func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall {
3878 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3879 return c
3880 }
3881
3882
3883
3884
3885 func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall {
3886 c.urlParams_.Set("pageToken", pageToken)
3887 return c
3888 }
3889
3890
3891
3892
3893 func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall {
3894 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3895 return c
3896 }
3897
3898
3899
3900
3901 func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall {
3902 c.ifNoneMatch_ = entityTag
3903 return c
3904 }
3905
3906
3907 func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall {
3908 c.ctx_ = ctx
3909 return c
3910 }
3911
3912
3913
3914 func (c *UrlchannelsListCall) Header() http.Header {
3915 if c.header_ == nil {
3916 c.header_ = make(http.Header)
3917 }
3918 return c.header_
3919 }
3920
3921 func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
3922 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3923 if c.ifNoneMatch_ != "" {
3924 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3925 }
3926 var body io.Reader = nil
3927 c.urlParams_.Set("alt", alt)
3928 c.urlParams_.Set("prettyPrint", "false")
3929 urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
3930 urls += "?" + c.urlParams_.Encode()
3931 req, err := http.NewRequest("GET", urls, body)
3932 if err != nil {
3933 return nil, err
3934 }
3935 req.Header = reqHeaders
3936 googleapi.Expand(req.URL, map[string]string{
3937 "adClientId": c.adClientId,
3938 })
3939 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3940 }
3941
3942
3943
3944
3945
3946
3947 func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
3948 gensupport.SetOptions(c.urlParams_, opts...)
3949 res, err := c.doRequest("json")
3950 if res != nil && res.StatusCode == http.StatusNotModified {
3951 if res.Body != nil {
3952 res.Body.Close()
3953 }
3954 return nil, gensupport.WrapError(&googleapi.Error{
3955 Code: res.StatusCode,
3956 Header: res.Header,
3957 })
3958 }
3959 if err != nil {
3960 return nil, err
3961 }
3962 defer googleapi.CloseBody(res)
3963 if err := googleapi.CheckResponse(res); err != nil {
3964 return nil, gensupport.WrapError(err)
3965 }
3966 ret := &UrlChannels{
3967 ServerResponse: googleapi.ServerResponse{
3968 Header: res.Header,
3969 HTTPStatusCode: res.StatusCode,
3970 },
3971 }
3972 target := &ret
3973 if err := gensupport.DecodeResponse(target, res); err != nil {
3974 return nil, err
3975 }
3976 return ret, nil
3977 }
3978
3979
3980
3981
3982 func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
3983 c.ctx_ = ctx
3984 defer c.PageToken(c.urlParams_.Get("pageToken"))
3985 for {
3986 x, err := c.Do()
3987 if err != nil {
3988 return err
3989 }
3990 if err := f(x); err != nil {
3991 return err
3992 }
3993 if x.NextPageToken == "" {
3994 return nil
3995 }
3996 c.PageToken(x.NextPageToken)
3997 }
3998 }
3999
View as plain text