1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 package youtubereporting
57
58 import (
59 "bytes"
60 "context"
61 "encoding/json"
62 "errors"
63 "fmt"
64 "io"
65 "net/http"
66 "net/url"
67 "strconv"
68 "strings"
69
70 googleapi "google.golang.org/api/googleapi"
71 internal "google.golang.org/api/internal"
72 gensupport "google.golang.org/api/internal/gensupport"
73 option "google.golang.org/api/option"
74 internaloption "google.golang.org/api/option/internaloption"
75 htransport "google.golang.org/api/transport/http"
76 )
77
78
79
80 var _ = bytes.NewBuffer
81 var _ = strconv.Itoa
82 var _ = fmt.Sprintf
83 var _ = json.NewDecoder
84 var _ = io.Copy
85 var _ = url.Parse
86 var _ = gensupport.MarshalJSON
87 var _ = googleapi.Version
88 var _ = errors.New
89 var _ = strings.Replace
90 var _ = context.Canceled
91 var _ = internaloption.WithDefaultEndpoint
92 var _ = internal.Version
93
94 const apiId = "youtubereporting:v1"
95 const apiName = "youtubereporting"
96 const apiVersion = "v1"
97 const basePath = "https://youtubereporting.googleapis.com/"
98 const basePathTemplate = "https://youtubereporting.UNIVERSE_DOMAIN/"
99 const mtlsBasePath = "https://youtubereporting.mtls.googleapis.com/"
100
101
102 const (
103
104
105 YtAnalyticsMonetaryReadonlyScope = "https://www.googleapis.com/auth/yt-analytics-monetary.readonly"
106
107
108 YtAnalyticsReadonlyScope = "https://www.googleapis.com/auth/yt-analytics.readonly"
109 )
110
111
112 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
113 scopesOption := internaloption.WithDefaultScopes(
114 "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
115 "https://www.googleapis.com/auth/yt-analytics.readonly",
116 )
117
118 opts = append([]option.ClientOption{scopesOption}, opts...)
119 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
120 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
121 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
122 opts = append(opts, internaloption.EnableNewAuthLibrary())
123 client, endpoint, err := htransport.NewClient(ctx, opts...)
124 if err != nil {
125 return nil, err
126 }
127 s, err := New(client)
128 if err != nil {
129 return nil, err
130 }
131 if endpoint != "" {
132 s.BasePath = endpoint
133 }
134 return s, nil
135 }
136
137
138
139
140
141
142 func New(client *http.Client) (*Service, error) {
143 if client == nil {
144 return nil, errors.New("client is nil")
145 }
146 s := &Service{client: client, BasePath: basePath}
147 s.Jobs = NewJobsService(s)
148 s.Media = NewMediaService(s)
149 s.ReportTypes = NewReportTypesService(s)
150 return s, nil
151 }
152
153 type Service struct {
154 client *http.Client
155 BasePath string
156 UserAgent string
157
158 Jobs *JobsService
159
160 Media *MediaService
161
162 ReportTypes *ReportTypesService
163 }
164
165 func (s *Service) userAgent() string {
166 if s.UserAgent == "" {
167 return googleapi.UserAgent
168 }
169 return googleapi.UserAgent + " " + s.UserAgent
170 }
171
172 func NewJobsService(s *Service) *JobsService {
173 rs := &JobsService{s: s}
174 rs.Reports = NewJobsReportsService(s)
175 return rs
176 }
177
178 type JobsService struct {
179 s *Service
180
181 Reports *JobsReportsService
182 }
183
184 func NewJobsReportsService(s *Service) *JobsReportsService {
185 rs := &JobsReportsService{s: s}
186 return rs
187 }
188
189 type JobsReportsService struct {
190 s *Service
191 }
192
193 func NewMediaService(s *Service) *MediaService {
194 rs := &MediaService{s: s}
195 return rs
196 }
197
198 type MediaService struct {
199 s *Service
200 }
201
202 func NewReportTypesService(s *Service) *ReportTypesService {
203 rs := &ReportTypesService{s: s}
204 return rs
205 }
206
207 type ReportTypesService struct {
208 s *Service
209 }
210
211
212
213
214
215 type Empty struct {
216
217 googleapi.ServerResponse `json:"-"`
218 }
219
220
221 type GdataBlobstore2Info struct {
222
223 BlobGeneration int64 `json:"blobGeneration,omitempty,string"`
224
225 BlobId string `json:"blobId,omitempty"`
226
227 DownloadReadHandle string `json:"downloadReadHandle,omitempty"`
228
229 ReadToken string `json:"readToken,omitempty"`
230
231 UploadMetadataContainer string `json:"uploadMetadataContainer,omitempty"`
232
233
234
235
236
237 ForceSendFields []string `json:"-"`
238
239
240
241
242 NullFields []string `json:"-"`
243 }
244
245 func (s *GdataBlobstore2Info) MarshalJSON() ([]byte, error) {
246 type NoMethod GdataBlobstore2Info
247 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
248 }
249
250
251 type GdataCompositeMedia struct {
252
253 BlobRef string `json:"blobRef,omitempty"`
254
255 Blobstore2Info *GdataBlobstore2Info `json:"blobstore2Info,omitempty"`
256
257 CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"`
258
259 Crc32cHash int64 `json:"crc32cHash,omitempty"`
260
261 Inline string `json:"inline,omitempty"`
262
263 Length int64 `json:"length,omitempty,string"`
264
265 Md5Hash string `json:"md5Hash,omitempty"`
266
267 ObjectId *GdataObjectId `json:"objectId,omitempty"`
268
269 Path string `json:"path,omitempty"`
270
271
272
273
274
275
276
277
278 ReferenceType string `json:"referenceType,omitempty"`
279
280 Sha1Hash string `json:"sha1Hash,omitempty"`
281
282
283
284
285
286 ForceSendFields []string `json:"-"`
287
288
289
290
291 NullFields []string `json:"-"`
292 }
293
294 func (s *GdataCompositeMedia) MarshalJSON() ([]byte, error) {
295 type NoMethod GdataCompositeMedia
296 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
297 }
298
299
300 type GdataContentTypeInfo struct {
301
302 BestGuess string `json:"bestGuess,omitempty"`
303
304 FromBytes string `json:"fromBytes,omitempty"`
305
306 FromFileName string `json:"fromFileName,omitempty"`
307
308 FromHeader string `json:"fromHeader,omitempty"`
309
310 FromUrlPath string `json:"fromUrlPath,omitempty"`
311
312
313
314
315
316 ForceSendFields []string `json:"-"`
317
318
319
320
321 NullFields []string `json:"-"`
322 }
323
324 func (s *GdataContentTypeInfo) MarshalJSON() ([]byte, error) {
325 type NoMethod GdataContentTypeInfo
326 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
327 }
328
329
330 type GdataDiffChecksumsResponse struct {
331
332 ChecksumsLocation *GdataCompositeMedia `json:"checksumsLocation,omitempty"`
333
334 ChunkSizeBytes int64 `json:"chunkSizeBytes,omitempty,string"`
335
336 ObjectLocation *GdataCompositeMedia `json:"objectLocation,omitempty"`
337
338 ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"`
339
340 ObjectVersion string `json:"objectVersion,omitempty"`
341
342
343
344
345
346 ForceSendFields []string `json:"-"`
347
348
349
350
351 NullFields []string `json:"-"`
352 }
353
354 func (s *GdataDiffChecksumsResponse) MarshalJSON() ([]byte, error) {
355 type NoMethod GdataDiffChecksumsResponse
356 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
357 }
358
359
360 type GdataDiffDownloadResponse struct {
361
362 ObjectLocation *GdataCompositeMedia `json:"objectLocation,omitempty"`
363
364
365
366
367
368 ForceSendFields []string `json:"-"`
369
370
371
372
373 NullFields []string `json:"-"`
374 }
375
376 func (s *GdataDiffDownloadResponse) MarshalJSON() ([]byte, error) {
377 type NoMethod GdataDiffDownloadResponse
378 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
379 }
380
381
382 type GdataDiffUploadRequest struct {
383
384 ChecksumsInfo *GdataCompositeMedia `json:"checksumsInfo,omitempty"`
385
386 ObjectInfo *GdataCompositeMedia `json:"objectInfo,omitempty"`
387
388 ObjectVersion string `json:"objectVersion,omitempty"`
389
390
391
392
393
394 ForceSendFields []string `json:"-"`
395
396
397
398
399 NullFields []string `json:"-"`
400 }
401
402 func (s *GdataDiffUploadRequest) MarshalJSON() ([]byte, error) {
403 type NoMethod GdataDiffUploadRequest
404 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
405 }
406
407
408 type GdataDiffUploadResponse struct {
409
410 ObjectVersion string `json:"objectVersion,omitempty"`
411
412 OriginalObject *GdataCompositeMedia `json:"originalObject,omitempty"`
413
414
415
416
417
418 ForceSendFields []string `json:"-"`
419
420
421
422
423 NullFields []string `json:"-"`
424 }
425
426 func (s *GdataDiffUploadResponse) MarshalJSON() ([]byte, error) {
427 type NoMethod GdataDiffUploadResponse
428 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
429 }
430
431
432 type GdataDiffVersionResponse struct {
433
434 ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"`
435
436 ObjectVersion string `json:"objectVersion,omitempty"`
437
438
439
440
441
442 ForceSendFields []string `json:"-"`
443
444
445
446
447 NullFields []string `json:"-"`
448 }
449
450 func (s *GdataDiffVersionResponse) MarshalJSON() ([]byte, error) {
451 type NoMethod GdataDiffVersionResponse
452 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
453 }
454
455
456 type GdataDownloadParameters struct {
457
458 AllowGzipCompression bool `json:"allowGzipCompression,omitempty"`
459
460 IgnoreRange bool `json:"ignoreRange,omitempty"`
461
462
463
464
465
466 ForceSendFields []string `json:"-"`
467
468
469
470
471 NullFields []string `json:"-"`
472 }
473
474 func (s *GdataDownloadParameters) MarshalJSON() ([]byte, error) {
475 type NoMethod GdataDownloadParameters
476 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
477 }
478
479
480 type GdataMedia struct {
481
482 Algorithm string `json:"algorithm,omitempty"`
483
484 BigstoreObjectRef string `json:"bigstoreObjectRef,omitempty"`
485
486 BlobRef string `json:"blobRef,omitempty"`
487
488 Blobstore2Info *GdataBlobstore2Info `json:"blobstore2Info,omitempty"`
489
490 CompositeMedia []*GdataCompositeMedia `json:"compositeMedia,omitempty"`
491
492 ContentType string `json:"contentType,omitempty"`
493
494 ContentTypeInfo *GdataContentTypeInfo `json:"contentTypeInfo,omitempty"`
495
496 CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"`
497
498 Crc32cHash int64 `json:"crc32cHash,omitempty"`
499
500 DiffChecksumsResponse *GdataDiffChecksumsResponse `json:"diffChecksumsResponse,omitempty"`
501
502 DiffDownloadResponse *GdataDiffDownloadResponse `json:"diffDownloadResponse,omitempty"`
503
504 DiffUploadRequest *GdataDiffUploadRequest `json:"diffUploadRequest,omitempty"`
505
506 DiffUploadResponse *GdataDiffUploadResponse `json:"diffUploadResponse,omitempty"`
507
508 DiffVersionResponse *GdataDiffVersionResponse `json:"diffVersionResponse,omitempty"`
509
510 DownloadParameters *GdataDownloadParameters `json:"downloadParameters,omitempty"`
511
512 Filename string `json:"filename,omitempty"`
513
514 Hash string `json:"hash,omitempty"`
515
516 HashVerified bool `json:"hashVerified,omitempty"`
517
518 Inline string `json:"inline,omitempty"`
519
520 IsPotentialRetry bool `json:"isPotentialRetry,omitempty"`
521
522 Length int64 `json:"length,omitempty,string"`
523
524 Md5Hash string `json:"md5Hash,omitempty"`
525
526 MediaId string `json:"mediaId,omitempty"`
527
528 ObjectId *GdataObjectId `json:"objectId,omitempty"`
529
530 Path string `json:"path,omitempty"`
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547 ReferenceType string `json:"referenceType,omitempty"`
548
549 Sha1Hash string `json:"sha1Hash,omitempty"`
550
551 Sha256Hash string `json:"sha256Hash,omitempty"`
552
553 Timestamp uint64 `json:"timestamp,omitempty,string"`
554
555 Token string `json:"token,omitempty"`
556
557
558 googleapi.ServerResponse `json:"-"`
559
560
561
562
563
564 ForceSendFields []string `json:"-"`
565
566
567
568
569 NullFields []string `json:"-"`
570 }
571
572 func (s *GdataMedia) MarshalJSON() ([]byte, error) {
573 type NoMethod GdataMedia
574 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
575 }
576
577
578 type GdataObjectId struct {
579
580 BucketName string `json:"bucketName,omitempty"`
581
582 Generation int64 `json:"generation,omitempty,string"`
583
584 ObjectName string `json:"objectName,omitempty"`
585
586
587
588
589
590 ForceSendFields []string `json:"-"`
591
592
593
594
595 NullFields []string `json:"-"`
596 }
597
598 func (s *GdataObjectId) MarshalJSON() ([]byte, error) {
599 type NoMethod GdataObjectId
600 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
601 }
602
603
604 type Job struct {
605
606 CreateTime string `json:"createTime,omitempty"`
607
608
609 ExpireTime string `json:"expireTime,omitempty"`
610
611 Id string `json:"id,omitempty"`
612
613 Name string `json:"name,omitempty"`
614
615
616 ReportTypeId string `json:"reportTypeId,omitempty"`
617
618
619 SystemManaged bool `json:"systemManaged,omitempty"`
620
621
622 googleapi.ServerResponse `json:"-"`
623
624
625
626
627
628 ForceSendFields []string `json:"-"`
629
630
631
632
633 NullFields []string `json:"-"`
634 }
635
636 func (s *Job) MarshalJSON() ([]byte, error) {
637 type NoMethod Job
638 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
639 }
640
641
642 type ListJobsResponse struct {
643
644 Jobs []*Job `json:"jobs,omitempty"`
645
646
647
648 NextPageToken string `json:"nextPageToken,omitempty"`
649
650
651 googleapi.ServerResponse `json:"-"`
652
653
654
655
656
657 ForceSendFields []string `json:"-"`
658
659
660
661
662 NullFields []string `json:"-"`
663 }
664
665 func (s *ListJobsResponse) MarshalJSON() ([]byte, error) {
666 type NoMethod ListJobsResponse
667 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
668 }
669
670
671
672 type ListReportTypesResponse struct {
673
674
675
676 NextPageToken string `json:"nextPageToken,omitempty"`
677
678 ReportTypes []*ReportType `json:"reportTypes,omitempty"`
679
680
681 googleapi.ServerResponse `json:"-"`
682
683
684
685
686
687 ForceSendFields []string `json:"-"`
688
689
690
691
692 NullFields []string `json:"-"`
693 }
694
695 func (s *ListReportTypesResponse) MarshalJSON() ([]byte, error) {
696 type NoMethod ListReportTypesResponse
697 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
698 }
699
700
701 type ListReportsResponse struct {
702
703
704
705 NextPageToken string `json:"nextPageToken,omitempty"`
706
707 Reports []*Report `json:"reports,omitempty"`
708
709
710 googleapi.ServerResponse `json:"-"`
711
712
713
714
715
716 ForceSendFields []string `json:"-"`
717
718
719
720
721 NullFields []string `json:"-"`
722 }
723
724 func (s *ListReportsResponse) MarshalJSON() ([]byte, error) {
725 type NoMethod ListReportsResponse
726 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
727 }
728
729
730
731 type Report struct {
732
733 CreateTime string `json:"createTime,omitempty"`
734
735
736 DownloadUrl string `json:"downloadUrl,omitempty"`
737
738
739 EndTime string `json:"endTime,omitempty"`
740
741 Id string `json:"id,omitempty"`
742
743
744 JobExpireTime string `json:"jobExpireTime,omitempty"`
745
746 JobId string `json:"jobId,omitempty"`
747
748
749 StartTime string `json:"startTime,omitempty"`
750
751
752 googleapi.ServerResponse `json:"-"`
753
754
755
756
757
758 ForceSendFields []string `json:"-"`
759
760
761
762
763 NullFields []string `json:"-"`
764 }
765
766 func (s *Report) MarshalJSON() ([]byte, error) {
767 type NoMethod Report
768 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
769 }
770
771
772 type ReportType struct {
773
774 DeprecateTime string `json:"deprecateTime,omitempty"`
775
776 Id string `json:"id,omitempty"`
777
778 Name string `json:"name,omitempty"`
779
780
781
782 SystemManaged bool `json:"systemManaged,omitempty"`
783
784
785
786
787
788 ForceSendFields []string `json:"-"`
789
790
791
792
793 NullFields []string `json:"-"`
794 }
795
796 func (s *ReportType) MarshalJSON() ([]byte, error) {
797 type NoMethod ReportType
798 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
799 }
800
801 type JobsCreateCall struct {
802 s *Service
803 job *Job
804 urlParams_ gensupport.URLParams
805 ctx_ context.Context
806 header_ http.Header
807 }
808
809
810 func (r *JobsService) Create(job *Job) *JobsCreateCall {
811 c := &JobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
812 c.job = job
813 return c
814 }
815
816
817
818
819 func (c *JobsCreateCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsCreateCall {
820 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
821 return c
822 }
823
824
825
826
827 func (c *JobsCreateCall) Fields(s ...googleapi.Field) *JobsCreateCall {
828 c.urlParams_.Set("fields", googleapi.CombineFields(s))
829 return c
830 }
831
832
833 func (c *JobsCreateCall) Context(ctx context.Context) *JobsCreateCall {
834 c.ctx_ = ctx
835 return c
836 }
837
838
839
840 func (c *JobsCreateCall) Header() http.Header {
841 if c.header_ == nil {
842 c.header_ = make(http.Header)
843 }
844 return c.header_
845 }
846
847 func (c *JobsCreateCall) doRequest(alt string) (*http.Response, error) {
848 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
849 var body io.Reader = nil
850 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job)
851 if err != nil {
852 return nil, err
853 }
854 c.urlParams_.Set("alt", alt)
855 c.urlParams_.Set("prettyPrint", "false")
856 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs")
857 urls += "?" + c.urlParams_.Encode()
858 req, err := http.NewRequest("POST", urls, body)
859 if err != nil {
860 return nil, err
861 }
862 req.Header = reqHeaders
863 return gensupport.SendRequest(c.ctx_, c.s.client, req)
864 }
865
866
867
868
869
870
871 func (c *JobsCreateCall) Do(opts ...googleapi.CallOption) (*Job, error) {
872 gensupport.SetOptions(c.urlParams_, opts...)
873 res, err := c.doRequest("json")
874 if res != nil && res.StatusCode == http.StatusNotModified {
875 if res.Body != nil {
876 res.Body.Close()
877 }
878 return nil, gensupport.WrapError(&googleapi.Error{
879 Code: res.StatusCode,
880 Header: res.Header,
881 })
882 }
883 if err != nil {
884 return nil, err
885 }
886 defer googleapi.CloseBody(res)
887 if err := googleapi.CheckResponse(res); err != nil {
888 return nil, gensupport.WrapError(err)
889 }
890 ret := &Job{
891 ServerResponse: googleapi.ServerResponse{
892 Header: res.Header,
893 HTTPStatusCode: res.StatusCode,
894 },
895 }
896 target := &ret
897 if err := gensupport.DecodeResponse(target, res); err != nil {
898 return nil, err
899 }
900 return ret, nil
901 }
902
903 type JobsDeleteCall struct {
904 s *Service
905 jobId string
906 urlParams_ gensupport.URLParams
907 ctx_ context.Context
908 header_ http.Header
909 }
910
911
912
913
914 func (r *JobsService) Delete(jobId string) *JobsDeleteCall {
915 c := &JobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
916 c.jobId = jobId
917 return c
918 }
919
920
921
922
923 func (c *JobsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsDeleteCall {
924 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
925 return c
926 }
927
928
929
930
931 func (c *JobsDeleteCall) Fields(s ...googleapi.Field) *JobsDeleteCall {
932 c.urlParams_.Set("fields", googleapi.CombineFields(s))
933 return c
934 }
935
936
937 func (c *JobsDeleteCall) Context(ctx context.Context) *JobsDeleteCall {
938 c.ctx_ = ctx
939 return c
940 }
941
942
943
944 func (c *JobsDeleteCall) Header() http.Header {
945 if c.header_ == nil {
946 c.header_ = make(http.Header)
947 }
948 return c.header_
949 }
950
951 func (c *JobsDeleteCall) doRequest(alt string) (*http.Response, error) {
952 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
953 var body io.Reader = nil
954 c.urlParams_.Set("alt", alt)
955 c.urlParams_.Set("prettyPrint", "false")
956 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}")
957 urls += "?" + c.urlParams_.Encode()
958 req, err := http.NewRequest("DELETE", urls, body)
959 if err != nil {
960 return nil, err
961 }
962 req.Header = reqHeaders
963 googleapi.Expand(req.URL, map[string]string{
964 "jobId": c.jobId,
965 })
966 return gensupport.SendRequest(c.ctx_, c.s.client, req)
967 }
968
969
970
971
972
973
974 func (c *JobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
975 gensupport.SetOptions(c.urlParams_, opts...)
976 res, err := c.doRequest("json")
977 if res != nil && res.StatusCode == http.StatusNotModified {
978 if res.Body != nil {
979 res.Body.Close()
980 }
981 return nil, gensupport.WrapError(&googleapi.Error{
982 Code: res.StatusCode,
983 Header: res.Header,
984 })
985 }
986 if err != nil {
987 return nil, err
988 }
989 defer googleapi.CloseBody(res)
990 if err := googleapi.CheckResponse(res); err != nil {
991 return nil, gensupport.WrapError(err)
992 }
993 ret := &Empty{
994 ServerResponse: googleapi.ServerResponse{
995 Header: res.Header,
996 HTTPStatusCode: res.StatusCode,
997 },
998 }
999 target := &ret
1000 if err := gensupport.DecodeResponse(target, res); err != nil {
1001 return nil, err
1002 }
1003 return ret, nil
1004 }
1005
1006 type JobsGetCall struct {
1007 s *Service
1008 jobId string
1009 urlParams_ gensupport.URLParams
1010 ifNoneMatch_ string
1011 ctx_ context.Context
1012 header_ http.Header
1013 }
1014
1015
1016
1017
1018 func (r *JobsService) Get(jobId string) *JobsGetCall {
1019 c := &JobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1020 c.jobId = jobId
1021 return c
1022 }
1023
1024
1025
1026
1027 func (c *JobsGetCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsGetCall {
1028 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
1029 return c
1030 }
1031
1032
1033
1034
1035 func (c *JobsGetCall) Fields(s ...googleapi.Field) *JobsGetCall {
1036 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1037 return c
1038 }
1039
1040
1041
1042
1043 func (c *JobsGetCall) IfNoneMatch(entityTag string) *JobsGetCall {
1044 c.ifNoneMatch_ = entityTag
1045 return c
1046 }
1047
1048
1049 func (c *JobsGetCall) Context(ctx context.Context) *JobsGetCall {
1050 c.ctx_ = ctx
1051 return c
1052 }
1053
1054
1055
1056 func (c *JobsGetCall) Header() http.Header {
1057 if c.header_ == nil {
1058 c.header_ = make(http.Header)
1059 }
1060 return c.header_
1061 }
1062
1063 func (c *JobsGetCall) doRequest(alt string) (*http.Response, error) {
1064 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1065 if c.ifNoneMatch_ != "" {
1066 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1067 }
1068 var body io.Reader = nil
1069 c.urlParams_.Set("alt", alt)
1070 c.urlParams_.Set("prettyPrint", "false")
1071 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}")
1072 urls += "?" + c.urlParams_.Encode()
1073 req, err := http.NewRequest("GET", urls, body)
1074 if err != nil {
1075 return nil, err
1076 }
1077 req.Header = reqHeaders
1078 googleapi.Expand(req.URL, map[string]string{
1079 "jobId": c.jobId,
1080 })
1081 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1082 }
1083
1084
1085
1086
1087
1088
1089 func (c *JobsGetCall) Do(opts ...googleapi.CallOption) (*Job, 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 := &Job{
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 JobsListCall struct {
1122 s *Service
1123 urlParams_ gensupport.URLParams
1124 ifNoneMatch_ string
1125 ctx_ context.Context
1126 header_ http.Header
1127 }
1128
1129
1130 func (r *JobsService) List() *JobsListCall {
1131 c := &JobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1132 return c
1133 }
1134
1135
1136
1137
1138
1139 func (c *JobsListCall) IncludeSystemManaged(includeSystemManaged bool) *JobsListCall {
1140 c.urlParams_.Set("includeSystemManaged", fmt.Sprint(includeSystemManaged))
1141 return c
1142 }
1143
1144
1145
1146
1147 func (c *JobsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsListCall {
1148 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
1149 return c
1150 }
1151
1152
1153
1154
1155 func (c *JobsListCall) PageSize(pageSize int64) *JobsListCall {
1156 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1157 return c
1158 }
1159
1160
1161
1162
1163
1164 func (c *JobsListCall) PageToken(pageToken string) *JobsListCall {
1165 c.urlParams_.Set("pageToken", pageToken)
1166 return c
1167 }
1168
1169
1170
1171
1172 func (c *JobsListCall) Fields(s ...googleapi.Field) *JobsListCall {
1173 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1174 return c
1175 }
1176
1177
1178
1179
1180 func (c *JobsListCall) IfNoneMatch(entityTag string) *JobsListCall {
1181 c.ifNoneMatch_ = entityTag
1182 return c
1183 }
1184
1185
1186 func (c *JobsListCall) Context(ctx context.Context) *JobsListCall {
1187 c.ctx_ = ctx
1188 return c
1189 }
1190
1191
1192
1193 func (c *JobsListCall) Header() http.Header {
1194 if c.header_ == nil {
1195 c.header_ = make(http.Header)
1196 }
1197 return c.header_
1198 }
1199
1200 func (c *JobsListCall) doRequest(alt string) (*http.Response, error) {
1201 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1202 if c.ifNoneMatch_ != "" {
1203 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1204 }
1205 var body io.Reader = nil
1206 c.urlParams_.Set("alt", alt)
1207 c.urlParams_.Set("prettyPrint", "false")
1208 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs")
1209 urls += "?" + c.urlParams_.Encode()
1210 req, err := http.NewRequest("GET", urls, body)
1211 if err != nil {
1212 return nil, err
1213 }
1214 req.Header = reqHeaders
1215 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1216 }
1217
1218
1219
1220
1221
1222
1223
1224 func (c *JobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) {
1225 gensupport.SetOptions(c.urlParams_, opts...)
1226 res, err := c.doRequest("json")
1227 if res != nil && res.StatusCode == http.StatusNotModified {
1228 if res.Body != nil {
1229 res.Body.Close()
1230 }
1231 return nil, gensupport.WrapError(&googleapi.Error{
1232 Code: res.StatusCode,
1233 Header: res.Header,
1234 })
1235 }
1236 if err != nil {
1237 return nil, err
1238 }
1239 defer googleapi.CloseBody(res)
1240 if err := googleapi.CheckResponse(res); err != nil {
1241 return nil, gensupport.WrapError(err)
1242 }
1243 ret := &ListJobsResponse{
1244 ServerResponse: googleapi.ServerResponse{
1245 Header: res.Header,
1246 HTTPStatusCode: res.StatusCode,
1247 },
1248 }
1249 target := &ret
1250 if err := gensupport.DecodeResponse(target, res); err != nil {
1251 return nil, err
1252 }
1253 return ret, nil
1254 }
1255
1256
1257
1258
1259 func (c *JobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error {
1260 c.ctx_ = ctx
1261 defer c.PageToken(c.urlParams_.Get("pageToken"))
1262 for {
1263 x, err := c.Do()
1264 if err != nil {
1265 return err
1266 }
1267 if err := f(x); err != nil {
1268 return err
1269 }
1270 if x.NextPageToken == "" {
1271 return nil
1272 }
1273 c.PageToken(x.NextPageToken)
1274 }
1275 }
1276
1277 type JobsReportsGetCall struct {
1278 s *Service
1279 jobId string
1280 reportId string
1281 urlParams_ gensupport.URLParams
1282 ifNoneMatch_ string
1283 ctx_ context.Context
1284 header_ http.Header
1285 }
1286
1287
1288
1289
1290
1291 func (r *JobsReportsService) Get(jobId string, reportId string) *JobsReportsGetCall {
1292 c := &JobsReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1293 c.jobId = jobId
1294 c.reportId = reportId
1295 return c
1296 }
1297
1298
1299
1300
1301 func (c *JobsReportsGetCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsReportsGetCall {
1302 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
1303 return c
1304 }
1305
1306
1307
1308
1309 func (c *JobsReportsGetCall) Fields(s ...googleapi.Field) *JobsReportsGetCall {
1310 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1311 return c
1312 }
1313
1314
1315
1316
1317 func (c *JobsReportsGetCall) IfNoneMatch(entityTag string) *JobsReportsGetCall {
1318 c.ifNoneMatch_ = entityTag
1319 return c
1320 }
1321
1322
1323 func (c *JobsReportsGetCall) Context(ctx context.Context) *JobsReportsGetCall {
1324 c.ctx_ = ctx
1325 return c
1326 }
1327
1328
1329
1330 func (c *JobsReportsGetCall) Header() http.Header {
1331 if c.header_ == nil {
1332 c.header_ = make(http.Header)
1333 }
1334 return c.header_
1335 }
1336
1337 func (c *JobsReportsGetCall) doRequest(alt string) (*http.Response, error) {
1338 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1339 if c.ifNoneMatch_ != "" {
1340 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1341 }
1342 var body io.Reader = nil
1343 c.urlParams_.Set("alt", alt)
1344 c.urlParams_.Set("prettyPrint", "false")
1345 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports/{reportId}")
1346 urls += "?" + c.urlParams_.Encode()
1347 req, err := http.NewRequest("GET", urls, body)
1348 if err != nil {
1349 return nil, err
1350 }
1351 req.Header = reqHeaders
1352 googleapi.Expand(req.URL, map[string]string{
1353 "jobId": c.jobId,
1354 "reportId": c.reportId,
1355 })
1356 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1357 }
1358
1359
1360
1361
1362
1363
1364 func (c *JobsReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) {
1365 gensupport.SetOptions(c.urlParams_, opts...)
1366 res, err := c.doRequest("json")
1367 if res != nil && res.StatusCode == http.StatusNotModified {
1368 if res.Body != nil {
1369 res.Body.Close()
1370 }
1371 return nil, gensupport.WrapError(&googleapi.Error{
1372 Code: res.StatusCode,
1373 Header: res.Header,
1374 })
1375 }
1376 if err != nil {
1377 return nil, err
1378 }
1379 defer googleapi.CloseBody(res)
1380 if err := googleapi.CheckResponse(res); err != nil {
1381 return nil, gensupport.WrapError(err)
1382 }
1383 ret := &Report{
1384 ServerResponse: googleapi.ServerResponse{
1385 Header: res.Header,
1386 HTTPStatusCode: res.StatusCode,
1387 },
1388 }
1389 target := &ret
1390 if err := gensupport.DecodeResponse(target, res); err != nil {
1391 return nil, err
1392 }
1393 return ret, nil
1394 }
1395
1396 type JobsReportsListCall struct {
1397 s *Service
1398 jobId string
1399 urlParams_ gensupport.URLParams
1400 ifNoneMatch_ string
1401 ctx_ context.Context
1402 header_ http.Header
1403 }
1404
1405
1406
1407
1408
1409 func (r *JobsReportsService) List(jobId string) *JobsReportsListCall {
1410 c := &JobsReportsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1411 c.jobId = jobId
1412 return c
1413 }
1414
1415
1416
1417 func (c *JobsReportsListCall) CreatedAfter(createdAfter string) *JobsReportsListCall {
1418 c.urlParams_.Set("createdAfter", createdAfter)
1419 return c
1420 }
1421
1422
1423
1424
1425 func (c *JobsReportsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsReportsListCall {
1426 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
1427 return c
1428 }
1429
1430
1431
1432
1433 func (c *JobsReportsListCall) PageSize(pageSize int64) *JobsReportsListCall {
1434 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1435 return c
1436 }
1437
1438
1439
1440
1441
1442 func (c *JobsReportsListCall) PageToken(pageToken string) *JobsReportsListCall {
1443 c.urlParams_.Set("pageToken", pageToken)
1444 return c
1445 }
1446
1447
1448
1449
1450 func (c *JobsReportsListCall) StartTimeAtOrAfter(startTimeAtOrAfter string) *JobsReportsListCall {
1451 c.urlParams_.Set("startTimeAtOrAfter", startTimeAtOrAfter)
1452 return c
1453 }
1454
1455
1456
1457
1458 func (c *JobsReportsListCall) StartTimeBefore(startTimeBefore string) *JobsReportsListCall {
1459 c.urlParams_.Set("startTimeBefore", startTimeBefore)
1460 return c
1461 }
1462
1463
1464
1465
1466 func (c *JobsReportsListCall) Fields(s ...googleapi.Field) *JobsReportsListCall {
1467 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1468 return c
1469 }
1470
1471
1472
1473
1474 func (c *JobsReportsListCall) IfNoneMatch(entityTag string) *JobsReportsListCall {
1475 c.ifNoneMatch_ = entityTag
1476 return c
1477 }
1478
1479
1480 func (c *JobsReportsListCall) Context(ctx context.Context) *JobsReportsListCall {
1481 c.ctx_ = ctx
1482 return c
1483 }
1484
1485
1486
1487 func (c *JobsReportsListCall) Header() http.Header {
1488 if c.header_ == nil {
1489 c.header_ = make(http.Header)
1490 }
1491 return c.header_
1492 }
1493
1494 func (c *JobsReportsListCall) doRequest(alt string) (*http.Response, error) {
1495 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1496 if c.ifNoneMatch_ != "" {
1497 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1498 }
1499 var body io.Reader = nil
1500 c.urlParams_.Set("alt", alt)
1501 c.urlParams_.Set("prettyPrint", "false")
1502 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports")
1503 urls += "?" + c.urlParams_.Encode()
1504 req, err := http.NewRequest("GET", urls, body)
1505 if err != nil {
1506 return nil, err
1507 }
1508 req.Header = reqHeaders
1509 googleapi.Expand(req.URL, map[string]string{
1510 "jobId": c.jobId,
1511 })
1512 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1513 }
1514
1515
1516
1517
1518
1519
1520
1521 func (c *JobsReportsListCall) Do(opts ...googleapi.CallOption) (*ListReportsResponse, error) {
1522 gensupport.SetOptions(c.urlParams_, opts...)
1523 res, err := c.doRequest("json")
1524 if res != nil && res.StatusCode == http.StatusNotModified {
1525 if res.Body != nil {
1526 res.Body.Close()
1527 }
1528 return nil, gensupport.WrapError(&googleapi.Error{
1529 Code: res.StatusCode,
1530 Header: res.Header,
1531 })
1532 }
1533 if err != nil {
1534 return nil, err
1535 }
1536 defer googleapi.CloseBody(res)
1537 if err := googleapi.CheckResponse(res); err != nil {
1538 return nil, gensupport.WrapError(err)
1539 }
1540 ret := &ListReportsResponse{
1541 ServerResponse: googleapi.ServerResponse{
1542 Header: res.Header,
1543 HTTPStatusCode: res.StatusCode,
1544 },
1545 }
1546 target := &ret
1547 if err := gensupport.DecodeResponse(target, res); err != nil {
1548 return nil, err
1549 }
1550 return ret, nil
1551 }
1552
1553
1554
1555
1556 func (c *JobsReportsListCall) Pages(ctx context.Context, f func(*ListReportsResponse) error) error {
1557 c.ctx_ = ctx
1558 defer c.PageToken(c.urlParams_.Get("pageToken"))
1559 for {
1560 x, err := c.Do()
1561 if err != nil {
1562 return err
1563 }
1564 if err := f(x); err != nil {
1565 return err
1566 }
1567 if x.NextPageToken == "" {
1568 return nil
1569 }
1570 c.PageToken(x.NextPageToken)
1571 }
1572 }
1573
1574 type MediaDownloadCall struct {
1575 s *Service
1576 resourceName string
1577 urlParams_ gensupport.URLParams
1578 ifNoneMatch_ string
1579 ctx_ context.Context
1580 header_ http.Header
1581 }
1582
1583
1584
1585
1586
1587 func (r *MediaService) Download(resourceName string) *MediaDownloadCall {
1588 c := &MediaDownloadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1589 c.resourceName = resourceName
1590 return c
1591 }
1592
1593
1594
1595
1596 func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {
1597 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1598 return c
1599 }
1600
1601
1602
1603
1604 func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {
1605 c.ifNoneMatch_ = entityTag
1606 return c
1607 }
1608
1609
1610 func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall {
1611 c.ctx_ = ctx
1612 return c
1613 }
1614
1615
1616
1617 func (c *MediaDownloadCall) Header() http.Header {
1618 if c.header_ == nil {
1619 c.header_ = make(http.Header)
1620 }
1621 return c.header_
1622 }
1623
1624 func (c *MediaDownloadCall) doRequest(alt string) (*http.Response, error) {
1625 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1626 if c.ifNoneMatch_ != "" {
1627 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1628 }
1629 var body io.Reader = nil
1630 c.urlParams_.Set("alt", alt)
1631 c.urlParams_.Set("prettyPrint", "false")
1632 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/media/{+resourceName}")
1633 urls += "?" + c.urlParams_.Encode()
1634 req, err := http.NewRequest("GET", urls, body)
1635 if err != nil {
1636 return nil, err
1637 }
1638 req.Header = reqHeaders
1639 googleapi.Expand(req.URL, map[string]string{
1640 "resourceName": c.resourceName,
1641 })
1642 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1643 }
1644
1645
1646
1647
1648 func (c *MediaDownloadCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
1649 gensupport.SetOptions(c.urlParams_, opts...)
1650 res, err := c.doRequest("media")
1651 if err != nil {
1652 return nil, err
1653 }
1654 if err := googleapi.CheckResponse(res); err != nil {
1655 res.Body.Close()
1656 return nil, gensupport.WrapError(err)
1657 }
1658 return res, nil
1659 }
1660
1661
1662
1663
1664
1665
1666 func (c *MediaDownloadCall) Do(opts ...googleapi.CallOption) (*GdataMedia, error) {
1667 gensupport.SetOptions(c.urlParams_, opts...)
1668 res, err := c.doRequest("json")
1669 if res != nil && res.StatusCode == http.StatusNotModified {
1670 if res.Body != nil {
1671 res.Body.Close()
1672 }
1673 return nil, gensupport.WrapError(&googleapi.Error{
1674 Code: res.StatusCode,
1675 Header: res.Header,
1676 })
1677 }
1678 if err != nil {
1679 return nil, err
1680 }
1681 defer googleapi.CloseBody(res)
1682 if err := googleapi.CheckResponse(res); err != nil {
1683 return nil, gensupport.WrapError(err)
1684 }
1685 ret := &GdataMedia{
1686 ServerResponse: googleapi.ServerResponse{
1687 Header: res.Header,
1688 HTTPStatusCode: res.StatusCode,
1689 },
1690 }
1691 target := &ret
1692 if err := gensupport.DecodeResponse(target, res); err != nil {
1693 return nil, err
1694 }
1695 return ret, nil
1696 }
1697
1698 type ReportTypesListCall struct {
1699 s *Service
1700 urlParams_ gensupport.URLParams
1701 ifNoneMatch_ string
1702 ctx_ context.Context
1703 header_ http.Header
1704 }
1705
1706
1707 func (r *ReportTypesService) List() *ReportTypesListCall {
1708 c := &ReportTypesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1709 return c
1710 }
1711
1712
1713
1714
1715
1716 func (c *ReportTypesListCall) IncludeSystemManaged(includeSystemManaged bool) *ReportTypesListCall {
1717 c.urlParams_.Set("includeSystemManaged", fmt.Sprint(includeSystemManaged))
1718 return c
1719 }
1720
1721
1722
1723
1724 func (c *ReportTypesListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *ReportTypesListCall {
1725 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
1726 return c
1727 }
1728
1729
1730
1731
1732 func (c *ReportTypesListCall) PageSize(pageSize int64) *ReportTypesListCall {
1733 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1734 return c
1735 }
1736
1737
1738
1739
1740
1741 func (c *ReportTypesListCall) PageToken(pageToken string) *ReportTypesListCall {
1742 c.urlParams_.Set("pageToken", pageToken)
1743 return c
1744 }
1745
1746
1747
1748
1749 func (c *ReportTypesListCall) Fields(s ...googleapi.Field) *ReportTypesListCall {
1750 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1751 return c
1752 }
1753
1754
1755
1756
1757 func (c *ReportTypesListCall) IfNoneMatch(entityTag string) *ReportTypesListCall {
1758 c.ifNoneMatch_ = entityTag
1759 return c
1760 }
1761
1762
1763 func (c *ReportTypesListCall) Context(ctx context.Context) *ReportTypesListCall {
1764 c.ctx_ = ctx
1765 return c
1766 }
1767
1768
1769
1770 func (c *ReportTypesListCall) Header() http.Header {
1771 if c.header_ == nil {
1772 c.header_ = make(http.Header)
1773 }
1774 return c.header_
1775 }
1776
1777 func (c *ReportTypesListCall) doRequest(alt string) (*http.Response, error) {
1778 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1779 if c.ifNoneMatch_ != "" {
1780 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1781 }
1782 var body io.Reader = nil
1783 c.urlParams_.Set("alt", alt)
1784 c.urlParams_.Set("prettyPrint", "false")
1785 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/reportTypes")
1786 urls += "?" + c.urlParams_.Encode()
1787 req, err := http.NewRequest("GET", urls, body)
1788 if err != nil {
1789 return nil, err
1790 }
1791 req.Header = reqHeaders
1792 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1793 }
1794
1795
1796
1797
1798
1799
1800
1801 func (c *ReportTypesListCall) Do(opts ...googleapi.CallOption) (*ListReportTypesResponse, error) {
1802 gensupport.SetOptions(c.urlParams_, opts...)
1803 res, err := c.doRequest("json")
1804 if res != nil && res.StatusCode == http.StatusNotModified {
1805 if res.Body != nil {
1806 res.Body.Close()
1807 }
1808 return nil, gensupport.WrapError(&googleapi.Error{
1809 Code: res.StatusCode,
1810 Header: res.Header,
1811 })
1812 }
1813 if err != nil {
1814 return nil, err
1815 }
1816 defer googleapi.CloseBody(res)
1817 if err := googleapi.CheckResponse(res); err != nil {
1818 return nil, gensupport.WrapError(err)
1819 }
1820 ret := &ListReportTypesResponse{
1821 ServerResponse: googleapi.ServerResponse{
1822 Header: res.Header,
1823 HTTPStatusCode: res.StatusCode,
1824 },
1825 }
1826 target := &ret
1827 if err := gensupport.DecodeResponse(target, res); err != nil {
1828 return nil, err
1829 }
1830 return ret, nil
1831 }
1832
1833
1834
1835
1836 func (c *ReportTypesListCall) Pages(ctx context.Context, f func(*ListReportTypesResponse) error) error {
1837 c.ctx_ = ctx
1838 defer c.PageToken(c.urlParams_.Get("pageToken"))
1839 for {
1840 x, err := c.Do()
1841 if err != nil {
1842 return err
1843 }
1844 if err := f(x); err != nil {
1845 return err
1846 }
1847 if x.NextPageToken == "" {
1848 return nil
1849 }
1850 c.PageToken(x.NextPageToken)
1851 }
1852 }
1853
View as plain text