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 doubleclickbidmanager
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 = "doubleclickbidmanager:v2"
90 const apiName = "doubleclickbidmanager"
91 const apiVersion = "v2"
92 const basePath = "https://doubleclickbidmanager.googleapis.com/v2/"
93 const basePathTemplate = "https://doubleclickbidmanager.UNIVERSE_DOMAIN/v2/"
94 const mtlsBasePath = "https://doubleclickbidmanager.mtls.googleapis.com/v2/"
95
96
97 const (
98
99 DoubleclickbidmanagerScope = "https://www.googleapis.com/auth/doubleclickbidmanager"
100 )
101
102
103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/doubleclickbidmanager",
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.Queries = NewQueriesService(s)
138 return s, nil
139 }
140
141 type Service struct {
142 client *http.Client
143 BasePath string
144 UserAgent string
145
146 Queries *QueriesService
147 }
148
149 func (s *Service) userAgent() string {
150 if s.UserAgent == "" {
151 return googleapi.UserAgent
152 }
153 return googleapi.UserAgent + " " + s.UserAgent
154 }
155
156 func NewQueriesService(s *Service) *QueriesService {
157 rs := &QueriesService{s: s}
158 rs.Reports = NewQueriesReportsService(s)
159 return rs
160 }
161
162 type QueriesService struct {
163 s *Service
164
165 Reports *QueriesReportsService
166 }
167
168 func NewQueriesReportsService(s *Service) *QueriesReportsService {
169 rs := &QueriesReportsService{s: s}
170 return rs
171 }
172
173 type QueriesReportsService struct {
174 s *Service
175 }
176
177
178 type DataRange struct {
179
180
181
182 CustomEndDate *Date `json:"customEndDate,omitempty"`
183
184
185
186 CustomStartDate *Date `json:"customStartDate,omitempty"`
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216 Range string `json:"range,omitempty"`
217
218
219
220
221
222 ForceSendFields []string `json:"-"`
223
224
225
226
227 NullFields []string `json:"-"`
228 }
229
230 func (s *DataRange) MarshalJSON() ([]byte, error) {
231 type NoMethod DataRange
232 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
233 }
234
235
236
237
238
239
240
241
242
243
244 type Date struct {
245
246
247
248 Day int64 `json:"day,omitempty"`
249
250
251 Month int64 `json:"month,omitempty"`
252
253
254 Year int64 `json:"year,omitempty"`
255
256
257
258
259
260 ForceSendFields []string `json:"-"`
261
262
263
264
265 NullFields []string `json:"-"`
266 }
267
268 func (s *Date) MarshalJSON() ([]byte, error) {
269 type NoMethod Date
270 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
271 }
272
273
274 type FilterPair struct {
275
276 Type string `json:"type,omitempty"`
277
278 Value string `json:"value,omitempty"`
279
280
281
282
283
284 ForceSendFields []string `json:"-"`
285
286
287
288
289 NullFields []string `json:"-"`
290 }
291
292 func (s *FilterPair) MarshalJSON() ([]byte, error) {
293 type NoMethod FilterPair
294 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
295 }
296
297 type ListQueriesResponse struct {
298
299
300 NextPageToken string `json:"nextPageToken,omitempty"`
301
302 Queries []*Query `json:"queries,omitempty"`
303
304
305 googleapi.ServerResponse `json:"-"`
306
307
308
309
310
311 ForceSendFields []string `json:"-"`
312
313
314
315
316 NullFields []string `json:"-"`
317 }
318
319 func (s *ListQueriesResponse) MarshalJSON() ([]byte, error) {
320 type NoMethod ListQueriesResponse
321 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
322 }
323
324 type ListReportsResponse struct {
325
326
327 NextPageToken string `json:"nextPageToken,omitempty"`
328
329 Reports []*Report `json:"reports,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 *ListReportsResponse) MarshalJSON() ([]byte, error) {
347 type NoMethod ListReportsResponse
348 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
349 }
350
351
352 type Options struct {
353
354
355
356 IncludeOnlyTargetedUserLists bool `json:"includeOnlyTargetedUserLists,omitempty"`
357
358
359
360
361
362 ForceSendFields []string `json:"-"`
363
364
365
366
367 NullFields []string `json:"-"`
368 }
369
370 func (s *Options) MarshalJSON() ([]byte, error) {
371 type NoMethod Options
372 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
373 }
374
375
376 type Parameters struct {
377
378 Filters []*FilterPair `json:"filters,omitempty"`
379
380 GroupBys []string `json:"groupBys,omitempty"`
381
382 Metrics []string `json:"metrics,omitempty"`
383
384 Options *Options `json:"options,omitempty"`
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401 Type string `json:"type,omitempty"`
402
403
404
405
406
407 ForceSendFields []string `json:"-"`
408
409
410
411
412 NullFields []string `json:"-"`
413 }
414
415 func (s *Parameters) MarshalJSON() ([]byte, error) {
416 type NoMethod Parameters
417 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
418 }
419
420
421 type Query struct {
422
423 Metadata *QueryMetadata `json:"metadata,omitempty"`
424
425 Params *Parameters `json:"params,omitempty"`
426
427 QueryId int64 `json:"queryId,omitempty,string"`
428
429
430
431 Schedule *QuerySchedule `json:"schedule,omitempty"`
432
433
434 googleapi.ServerResponse `json:"-"`
435
436
437
438
439
440 ForceSendFields []string `json:"-"`
441
442
443
444
445 NullFields []string `json:"-"`
446 }
447
448 func (s *Query) MarshalJSON() ([]byte, error) {
449 type NoMethod Query
450 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
451 }
452
453
454 type QueryMetadata struct {
455
456
457 DataRange *DataRange `json:"dataRange,omitempty"`
458
459
460
461
462
463
464
465 Format string `json:"format,omitempty"`
466
467
468 SendNotification bool `json:"sendNotification,omitempty"`
469
470
471 ShareEmailAddress []string `json:"shareEmailAddress,omitempty"`
472
473
474 Title string `json:"title,omitempty"`
475
476
477
478
479
480 ForceSendFields []string `json:"-"`
481
482
483
484
485 NullFields []string `json:"-"`
486 }
487
488 func (s *QueryMetadata) MarshalJSON() ([]byte, error) {
489 type NoMethod QueryMetadata
490 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
491 }
492
493
494 type QuerySchedule struct {
495
496
497 EndDate *Date `json:"endDate,omitempty"`
498
499
500
501
502
503
504
505
506
507
508
509
510 Frequency string `json:"frequency,omitempty"`
511
512
513 NextRunTimezoneCode string `json:"nextRunTimezoneCode,omitempty"`
514
515
516 StartDate *Date `json:"startDate,omitempty"`
517
518
519
520
521
522 ForceSendFields []string `json:"-"`
523
524
525
526
527 NullFields []string `json:"-"`
528 }
529
530 func (s *QuerySchedule) MarshalJSON() ([]byte, error) {
531 type NoMethod QuerySchedule
532 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
533 }
534
535
536 type Report struct {
537
538 Key *ReportKey `json:"key,omitempty"`
539
540 Metadata *ReportMetadata `json:"metadata,omitempty"`
541
542 Params *Parameters `json:"params,omitempty"`
543
544
545 googleapi.ServerResponse `json:"-"`
546
547
548
549
550
551 ForceSendFields []string `json:"-"`
552
553
554
555
556 NullFields []string `json:"-"`
557 }
558
559 func (s *Report) MarshalJSON() ([]byte, error) {
560 type NoMethod Report
561 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
562 }
563
564
565 type ReportKey struct {
566
567 QueryId int64 `json:"queryId,omitempty,string"`
568
569 ReportId int64 `json:"reportId,omitempty,string"`
570
571
572
573
574
575 ForceSendFields []string `json:"-"`
576
577
578
579
580 NullFields []string `json:"-"`
581 }
582
583 func (s *ReportKey) MarshalJSON() ([]byte, error) {
584 type NoMethod ReportKey
585 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
586 }
587
588
589 type ReportMetadata struct {
590
591
592 GoogleCloudStoragePath string `json:"googleCloudStoragePath,omitempty"`
593
594 ReportDataEndDate *Date `json:"reportDataEndDate,omitempty"`
595
596
597 ReportDataStartDate *Date `json:"reportDataStartDate,omitempty"`
598
599 Status *ReportStatus `json:"status,omitempty"`
600
601
602
603
604
605 ForceSendFields []string `json:"-"`
606
607
608
609
610 NullFields []string `json:"-"`
611 }
612
613 func (s *ReportMetadata) MarshalJSON() ([]byte, error) {
614 type NoMethod ReportMetadata
615 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
616 }
617
618
619 type ReportStatus struct {
620
621
622 FinishTime string `json:"finishTime,omitempty"`
623
624
625
626
627
628
629
630 Format string `json:"format,omitempty"`
631
632
633
634
635
636
637
638
639
640 State string `json:"state,omitempty"`
641
642
643
644
645
646 ForceSendFields []string `json:"-"`
647
648
649
650
651 NullFields []string `json:"-"`
652 }
653
654 func (s *ReportStatus) MarshalJSON() ([]byte, error) {
655 type NoMethod ReportStatus
656 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
657 }
658
659
660 type RunQueryRequest struct {
661
662
663 DataRange *DataRange `json:"dataRange,omitempty"`
664
665
666
667
668
669 ForceSendFields []string `json:"-"`
670
671
672
673
674 NullFields []string `json:"-"`
675 }
676
677 func (s *RunQueryRequest) MarshalJSON() ([]byte, error) {
678 type NoMethod RunQueryRequest
679 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
680 }
681
682 type QueriesCreateCall struct {
683 s *Service
684 query *Query
685 urlParams_ gensupport.URLParams
686 ctx_ context.Context
687 header_ http.Header
688 }
689
690
691 func (r *QueriesService) Create(query *Query) *QueriesCreateCall {
692 c := &QueriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
693 c.query = query
694 return c
695 }
696
697
698
699
700 func (c *QueriesCreateCall) Fields(s ...googleapi.Field) *QueriesCreateCall {
701 c.urlParams_.Set("fields", googleapi.CombineFields(s))
702 return c
703 }
704
705
706 func (c *QueriesCreateCall) Context(ctx context.Context) *QueriesCreateCall {
707 c.ctx_ = ctx
708 return c
709 }
710
711
712
713 func (c *QueriesCreateCall) Header() http.Header {
714 if c.header_ == nil {
715 c.header_ = make(http.Header)
716 }
717 return c.header_
718 }
719
720 func (c *QueriesCreateCall) doRequest(alt string) (*http.Response, error) {
721 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
722 var body io.Reader = nil
723 body, err := googleapi.WithoutDataWrapper.JSONReader(c.query)
724 if err != nil {
725 return nil, err
726 }
727 c.urlParams_.Set("alt", alt)
728 c.urlParams_.Set("prettyPrint", "false")
729 urls := googleapi.ResolveRelative(c.s.BasePath, "queries")
730 urls += "?" + c.urlParams_.Encode()
731 req, err := http.NewRequest("POST", urls, body)
732 if err != nil {
733 return nil, err
734 }
735 req.Header = reqHeaders
736 return gensupport.SendRequest(c.ctx_, c.s.client, req)
737 }
738
739
740
741
742
743
744 func (c *QueriesCreateCall) Do(opts ...googleapi.CallOption) (*Query, error) {
745 gensupport.SetOptions(c.urlParams_, opts...)
746 res, err := c.doRequest("json")
747 if res != nil && res.StatusCode == http.StatusNotModified {
748 if res.Body != nil {
749 res.Body.Close()
750 }
751 return nil, gensupport.WrapError(&googleapi.Error{
752 Code: res.StatusCode,
753 Header: res.Header,
754 })
755 }
756 if err != nil {
757 return nil, err
758 }
759 defer googleapi.CloseBody(res)
760 if err := googleapi.CheckResponse(res); err != nil {
761 return nil, gensupport.WrapError(err)
762 }
763 ret := &Query{
764 ServerResponse: googleapi.ServerResponse{
765 Header: res.Header,
766 HTTPStatusCode: res.StatusCode,
767 },
768 }
769 target := &ret
770 if err := gensupport.DecodeResponse(target, res); err != nil {
771 return nil, err
772 }
773 return ret, nil
774 }
775
776 type QueriesDeleteCall struct {
777 s *Service
778 queryId int64
779 urlParams_ gensupport.URLParams
780 ctx_ context.Context
781 header_ http.Header
782 }
783
784
785
786
787 func (r *QueriesService) Delete(queryId int64) *QueriesDeleteCall {
788 c := &QueriesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
789 c.queryId = queryId
790 return c
791 }
792
793
794
795
796 func (c *QueriesDeleteCall) Fields(s ...googleapi.Field) *QueriesDeleteCall {
797 c.urlParams_.Set("fields", googleapi.CombineFields(s))
798 return c
799 }
800
801
802 func (c *QueriesDeleteCall) Context(ctx context.Context) *QueriesDeleteCall {
803 c.ctx_ = ctx
804 return c
805 }
806
807
808
809 func (c *QueriesDeleteCall) Header() http.Header {
810 if c.header_ == nil {
811 c.header_ = make(http.Header)
812 }
813 return c.header_
814 }
815
816 func (c *QueriesDeleteCall) doRequest(alt string) (*http.Response, error) {
817 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
818 var body io.Reader = nil
819 c.urlParams_.Set("alt", alt)
820 c.urlParams_.Set("prettyPrint", "false")
821 urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}")
822 urls += "?" + c.urlParams_.Encode()
823 req, err := http.NewRequest("DELETE", urls, body)
824 if err != nil {
825 return nil, err
826 }
827 req.Header = reqHeaders
828 googleapi.Expand(req.URL, map[string]string{
829 "queryId": strconv.FormatInt(c.queryId, 10),
830 })
831 return gensupport.SendRequest(c.ctx_, c.s.client, req)
832 }
833
834
835 func (c *QueriesDeleteCall) Do(opts ...googleapi.CallOption) error {
836 gensupport.SetOptions(c.urlParams_, opts...)
837 res, err := c.doRequest("json")
838 if err != nil {
839 return err
840 }
841 defer googleapi.CloseBody(res)
842 if err := googleapi.CheckResponse(res); err != nil {
843 return gensupport.WrapError(err)
844 }
845 return nil
846 }
847
848 type QueriesGetCall struct {
849 s *Service
850 queryId int64
851 urlParams_ gensupport.URLParams
852 ifNoneMatch_ string
853 ctx_ context.Context
854 header_ http.Header
855 }
856
857
858
859
860 func (r *QueriesService) Get(queryId int64) *QueriesGetCall {
861 c := &QueriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
862 c.queryId = queryId
863 return c
864 }
865
866
867
868
869 func (c *QueriesGetCall) Fields(s ...googleapi.Field) *QueriesGetCall {
870 c.urlParams_.Set("fields", googleapi.CombineFields(s))
871 return c
872 }
873
874
875
876
877 func (c *QueriesGetCall) IfNoneMatch(entityTag string) *QueriesGetCall {
878 c.ifNoneMatch_ = entityTag
879 return c
880 }
881
882
883 func (c *QueriesGetCall) Context(ctx context.Context) *QueriesGetCall {
884 c.ctx_ = ctx
885 return c
886 }
887
888
889
890 func (c *QueriesGetCall) Header() http.Header {
891 if c.header_ == nil {
892 c.header_ = make(http.Header)
893 }
894 return c.header_
895 }
896
897 func (c *QueriesGetCall) doRequest(alt string) (*http.Response, error) {
898 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
899 if c.ifNoneMatch_ != "" {
900 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
901 }
902 var body io.Reader = nil
903 c.urlParams_.Set("alt", alt)
904 c.urlParams_.Set("prettyPrint", "false")
905 urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}")
906 urls += "?" + c.urlParams_.Encode()
907 req, err := http.NewRequest("GET", urls, body)
908 if err != nil {
909 return nil, err
910 }
911 req.Header = reqHeaders
912 googleapi.Expand(req.URL, map[string]string{
913 "queryId": strconv.FormatInt(c.queryId, 10),
914 })
915 return gensupport.SendRequest(c.ctx_, c.s.client, req)
916 }
917
918
919
920
921
922
923 func (c *QueriesGetCall) Do(opts ...googleapi.CallOption) (*Query, error) {
924 gensupport.SetOptions(c.urlParams_, opts...)
925 res, err := c.doRequest("json")
926 if res != nil && res.StatusCode == http.StatusNotModified {
927 if res.Body != nil {
928 res.Body.Close()
929 }
930 return nil, gensupport.WrapError(&googleapi.Error{
931 Code: res.StatusCode,
932 Header: res.Header,
933 })
934 }
935 if err != nil {
936 return nil, err
937 }
938 defer googleapi.CloseBody(res)
939 if err := googleapi.CheckResponse(res); err != nil {
940 return nil, gensupport.WrapError(err)
941 }
942 ret := &Query{
943 ServerResponse: googleapi.ServerResponse{
944 Header: res.Header,
945 HTTPStatusCode: res.StatusCode,
946 },
947 }
948 target := &ret
949 if err := gensupport.DecodeResponse(target, res); err != nil {
950 return nil, err
951 }
952 return ret, nil
953 }
954
955 type QueriesListCall struct {
956 s *Service
957 urlParams_ gensupport.URLParams
958 ifNoneMatch_ string
959 ctx_ context.Context
960 header_ http.Header
961 }
962
963
964 func (r *QueriesService) List() *QueriesListCall {
965 c := &QueriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
966 return c
967 }
968
969
970
971
972
973
974 func (c *QueriesListCall) OrderBy(orderBy string) *QueriesListCall {
975 c.urlParams_.Set("orderBy", orderBy)
976 return c
977 }
978
979
980
981 func (c *QueriesListCall) PageSize(pageSize int64) *QueriesListCall {
982 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
983 return c
984 }
985
986
987
988
989 func (c *QueriesListCall) PageToken(pageToken string) *QueriesListCall {
990 c.urlParams_.Set("pageToken", pageToken)
991 return c
992 }
993
994
995
996
997 func (c *QueriesListCall) Fields(s ...googleapi.Field) *QueriesListCall {
998 c.urlParams_.Set("fields", googleapi.CombineFields(s))
999 return c
1000 }
1001
1002
1003
1004
1005 func (c *QueriesListCall) IfNoneMatch(entityTag string) *QueriesListCall {
1006 c.ifNoneMatch_ = entityTag
1007 return c
1008 }
1009
1010
1011 func (c *QueriesListCall) Context(ctx context.Context) *QueriesListCall {
1012 c.ctx_ = ctx
1013 return c
1014 }
1015
1016
1017
1018 func (c *QueriesListCall) Header() http.Header {
1019 if c.header_ == nil {
1020 c.header_ = make(http.Header)
1021 }
1022 return c.header_
1023 }
1024
1025 func (c *QueriesListCall) doRequest(alt string) (*http.Response, error) {
1026 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1027 if c.ifNoneMatch_ != "" {
1028 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1029 }
1030 var body io.Reader = nil
1031 c.urlParams_.Set("alt", alt)
1032 c.urlParams_.Set("prettyPrint", "false")
1033 urls := googleapi.ResolveRelative(c.s.BasePath, "queries")
1034 urls += "?" + c.urlParams_.Encode()
1035 req, err := http.NewRequest("GET", urls, body)
1036 if err != nil {
1037 return nil, err
1038 }
1039 req.Header = reqHeaders
1040 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1041 }
1042
1043
1044
1045
1046
1047
1048
1049 func (c *QueriesListCall) Do(opts ...googleapi.CallOption) (*ListQueriesResponse, error) {
1050 gensupport.SetOptions(c.urlParams_, opts...)
1051 res, err := c.doRequest("json")
1052 if res != nil && res.StatusCode == http.StatusNotModified {
1053 if res.Body != nil {
1054 res.Body.Close()
1055 }
1056 return nil, gensupport.WrapError(&googleapi.Error{
1057 Code: res.StatusCode,
1058 Header: res.Header,
1059 })
1060 }
1061 if err != nil {
1062 return nil, err
1063 }
1064 defer googleapi.CloseBody(res)
1065 if err := googleapi.CheckResponse(res); err != nil {
1066 return nil, gensupport.WrapError(err)
1067 }
1068 ret := &ListQueriesResponse{
1069 ServerResponse: googleapi.ServerResponse{
1070 Header: res.Header,
1071 HTTPStatusCode: res.StatusCode,
1072 },
1073 }
1074 target := &ret
1075 if err := gensupport.DecodeResponse(target, res); err != nil {
1076 return nil, err
1077 }
1078 return ret, nil
1079 }
1080
1081
1082
1083
1084 func (c *QueriesListCall) Pages(ctx context.Context, f func(*ListQueriesResponse) error) error {
1085 c.ctx_ = ctx
1086 defer c.PageToken(c.urlParams_.Get("pageToken"))
1087 for {
1088 x, err := c.Do()
1089 if err != nil {
1090 return err
1091 }
1092 if err := f(x); err != nil {
1093 return err
1094 }
1095 if x.NextPageToken == "" {
1096 return nil
1097 }
1098 c.PageToken(x.NextPageToken)
1099 }
1100 }
1101
1102 type QueriesRunCall struct {
1103 s *Service
1104 queryId int64
1105 runqueryrequest *RunQueryRequest
1106 urlParams_ gensupport.URLParams
1107 ctx_ context.Context
1108 header_ http.Header
1109 }
1110
1111
1112
1113
1114 func (r *QueriesService) Run(queryId int64, runqueryrequest *RunQueryRequest) *QueriesRunCall {
1115 c := &QueriesRunCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1116 c.queryId = queryId
1117 c.runqueryrequest = runqueryrequest
1118 return c
1119 }
1120
1121
1122
1123
1124
1125 func (c *QueriesRunCall) Synchronous(synchronous bool) *QueriesRunCall {
1126 c.urlParams_.Set("synchronous", fmt.Sprint(synchronous))
1127 return c
1128 }
1129
1130
1131
1132
1133 func (c *QueriesRunCall) Fields(s ...googleapi.Field) *QueriesRunCall {
1134 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1135 return c
1136 }
1137
1138
1139 func (c *QueriesRunCall) Context(ctx context.Context) *QueriesRunCall {
1140 c.ctx_ = ctx
1141 return c
1142 }
1143
1144
1145
1146 func (c *QueriesRunCall) Header() http.Header {
1147 if c.header_ == nil {
1148 c.header_ = make(http.Header)
1149 }
1150 return c.header_
1151 }
1152
1153 func (c *QueriesRunCall) doRequest(alt string) (*http.Response, error) {
1154 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1155 var body io.Reader = nil
1156 body, err := googleapi.WithoutDataWrapper.JSONReader(c.runqueryrequest)
1157 if err != nil {
1158 return nil, err
1159 }
1160 c.urlParams_.Set("alt", alt)
1161 c.urlParams_.Set("prettyPrint", "false")
1162 urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}:run")
1163 urls += "?" + c.urlParams_.Encode()
1164 req, err := http.NewRequest("POST", urls, body)
1165 if err != nil {
1166 return nil, err
1167 }
1168 req.Header = reqHeaders
1169 googleapi.Expand(req.URL, map[string]string{
1170 "queryId": strconv.FormatInt(c.queryId, 10),
1171 })
1172 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1173 }
1174
1175
1176
1177
1178
1179
1180 func (c *QueriesRunCall) Do(opts ...googleapi.CallOption) (*Report, error) {
1181 gensupport.SetOptions(c.urlParams_, opts...)
1182 res, err := c.doRequest("json")
1183 if res != nil && res.StatusCode == http.StatusNotModified {
1184 if res.Body != nil {
1185 res.Body.Close()
1186 }
1187 return nil, gensupport.WrapError(&googleapi.Error{
1188 Code: res.StatusCode,
1189 Header: res.Header,
1190 })
1191 }
1192 if err != nil {
1193 return nil, err
1194 }
1195 defer googleapi.CloseBody(res)
1196 if err := googleapi.CheckResponse(res); err != nil {
1197 return nil, gensupport.WrapError(err)
1198 }
1199 ret := &Report{
1200 ServerResponse: googleapi.ServerResponse{
1201 Header: res.Header,
1202 HTTPStatusCode: res.StatusCode,
1203 },
1204 }
1205 target := &ret
1206 if err := gensupport.DecodeResponse(target, res); err != nil {
1207 return nil, err
1208 }
1209 return ret, nil
1210 }
1211
1212 type QueriesReportsGetCall struct {
1213 s *Service
1214 queryId int64
1215 reportId int64
1216 urlParams_ gensupport.URLParams
1217 ifNoneMatch_ string
1218 ctx_ context.Context
1219 header_ http.Header
1220 }
1221
1222
1223
1224
1225
1226 func (r *QueriesReportsService) Get(queryId int64, reportId int64) *QueriesReportsGetCall {
1227 c := &QueriesReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1228 c.queryId = queryId
1229 c.reportId = reportId
1230 return c
1231 }
1232
1233
1234
1235
1236 func (c *QueriesReportsGetCall) Fields(s ...googleapi.Field) *QueriesReportsGetCall {
1237 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1238 return c
1239 }
1240
1241
1242
1243
1244 func (c *QueriesReportsGetCall) IfNoneMatch(entityTag string) *QueriesReportsGetCall {
1245 c.ifNoneMatch_ = entityTag
1246 return c
1247 }
1248
1249
1250 func (c *QueriesReportsGetCall) Context(ctx context.Context) *QueriesReportsGetCall {
1251 c.ctx_ = ctx
1252 return c
1253 }
1254
1255
1256
1257 func (c *QueriesReportsGetCall) Header() http.Header {
1258 if c.header_ == nil {
1259 c.header_ = make(http.Header)
1260 }
1261 return c.header_
1262 }
1263
1264 func (c *QueriesReportsGetCall) doRequest(alt string) (*http.Response, error) {
1265 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1266 if c.ifNoneMatch_ != "" {
1267 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1268 }
1269 var body io.Reader = nil
1270 c.urlParams_.Set("alt", alt)
1271 c.urlParams_.Set("prettyPrint", "false")
1272 urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}/reports/{reportId}")
1273 urls += "?" + c.urlParams_.Encode()
1274 req, err := http.NewRequest("GET", urls, body)
1275 if err != nil {
1276 return nil, err
1277 }
1278 req.Header = reqHeaders
1279 googleapi.Expand(req.URL, map[string]string{
1280 "queryId": strconv.FormatInt(c.queryId, 10),
1281 "reportId": strconv.FormatInt(c.reportId, 10),
1282 })
1283 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1284 }
1285
1286
1287
1288
1289
1290
1291 func (c *QueriesReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) {
1292 gensupport.SetOptions(c.urlParams_, opts...)
1293 res, err := c.doRequest("json")
1294 if res != nil && res.StatusCode == http.StatusNotModified {
1295 if res.Body != nil {
1296 res.Body.Close()
1297 }
1298 return nil, gensupport.WrapError(&googleapi.Error{
1299 Code: res.StatusCode,
1300 Header: res.Header,
1301 })
1302 }
1303 if err != nil {
1304 return nil, err
1305 }
1306 defer googleapi.CloseBody(res)
1307 if err := googleapi.CheckResponse(res); err != nil {
1308 return nil, gensupport.WrapError(err)
1309 }
1310 ret := &Report{
1311 ServerResponse: googleapi.ServerResponse{
1312 Header: res.Header,
1313 HTTPStatusCode: res.StatusCode,
1314 },
1315 }
1316 target := &ret
1317 if err := gensupport.DecodeResponse(target, res); err != nil {
1318 return nil, err
1319 }
1320 return ret, nil
1321 }
1322
1323 type QueriesReportsListCall struct {
1324 s *Service
1325 queryId int64
1326 urlParams_ gensupport.URLParams
1327 ifNoneMatch_ string
1328 ctx_ context.Context
1329 header_ http.Header
1330 }
1331
1332
1333
1334
1335 func (r *QueriesReportsService) List(queryId int64) *QueriesReportsListCall {
1336 c := &QueriesReportsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1337 c.queryId = queryId
1338 return c
1339 }
1340
1341
1342
1343
1344
1345 func (c *QueriesReportsListCall) OrderBy(orderBy string) *QueriesReportsListCall {
1346 c.urlParams_.Set("orderBy", orderBy)
1347 return c
1348 }
1349
1350
1351
1352 func (c *QueriesReportsListCall) PageSize(pageSize int64) *QueriesReportsListCall {
1353 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1354 return c
1355 }
1356
1357
1358
1359
1360 func (c *QueriesReportsListCall) PageToken(pageToken string) *QueriesReportsListCall {
1361 c.urlParams_.Set("pageToken", pageToken)
1362 return c
1363 }
1364
1365
1366
1367
1368 func (c *QueriesReportsListCall) Fields(s ...googleapi.Field) *QueriesReportsListCall {
1369 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1370 return c
1371 }
1372
1373
1374
1375
1376 func (c *QueriesReportsListCall) IfNoneMatch(entityTag string) *QueriesReportsListCall {
1377 c.ifNoneMatch_ = entityTag
1378 return c
1379 }
1380
1381
1382 func (c *QueriesReportsListCall) Context(ctx context.Context) *QueriesReportsListCall {
1383 c.ctx_ = ctx
1384 return c
1385 }
1386
1387
1388
1389 func (c *QueriesReportsListCall) Header() http.Header {
1390 if c.header_ == nil {
1391 c.header_ = make(http.Header)
1392 }
1393 return c.header_
1394 }
1395
1396 func (c *QueriesReportsListCall) doRequest(alt string) (*http.Response, error) {
1397 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1398 if c.ifNoneMatch_ != "" {
1399 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1400 }
1401 var body io.Reader = nil
1402 c.urlParams_.Set("alt", alt)
1403 c.urlParams_.Set("prettyPrint", "false")
1404 urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}/reports")
1405 urls += "?" + c.urlParams_.Encode()
1406 req, err := http.NewRequest("GET", urls, body)
1407 if err != nil {
1408 return nil, err
1409 }
1410 req.Header = reqHeaders
1411 googleapi.Expand(req.URL, map[string]string{
1412 "queryId": strconv.FormatInt(c.queryId, 10),
1413 })
1414 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1415 }
1416
1417
1418
1419
1420
1421
1422
1423 func (c *QueriesReportsListCall) Do(opts ...googleapi.CallOption) (*ListReportsResponse, error) {
1424 gensupport.SetOptions(c.urlParams_, opts...)
1425 res, err := c.doRequest("json")
1426 if res != nil && res.StatusCode == http.StatusNotModified {
1427 if res.Body != nil {
1428 res.Body.Close()
1429 }
1430 return nil, gensupport.WrapError(&googleapi.Error{
1431 Code: res.StatusCode,
1432 Header: res.Header,
1433 })
1434 }
1435 if err != nil {
1436 return nil, err
1437 }
1438 defer googleapi.CloseBody(res)
1439 if err := googleapi.CheckResponse(res); err != nil {
1440 return nil, gensupport.WrapError(err)
1441 }
1442 ret := &ListReportsResponse{
1443 ServerResponse: googleapi.ServerResponse{
1444 Header: res.Header,
1445 HTTPStatusCode: res.StatusCode,
1446 },
1447 }
1448 target := &ret
1449 if err := gensupport.DecodeResponse(target, res); err != nil {
1450 return nil, err
1451 }
1452 return ret, nil
1453 }
1454
1455
1456
1457
1458 func (c *QueriesReportsListCall) Pages(ctx context.Context, f func(*ListReportsResponse) error) error {
1459 c.ctx_ = ctx
1460 defer c.PageToken(c.urlParams_.Get("pageToken"))
1461 for {
1462 x, err := c.Do()
1463 if err != nil {
1464 return err
1465 }
1466 if err := f(x); err != nil {
1467 return err
1468 }
1469 if x.NextPageToken == "" {
1470 return nil
1471 }
1472 c.PageToken(x.NextPageToken)
1473 }
1474 }
1475
View as plain text