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 doubleclicksearch
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 = "doubleclicksearch:v2"
90 const apiName = "doubleclicksearch"
91 const apiVersion = "v2"
92 const basePath = "https://doubleclicksearch.googleapis.com/"
93 const basePathTemplate = "https://doubleclicksearch.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://doubleclicksearch.mtls.googleapis.com/"
95
96
97 const (
98
99 DoubleclicksearchScope = "https://www.googleapis.com/auth/doubleclicksearch"
100 )
101
102
103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/doubleclicksearch",
106 )
107
108 opts = append([]option.ClientOption{scopesOption}, opts...)
109 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
110 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
111 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
112 opts = append(opts, internaloption.EnableNewAuthLibrary())
113 client, endpoint, err := htransport.NewClient(ctx, opts...)
114 if err != nil {
115 return nil, err
116 }
117 s, err := New(client)
118 if err != nil {
119 return nil, err
120 }
121 if endpoint != "" {
122 s.BasePath = endpoint
123 }
124 return s, nil
125 }
126
127
128
129
130
131
132 func New(client *http.Client) (*Service, error) {
133 if client == nil {
134 return nil, errors.New("client is nil")
135 }
136 s := &Service{client: client, BasePath: basePath}
137 s.Conversion = NewConversionService(s)
138 s.Reports = NewReportsService(s)
139 s.SavedColumns = NewSavedColumnsService(s)
140 return s, nil
141 }
142
143 type Service struct {
144 client *http.Client
145 BasePath string
146 UserAgent string
147
148 Conversion *ConversionService
149
150 Reports *ReportsService
151
152 SavedColumns *SavedColumnsService
153 }
154
155 func (s *Service) userAgent() string {
156 if s.UserAgent == "" {
157 return googleapi.UserAgent
158 }
159 return googleapi.UserAgent + " " + s.UserAgent
160 }
161
162 func NewConversionService(s *Service) *ConversionService {
163 rs := &ConversionService{s: s}
164 return rs
165 }
166
167 type ConversionService struct {
168 s *Service
169 }
170
171 func NewReportsService(s *Service) *ReportsService {
172 rs := &ReportsService{s: s}
173 return rs
174 }
175
176 type ReportsService struct {
177 s *Service
178 }
179
180 func NewSavedColumnsService(s *Service) *SavedColumnsService {
181 rs := &SavedColumnsService{s: s}
182 return rs
183 }
184
185 type SavedColumnsService struct {
186 s *Service
187 }
188
189
190
191 type Availability struct {
192
193 AdvertiserId int64 `json:"advertiserId,omitempty,string"`
194
195 AgencyId int64 `json:"agencyId,omitempty,string"`
196
197
198 AvailabilityTimestamp int64 `json:"availabilityTimestamp,omitempty,string"`
199
200
201 CustomerId string `json:"customerId,omitempty"`
202
203
204 SegmentationId int64 `json:"segmentationId,omitempty,string"`
205
206
207 SegmentationName string `json:"segmentationName,omitempty"`
208
209
210 SegmentationType string `json:"segmentationType,omitempty"`
211
212
213
214
215
216 ForceSendFields []string `json:"-"`
217
218
219
220
221 NullFields []string `json:"-"`
222 }
223
224 func (s *Availability) MarshalJSON() ([]byte, error) {
225 type NoMethod Availability
226 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
227 }
228
229
230 type Conversion struct {
231
232 AdGroupId int64 `json:"adGroupId,omitempty,string"`
233
234 AdId int64 `json:"adId,omitempty,string"`
235
236
237
238
239
240
241
242
243
244 AdUserDataConsent string `json:"adUserDataConsent,omitempty"`
245
246 AdvertiserId int64 `json:"advertiserId,omitempty,string"`
247
248 AgencyId int64 `json:"agencyId,omitempty,string"`
249
250
251 AttributionModel string `json:"attributionModel,omitempty"`
252
253 CampaignId int64 `json:"campaignId,omitempty,string"`
254
255
256 Channel string `json:"channel,omitempty"`
257
258 ClickId string `json:"clickId,omitempty"`
259
260
261
262
263
264
265 ConversionId string `json:"conversionId,omitempty"`
266
267
268 ConversionModifiedTimestamp int64 `json:"conversionModifiedTimestamp,omitempty,string"`
269
270
271 ConversionTimestamp string `json:"conversionTimestamp,omitempty"`
272
273
274 CountMillis int64 `json:"countMillis,omitempty,string"`
275
276 CriterionId int64 `json:"criterionId,omitempty,string"`
277
278
279 CurrencyCode string `json:"currencyCode,omitempty"`
280
281
282 CustomDimension []*CustomDimension `json:"customDimension,omitempty"`
283
284 CustomMetric []*CustomMetric `json:"customMetric,omitempty"`
285
286
287 CustomerId string `json:"customerId,omitempty"`
288
289 DeviceType string `json:"deviceType,omitempty"`
290
291 DsConversionId int64 `json:"dsConversionId,omitempty,string"`
292
293 EngineAccountId int64 `json:"engineAccountId,omitempty,string"`
294
295
296 FloodlightOrderId string `json:"floodlightOrderId,omitempty"`
297
298
299 InventoryAccountId int64 `json:"inventoryAccountId,omitempty,string"`
300
301
302 ProductCountry string `json:"productCountry,omitempty"`
303
304 ProductGroupId int64 `json:"productGroupId,omitempty,string"`
305
306 ProductId string `json:"productId,omitempty"`
307
308
309 ProductLanguage string `json:"productLanguage,omitempty"`
310
311 QuantityMillis int64 `json:"quantityMillis,omitempty,string"`
312
313
314
315 RevenueMicros string `json:"revenueMicros,omitempty"`
316
317
318 SegmentationId int64 `json:"segmentationId,omitempty,string"`
319
320
321 SegmentationName string `json:"segmentationName,omitempty"`
322
323
324 SegmentationType string `json:"segmentationType,omitempty"`
325
326
327 State string `json:"state,omitempty"`
328
329
330 StoreId string `json:"storeId,omitempty"`
331
332
333
334
335
336 Type string `json:"type,omitempty"`
337
338
339
340
341
342 ForceSendFields []string `json:"-"`
343
344
345
346
347 NullFields []string `json:"-"`
348 }
349
350 func (s *Conversion) MarshalJSON() ([]byte, error) {
351 type NoMethod Conversion
352 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
353 }
354
355
356 type ConversionList struct {
357
358 Conversion []*Conversion `json:"conversion,omitempty"`
359
360
361 Kind string `json:"kind,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 *ConversionList) MarshalJSON() ([]byte, error) {
379 type NoMethod ConversionList
380 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
381 }
382
383
384 type CustomDimension struct {
385
386 Name string `json:"name,omitempty"`
387
388 Value string `json:"value,omitempty"`
389
390
391
392
393
394 ForceSendFields []string `json:"-"`
395
396
397
398
399 NullFields []string `json:"-"`
400 }
401
402 func (s *CustomDimension) MarshalJSON() ([]byte, error) {
403 type NoMethod CustomDimension
404 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
405 }
406
407
408 type CustomMetric struct {
409
410 Name string `json:"name,omitempty"`
411
412 Value float64 `json:"value,omitempty"`
413
414
415
416
417
418 ForceSendFields []string `json:"-"`
419
420
421
422
423 NullFields []string `json:"-"`
424 }
425
426 func (s *CustomMetric) MarshalJSON() ([]byte, error) {
427 type NoMethod CustomMetric
428 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
429 }
430
431 func (s *CustomMetric) UnmarshalJSON(data []byte) error {
432 type NoMethod CustomMetric
433 var s1 struct {
434 Value gensupport.JSONFloat64 `json:"value"`
435 *NoMethod
436 }
437 s1.NoMethod = (*NoMethod)(s)
438 if err := json.Unmarshal(data, &s1); err != nil {
439 return err
440 }
441 s.Value = float64(s1.Value)
442 return nil
443 }
444
445
446
447 type IdMappingFile struct {
448
449 googleapi.ServerResponse `json:"-"`
450 }
451
452
453
454
455 type Report struct {
456
457
458 Files []*ReportFiles `json:"files,omitempty"`
459
460 Id string `json:"id,omitempty"`
461
462
463 IsReportReady bool `json:"isReportReady,omitempty"`
464
465
466 Kind string `json:"kind,omitempty"`
467
468
469 Request *ReportRequest `json:"request,omitempty"`
470
471
472 RowCount int64 `json:"rowCount,omitempty"`
473
474 Rows []googleapi.RawMessage `json:"rows,omitempty"`
475
476
477
478
479
480 StatisticsCurrencyCode string `json:"statisticsCurrencyCode,omitempty"`
481
482
483 StatisticsTimeZone string `json:"statisticsTimeZone,omitempty"`
484
485
486 googleapi.ServerResponse `json:"-"`
487
488
489
490
491
492 ForceSendFields []string `json:"-"`
493
494
495
496
497 NullFields []string `json:"-"`
498 }
499
500 func (s *Report) MarshalJSON() ([]byte, error) {
501 type NoMethod Report
502 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
503 }
504
505 type ReportFiles struct {
506
507 ByteCount int64 `json:"byteCount,omitempty,string"`
508
509 Url string `json:"url,omitempty"`
510
511
512
513
514
515 ForceSendFields []string `json:"-"`
516
517
518
519
520 NullFields []string `json:"-"`
521 }
522
523 func (s *ReportFiles) MarshalJSON() ([]byte, error) {
524 type NoMethod ReportFiles
525 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
526 }
527
528
529
530 type ReportApiColumnSpec struct {
531
532 ColumnName string `json:"columnName,omitempty"`
533
534
535
536
537
538
539 CustomDimensionName string `json:"customDimensionName,omitempty"`
540
541
542
543
544 CustomMetricName string `json:"customMetricName,omitempty"`
545
546
547
548 EndDate string `json:"endDate,omitempty"`
549
550
551 GroupByColumn bool `json:"groupByColumn,omitempty"`
552
553
554
555
556 HeaderText string `json:"headerText,omitempty"`
557
558
559 PlatformSource string `json:"platformSource,omitempty"`
560
561
562
563
564
565 ProductReportPerspective string `json:"productReportPerspective,omitempty"`
566
567
568
569 SavedColumnName string `json:"savedColumnName,omitempty"`
570
571
572
573 StartDate string `json:"startDate,omitempty"`
574
575
576
577
578
579 ForceSendFields []string `json:"-"`
580
581
582
583
584 NullFields []string `json:"-"`
585 }
586
587 func (s *ReportApiColumnSpec) MarshalJSON() ([]byte, error) {
588 type NoMethod ReportApiColumnSpec
589 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
590 }
591
592
593 type ReportRequest struct {
594
595
596
597
598
599
600 Columns []*ReportApiColumnSpec `json:"columns,omitempty"`
601
602
603 DownloadFormat string `json:"downloadFormat,omitempty"`
604
605
606 Filters []*ReportRequestFilters `json:"filters,omitempty"`
607
608
609
610 IncludeDeletedEntities bool `json:"includeDeletedEntities,omitempty"`
611
612
613 IncludeRemovedEntities bool `json:"includeRemovedEntities,omitempty"`
614
615
616
617 MaxRowsPerFile int64 `json:"maxRowsPerFile,omitempty"`
618
619
620
621 OrderBy []*ReportRequestOrderBy `json:"orderBy,omitempty"`
622
623
624
625 ReportScope *ReportRequestReportScope `json:"reportScope,omitempty"`
626
627
628
629
630
631 ReportType string `json:"reportType,omitempty"`
632
633
634
635 RowCount int64 `json:"rowCount,omitempty"`
636
637
638 StartRow int64 `json:"startRow,omitempty"`
639
640
641
642
643
644 StatisticsCurrency string `json:"statisticsCurrency,omitempty"`
645
646
647 TimeRange *ReportRequestTimeRange `json:"timeRange,omitempty"`
648
649
650 VerifySingleTimeZone bool `json:"verifySingleTimeZone,omitempty"`
651
652
653
654
655
656 ForceSendFields []string `json:"-"`
657
658
659
660
661 NullFields []string `json:"-"`
662 }
663
664 func (s *ReportRequest) MarshalJSON() ([]byte, error) {
665 type NoMethod ReportRequest
666 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
667 }
668
669 type ReportRequestFilters struct {
670
671
672 Column *ReportApiColumnSpec `json:"column,omitempty"`
673
674
675 Operator string `json:"operator,omitempty"`
676
677
678 Values []interface{} `json:"values,omitempty"`
679
680
681
682
683
684 ForceSendFields []string `json:"-"`
685
686
687
688
689 NullFields []string `json:"-"`
690 }
691
692 func (s *ReportRequestFilters) MarshalJSON() ([]byte, error) {
693 type NoMethod ReportRequestFilters
694 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
695 }
696
697 type ReportRequestOrderBy struct {
698
699
700 Column *ReportApiColumnSpec `json:"column,omitempty"`
701
702 SortOrder string `json:"sortOrder,omitempty"`
703
704
705
706
707
708 ForceSendFields []string `json:"-"`
709
710
711
712
713 NullFields []string `json:"-"`
714 }
715
716 func (s *ReportRequestOrderBy) MarshalJSON() ([]byte, error) {
717 type NoMethod ReportRequestOrderBy
718 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
719 }
720
721
722
723
724
725 type ReportRequestReportScope struct {
726
727 AdGroupId int64 `json:"adGroupId,omitempty,string"`
728
729 AdId int64 `json:"adId,omitempty,string"`
730
731 AdvertiserId int64 `json:"advertiserId,omitempty,string"`
732
733 AgencyId int64 `json:"agencyId,omitempty,string"`
734
735 CampaignId int64 `json:"campaignId,omitempty,string"`
736
737 EngineAccountId int64 `json:"engineAccountId,omitempty,string"`
738
739 KeywordId int64 `json:"keywordId,omitempty,string"`
740
741
742
743
744
745 ForceSendFields []string `json:"-"`
746
747
748
749
750 NullFields []string `json:"-"`
751 }
752
753 func (s *ReportRequestReportScope) MarshalJSON() ([]byte, error) {
754 type NoMethod ReportRequestReportScope
755 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
756 }
757
758
759
760 type ReportRequestTimeRange struct {
761
762
763
764 ChangedAttributesSinceTimestamp string `json:"changedAttributesSinceTimestamp,omitempty"`
765
766
767
768 ChangedMetricsSinceTimestamp string `json:"changedMetricsSinceTimestamp,omitempty"`
769
770 EndDate string `json:"endDate,omitempty"`
771
772 StartDate string `json:"startDate,omitempty"`
773
774
775
776
777
778
779 ForceSendFields []string `json:"-"`
780
781
782
783
784 NullFields []string `json:"-"`
785 }
786
787 func (s *ReportRequestTimeRange) MarshalJSON() ([]byte, error) {
788 type NoMethod ReportRequestTimeRange
789 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
790 }
791
792
793 type SavedColumn struct {
794
795
796 Kind string `json:"kind,omitempty"`
797
798 SavedColumnName string `json:"savedColumnName,omitempty"`
799
800 Type string `json:"type,omitempty"`
801
802
803
804
805
806 ForceSendFields []string `json:"-"`
807
808
809
810
811 NullFields []string `json:"-"`
812 }
813
814 func (s *SavedColumn) MarshalJSON() ([]byte, error) {
815 type NoMethod SavedColumn
816 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
817 }
818
819
820
821
822
823 type SavedColumnList struct {
824
825 Items []*SavedColumn `json:"items,omitempty"`
826
827
828 Kind string `json:"kind,omitempty"`
829
830
831 googleapi.ServerResponse `json:"-"`
832
833
834
835
836
837 ForceSendFields []string `json:"-"`
838
839
840
841
842 NullFields []string `json:"-"`
843 }
844
845 func (s *SavedColumnList) MarshalJSON() ([]byte, error) {
846 type NoMethod SavedColumnList
847 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
848 }
849
850
851 type UpdateAvailabilityRequest struct {
852
853 Availabilities []*Availability `json:"availabilities,omitempty"`
854
855
856
857
858
859 ForceSendFields []string `json:"-"`
860
861
862
863
864 NullFields []string `json:"-"`
865 }
866
867 func (s *UpdateAvailabilityRequest) MarshalJSON() ([]byte, error) {
868 type NoMethod UpdateAvailabilityRequest
869 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
870 }
871
872
873 type UpdateAvailabilityResponse struct {
874
875 Availabilities []*Availability `json:"availabilities,omitempty"`
876
877
878 googleapi.ServerResponse `json:"-"`
879
880
881
882
883
884 ForceSendFields []string `json:"-"`
885
886
887
888
889 NullFields []string `json:"-"`
890 }
891
892 func (s *UpdateAvailabilityResponse) MarshalJSON() ([]byte, error) {
893 type NoMethod UpdateAvailabilityResponse
894 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
895 }
896
897 type ConversionGetCall struct {
898 s *Service
899 agencyId int64
900 advertiserId int64
901 engineAccountId int64
902 urlParams_ gensupport.URLParams
903 ifNoneMatch_ string
904 ctx_ context.Context
905 header_ http.Header
906 }
907
908
909
910
911
912
913
914
915
916
917
918
919
920 func (r *ConversionService) Get(agencyId int64, advertiserId int64, engineAccountId int64, endDate int64, rowCount int64, startDate int64, startRow int64) *ConversionGetCall {
921 c := &ConversionGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
922 c.agencyId = agencyId
923 c.advertiserId = advertiserId
924 c.engineAccountId = engineAccountId
925 c.urlParams_.Set("endDate", fmt.Sprint(endDate))
926 c.urlParams_.Set("rowCount", fmt.Sprint(rowCount))
927 c.urlParams_.Set("startDate", fmt.Sprint(startDate))
928 c.urlParams_.Set("startRow", fmt.Sprint(startRow))
929 return c
930 }
931
932
933
934 func (c *ConversionGetCall) AdGroupId(adGroupId int64) *ConversionGetCall {
935 c.urlParams_.Set("adGroupId", fmt.Sprint(adGroupId))
936 return c
937 }
938
939
940 func (c *ConversionGetCall) AdId(adId int64) *ConversionGetCall {
941 c.urlParams_.Set("adId", fmt.Sprint(adId))
942 return c
943 }
944
945
946
947 func (c *ConversionGetCall) CampaignId(campaignId int64) *ConversionGetCall {
948 c.urlParams_.Set("campaignId", fmt.Sprint(campaignId))
949 return c
950 }
951
952
953
954 func (c *ConversionGetCall) CriterionId(criterionId int64) *ConversionGetCall {
955 c.urlParams_.Set("criterionId", fmt.Sprint(criterionId))
956 return c
957 }
958
959
960
961 func (c *ConversionGetCall) CustomerId(customerId string) *ConversionGetCall {
962 c.urlParams_.Set("customerId", customerId)
963 return c
964 }
965
966
967
968
969 func (c *ConversionGetCall) Fields(s ...googleapi.Field) *ConversionGetCall {
970 c.urlParams_.Set("fields", googleapi.CombineFields(s))
971 return c
972 }
973
974
975
976
977 func (c *ConversionGetCall) IfNoneMatch(entityTag string) *ConversionGetCall {
978 c.ifNoneMatch_ = entityTag
979 return c
980 }
981
982
983 func (c *ConversionGetCall) Context(ctx context.Context) *ConversionGetCall {
984 c.ctx_ = ctx
985 return c
986 }
987
988
989
990 func (c *ConversionGetCall) Header() http.Header {
991 if c.header_ == nil {
992 c.header_ = make(http.Header)
993 }
994 return c.header_
995 }
996
997 func (c *ConversionGetCall) doRequest(alt string) (*http.Response, error) {
998 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
999 if c.ifNoneMatch_ != "" {
1000 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1001 }
1002 var body io.Reader = nil
1003 c.urlParams_.Set("alt", alt)
1004 c.urlParams_.Set("prettyPrint", "false")
1005 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/agency/{agencyId}/advertiser/{advertiserId}/engine/{engineAccountId}/conversion")
1006 urls += "?" + c.urlParams_.Encode()
1007 req, err := http.NewRequest("GET", urls, body)
1008 if err != nil {
1009 return nil, err
1010 }
1011 req.Header = reqHeaders
1012 googleapi.Expand(req.URL, map[string]string{
1013 "agencyId": strconv.FormatInt(c.agencyId, 10),
1014 "advertiserId": strconv.FormatInt(c.advertiserId, 10),
1015 "engineAccountId": strconv.FormatInt(c.engineAccountId, 10),
1016 })
1017 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1018 }
1019
1020
1021
1022
1023
1024
1025 func (c *ConversionGetCall) Do(opts ...googleapi.CallOption) (*ConversionList, error) {
1026 gensupport.SetOptions(c.urlParams_, opts...)
1027 res, err := c.doRequest("json")
1028 if res != nil && res.StatusCode == http.StatusNotModified {
1029 if res.Body != nil {
1030 res.Body.Close()
1031 }
1032 return nil, gensupport.WrapError(&googleapi.Error{
1033 Code: res.StatusCode,
1034 Header: res.Header,
1035 })
1036 }
1037 if err != nil {
1038 return nil, err
1039 }
1040 defer googleapi.CloseBody(res)
1041 if err := googleapi.CheckResponse(res); err != nil {
1042 return nil, gensupport.WrapError(err)
1043 }
1044 ret := &ConversionList{
1045 ServerResponse: googleapi.ServerResponse{
1046 Header: res.Header,
1047 HTTPStatusCode: res.StatusCode,
1048 },
1049 }
1050 target := &ret
1051 if err := gensupport.DecodeResponse(target, res); err != nil {
1052 return nil, err
1053 }
1054 return ret, nil
1055 }
1056
1057 type ConversionGetByCustomerIdCall struct {
1058 s *Service
1059 customerId string
1060 urlParams_ gensupport.URLParams
1061 ifNoneMatch_ string
1062 ctx_ context.Context
1063 header_ http.Header
1064 }
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077 func (r *ConversionService) GetByCustomerId(customerId string, endDate int64, rowCount int64, startDate int64, startRow int64) *ConversionGetByCustomerIdCall {
1078 c := &ConversionGetByCustomerIdCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1079 c.customerId = customerId
1080 c.urlParams_.Set("endDate", fmt.Sprint(endDate))
1081 c.urlParams_.Set("rowCount", fmt.Sprint(rowCount))
1082 c.urlParams_.Set("startDate", fmt.Sprint(startDate))
1083 c.urlParams_.Set("startRow", fmt.Sprint(startRow))
1084 return c
1085 }
1086
1087
1088
1089 func (c *ConversionGetByCustomerIdCall) AdGroupId(adGroupId int64) *ConversionGetByCustomerIdCall {
1090 c.urlParams_.Set("adGroupId", fmt.Sprint(adGroupId))
1091 return c
1092 }
1093
1094
1095 func (c *ConversionGetByCustomerIdCall) AdId(adId int64) *ConversionGetByCustomerIdCall {
1096 c.urlParams_.Set("adId", fmt.Sprint(adId))
1097 return c
1098 }
1099
1100
1101
1102 func (c *ConversionGetByCustomerIdCall) AdvertiserId(advertiserId int64) *ConversionGetByCustomerIdCall {
1103 c.urlParams_.Set("advertiserId", fmt.Sprint(advertiserId))
1104 return c
1105 }
1106
1107
1108 func (c *ConversionGetByCustomerIdCall) AgencyId(agencyId int64) *ConversionGetByCustomerIdCall {
1109 c.urlParams_.Set("agencyId", fmt.Sprint(agencyId))
1110 return c
1111 }
1112
1113
1114
1115 func (c *ConversionGetByCustomerIdCall) CampaignId(campaignId int64) *ConversionGetByCustomerIdCall {
1116 c.urlParams_.Set("campaignId", fmt.Sprint(campaignId))
1117 return c
1118 }
1119
1120
1121
1122 func (c *ConversionGetByCustomerIdCall) CriterionId(criterionId int64) *ConversionGetByCustomerIdCall {
1123 c.urlParams_.Set("criterionId", fmt.Sprint(criterionId))
1124 return c
1125 }
1126
1127
1128
1129 func (c *ConversionGetByCustomerIdCall) EngineAccountId(engineAccountId int64) *ConversionGetByCustomerIdCall {
1130 c.urlParams_.Set("engineAccountId", fmt.Sprint(engineAccountId))
1131 return c
1132 }
1133
1134
1135
1136
1137 func (c *ConversionGetByCustomerIdCall) Fields(s ...googleapi.Field) *ConversionGetByCustomerIdCall {
1138 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1139 return c
1140 }
1141
1142
1143
1144
1145 func (c *ConversionGetByCustomerIdCall) IfNoneMatch(entityTag string) *ConversionGetByCustomerIdCall {
1146 c.ifNoneMatch_ = entityTag
1147 return c
1148 }
1149
1150
1151 func (c *ConversionGetByCustomerIdCall) Context(ctx context.Context) *ConversionGetByCustomerIdCall {
1152 c.ctx_ = ctx
1153 return c
1154 }
1155
1156
1157
1158 func (c *ConversionGetByCustomerIdCall) Header() http.Header {
1159 if c.header_ == nil {
1160 c.header_ = make(http.Header)
1161 }
1162 return c.header_
1163 }
1164
1165 func (c *ConversionGetByCustomerIdCall) doRequest(alt string) (*http.Response, error) {
1166 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1167 if c.ifNoneMatch_ != "" {
1168 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1169 }
1170 var body io.Reader = nil
1171 c.urlParams_.Set("alt", alt)
1172 c.urlParams_.Set("prettyPrint", "false")
1173 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/customer/{customerId}/conversion")
1174 urls += "?" + c.urlParams_.Encode()
1175 req, err := http.NewRequest("GET", urls, body)
1176 if err != nil {
1177 return nil, err
1178 }
1179 req.Header = reqHeaders
1180 googleapi.Expand(req.URL, map[string]string{
1181 "customerId": c.customerId,
1182 })
1183 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1184 }
1185
1186
1187
1188
1189
1190
1191 func (c *ConversionGetByCustomerIdCall) Do(opts ...googleapi.CallOption) (*ConversionList, error) {
1192 gensupport.SetOptions(c.urlParams_, opts...)
1193 res, err := c.doRequest("json")
1194 if res != nil && res.StatusCode == http.StatusNotModified {
1195 if res.Body != nil {
1196 res.Body.Close()
1197 }
1198 return nil, gensupport.WrapError(&googleapi.Error{
1199 Code: res.StatusCode,
1200 Header: res.Header,
1201 })
1202 }
1203 if err != nil {
1204 return nil, err
1205 }
1206 defer googleapi.CloseBody(res)
1207 if err := googleapi.CheckResponse(res); err != nil {
1208 return nil, gensupport.WrapError(err)
1209 }
1210 ret := &ConversionList{
1211 ServerResponse: googleapi.ServerResponse{
1212 Header: res.Header,
1213 HTTPStatusCode: res.StatusCode,
1214 },
1215 }
1216 target := &ret
1217 if err := gensupport.DecodeResponse(target, res); err != nil {
1218 return nil, err
1219 }
1220 return ret, nil
1221 }
1222
1223 type ConversionInsertCall struct {
1224 s *Service
1225 conversionlist *ConversionList
1226 urlParams_ gensupport.URLParams
1227 ctx_ context.Context
1228 header_ http.Header
1229 }
1230
1231
1232 func (r *ConversionService) Insert(conversionlist *ConversionList) *ConversionInsertCall {
1233 c := &ConversionInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1234 c.conversionlist = conversionlist
1235 return c
1236 }
1237
1238
1239
1240
1241 func (c *ConversionInsertCall) Fields(s ...googleapi.Field) *ConversionInsertCall {
1242 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1243 return c
1244 }
1245
1246
1247 func (c *ConversionInsertCall) Context(ctx context.Context) *ConversionInsertCall {
1248 c.ctx_ = ctx
1249 return c
1250 }
1251
1252
1253
1254 func (c *ConversionInsertCall) Header() http.Header {
1255 if c.header_ == nil {
1256 c.header_ = make(http.Header)
1257 }
1258 return c.header_
1259 }
1260
1261 func (c *ConversionInsertCall) doRequest(alt string) (*http.Response, error) {
1262 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1263 var body io.Reader = nil
1264 body, err := googleapi.WithoutDataWrapper.JSONReader(c.conversionlist)
1265 if err != nil {
1266 return nil, err
1267 }
1268 c.urlParams_.Set("alt", alt)
1269 c.urlParams_.Set("prettyPrint", "false")
1270 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/conversion")
1271 urls += "?" + c.urlParams_.Encode()
1272 req, err := http.NewRequest("POST", urls, body)
1273 if err != nil {
1274 return nil, err
1275 }
1276 req.Header = reqHeaders
1277 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1278 }
1279
1280
1281
1282
1283
1284
1285 func (c *ConversionInsertCall) Do(opts ...googleapi.CallOption) (*ConversionList, error) {
1286 gensupport.SetOptions(c.urlParams_, opts...)
1287 res, err := c.doRequest("json")
1288 if res != nil && res.StatusCode == http.StatusNotModified {
1289 if res.Body != nil {
1290 res.Body.Close()
1291 }
1292 return nil, gensupport.WrapError(&googleapi.Error{
1293 Code: res.StatusCode,
1294 Header: res.Header,
1295 })
1296 }
1297 if err != nil {
1298 return nil, err
1299 }
1300 defer googleapi.CloseBody(res)
1301 if err := googleapi.CheckResponse(res); err != nil {
1302 return nil, gensupport.WrapError(err)
1303 }
1304 ret := &ConversionList{
1305 ServerResponse: googleapi.ServerResponse{
1306 Header: res.Header,
1307 HTTPStatusCode: res.StatusCode,
1308 },
1309 }
1310 target := &ret
1311 if err := gensupport.DecodeResponse(target, res); err != nil {
1312 return nil, err
1313 }
1314 return ret, nil
1315 }
1316
1317 type ConversionUpdateCall struct {
1318 s *Service
1319 conversionlist *ConversionList
1320 urlParams_ gensupport.URLParams
1321 ctx_ context.Context
1322 header_ http.Header
1323 }
1324
1325
1326 func (r *ConversionService) Update(conversionlist *ConversionList) *ConversionUpdateCall {
1327 c := &ConversionUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1328 c.conversionlist = conversionlist
1329 return c
1330 }
1331
1332
1333
1334
1335 func (c *ConversionUpdateCall) Fields(s ...googleapi.Field) *ConversionUpdateCall {
1336 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1337 return c
1338 }
1339
1340
1341 func (c *ConversionUpdateCall) Context(ctx context.Context) *ConversionUpdateCall {
1342 c.ctx_ = ctx
1343 return c
1344 }
1345
1346
1347
1348 func (c *ConversionUpdateCall) Header() http.Header {
1349 if c.header_ == nil {
1350 c.header_ = make(http.Header)
1351 }
1352 return c.header_
1353 }
1354
1355 func (c *ConversionUpdateCall) doRequest(alt string) (*http.Response, error) {
1356 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1357 var body io.Reader = nil
1358 body, err := googleapi.WithoutDataWrapper.JSONReader(c.conversionlist)
1359 if err != nil {
1360 return nil, err
1361 }
1362 c.urlParams_.Set("alt", alt)
1363 c.urlParams_.Set("prettyPrint", "false")
1364 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/conversion")
1365 urls += "?" + c.urlParams_.Encode()
1366 req, err := http.NewRequest("PUT", urls, body)
1367 if err != nil {
1368 return nil, err
1369 }
1370 req.Header = reqHeaders
1371 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1372 }
1373
1374
1375
1376
1377
1378
1379 func (c *ConversionUpdateCall) Do(opts ...googleapi.CallOption) (*ConversionList, error) {
1380 gensupport.SetOptions(c.urlParams_, opts...)
1381 res, err := c.doRequest("json")
1382 if res != nil && res.StatusCode == http.StatusNotModified {
1383 if res.Body != nil {
1384 res.Body.Close()
1385 }
1386 return nil, gensupport.WrapError(&googleapi.Error{
1387 Code: res.StatusCode,
1388 Header: res.Header,
1389 })
1390 }
1391 if err != nil {
1392 return nil, err
1393 }
1394 defer googleapi.CloseBody(res)
1395 if err := googleapi.CheckResponse(res); err != nil {
1396 return nil, gensupport.WrapError(err)
1397 }
1398 ret := &ConversionList{
1399 ServerResponse: googleapi.ServerResponse{
1400 Header: res.Header,
1401 HTTPStatusCode: res.StatusCode,
1402 },
1403 }
1404 target := &ret
1405 if err := gensupport.DecodeResponse(target, res); err != nil {
1406 return nil, err
1407 }
1408 return ret, nil
1409 }
1410
1411 type ConversionUpdateAvailabilityCall struct {
1412 s *Service
1413 updateavailabilityrequest *UpdateAvailabilityRequest
1414 urlParams_ gensupport.URLParams
1415 ctx_ context.Context
1416 header_ http.Header
1417 }
1418
1419
1420
1421 func (r *ConversionService) UpdateAvailability(updateavailabilityrequest *UpdateAvailabilityRequest) *ConversionUpdateAvailabilityCall {
1422 c := &ConversionUpdateAvailabilityCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1423 c.updateavailabilityrequest = updateavailabilityrequest
1424 return c
1425 }
1426
1427
1428
1429
1430 func (c *ConversionUpdateAvailabilityCall) Fields(s ...googleapi.Field) *ConversionUpdateAvailabilityCall {
1431 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1432 return c
1433 }
1434
1435
1436 func (c *ConversionUpdateAvailabilityCall) Context(ctx context.Context) *ConversionUpdateAvailabilityCall {
1437 c.ctx_ = ctx
1438 return c
1439 }
1440
1441
1442
1443 func (c *ConversionUpdateAvailabilityCall) Header() http.Header {
1444 if c.header_ == nil {
1445 c.header_ = make(http.Header)
1446 }
1447 return c.header_
1448 }
1449
1450 func (c *ConversionUpdateAvailabilityCall) doRequest(alt string) (*http.Response, error) {
1451 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1452 var body io.Reader = nil
1453 body, err := googleapi.WithoutDataWrapper.JSONReader(c.updateavailabilityrequest)
1454 if err != nil {
1455 return nil, err
1456 }
1457 c.urlParams_.Set("alt", alt)
1458 c.urlParams_.Set("prettyPrint", "false")
1459 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/conversion/updateAvailability")
1460 urls += "?" + c.urlParams_.Encode()
1461 req, err := http.NewRequest("POST", urls, body)
1462 if err != nil {
1463 return nil, err
1464 }
1465 req.Header = reqHeaders
1466 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1467 }
1468
1469
1470
1471
1472
1473
1474
1475 func (c *ConversionUpdateAvailabilityCall) Do(opts ...googleapi.CallOption) (*UpdateAvailabilityResponse, error) {
1476 gensupport.SetOptions(c.urlParams_, opts...)
1477 res, err := c.doRequest("json")
1478 if res != nil && res.StatusCode == http.StatusNotModified {
1479 if res.Body != nil {
1480 res.Body.Close()
1481 }
1482 return nil, gensupport.WrapError(&googleapi.Error{
1483 Code: res.StatusCode,
1484 Header: res.Header,
1485 })
1486 }
1487 if err != nil {
1488 return nil, err
1489 }
1490 defer googleapi.CloseBody(res)
1491 if err := googleapi.CheckResponse(res); err != nil {
1492 return nil, gensupport.WrapError(err)
1493 }
1494 ret := &UpdateAvailabilityResponse{
1495 ServerResponse: googleapi.ServerResponse{
1496 Header: res.Header,
1497 HTTPStatusCode: res.StatusCode,
1498 },
1499 }
1500 target := &ret
1501 if err := gensupport.DecodeResponse(target, res); err != nil {
1502 return nil, err
1503 }
1504 return ret, nil
1505 }
1506
1507 type ReportsGenerateCall struct {
1508 s *Service
1509 reportrequest *ReportRequest
1510 urlParams_ gensupport.URLParams
1511 ctx_ context.Context
1512 header_ http.Header
1513 }
1514
1515
1516 func (r *ReportsService) Generate(reportrequest *ReportRequest) *ReportsGenerateCall {
1517 c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1518 c.reportrequest = reportrequest
1519 return c
1520 }
1521
1522
1523
1524
1525 func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
1526 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1527 return c
1528 }
1529
1530
1531 func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
1532 c.ctx_ = ctx
1533 return c
1534 }
1535
1536
1537
1538 func (c *ReportsGenerateCall) Header() http.Header {
1539 if c.header_ == nil {
1540 c.header_ = make(http.Header)
1541 }
1542 return c.header_
1543 }
1544
1545 func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
1546 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1547 var body io.Reader = nil
1548 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reportrequest)
1549 if err != nil {
1550 return nil, err
1551 }
1552 c.urlParams_.Set("alt", alt)
1553 c.urlParams_.Set("prettyPrint", "false")
1554 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/reports/generate")
1555 urls += "?" + c.urlParams_.Encode()
1556 req, err := http.NewRequest("POST", urls, body)
1557 if err != nil {
1558 return nil, err
1559 }
1560 req.Header = reqHeaders
1561 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1562 }
1563
1564
1565
1566
1567
1568
1569 func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
1570 gensupport.SetOptions(c.urlParams_, opts...)
1571 res, err := c.doRequest("json")
1572 if res != nil && res.StatusCode == http.StatusNotModified {
1573 if res.Body != nil {
1574 res.Body.Close()
1575 }
1576 return nil, gensupport.WrapError(&googleapi.Error{
1577 Code: res.StatusCode,
1578 Header: res.Header,
1579 })
1580 }
1581 if err != nil {
1582 return nil, err
1583 }
1584 defer googleapi.CloseBody(res)
1585 if err := googleapi.CheckResponse(res); err != nil {
1586 return nil, gensupport.WrapError(err)
1587 }
1588 ret := &Report{
1589 ServerResponse: googleapi.ServerResponse{
1590 Header: res.Header,
1591 HTTPStatusCode: res.StatusCode,
1592 },
1593 }
1594 target := &ret
1595 if err := gensupport.DecodeResponse(target, res); err != nil {
1596 return nil, err
1597 }
1598 return ret, nil
1599 }
1600
1601 type ReportsGetCall struct {
1602 s *Service
1603 reportId string
1604 urlParams_ gensupport.URLParams
1605 ifNoneMatch_ string
1606 ctx_ context.Context
1607 header_ http.Header
1608 }
1609
1610
1611
1612
1613 func (r *ReportsService) Get(reportId string) *ReportsGetCall {
1614 c := &ReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1615 c.reportId = reportId
1616 return c
1617 }
1618
1619
1620
1621
1622 func (c *ReportsGetCall) Fields(s ...googleapi.Field) *ReportsGetCall {
1623 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1624 return c
1625 }
1626
1627
1628
1629
1630 func (c *ReportsGetCall) IfNoneMatch(entityTag string) *ReportsGetCall {
1631 c.ifNoneMatch_ = entityTag
1632 return c
1633 }
1634
1635
1636 func (c *ReportsGetCall) Context(ctx context.Context) *ReportsGetCall {
1637 c.ctx_ = ctx
1638 return c
1639 }
1640
1641
1642
1643 func (c *ReportsGetCall) Header() http.Header {
1644 if c.header_ == nil {
1645 c.header_ = make(http.Header)
1646 }
1647 return c.header_
1648 }
1649
1650 func (c *ReportsGetCall) doRequest(alt string) (*http.Response, error) {
1651 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1652 if c.ifNoneMatch_ != "" {
1653 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1654 }
1655 var body io.Reader = nil
1656 c.urlParams_.Set("alt", alt)
1657 c.urlParams_.Set("prettyPrint", "false")
1658 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/reports/{reportId}")
1659 urls += "?" + c.urlParams_.Encode()
1660 req, err := http.NewRequest("GET", urls, body)
1661 if err != nil {
1662 return nil, err
1663 }
1664 req.Header = reqHeaders
1665 googleapi.Expand(req.URL, map[string]string{
1666 "reportId": c.reportId,
1667 })
1668 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1669 }
1670
1671
1672
1673
1674
1675
1676 func (c *ReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) {
1677 gensupport.SetOptions(c.urlParams_, opts...)
1678 res, err := c.doRequest("json")
1679 if res != nil && res.StatusCode == http.StatusNotModified {
1680 if res.Body != nil {
1681 res.Body.Close()
1682 }
1683 return nil, gensupport.WrapError(&googleapi.Error{
1684 Code: res.StatusCode,
1685 Header: res.Header,
1686 })
1687 }
1688 if err != nil {
1689 return nil, err
1690 }
1691 defer googleapi.CloseBody(res)
1692 if err := googleapi.CheckResponse(res); err != nil {
1693 return nil, gensupport.WrapError(err)
1694 }
1695 ret := &Report{
1696 ServerResponse: googleapi.ServerResponse{
1697 Header: res.Header,
1698 HTTPStatusCode: res.StatusCode,
1699 },
1700 }
1701 target := &ret
1702 if err := gensupport.DecodeResponse(target, res); err != nil {
1703 return nil, err
1704 }
1705 return ret, nil
1706 }
1707
1708 type ReportsGetFileCall struct {
1709 s *Service
1710 reportId string
1711 reportFragment int64
1712 urlParams_ gensupport.URLParams
1713 ifNoneMatch_ string
1714 ctx_ context.Context
1715 header_ http.Header
1716 }
1717
1718
1719
1720
1721
1722 func (r *ReportsService) GetFile(reportId string, reportFragment int64) *ReportsGetFileCall {
1723 c := &ReportsGetFileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1724 c.reportId = reportId
1725 c.reportFragment = reportFragment
1726 return c
1727 }
1728
1729
1730
1731
1732 func (c *ReportsGetFileCall) Fields(s ...googleapi.Field) *ReportsGetFileCall {
1733 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1734 return c
1735 }
1736
1737
1738
1739
1740 func (c *ReportsGetFileCall) IfNoneMatch(entityTag string) *ReportsGetFileCall {
1741 c.ifNoneMatch_ = entityTag
1742 return c
1743 }
1744
1745
1746 func (c *ReportsGetFileCall) Context(ctx context.Context) *ReportsGetFileCall {
1747 c.ctx_ = ctx
1748 return c
1749 }
1750
1751
1752
1753 func (c *ReportsGetFileCall) Header() http.Header {
1754 if c.header_ == nil {
1755 c.header_ = make(http.Header)
1756 }
1757 return c.header_
1758 }
1759
1760 func (c *ReportsGetFileCall) doRequest(alt string) (*http.Response, error) {
1761 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1762 if c.ifNoneMatch_ != "" {
1763 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1764 }
1765 var body io.Reader = nil
1766 c.urlParams_.Set("alt", alt)
1767 c.urlParams_.Set("prettyPrint", "false")
1768 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/reports/{reportId}/files/{reportFragment}")
1769 urls += "?" + c.urlParams_.Encode()
1770 req, err := http.NewRequest("GET", urls, body)
1771 if err != nil {
1772 return nil, err
1773 }
1774 req.Header = reqHeaders
1775 googleapi.Expand(req.URL, map[string]string{
1776 "reportId": c.reportId,
1777 "reportFragment": strconv.FormatInt(c.reportFragment, 10),
1778 })
1779 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1780 }
1781
1782
1783
1784
1785 func (c *ReportsGetFileCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
1786 gensupport.SetOptions(c.urlParams_, opts...)
1787 res, err := c.doRequest("media")
1788 if err != nil {
1789 return nil, err
1790 }
1791 if err := googleapi.CheckResponse(res); err != nil {
1792 res.Body.Close()
1793 return nil, gensupport.WrapError(err)
1794 }
1795 return res, nil
1796 }
1797
1798
1799 func (c *ReportsGetFileCall) Do(opts ...googleapi.CallOption) error {
1800 gensupport.SetOptions(c.urlParams_, opts...)
1801 res, err := c.doRequest("json")
1802 if err != nil {
1803 return err
1804 }
1805 defer googleapi.CloseBody(res)
1806 if err := googleapi.CheckResponse(res); err != nil {
1807 return gensupport.WrapError(err)
1808 }
1809 return nil
1810 }
1811
1812 type ReportsGetIdMappingFileCall struct {
1813 s *Service
1814 agencyId int64
1815 advertiserId int64
1816 urlParams_ gensupport.URLParams
1817 ifNoneMatch_ string
1818 ctx_ context.Context
1819 header_ http.Header
1820 }
1821
1822
1823
1824
1825
1826
1827
1828
1829 func (r *ReportsService) GetIdMappingFile(agencyId int64, advertiserId int64) *ReportsGetIdMappingFileCall {
1830 c := &ReportsGetIdMappingFileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1831 c.agencyId = agencyId
1832 c.advertiserId = advertiserId
1833 return c
1834 }
1835
1836
1837
1838
1839 func (c *ReportsGetIdMappingFileCall) Fields(s ...googleapi.Field) *ReportsGetIdMappingFileCall {
1840 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1841 return c
1842 }
1843
1844
1845
1846
1847 func (c *ReportsGetIdMappingFileCall) IfNoneMatch(entityTag string) *ReportsGetIdMappingFileCall {
1848 c.ifNoneMatch_ = entityTag
1849 return c
1850 }
1851
1852
1853 func (c *ReportsGetIdMappingFileCall) Context(ctx context.Context) *ReportsGetIdMappingFileCall {
1854 c.ctx_ = ctx
1855 return c
1856 }
1857
1858
1859
1860 func (c *ReportsGetIdMappingFileCall) Header() http.Header {
1861 if c.header_ == nil {
1862 c.header_ = make(http.Header)
1863 }
1864 return c.header_
1865 }
1866
1867 func (c *ReportsGetIdMappingFileCall) doRequest(alt string) (*http.Response, error) {
1868 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1869 if c.ifNoneMatch_ != "" {
1870 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1871 }
1872 var body io.Reader = nil
1873 c.urlParams_.Set("alt", alt)
1874 c.urlParams_.Set("prettyPrint", "false")
1875 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/agency/{agencyId}/advertiser/{advertiserId}/idmapping")
1876 urls += "?" + c.urlParams_.Encode()
1877 req, err := http.NewRequest("GET", urls, body)
1878 if err != nil {
1879 return nil, err
1880 }
1881 req.Header = reqHeaders
1882 googleapi.Expand(req.URL, map[string]string{
1883 "agencyId": strconv.FormatInt(c.agencyId, 10),
1884 "advertiserId": strconv.FormatInt(c.advertiserId, 10),
1885 })
1886 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1887 }
1888
1889
1890
1891
1892 func (c *ReportsGetIdMappingFileCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
1893 gensupport.SetOptions(c.urlParams_, opts...)
1894 res, err := c.doRequest("media")
1895 if err != nil {
1896 return nil, err
1897 }
1898 if err := googleapi.CheckResponse(res); err != nil {
1899 res.Body.Close()
1900 return nil, gensupport.WrapError(err)
1901 }
1902 return res, nil
1903 }
1904
1905
1906
1907
1908
1909
1910 func (c *ReportsGetIdMappingFileCall) Do(opts ...googleapi.CallOption) (*IdMappingFile, error) {
1911 gensupport.SetOptions(c.urlParams_, opts...)
1912 res, err := c.doRequest("json")
1913 if res != nil && res.StatusCode == http.StatusNotModified {
1914 if res.Body != nil {
1915 res.Body.Close()
1916 }
1917 return nil, gensupport.WrapError(&googleapi.Error{
1918 Code: res.StatusCode,
1919 Header: res.Header,
1920 })
1921 }
1922 if err != nil {
1923 return nil, err
1924 }
1925 defer googleapi.CloseBody(res)
1926 if err := googleapi.CheckResponse(res); err != nil {
1927 return nil, gensupport.WrapError(err)
1928 }
1929 ret := &IdMappingFile{
1930 ServerResponse: googleapi.ServerResponse{
1931 Header: res.Header,
1932 HTTPStatusCode: res.StatusCode,
1933 },
1934 }
1935 target := &ret
1936 if err := gensupport.DecodeResponse(target, res); err != nil {
1937 return nil, err
1938 }
1939 return ret, nil
1940 }
1941
1942 type ReportsRequestCall struct {
1943 s *Service
1944 reportrequest *ReportRequest
1945 urlParams_ gensupport.URLParams
1946 ctx_ context.Context
1947 header_ http.Header
1948 }
1949
1950
1951 func (r *ReportsService) Request(reportrequest *ReportRequest) *ReportsRequestCall {
1952 c := &ReportsRequestCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1953 c.reportrequest = reportrequest
1954 return c
1955 }
1956
1957
1958
1959
1960 func (c *ReportsRequestCall) Fields(s ...googleapi.Field) *ReportsRequestCall {
1961 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1962 return c
1963 }
1964
1965
1966 func (c *ReportsRequestCall) Context(ctx context.Context) *ReportsRequestCall {
1967 c.ctx_ = ctx
1968 return c
1969 }
1970
1971
1972
1973 func (c *ReportsRequestCall) Header() http.Header {
1974 if c.header_ == nil {
1975 c.header_ = make(http.Header)
1976 }
1977 return c.header_
1978 }
1979
1980 func (c *ReportsRequestCall) doRequest(alt string) (*http.Response, error) {
1981 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1982 var body io.Reader = nil
1983 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reportrequest)
1984 if err != nil {
1985 return nil, err
1986 }
1987 c.urlParams_.Set("alt", alt)
1988 c.urlParams_.Set("prettyPrint", "false")
1989 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/reports")
1990 urls += "?" + c.urlParams_.Encode()
1991 req, err := http.NewRequest("POST", urls, body)
1992 if err != nil {
1993 return nil, err
1994 }
1995 req.Header = reqHeaders
1996 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1997 }
1998
1999
2000
2001
2002
2003
2004 func (c *ReportsRequestCall) Do(opts ...googleapi.CallOption) (*Report, error) {
2005 gensupport.SetOptions(c.urlParams_, opts...)
2006 res, err := c.doRequest("json")
2007 if res != nil && res.StatusCode == http.StatusNotModified {
2008 if res.Body != nil {
2009 res.Body.Close()
2010 }
2011 return nil, gensupport.WrapError(&googleapi.Error{
2012 Code: res.StatusCode,
2013 Header: res.Header,
2014 })
2015 }
2016 if err != nil {
2017 return nil, err
2018 }
2019 defer googleapi.CloseBody(res)
2020 if err := googleapi.CheckResponse(res); err != nil {
2021 return nil, gensupport.WrapError(err)
2022 }
2023 ret := &Report{
2024 ServerResponse: googleapi.ServerResponse{
2025 Header: res.Header,
2026 HTTPStatusCode: res.StatusCode,
2027 },
2028 }
2029 target := &ret
2030 if err := gensupport.DecodeResponse(target, res); err != nil {
2031 return nil, err
2032 }
2033 return ret, nil
2034 }
2035
2036 type SavedColumnsListCall struct {
2037 s *Service
2038 agencyId int64
2039 advertiserId int64
2040 urlParams_ gensupport.URLParams
2041 ifNoneMatch_ string
2042 ctx_ context.Context
2043 header_ http.Header
2044 }
2045
2046
2047
2048
2049
2050 func (r *SavedColumnsService) List(agencyId int64, advertiserId int64) *SavedColumnsListCall {
2051 c := &SavedColumnsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2052 c.agencyId = agencyId
2053 c.advertiserId = advertiserId
2054 return c
2055 }
2056
2057
2058
2059
2060 func (c *SavedColumnsListCall) Fields(s ...googleapi.Field) *SavedColumnsListCall {
2061 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2062 return c
2063 }
2064
2065
2066
2067
2068 func (c *SavedColumnsListCall) IfNoneMatch(entityTag string) *SavedColumnsListCall {
2069 c.ifNoneMatch_ = entityTag
2070 return c
2071 }
2072
2073
2074 func (c *SavedColumnsListCall) Context(ctx context.Context) *SavedColumnsListCall {
2075 c.ctx_ = ctx
2076 return c
2077 }
2078
2079
2080
2081 func (c *SavedColumnsListCall) Header() http.Header {
2082 if c.header_ == nil {
2083 c.header_ = make(http.Header)
2084 }
2085 return c.header_
2086 }
2087
2088 func (c *SavedColumnsListCall) doRequest(alt string) (*http.Response, error) {
2089 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2090 if c.ifNoneMatch_ != "" {
2091 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2092 }
2093 var body io.Reader = nil
2094 c.urlParams_.Set("alt", alt)
2095 c.urlParams_.Set("prettyPrint", "false")
2096 urls := googleapi.ResolveRelative(c.s.BasePath, "doubleclicksearch/v2/agency/{agencyId}/advertiser/{advertiserId}/savedcolumns")
2097 urls += "?" + c.urlParams_.Encode()
2098 req, err := http.NewRequest("GET", urls, body)
2099 if err != nil {
2100 return nil, err
2101 }
2102 req.Header = reqHeaders
2103 googleapi.Expand(req.URL, map[string]string{
2104 "agencyId": strconv.FormatInt(c.agencyId, 10),
2105 "advertiserId": strconv.FormatInt(c.advertiserId, 10),
2106 })
2107 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2108 }
2109
2110
2111
2112
2113
2114
2115
2116 func (c *SavedColumnsListCall) Do(opts ...googleapi.CallOption) (*SavedColumnList, error) {
2117 gensupport.SetOptions(c.urlParams_, opts...)
2118 res, err := c.doRequest("json")
2119 if res != nil && res.StatusCode == http.StatusNotModified {
2120 if res.Body != nil {
2121 res.Body.Close()
2122 }
2123 return nil, gensupport.WrapError(&googleapi.Error{
2124 Code: res.StatusCode,
2125 Header: res.Header,
2126 })
2127 }
2128 if err != nil {
2129 return nil, err
2130 }
2131 defer googleapi.CloseBody(res)
2132 if err := googleapi.CheckResponse(res); err != nil {
2133 return nil, gensupport.WrapError(err)
2134 }
2135 ret := &SavedColumnList{
2136 ServerResponse: googleapi.ServerResponse{
2137 Header: res.Header,
2138 HTTPStatusCode: res.StatusCode,
2139 },
2140 }
2141 target := &ret
2142 if err := gensupport.DecodeResponse(target, res); err != nil {
2143 return nil, err
2144 }
2145 return ret, nil
2146 }
2147
View as plain text