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 fitness
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 = "fitness:v1"
95 const apiName = "fitness"
96 const apiVersion = "v1"
97 const basePath = "https://fitness.googleapis.com/fitness/v1/users/"
98 const basePathTemplate = "https://fitness.UNIVERSE_DOMAIN/fitness/v1/users/"
99 const mtlsBasePath = "https://fitness.mtls.googleapis.com/fitness/v1/users/"
100
101
102 const (
103
104 FitnessActivityReadScope = "https://www.googleapis.com/auth/fitness.activity.read"
105
106
107 FitnessActivityWriteScope = "https://www.googleapis.com/auth/fitness.activity.write"
108
109
110
111 FitnessBloodGlucoseReadScope = "https://www.googleapis.com/auth/fitness.blood_glucose.read"
112
113
114
115 FitnessBloodGlucoseWriteScope = "https://www.googleapis.com/auth/fitness.blood_glucose.write"
116
117
118
119 FitnessBloodPressureReadScope = "https://www.googleapis.com/auth/fitness.blood_pressure.read"
120
121
122
123 FitnessBloodPressureWriteScope = "https://www.googleapis.com/auth/fitness.blood_pressure.write"
124
125
126 FitnessBodyReadScope = "https://www.googleapis.com/auth/fitness.body.read"
127
128
129 FitnessBodyWriteScope = "https://www.googleapis.com/auth/fitness.body.write"
130
131
132
133 FitnessBodyTemperatureReadScope = "https://www.googleapis.com/auth/fitness.body_temperature.read"
134
135
136
137 FitnessBodyTemperatureWriteScope = "https://www.googleapis.com/auth/fitness.body_temperature.write"
138
139
140
141 FitnessHeartRateReadScope = "https://www.googleapis.com/auth/fitness.heart_rate.read"
142
143
144
145 FitnessHeartRateWriteScope = "https://www.googleapis.com/auth/fitness.heart_rate.write"
146
147
148 FitnessLocationReadScope = "https://www.googleapis.com/auth/fitness.location.read"
149
150
151 FitnessLocationWriteScope = "https://www.googleapis.com/auth/fitness.location.write"
152
153
154 FitnessNutritionReadScope = "https://www.googleapis.com/auth/fitness.nutrition.read"
155
156
157 FitnessNutritionWriteScope = "https://www.googleapis.com/auth/fitness.nutrition.write"
158
159
160
161 FitnessOxygenSaturationReadScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.read"
162
163
164
165 FitnessOxygenSaturationWriteScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.write"
166
167
168
169 FitnessReproductiveHealthReadScope = "https://www.googleapis.com/auth/fitness.reproductive_health.read"
170
171
172
173 FitnessReproductiveHealthWriteScope = "https://www.googleapis.com/auth/fitness.reproductive_health.write"
174
175
176
177 FitnessSleepReadScope = "https://www.googleapis.com/auth/fitness.sleep.read"
178
179
180
181 FitnessSleepWriteScope = "https://www.googleapis.com/auth/fitness.sleep.write"
182 )
183
184
185 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
186 scopesOption := internaloption.WithDefaultScopes(
187 "https://www.googleapis.com/auth/fitness.activity.read",
188 "https://www.googleapis.com/auth/fitness.activity.write",
189 "https://www.googleapis.com/auth/fitness.blood_glucose.read",
190 "https://www.googleapis.com/auth/fitness.blood_glucose.write",
191 "https://www.googleapis.com/auth/fitness.blood_pressure.read",
192 "https://www.googleapis.com/auth/fitness.blood_pressure.write",
193 "https://www.googleapis.com/auth/fitness.body.read",
194 "https://www.googleapis.com/auth/fitness.body.write",
195 "https://www.googleapis.com/auth/fitness.body_temperature.read",
196 "https://www.googleapis.com/auth/fitness.body_temperature.write",
197 "https://www.googleapis.com/auth/fitness.heart_rate.read",
198 "https://www.googleapis.com/auth/fitness.heart_rate.write",
199 "https://www.googleapis.com/auth/fitness.location.read",
200 "https://www.googleapis.com/auth/fitness.location.write",
201 "https://www.googleapis.com/auth/fitness.nutrition.read",
202 "https://www.googleapis.com/auth/fitness.nutrition.write",
203 "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
204 "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
205 "https://www.googleapis.com/auth/fitness.reproductive_health.read",
206 "https://www.googleapis.com/auth/fitness.reproductive_health.write",
207 "https://www.googleapis.com/auth/fitness.sleep.read",
208 "https://www.googleapis.com/auth/fitness.sleep.write",
209 )
210
211 opts = append([]option.ClientOption{scopesOption}, opts...)
212 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
213 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
214 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
215 opts = append(opts, internaloption.EnableNewAuthLibrary())
216 client, endpoint, err := htransport.NewClient(ctx, opts...)
217 if err != nil {
218 return nil, err
219 }
220 s, err := New(client)
221 if err != nil {
222 return nil, err
223 }
224 if endpoint != "" {
225 s.BasePath = endpoint
226 }
227 return s, nil
228 }
229
230
231
232
233
234
235 func New(client *http.Client) (*Service, error) {
236 if client == nil {
237 return nil, errors.New("client is nil")
238 }
239 s := &Service{client: client, BasePath: basePath}
240 s.Users = NewUsersService(s)
241 return s, nil
242 }
243
244 type Service struct {
245 client *http.Client
246 BasePath string
247 UserAgent string
248
249 Users *UsersService
250 }
251
252 func (s *Service) userAgent() string {
253 if s.UserAgent == "" {
254 return googleapi.UserAgent
255 }
256 return googleapi.UserAgent + " " + s.UserAgent
257 }
258
259 func NewUsersService(s *Service) *UsersService {
260 rs := &UsersService{s: s}
261 rs.DataSources = NewUsersDataSourcesService(s)
262 rs.Dataset = NewUsersDatasetService(s)
263 rs.Sessions = NewUsersSessionsService(s)
264 return rs
265 }
266
267 type UsersService struct {
268 s *Service
269
270 DataSources *UsersDataSourcesService
271
272 Dataset *UsersDatasetService
273
274 Sessions *UsersSessionsService
275 }
276
277 func NewUsersDataSourcesService(s *Service) *UsersDataSourcesService {
278 rs := &UsersDataSourcesService{s: s}
279 rs.DataPointChanges = NewUsersDataSourcesDataPointChangesService(s)
280 rs.Datasets = NewUsersDataSourcesDatasetsService(s)
281 return rs
282 }
283
284 type UsersDataSourcesService struct {
285 s *Service
286
287 DataPointChanges *UsersDataSourcesDataPointChangesService
288
289 Datasets *UsersDataSourcesDatasetsService
290 }
291
292 func NewUsersDataSourcesDataPointChangesService(s *Service) *UsersDataSourcesDataPointChangesService {
293 rs := &UsersDataSourcesDataPointChangesService{s: s}
294 return rs
295 }
296
297 type UsersDataSourcesDataPointChangesService struct {
298 s *Service
299 }
300
301 func NewUsersDataSourcesDatasetsService(s *Service) *UsersDataSourcesDatasetsService {
302 rs := &UsersDataSourcesDatasetsService{s: s}
303 return rs
304 }
305
306 type UsersDataSourcesDatasetsService struct {
307 s *Service
308 }
309
310 func NewUsersDatasetService(s *Service) *UsersDatasetService {
311 rs := &UsersDatasetService{s: s}
312 return rs
313 }
314
315 type UsersDatasetService struct {
316 s *Service
317 }
318
319 func NewUsersSessionsService(s *Service) *UsersSessionsService {
320 rs := &UsersSessionsService{s: s}
321 return rs
322 }
323
324 type UsersSessionsService struct {
325 s *Service
326 }
327
328 type AggregateBucket struct {
329
330
331 Activity int64 `json:"activity,omitempty"`
332
333 Dataset []*Dataset `json:"dataset,omitempty"`
334
335
336 EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
337
338 Session *Session `json:"session,omitempty"`
339
340
341 StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359 Type string `json:"type,omitempty"`
360
361
362
363
364
365 ForceSendFields []string `json:"-"`
366
367
368
369
370 NullFields []string `json:"-"`
371 }
372
373 func (s *AggregateBucket) MarshalJSON() ([]byte, error) {
374 type NoMethod AggregateBucket
375 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
376 }
377
378
379 type AggregateBy struct {
380
381
382
383
384
385
386 DataSourceId string `json:"dataSourceId,omitempty"`
387
388
389
390
391
392
393 DataTypeName string `json:"dataTypeName,omitempty"`
394
395
396
397
398
399 ForceSendFields []string `json:"-"`
400
401
402
403
404 NullFields []string `json:"-"`
405 }
406
407 func (s *AggregateBy) MarshalJSON() ([]byte, error) {
408 type NoMethod AggregateBy
409 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
410 }
411
412
413 type AggregateRequest struct {
414
415
416
417
418 AggregateBy []*AggregateBy `json:"aggregateBy,omitempty"`
419
420
421
422
423 BucketByActivitySegment *BucketByActivity `json:"bucketByActivitySegment,omitempty"`
424
425
426
427
428
429
430 BucketByActivityType *BucketByActivity `json:"bucketByActivityType,omitempty"`
431
432
433
434 BucketBySession *BucketBySession `json:"bucketBySession,omitempty"`
435
436
437 BucketByTime *BucketByTime `json:"bucketByTime,omitempty"`
438
439
440
441
442 EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
443
444
445
446
447
448
449
450
451
452
453
454
455
456 FilteredDataQualityStandard []string `json:"filteredDataQualityStandard,omitempty"`
457
458
459
460 StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
461
462
463
464
465
466 ForceSendFields []string `json:"-"`
467
468
469
470
471 NullFields []string `json:"-"`
472 }
473
474 func (s *AggregateRequest) MarshalJSON() ([]byte, error) {
475 type NoMethod AggregateRequest
476 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
477 }
478
479 type AggregateResponse struct {
480
481 Bucket []*AggregateBucket `json:"bucket,omitempty"`
482
483
484 googleapi.ServerResponse `json:"-"`
485
486
487
488
489
490 ForceSendFields []string `json:"-"`
491
492
493
494
495 NullFields []string `json:"-"`
496 }
497
498 func (s *AggregateResponse) MarshalJSON() ([]byte, error) {
499 type NoMethod AggregateResponse
500 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
501 }
502
503 type Application struct {
504
505
506 DetailsUrl string `json:"detailsUrl,omitempty"`
507
508
509
510
511 Name string `json:"name,omitempty"`
512
513
514
515
516 PackageName string `json:"packageName,omitempty"`
517
518
519 Version string `json:"version,omitempty"`
520
521
522
523
524
525 ForceSendFields []string `json:"-"`
526
527
528
529
530 NullFields []string `json:"-"`
531 }
532
533 func (s *Application) MarshalJSON() ([]byte, error) {
534 type NoMethod Application
535 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
536 }
537
538 type BucketByActivity struct {
539
540
541 ActivityDataSourceId string `json:"activityDataSourceId,omitempty"`
542
543
544
545 MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"`
546
547
548
549
550
551 ForceSendFields []string `json:"-"`
552
553
554
555
556 NullFields []string `json:"-"`
557 }
558
559 func (s *BucketByActivity) MarshalJSON() ([]byte, error) {
560 type NoMethod BucketByActivity
561 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
562 }
563
564 type BucketBySession struct {
565
566
567
568 MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"`
569
570
571
572
573
574 ForceSendFields []string `json:"-"`
575
576
577
578
579 NullFields []string `json:"-"`
580 }
581
582 func (s *BucketBySession) MarshalJSON() ([]byte, error) {
583 type NoMethod BucketBySession
584 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
585 }
586
587 type BucketByTime struct {
588
589
590
591 DurationMillis int64 `json:"durationMillis,omitempty,string"`
592 Period *BucketByTimePeriod `json:"period,omitempty"`
593
594
595
596
597
598 ForceSendFields []string `json:"-"`
599
600
601
602
603 NullFields []string `json:"-"`
604 }
605
606 func (s *BucketByTime) MarshalJSON() ([]byte, error) {
607 type NoMethod BucketByTime
608 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
609 }
610
611 type BucketByTimePeriod struct {
612
613 TimeZoneId string `json:"timeZoneId,omitempty"`
614
615
616
617
618 Type string `json:"type,omitempty"`
619 Value int64 `json:"value,omitempty"`
620
621
622
623
624
625 ForceSendFields []string `json:"-"`
626
627
628
629
630 NullFields []string `json:"-"`
631 }
632
633 func (s *BucketByTimePeriod) MarshalJSON() ([]byte, error) {
634 type NoMethod BucketByTimePeriod
635 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
636 }
637
638
639
640
641
642
643
644
645
646 type DataPoint struct {
647
648 ComputationTimeMillis int64 `json:"computationTimeMillis,omitempty,string"`
649
650
651 DataTypeName string `json:"dataTypeName,omitempty"`
652
653
654 EndTimeNanos int64 `json:"endTimeNanos,omitempty,string"`
655
656
657
658 ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"`
659
660
661
662
663
664
665 OriginDataSourceId string `json:"originDataSourceId,omitempty"`
666
667 RawTimestampNanos int64 `json:"rawTimestampNanos,omitempty,string"`
668
669
670 StartTimeNanos int64 `json:"startTimeNanos,omitempty,string"`
671
672
673
674
675
676 Value []*Value `json:"value,omitempty"`
677
678
679
680
681
682 ForceSendFields []string `json:"-"`
683
684
685
686
687 NullFields []string `json:"-"`
688 }
689
690 func (s *DataPoint) MarshalJSON() ([]byte, error) {
691 type NoMethod DataPoint
692 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
693 }
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708 type DataSource struct {
709
710
711 Application *Application `json:"application,omitempty"`
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727 DataQualityStandard []string `json:"dataQualityStandard,omitempty"`
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752 DataStreamId string `json:"dataStreamId,omitempty"`
753
754
755
756
757
758 DataStreamName string `json:"dataStreamName,omitempty"`
759
760
761 DataType *DataType `json:"dataType,omitempty"`
762
763
764 Device *Device `json:"device,omitempty"`
765
766 Name string `json:"name,omitempty"`
767
768
769
770
771
772
773 Type string `json:"type,omitempty"`
774
775
776 googleapi.ServerResponse `json:"-"`
777
778
779
780
781
782 ForceSendFields []string `json:"-"`
783
784
785
786
787 NullFields []string `json:"-"`
788 }
789
790 func (s *DataSource) MarshalJSON() ([]byte, error) {
791 type NoMethod DataSource
792 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
793 }
794
795 type DataType struct {
796
797 Field []*DataTypeField `json:"field,omitempty"`
798
799
800 Name string `json:"name,omitempty"`
801
802
803
804
805
806 ForceSendFields []string `json:"-"`
807
808
809
810
811 NullFields []string `json:"-"`
812 }
813
814 func (s *DataType) MarshalJSON() ([]byte, error) {
815 type NoMethod DataType
816 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
817 }
818
819
820
821
822
823
824 type DataTypeField struct {
825
826
827
828
829
830
831
832
833
834
835 Format string `json:"format,omitempty"`
836
837
838 Name string `json:"name,omitempty"`
839 Optional bool `json:"optional,omitempty"`
840
841
842
843
844
845 ForceSendFields []string `json:"-"`
846
847
848
849
850 NullFields []string `json:"-"`
851 }
852
853 func (s *DataTypeField) MarshalJSON() ([]byte, error) {
854 type NoMethod DataTypeField
855 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
856 }
857
858
859
860
861
862 type Dataset struct {
863
864
865 DataSourceId string `json:"dataSourceId,omitempty"`
866
867
868
869 MaxEndTimeNs int64 `json:"maxEndTimeNs,omitempty,string"`
870
871
872
873 MinStartTimeNs int64 `json:"minStartTimeNs,omitempty,string"`
874
875
876
877
878 NextPageToken string `json:"nextPageToken,omitempty"`
879
880
881
882
883 Point []*DataPoint `json:"point,omitempty"`
884
885
886 googleapi.ServerResponse `json:"-"`
887
888
889
890
891
892 ForceSendFields []string `json:"-"`
893
894
895
896
897 NullFields []string `json:"-"`
898 }
899
900 func (s *Dataset) MarshalJSON() ([]byte, error) {
901 type NoMethod Dataset
902 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
903 }
904
905
906
907
908
909
910
911
912
913
914
915 type Device struct {
916
917 Manufacturer string `json:"manufacturer,omitempty"`
918
919 Model string `json:"model,omitempty"`
920
921
922
923
924
925
926
927
928
929
930
931 Type string `json:"type,omitempty"`
932
933
934
935
936
937 Uid string `json:"uid,omitempty"`
938
939 Version string `json:"version,omitempty"`
940
941
942
943
944
945 ForceSendFields []string `json:"-"`
946
947
948
949
950 NullFields []string `json:"-"`
951 }
952
953 func (s *Device) MarshalJSON() ([]byte, error) {
954 type NoMethod Device
955 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
956 }
957
958 type ListDataPointChangesResponse struct {
959
960 DataSourceId string `json:"dataSourceId,omitempty"`
961
962
963 DeletedDataPoint []*DataPoint `json:"deletedDataPoint,omitempty"`
964
965 InsertedDataPoint []*DataPoint `json:"insertedDataPoint,omitempty"`
966
967
968
969 NextPageToken string `json:"nextPageToken,omitempty"`
970
971
972 googleapi.ServerResponse `json:"-"`
973
974
975
976
977
978 ForceSendFields []string `json:"-"`
979
980
981
982
983 NullFields []string `json:"-"`
984 }
985
986 func (s *ListDataPointChangesResponse) MarshalJSON() ([]byte, error) {
987 type NoMethod ListDataPointChangesResponse
988 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
989 }
990
991 type ListDataSourcesResponse struct {
992
993 DataSource []*DataSource `json:"dataSource,omitempty"`
994
995
996 googleapi.ServerResponse `json:"-"`
997
998
999
1000
1001
1002 ForceSendFields []string `json:"-"`
1003
1004
1005
1006
1007 NullFields []string `json:"-"`
1008 }
1009
1010 func (s *ListDataSourcesResponse) MarshalJSON() ([]byte, error) {
1011 type NoMethod ListDataSourcesResponse
1012 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1013 }
1014
1015 type ListSessionsResponse struct {
1016
1017
1018
1019 DeletedSession []*Session `json:"deletedSession,omitempty"`
1020
1021
1022 HasMoreData bool `json:"hasMoreData,omitempty"`
1023
1024
1025
1026 NextPageToken string `json:"nextPageToken,omitempty"`
1027
1028
1029 Session []*Session `json:"session,omitempty"`
1030
1031
1032 googleapi.ServerResponse `json:"-"`
1033
1034
1035
1036
1037
1038 ForceSendFields []string `json:"-"`
1039
1040
1041
1042
1043 NullFields []string `json:"-"`
1044 }
1045
1046 func (s *ListSessionsResponse) MarshalJSON() ([]byte, error) {
1047 type NoMethod ListSessionsResponse
1048 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1049 }
1050
1051
1052
1053
1054 type MapValue struct {
1055
1056 FpVal float64 `json:"fpVal,omitempty"`
1057
1058
1059
1060
1061
1062 ForceSendFields []string `json:"-"`
1063
1064
1065
1066
1067 NullFields []string `json:"-"`
1068 }
1069
1070 func (s *MapValue) MarshalJSON() ([]byte, error) {
1071 type NoMethod MapValue
1072 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1073 }
1074
1075 func (s *MapValue) UnmarshalJSON(data []byte) error {
1076 type NoMethod MapValue
1077 var s1 struct {
1078 FpVal gensupport.JSONFloat64 `json:"fpVal"`
1079 *NoMethod
1080 }
1081 s1.NoMethod = (*NoMethod)(s)
1082 if err := json.Unmarshal(data, &s1); err != nil {
1083 return err
1084 }
1085 s.FpVal = float64(s1.FpVal)
1086 return nil
1087 }
1088
1089
1090
1091 type Session struct {
1092
1093
1094
1095
1096
1097 ActiveTimeMillis int64 `json:"activeTimeMillis,omitempty,string"`
1098
1099 ActivityType int64 `json:"activityType,omitempty"`
1100
1101 Application *Application `json:"application,omitempty"`
1102
1103 Description string `json:"description,omitempty"`
1104
1105 EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
1106
1107
1108 Id string `json:"id,omitempty"`
1109
1110
1111 ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"`
1112
1113 Name string `json:"name,omitempty"`
1114
1115 StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
1116
1117
1118 googleapi.ServerResponse `json:"-"`
1119
1120
1121
1122
1123
1124 ForceSendFields []string `json:"-"`
1125
1126
1127
1128
1129 NullFields []string `json:"-"`
1130 }
1131
1132 func (s *Session) MarshalJSON() ([]byte, error) {
1133 type NoMethod Session
1134 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1135 }
1136
1137
1138
1139
1140 type Value struct {
1141
1142 FpVal float64 `json:"fpVal,omitempty"`
1143
1144 IntVal int64 `json:"intVal,omitempty"`
1145
1146
1147
1148
1149 MapVal []*ValueMapValEntry `json:"mapVal,omitempty"`
1150
1151
1152
1153 StringVal string `json:"stringVal,omitempty"`
1154
1155
1156
1157
1158
1159 ForceSendFields []string `json:"-"`
1160
1161
1162
1163
1164 NullFields []string `json:"-"`
1165 }
1166
1167 func (s *Value) MarshalJSON() ([]byte, error) {
1168 type NoMethod Value
1169 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1170 }
1171
1172 func (s *Value) UnmarshalJSON(data []byte) error {
1173 type NoMethod Value
1174 var s1 struct {
1175 FpVal gensupport.JSONFloat64 `json:"fpVal"`
1176 *NoMethod
1177 }
1178 s1.NoMethod = (*NoMethod)(s)
1179 if err := json.Unmarshal(data, &s1); err != nil {
1180 return err
1181 }
1182 s.FpVal = float64(s1.FpVal)
1183 return nil
1184 }
1185
1186 type ValueMapValEntry struct {
1187 Key string `json:"key,omitempty"`
1188 Value *MapValue `json:"value,omitempty"`
1189
1190
1191
1192
1193
1194 ForceSendFields []string `json:"-"`
1195
1196
1197
1198
1199 NullFields []string `json:"-"`
1200 }
1201
1202 func (s *ValueMapValEntry) MarshalJSON() ([]byte, error) {
1203 type NoMethod ValueMapValEntry
1204 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1205 }
1206
1207 type UsersDataSourcesCreateCall struct {
1208 s *Service
1209 userId string
1210 datasource *DataSource
1211 urlParams_ gensupport.URLParams
1212 ctx_ context.Context
1213 header_ http.Header
1214 }
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244 func (r *UsersDataSourcesService) Create(userId string, datasource *DataSource) *UsersDataSourcesCreateCall {
1245 c := &UsersDataSourcesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1246 c.userId = userId
1247 c.datasource = datasource
1248 return c
1249 }
1250
1251
1252
1253
1254 func (c *UsersDataSourcesCreateCall) Fields(s ...googleapi.Field) *UsersDataSourcesCreateCall {
1255 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1256 return c
1257 }
1258
1259
1260 func (c *UsersDataSourcesCreateCall) Context(ctx context.Context) *UsersDataSourcesCreateCall {
1261 c.ctx_ = ctx
1262 return c
1263 }
1264
1265
1266
1267 func (c *UsersDataSourcesCreateCall) Header() http.Header {
1268 if c.header_ == nil {
1269 c.header_ = make(http.Header)
1270 }
1271 return c.header_
1272 }
1273
1274 func (c *UsersDataSourcesCreateCall) doRequest(alt string) (*http.Response, error) {
1275 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1276 var body io.Reader = nil
1277 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
1278 if err != nil {
1279 return nil, err
1280 }
1281 c.urlParams_.Set("alt", alt)
1282 c.urlParams_.Set("prettyPrint", "false")
1283 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources")
1284 urls += "?" + c.urlParams_.Encode()
1285 req, err := http.NewRequest("POST", urls, body)
1286 if err != nil {
1287 return nil, err
1288 }
1289 req.Header = reqHeaders
1290 googleapi.Expand(req.URL, map[string]string{
1291 "userId": c.userId,
1292 })
1293 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1294 }
1295
1296
1297
1298
1299
1300
1301 func (c *UsersDataSourcesCreateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
1302 gensupport.SetOptions(c.urlParams_, opts...)
1303 res, err := c.doRequest("json")
1304 if res != nil && res.StatusCode == http.StatusNotModified {
1305 if res.Body != nil {
1306 res.Body.Close()
1307 }
1308 return nil, gensupport.WrapError(&googleapi.Error{
1309 Code: res.StatusCode,
1310 Header: res.Header,
1311 })
1312 }
1313 if err != nil {
1314 return nil, err
1315 }
1316 defer googleapi.CloseBody(res)
1317 if err := googleapi.CheckResponse(res); err != nil {
1318 return nil, gensupport.WrapError(err)
1319 }
1320 ret := &DataSource{
1321 ServerResponse: googleapi.ServerResponse{
1322 Header: res.Header,
1323 HTTPStatusCode: res.StatusCode,
1324 },
1325 }
1326 target := &ret
1327 if err := gensupport.DecodeResponse(target, res); err != nil {
1328 return nil, err
1329 }
1330 return ret, nil
1331 }
1332
1333 type UsersDataSourcesDeleteCall struct {
1334 s *Service
1335 userId string
1336 dataSourceId string
1337 urlParams_ gensupport.URLParams
1338 ctx_ context.Context
1339 header_ http.Header
1340 }
1341
1342
1343
1344
1345
1346
1347
1348 func (r *UsersDataSourcesService) Delete(userId string, dataSourceId string) *UsersDataSourcesDeleteCall {
1349 c := &UsersDataSourcesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1350 c.userId = userId
1351 c.dataSourceId = dataSourceId
1352 return c
1353 }
1354
1355
1356
1357
1358 func (c *UsersDataSourcesDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDeleteCall {
1359 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1360 return c
1361 }
1362
1363
1364 func (c *UsersDataSourcesDeleteCall) Context(ctx context.Context) *UsersDataSourcesDeleteCall {
1365 c.ctx_ = ctx
1366 return c
1367 }
1368
1369
1370
1371 func (c *UsersDataSourcesDeleteCall) Header() http.Header {
1372 if c.header_ == nil {
1373 c.header_ = make(http.Header)
1374 }
1375 return c.header_
1376 }
1377
1378 func (c *UsersDataSourcesDeleteCall) doRequest(alt string) (*http.Response, error) {
1379 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1380 var body io.Reader = nil
1381 c.urlParams_.Set("alt", alt)
1382 c.urlParams_.Set("prettyPrint", "false")
1383 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
1384 urls += "?" + c.urlParams_.Encode()
1385 req, err := http.NewRequest("DELETE", urls, body)
1386 if err != nil {
1387 return nil, err
1388 }
1389 req.Header = reqHeaders
1390 googleapi.Expand(req.URL, map[string]string{
1391 "userId": c.userId,
1392 "dataSourceId": c.dataSourceId,
1393 })
1394 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1395 }
1396
1397
1398
1399
1400
1401
1402 func (c *UsersDataSourcesDeleteCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
1403 gensupport.SetOptions(c.urlParams_, opts...)
1404 res, err := c.doRequest("json")
1405 if res != nil && res.StatusCode == http.StatusNotModified {
1406 if res.Body != nil {
1407 res.Body.Close()
1408 }
1409 return nil, gensupport.WrapError(&googleapi.Error{
1410 Code: res.StatusCode,
1411 Header: res.Header,
1412 })
1413 }
1414 if err != nil {
1415 return nil, err
1416 }
1417 defer googleapi.CloseBody(res)
1418 if err := googleapi.CheckResponse(res); err != nil {
1419 return nil, gensupport.WrapError(err)
1420 }
1421 ret := &DataSource{
1422 ServerResponse: googleapi.ServerResponse{
1423 Header: res.Header,
1424 HTTPStatusCode: res.StatusCode,
1425 },
1426 }
1427 target := &ret
1428 if err := gensupport.DecodeResponse(target, res); err != nil {
1429 return nil, err
1430 }
1431 return ret, nil
1432 }
1433
1434 type UsersDataSourcesGetCall struct {
1435 s *Service
1436 userId string
1437 dataSourceId string
1438 urlParams_ gensupport.URLParams
1439 ifNoneMatch_ string
1440 ctx_ context.Context
1441 header_ http.Header
1442 }
1443
1444
1445
1446
1447
1448
1449 func (r *UsersDataSourcesService) Get(userId string, dataSourceId string) *UsersDataSourcesGetCall {
1450 c := &UsersDataSourcesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1451 c.userId = userId
1452 c.dataSourceId = dataSourceId
1453 return c
1454 }
1455
1456
1457
1458
1459 func (c *UsersDataSourcesGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesGetCall {
1460 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1461 return c
1462 }
1463
1464
1465
1466
1467 func (c *UsersDataSourcesGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesGetCall {
1468 c.ifNoneMatch_ = entityTag
1469 return c
1470 }
1471
1472
1473 func (c *UsersDataSourcesGetCall) Context(ctx context.Context) *UsersDataSourcesGetCall {
1474 c.ctx_ = ctx
1475 return c
1476 }
1477
1478
1479
1480 func (c *UsersDataSourcesGetCall) Header() http.Header {
1481 if c.header_ == nil {
1482 c.header_ = make(http.Header)
1483 }
1484 return c.header_
1485 }
1486
1487 func (c *UsersDataSourcesGetCall) doRequest(alt string) (*http.Response, error) {
1488 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1489 if c.ifNoneMatch_ != "" {
1490 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1491 }
1492 var body io.Reader = nil
1493 c.urlParams_.Set("alt", alt)
1494 c.urlParams_.Set("prettyPrint", "false")
1495 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
1496 urls += "?" + c.urlParams_.Encode()
1497 req, err := http.NewRequest("GET", urls, body)
1498 if err != nil {
1499 return nil, err
1500 }
1501 req.Header = reqHeaders
1502 googleapi.Expand(req.URL, map[string]string{
1503 "userId": c.userId,
1504 "dataSourceId": c.dataSourceId,
1505 })
1506 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1507 }
1508
1509
1510
1511
1512
1513
1514 func (c *UsersDataSourcesGetCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
1515 gensupport.SetOptions(c.urlParams_, opts...)
1516 res, err := c.doRequest("json")
1517 if res != nil && res.StatusCode == http.StatusNotModified {
1518 if res.Body != nil {
1519 res.Body.Close()
1520 }
1521 return nil, gensupport.WrapError(&googleapi.Error{
1522 Code: res.StatusCode,
1523 Header: res.Header,
1524 })
1525 }
1526 if err != nil {
1527 return nil, err
1528 }
1529 defer googleapi.CloseBody(res)
1530 if err := googleapi.CheckResponse(res); err != nil {
1531 return nil, gensupport.WrapError(err)
1532 }
1533 ret := &DataSource{
1534 ServerResponse: googleapi.ServerResponse{
1535 Header: res.Header,
1536 HTTPStatusCode: res.StatusCode,
1537 },
1538 }
1539 target := &ret
1540 if err := gensupport.DecodeResponse(target, res); err != nil {
1541 return nil, err
1542 }
1543 return ret, nil
1544 }
1545
1546 type UsersDataSourcesListCall struct {
1547 s *Service
1548 userId string
1549 urlParams_ gensupport.URLParams
1550 ifNoneMatch_ string
1551 ctx_ context.Context
1552 header_ http.Header
1553 }
1554
1555
1556
1557
1558
1559
1560
1561
1562 func (r *UsersDataSourcesService) List(userId string) *UsersDataSourcesListCall {
1563 c := &UsersDataSourcesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1564 c.userId = userId
1565 return c
1566 }
1567
1568
1569
1570
1571 func (c *UsersDataSourcesListCall) DataTypeName(dataTypeName ...string) *UsersDataSourcesListCall {
1572 c.urlParams_.SetMulti("dataTypeName", append([]string{}, dataTypeName...))
1573 return c
1574 }
1575
1576
1577
1578
1579 func (c *UsersDataSourcesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesListCall {
1580 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1581 return c
1582 }
1583
1584
1585
1586
1587 func (c *UsersDataSourcesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesListCall {
1588 c.ifNoneMatch_ = entityTag
1589 return c
1590 }
1591
1592
1593 func (c *UsersDataSourcesListCall) Context(ctx context.Context) *UsersDataSourcesListCall {
1594 c.ctx_ = ctx
1595 return c
1596 }
1597
1598
1599
1600 func (c *UsersDataSourcesListCall) Header() http.Header {
1601 if c.header_ == nil {
1602 c.header_ = make(http.Header)
1603 }
1604 return c.header_
1605 }
1606
1607 func (c *UsersDataSourcesListCall) doRequest(alt string) (*http.Response, error) {
1608 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1609 if c.ifNoneMatch_ != "" {
1610 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1611 }
1612 var body io.Reader = nil
1613 c.urlParams_.Set("alt", alt)
1614 c.urlParams_.Set("prettyPrint", "false")
1615 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources")
1616 urls += "?" + c.urlParams_.Encode()
1617 req, err := http.NewRequest("GET", urls, body)
1618 if err != nil {
1619 return nil, err
1620 }
1621 req.Header = reqHeaders
1622 googleapi.Expand(req.URL, map[string]string{
1623 "userId": c.userId,
1624 })
1625 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1626 }
1627
1628
1629
1630
1631
1632
1633
1634 func (c *UsersDataSourcesListCall) Do(opts ...googleapi.CallOption) (*ListDataSourcesResponse, error) {
1635 gensupport.SetOptions(c.urlParams_, opts...)
1636 res, err := c.doRequest("json")
1637 if res != nil && res.StatusCode == http.StatusNotModified {
1638 if res.Body != nil {
1639 res.Body.Close()
1640 }
1641 return nil, gensupport.WrapError(&googleapi.Error{
1642 Code: res.StatusCode,
1643 Header: res.Header,
1644 })
1645 }
1646 if err != nil {
1647 return nil, err
1648 }
1649 defer googleapi.CloseBody(res)
1650 if err := googleapi.CheckResponse(res); err != nil {
1651 return nil, gensupport.WrapError(err)
1652 }
1653 ret := &ListDataSourcesResponse{
1654 ServerResponse: googleapi.ServerResponse{
1655 Header: res.Header,
1656 HTTPStatusCode: res.StatusCode,
1657 },
1658 }
1659 target := &ret
1660 if err := gensupport.DecodeResponse(target, res); err != nil {
1661 return nil, err
1662 }
1663 return ret, nil
1664 }
1665
1666 type UsersDataSourcesUpdateCall struct {
1667 s *Service
1668 userId string
1669 dataSourceId string
1670 datasource *DataSource
1671 urlParams_ gensupport.URLParams
1672 ctx_ context.Context
1673 header_ http.Header
1674 }
1675
1676
1677
1678
1679
1680
1681
1682
1683 func (r *UsersDataSourcesService) Update(userId string, dataSourceId string, datasource *DataSource) *UsersDataSourcesUpdateCall {
1684 c := &UsersDataSourcesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1685 c.userId = userId
1686 c.dataSourceId = dataSourceId
1687 c.datasource = datasource
1688 return c
1689 }
1690
1691
1692
1693
1694 func (c *UsersDataSourcesUpdateCall) Fields(s ...googleapi.Field) *UsersDataSourcesUpdateCall {
1695 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1696 return c
1697 }
1698
1699
1700 func (c *UsersDataSourcesUpdateCall) Context(ctx context.Context) *UsersDataSourcesUpdateCall {
1701 c.ctx_ = ctx
1702 return c
1703 }
1704
1705
1706
1707 func (c *UsersDataSourcesUpdateCall) Header() http.Header {
1708 if c.header_ == nil {
1709 c.header_ = make(http.Header)
1710 }
1711 return c.header_
1712 }
1713
1714 func (c *UsersDataSourcesUpdateCall) doRequest(alt string) (*http.Response, error) {
1715 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1716 var body io.Reader = nil
1717 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
1718 if err != nil {
1719 return nil, err
1720 }
1721 c.urlParams_.Set("alt", alt)
1722 c.urlParams_.Set("prettyPrint", "false")
1723 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
1724 urls += "?" + c.urlParams_.Encode()
1725 req, err := http.NewRequest("PUT", urls, body)
1726 if err != nil {
1727 return nil, err
1728 }
1729 req.Header = reqHeaders
1730 googleapi.Expand(req.URL, map[string]string{
1731 "userId": c.userId,
1732 "dataSourceId": c.dataSourceId,
1733 })
1734 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1735 }
1736
1737
1738
1739
1740
1741
1742 func (c *UsersDataSourcesUpdateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
1743 gensupport.SetOptions(c.urlParams_, opts...)
1744 res, err := c.doRequest("json")
1745 if res != nil && res.StatusCode == http.StatusNotModified {
1746 if res.Body != nil {
1747 res.Body.Close()
1748 }
1749 return nil, gensupport.WrapError(&googleapi.Error{
1750 Code: res.StatusCode,
1751 Header: res.Header,
1752 })
1753 }
1754 if err != nil {
1755 return nil, err
1756 }
1757 defer googleapi.CloseBody(res)
1758 if err := googleapi.CheckResponse(res); err != nil {
1759 return nil, gensupport.WrapError(err)
1760 }
1761 ret := &DataSource{
1762 ServerResponse: googleapi.ServerResponse{
1763 Header: res.Header,
1764 HTTPStatusCode: res.StatusCode,
1765 },
1766 }
1767 target := &ret
1768 if err := gensupport.DecodeResponse(target, res); err != nil {
1769 return nil, err
1770 }
1771 return ret, nil
1772 }
1773
1774 type UsersDataSourcesDataPointChangesListCall struct {
1775 s *Service
1776 userId string
1777 dataSourceId string
1778 urlParams_ gensupport.URLParams
1779 ifNoneMatch_ string
1780 ctx_ context.Context
1781 header_ http.Header
1782 }
1783
1784
1785
1786
1787
1788
1789
1790 func (r *UsersDataSourcesDataPointChangesService) List(userId string, dataSourceId string) *UsersDataSourcesDataPointChangesListCall {
1791 c := &UsersDataSourcesDataPointChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1792 c.userId = userId
1793 c.dataSourceId = dataSourceId
1794 return c
1795 }
1796
1797
1798
1799 func (c *UsersDataSourcesDataPointChangesListCall) Limit(limit int64) *UsersDataSourcesDataPointChangesListCall {
1800 c.urlParams_.Set("limit", fmt.Sprint(limit))
1801 return c
1802 }
1803
1804
1805
1806
1807
1808 func (c *UsersDataSourcesDataPointChangesListCall) PageToken(pageToken string) *UsersDataSourcesDataPointChangesListCall {
1809 c.urlParams_.Set("pageToken", pageToken)
1810 return c
1811 }
1812
1813
1814
1815
1816 func (c *UsersDataSourcesDataPointChangesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesDataPointChangesListCall {
1817 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1818 return c
1819 }
1820
1821
1822
1823
1824 func (c *UsersDataSourcesDataPointChangesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesDataPointChangesListCall {
1825 c.ifNoneMatch_ = entityTag
1826 return c
1827 }
1828
1829
1830 func (c *UsersDataSourcesDataPointChangesListCall) Context(ctx context.Context) *UsersDataSourcesDataPointChangesListCall {
1831 c.ctx_ = ctx
1832 return c
1833 }
1834
1835
1836
1837 func (c *UsersDataSourcesDataPointChangesListCall) Header() http.Header {
1838 if c.header_ == nil {
1839 c.header_ = make(http.Header)
1840 }
1841 return c.header_
1842 }
1843
1844 func (c *UsersDataSourcesDataPointChangesListCall) doRequest(alt string) (*http.Response, error) {
1845 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1846 if c.ifNoneMatch_ != "" {
1847 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1848 }
1849 var body io.Reader = nil
1850 c.urlParams_.Set("alt", alt)
1851 c.urlParams_.Set("prettyPrint", "false")
1852 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/dataPointChanges")
1853 urls += "?" + c.urlParams_.Encode()
1854 req, err := http.NewRequest("GET", urls, body)
1855 if err != nil {
1856 return nil, err
1857 }
1858 req.Header = reqHeaders
1859 googleapi.Expand(req.URL, map[string]string{
1860 "userId": c.userId,
1861 "dataSourceId": c.dataSourceId,
1862 })
1863 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1864 }
1865
1866
1867
1868
1869
1870
1871
1872 func (c *UsersDataSourcesDataPointChangesListCall) Do(opts ...googleapi.CallOption) (*ListDataPointChangesResponse, error) {
1873 gensupport.SetOptions(c.urlParams_, opts...)
1874 res, err := c.doRequest("json")
1875 if res != nil && res.StatusCode == http.StatusNotModified {
1876 if res.Body != nil {
1877 res.Body.Close()
1878 }
1879 return nil, gensupport.WrapError(&googleapi.Error{
1880 Code: res.StatusCode,
1881 Header: res.Header,
1882 })
1883 }
1884 if err != nil {
1885 return nil, err
1886 }
1887 defer googleapi.CloseBody(res)
1888 if err := googleapi.CheckResponse(res); err != nil {
1889 return nil, gensupport.WrapError(err)
1890 }
1891 ret := &ListDataPointChangesResponse{
1892 ServerResponse: googleapi.ServerResponse{
1893 Header: res.Header,
1894 HTTPStatusCode: res.StatusCode,
1895 },
1896 }
1897 target := &ret
1898 if err := gensupport.DecodeResponse(target, res); err != nil {
1899 return nil, err
1900 }
1901 return ret, nil
1902 }
1903
1904
1905
1906
1907 func (c *UsersDataSourcesDataPointChangesListCall) Pages(ctx context.Context, f func(*ListDataPointChangesResponse) error) error {
1908 c.ctx_ = ctx
1909 defer c.PageToken(c.urlParams_.Get("pageToken"))
1910 for {
1911 x, err := c.Do()
1912 if err != nil {
1913 return err
1914 }
1915 if err := f(x); err != nil {
1916 return err
1917 }
1918 if x.NextPageToken == "" {
1919 return nil
1920 }
1921 c.PageToken(x.NextPageToken)
1922 }
1923 }
1924
1925 type UsersDataSourcesDatasetsDeleteCall struct {
1926 s *Service
1927 userId string
1928 dataSourceId string
1929 datasetId string
1930 urlParams_ gensupport.URLParams
1931 ctx_ context.Context
1932 header_ http.Header
1933 }
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950 func (r *UsersDataSourcesDatasetsService) Delete(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsDeleteCall {
1951 c := &UsersDataSourcesDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1952 c.userId = userId
1953 c.dataSourceId = dataSourceId
1954 c.datasetId = datasetId
1955 return c
1956 }
1957
1958
1959
1960
1961 func (c *UsersDataSourcesDatasetsDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsDeleteCall {
1962 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1963 return c
1964 }
1965
1966
1967 func (c *UsersDataSourcesDatasetsDeleteCall) Context(ctx context.Context) *UsersDataSourcesDatasetsDeleteCall {
1968 c.ctx_ = ctx
1969 return c
1970 }
1971
1972
1973
1974 func (c *UsersDataSourcesDatasetsDeleteCall) Header() http.Header {
1975 if c.header_ == nil {
1976 c.header_ = make(http.Header)
1977 }
1978 return c.header_
1979 }
1980
1981 func (c *UsersDataSourcesDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
1982 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1983 var body io.Reader = nil
1984 c.urlParams_.Set("alt", alt)
1985 c.urlParams_.Set("prettyPrint", "false")
1986 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
1987 urls += "?" + c.urlParams_.Encode()
1988 req, err := http.NewRequest("DELETE", urls, body)
1989 if err != nil {
1990 return nil, err
1991 }
1992 req.Header = reqHeaders
1993 googleapi.Expand(req.URL, map[string]string{
1994 "userId": c.userId,
1995 "dataSourceId": c.dataSourceId,
1996 "datasetId": c.datasetId,
1997 })
1998 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1999 }
2000
2001
2002 func (c *UsersDataSourcesDatasetsDeleteCall) Do(opts ...googleapi.CallOption) error {
2003 gensupport.SetOptions(c.urlParams_, opts...)
2004 res, err := c.doRequest("json")
2005 if err != nil {
2006 return err
2007 }
2008 defer googleapi.CloseBody(res)
2009 if err := googleapi.CheckResponse(res); err != nil {
2010 return gensupport.WrapError(err)
2011 }
2012 return nil
2013 }
2014
2015 type UsersDataSourcesDatasetsGetCall struct {
2016 s *Service
2017 userId string
2018 dataSourceId string
2019 datasetId string
2020 urlParams_ gensupport.URLParams
2021 ifNoneMatch_ string
2022 ctx_ context.Context
2023 header_ http.Header
2024 }
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040 func (r *UsersDataSourcesDatasetsService) Get(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsGetCall {
2041 c := &UsersDataSourcesDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2042 c.userId = userId
2043 c.dataSourceId = dataSourceId
2044 c.datasetId = datasetId
2045 return c
2046 }
2047
2048
2049
2050
2051
2052
2053 func (c *UsersDataSourcesDatasetsGetCall) Limit(limit int64) *UsersDataSourcesDatasetsGetCall {
2054 c.urlParams_.Set("limit", fmt.Sprint(limit))
2055 return c
2056 }
2057
2058
2059
2060
2061
2062
2063
2064 func (c *UsersDataSourcesDatasetsGetCall) PageToken(pageToken string) *UsersDataSourcesDatasetsGetCall {
2065 c.urlParams_.Set("pageToken", pageToken)
2066 return c
2067 }
2068
2069
2070
2071
2072 func (c *UsersDataSourcesDatasetsGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsGetCall {
2073 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2074 return c
2075 }
2076
2077
2078
2079
2080 func (c *UsersDataSourcesDatasetsGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesDatasetsGetCall {
2081 c.ifNoneMatch_ = entityTag
2082 return c
2083 }
2084
2085
2086 func (c *UsersDataSourcesDatasetsGetCall) Context(ctx context.Context) *UsersDataSourcesDatasetsGetCall {
2087 c.ctx_ = ctx
2088 return c
2089 }
2090
2091
2092
2093 func (c *UsersDataSourcesDatasetsGetCall) Header() http.Header {
2094 if c.header_ == nil {
2095 c.header_ = make(http.Header)
2096 }
2097 return c.header_
2098 }
2099
2100 func (c *UsersDataSourcesDatasetsGetCall) doRequest(alt string) (*http.Response, error) {
2101 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2102 if c.ifNoneMatch_ != "" {
2103 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2104 }
2105 var body io.Reader = nil
2106 c.urlParams_.Set("alt", alt)
2107 c.urlParams_.Set("prettyPrint", "false")
2108 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
2109 urls += "?" + c.urlParams_.Encode()
2110 req, err := http.NewRequest("GET", urls, body)
2111 if err != nil {
2112 return nil, err
2113 }
2114 req.Header = reqHeaders
2115 googleapi.Expand(req.URL, map[string]string{
2116 "userId": c.userId,
2117 "dataSourceId": c.dataSourceId,
2118 "datasetId": c.datasetId,
2119 })
2120 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2121 }
2122
2123
2124
2125
2126
2127
2128 func (c *UsersDataSourcesDatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
2129 gensupport.SetOptions(c.urlParams_, opts...)
2130 res, err := c.doRequest("json")
2131 if res != nil && res.StatusCode == http.StatusNotModified {
2132 if res.Body != nil {
2133 res.Body.Close()
2134 }
2135 return nil, gensupport.WrapError(&googleapi.Error{
2136 Code: res.StatusCode,
2137 Header: res.Header,
2138 })
2139 }
2140 if err != nil {
2141 return nil, err
2142 }
2143 defer googleapi.CloseBody(res)
2144 if err := googleapi.CheckResponse(res); err != nil {
2145 return nil, gensupport.WrapError(err)
2146 }
2147 ret := &Dataset{
2148 ServerResponse: googleapi.ServerResponse{
2149 Header: res.Header,
2150 HTTPStatusCode: res.StatusCode,
2151 },
2152 }
2153 target := &ret
2154 if err := gensupport.DecodeResponse(target, res); err != nil {
2155 return nil, err
2156 }
2157 return ret, nil
2158 }
2159
2160
2161
2162
2163 func (c *UsersDataSourcesDatasetsGetCall) Pages(ctx context.Context, f func(*Dataset) error) error {
2164 c.ctx_ = ctx
2165 defer c.PageToken(c.urlParams_.Get("pageToken"))
2166 for {
2167 x, err := c.Do()
2168 if err != nil {
2169 return err
2170 }
2171 if err := f(x); err != nil {
2172 return err
2173 }
2174 if x.NextPageToken == "" {
2175 return nil
2176 }
2177 c.PageToken(x.NextPageToken)
2178 }
2179 }
2180
2181 type UsersDataSourcesDatasetsPatchCall struct {
2182 s *Service
2183 userId string
2184 dataSourceId string
2185 datasetId string
2186 dataset *Dataset
2187 urlParams_ gensupport.URLParams
2188 ctx_ context.Context
2189 header_ http.Header
2190 }
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203 func (r *UsersDataSourcesDatasetsService) Patch(userId string, dataSourceId string, datasetId string, dataset *Dataset) *UsersDataSourcesDatasetsPatchCall {
2204 c := &UsersDataSourcesDatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2205 c.userId = userId
2206 c.dataSourceId = dataSourceId
2207 c.datasetId = datasetId
2208 c.dataset = dataset
2209 return c
2210 }
2211
2212
2213
2214
2215 func (c *UsersDataSourcesDatasetsPatchCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsPatchCall {
2216 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2217 return c
2218 }
2219
2220
2221 func (c *UsersDataSourcesDatasetsPatchCall) Context(ctx context.Context) *UsersDataSourcesDatasetsPatchCall {
2222 c.ctx_ = ctx
2223 return c
2224 }
2225
2226
2227
2228 func (c *UsersDataSourcesDatasetsPatchCall) Header() http.Header {
2229 if c.header_ == nil {
2230 c.header_ = make(http.Header)
2231 }
2232 return c.header_
2233 }
2234
2235 func (c *UsersDataSourcesDatasetsPatchCall) doRequest(alt string) (*http.Response, error) {
2236 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2237 var body io.Reader = nil
2238 body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
2239 if err != nil {
2240 return nil, err
2241 }
2242 c.urlParams_.Set("alt", alt)
2243 c.urlParams_.Set("prettyPrint", "false")
2244 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
2245 urls += "?" + c.urlParams_.Encode()
2246 req, err := http.NewRequest("PATCH", urls, body)
2247 if err != nil {
2248 return nil, err
2249 }
2250 req.Header = reqHeaders
2251 googleapi.Expand(req.URL, map[string]string{
2252 "userId": c.userId,
2253 "dataSourceId": c.dataSourceId,
2254 "datasetId": c.datasetId,
2255 })
2256 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2257 }
2258
2259
2260
2261
2262
2263
2264 func (c *UsersDataSourcesDatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
2265 gensupport.SetOptions(c.urlParams_, opts...)
2266 res, err := c.doRequest("json")
2267 if res != nil && res.StatusCode == http.StatusNotModified {
2268 if res.Body != nil {
2269 res.Body.Close()
2270 }
2271 return nil, gensupport.WrapError(&googleapi.Error{
2272 Code: res.StatusCode,
2273 Header: res.Header,
2274 })
2275 }
2276 if err != nil {
2277 return nil, err
2278 }
2279 defer googleapi.CloseBody(res)
2280 if err := googleapi.CheckResponse(res); err != nil {
2281 return nil, gensupport.WrapError(err)
2282 }
2283 ret := &Dataset{
2284 ServerResponse: googleapi.ServerResponse{
2285 Header: res.Header,
2286 HTTPStatusCode: res.StatusCode,
2287 },
2288 }
2289 target := &ret
2290 if err := gensupport.DecodeResponse(target, res); err != nil {
2291 return nil, err
2292 }
2293 return ret, nil
2294 }
2295
2296
2297
2298
2299 func (c *UsersDataSourcesDatasetsPatchCall) Pages(ctx context.Context, f func(*Dataset) error) error {
2300 c.ctx_ = ctx
2301 defer func(pt string) { c.dataset.NextPageToken = pt }(c.dataset.NextPageToken)
2302 for {
2303 x, err := c.Do()
2304 if err != nil {
2305 return err
2306 }
2307 if err := f(x); err != nil {
2308 return err
2309 }
2310 if x.NextPageToken == "" {
2311 return nil
2312 }
2313 c.dataset.NextPageToken = x.NextPageToken
2314 }
2315 }
2316
2317 type UsersDatasetAggregateCall struct {
2318 s *Service
2319 userId string
2320 aggregaterequest *AggregateRequest
2321 urlParams_ gensupport.URLParams
2322 ctx_ context.Context
2323 header_ http.Header
2324 }
2325
2326
2327
2328
2329
2330
2331
2332 func (r *UsersDatasetService) Aggregate(userId string, aggregaterequest *AggregateRequest) *UsersDatasetAggregateCall {
2333 c := &UsersDatasetAggregateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2334 c.userId = userId
2335 c.aggregaterequest = aggregaterequest
2336 return c
2337 }
2338
2339
2340
2341
2342 func (c *UsersDatasetAggregateCall) Fields(s ...googleapi.Field) *UsersDatasetAggregateCall {
2343 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2344 return c
2345 }
2346
2347
2348 func (c *UsersDatasetAggregateCall) Context(ctx context.Context) *UsersDatasetAggregateCall {
2349 c.ctx_ = ctx
2350 return c
2351 }
2352
2353
2354
2355 func (c *UsersDatasetAggregateCall) Header() http.Header {
2356 if c.header_ == nil {
2357 c.header_ = make(http.Header)
2358 }
2359 return c.header_
2360 }
2361
2362 func (c *UsersDatasetAggregateCall) doRequest(alt string) (*http.Response, error) {
2363 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2364 var body io.Reader = nil
2365 body, err := googleapi.WithoutDataWrapper.JSONReader(c.aggregaterequest)
2366 if err != nil {
2367 return nil, err
2368 }
2369 c.urlParams_.Set("alt", alt)
2370 c.urlParams_.Set("prettyPrint", "false")
2371 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataset:aggregate")
2372 urls += "?" + c.urlParams_.Encode()
2373 req, err := http.NewRequest("POST", urls, body)
2374 if err != nil {
2375 return nil, err
2376 }
2377 req.Header = reqHeaders
2378 googleapi.Expand(req.URL, map[string]string{
2379 "userId": c.userId,
2380 })
2381 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2382 }
2383
2384
2385
2386
2387
2388
2389
2390 func (c *UsersDatasetAggregateCall) Do(opts ...googleapi.CallOption) (*AggregateResponse, error) {
2391 gensupport.SetOptions(c.urlParams_, opts...)
2392 res, err := c.doRequest("json")
2393 if res != nil && res.StatusCode == http.StatusNotModified {
2394 if res.Body != nil {
2395 res.Body.Close()
2396 }
2397 return nil, gensupport.WrapError(&googleapi.Error{
2398 Code: res.StatusCode,
2399 Header: res.Header,
2400 })
2401 }
2402 if err != nil {
2403 return nil, err
2404 }
2405 defer googleapi.CloseBody(res)
2406 if err := googleapi.CheckResponse(res); err != nil {
2407 return nil, gensupport.WrapError(err)
2408 }
2409 ret := &AggregateResponse{
2410 ServerResponse: googleapi.ServerResponse{
2411 Header: res.Header,
2412 HTTPStatusCode: res.StatusCode,
2413 },
2414 }
2415 target := &ret
2416 if err := gensupport.DecodeResponse(target, res); err != nil {
2417 return nil, err
2418 }
2419 return ret, nil
2420 }
2421
2422 type UsersSessionsDeleteCall struct {
2423 s *Service
2424 userId string
2425 sessionId string
2426 urlParams_ gensupport.URLParams
2427 ctx_ context.Context
2428 header_ http.Header
2429 }
2430
2431
2432
2433
2434
2435
2436 func (r *UsersSessionsService) Delete(userId string, sessionId string) *UsersSessionsDeleteCall {
2437 c := &UsersSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2438 c.userId = userId
2439 c.sessionId = sessionId
2440 return c
2441 }
2442
2443
2444
2445
2446 func (c *UsersSessionsDeleteCall) Fields(s ...googleapi.Field) *UsersSessionsDeleteCall {
2447 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2448 return c
2449 }
2450
2451
2452 func (c *UsersSessionsDeleteCall) Context(ctx context.Context) *UsersSessionsDeleteCall {
2453 c.ctx_ = ctx
2454 return c
2455 }
2456
2457
2458
2459 func (c *UsersSessionsDeleteCall) Header() http.Header {
2460 if c.header_ == nil {
2461 c.header_ = make(http.Header)
2462 }
2463 return c.header_
2464 }
2465
2466 func (c *UsersSessionsDeleteCall) doRequest(alt string) (*http.Response, error) {
2467 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2468 var body io.Reader = nil
2469 c.urlParams_.Set("alt", alt)
2470 c.urlParams_.Set("prettyPrint", "false")
2471 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}")
2472 urls += "?" + c.urlParams_.Encode()
2473 req, err := http.NewRequest("DELETE", urls, body)
2474 if err != nil {
2475 return nil, err
2476 }
2477 req.Header = reqHeaders
2478 googleapi.Expand(req.URL, map[string]string{
2479 "userId": c.userId,
2480 "sessionId": c.sessionId,
2481 })
2482 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2483 }
2484
2485
2486 func (c *UsersSessionsDeleteCall) Do(opts ...googleapi.CallOption) error {
2487 gensupport.SetOptions(c.urlParams_, opts...)
2488 res, err := c.doRequest("json")
2489 if err != nil {
2490 return err
2491 }
2492 defer googleapi.CloseBody(res)
2493 if err := googleapi.CheckResponse(res); err != nil {
2494 return gensupport.WrapError(err)
2495 }
2496 return nil
2497 }
2498
2499 type UsersSessionsListCall struct {
2500 s *Service
2501 userId string
2502 urlParams_ gensupport.URLParams
2503 ifNoneMatch_ string
2504 ctx_ context.Context
2505 header_ http.Header
2506 }
2507
2508
2509
2510
2511
2512 func (r *UsersSessionsService) List(userId string) *UsersSessionsListCall {
2513 c := &UsersSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2514 c.userId = userId
2515 return c
2516 }
2517
2518
2519
2520 func (c *UsersSessionsListCall) ActivityType(activityType ...int64) *UsersSessionsListCall {
2521 var activityType_ []string
2522 for _, v := range activityType {
2523 activityType_ = append(activityType_, fmt.Sprint(v))
2524 }
2525 c.urlParams_.SetMulti("activityType", activityType_)
2526 return c
2527 }
2528
2529
2530
2531
2532
2533 func (c *UsersSessionsListCall) EndTime(endTime string) *UsersSessionsListCall {
2534 c.urlParams_.Set("endTime", endTime)
2535 return c
2536 }
2537
2538
2539
2540 func (c *UsersSessionsListCall) IncludeDeleted(includeDeleted bool) *UsersSessionsListCall {
2541 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
2542 return c
2543 }
2544
2545
2546
2547
2548
2549
2550
2551 func (c *UsersSessionsListCall) PageToken(pageToken string) *UsersSessionsListCall {
2552 c.urlParams_.Set("pageToken", pageToken)
2553 return c
2554 }
2555
2556
2557
2558
2559
2560 func (c *UsersSessionsListCall) StartTime(startTime string) *UsersSessionsListCall {
2561 c.urlParams_.Set("startTime", startTime)
2562 return c
2563 }
2564
2565
2566
2567
2568 func (c *UsersSessionsListCall) Fields(s ...googleapi.Field) *UsersSessionsListCall {
2569 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2570 return c
2571 }
2572
2573
2574
2575
2576 func (c *UsersSessionsListCall) IfNoneMatch(entityTag string) *UsersSessionsListCall {
2577 c.ifNoneMatch_ = entityTag
2578 return c
2579 }
2580
2581
2582 func (c *UsersSessionsListCall) Context(ctx context.Context) *UsersSessionsListCall {
2583 c.ctx_ = ctx
2584 return c
2585 }
2586
2587
2588
2589 func (c *UsersSessionsListCall) Header() http.Header {
2590 if c.header_ == nil {
2591 c.header_ = make(http.Header)
2592 }
2593 return c.header_
2594 }
2595
2596 func (c *UsersSessionsListCall) doRequest(alt string) (*http.Response, error) {
2597 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2598 if c.ifNoneMatch_ != "" {
2599 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2600 }
2601 var body io.Reader = nil
2602 c.urlParams_.Set("alt", alt)
2603 c.urlParams_.Set("prettyPrint", "false")
2604 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions")
2605 urls += "?" + c.urlParams_.Encode()
2606 req, err := http.NewRequest("GET", urls, body)
2607 if err != nil {
2608 return nil, err
2609 }
2610 req.Header = reqHeaders
2611 googleapi.Expand(req.URL, map[string]string{
2612 "userId": c.userId,
2613 })
2614 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2615 }
2616
2617
2618
2619
2620
2621
2622
2623 func (c *UsersSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) {
2624 gensupport.SetOptions(c.urlParams_, opts...)
2625 res, err := c.doRequest("json")
2626 if res != nil && res.StatusCode == http.StatusNotModified {
2627 if res.Body != nil {
2628 res.Body.Close()
2629 }
2630 return nil, gensupport.WrapError(&googleapi.Error{
2631 Code: res.StatusCode,
2632 Header: res.Header,
2633 })
2634 }
2635 if err != nil {
2636 return nil, err
2637 }
2638 defer googleapi.CloseBody(res)
2639 if err := googleapi.CheckResponse(res); err != nil {
2640 return nil, gensupport.WrapError(err)
2641 }
2642 ret := &ListSessionsResponse{
2643 ServerResponse: googleapi.ServerResponse{
2644 Header: res.Header,
2645 HTTPStatusCode: res.StatusCode,
2646 },
2647 }
2648 target := &ret
2649 if err := gensupport.DecodeResponse(target, res); err != nil {
2650 return nil, err
2651 }
2652 return ret, nil
2653 }
2654
2655
2656
2657
2658 func (c *UsersSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error {
2659 c.ctx_ = ctx
2660 defer c.PageToken(c.urlParams_.Get("pageToken"))
2661 for {
2662 x, err := c.Do()
2663 if err != nil {
2664 return err
2665 }
2666 if err := f(x); err != nil {
2667 return err
2668 }
2669 if x.NextPageToken == "" {
2670 return nil
2671 }
2672 c.PageToken(x.NextPageToken)
2673 }
2674 }
2675
2676 type UsersSessionsUpdateCall struct {
2677 s *Service
2678 userId string
2679 sessionId string
2680 session *Session
2681 urlParams_ gensupport.URLParams
2682 ctx_ context.Context
2683 header_ http.Header
2684 }
2685
2686
2687
2688
2689
2690
2691 func (r *UsersSessionsService) Update(userId string, sessionId string, session *Session) *UsersSessionsUpdateCall {
2692 c := &UsersSessionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2693 c.userId = userId
2694 c.sessionId = sessionId
2695 c.session = session
2696 return c
2697 }
2698
2699
2700
2701
2702 func (c *UsersSessionsUpdateCall) Fields(s ...googleapi.Field) *UsersSessionsUpdateCall {
2703 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2704 return c
2705 }
2706
2707
2708 func (c *UsersSessionsUpdateCall) Context(ctx context.Context) *UsersSessionsUpdateCall {
2709 c.ctx_ = ctx
2710 return c
2711 }
2712
2713
2714
2715 func (c *UsersSessionsUpdateCall) Header() http.Header {
2716 if c.header_ == nil {
2717 c.header_ = make(http.Header)
2718 }
2719 return c.header_
2720 }
2721
2722 func (c *UsersSessionsUpdateCall) doRequest(alt string) (*http.Response, error) {
2723 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2724 var body io.Reader = nil
2725 body, err := googleapi.WithoutDataWrapper.JSONReader(c.session)
2726 if err != nil {
2727 return nil, err
2728 }
2729 c.urlParams_.Set("alt", alt)
2730 c.urlParams_.Set("prettyPrint", "false")
2731 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}")
2732 urls += "?" + c.urlParams_.Encode()
2733 req, err := http.NewRequest("PUT", urls, body)
2734 if err != nil {
2735 return nil, err
2736 }
2737 req.Header = reqHeaders
2738 googleapi.Expand(req.URL, map[string]string{
2739 "userId": c.userId,
2740 "sessionId": c.sessionId,
2741 })
2742 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2743 }
2744
2745
2746
2747
2748
2749
2750 func (c *UsersSessionsUpdateCall) Do(opts ...googleapi.CallOption) (*Session, error) {
2751 gensupport.SetOptions(c.urlParams_, opts...)
2752 res, err := c.doRequest("json")
2753 if res != nil && res.StatusCode == http.StatusNotModified {
2754 if res.Body != nil {
2755 res.Body.Close()
2756 }
2757 return nil, gensupport.WrapError(&googleapi.Error{
2758 Code: res.StatusCode,
2759 Header: res.Header,
2760 })
2761 }
2762 if err != nil {
2763 return nil, err
2764 }
2765 defer googleapi.CloseBody(res)
2766 if err := googleapi.CheckResponse(res); err != nil {
2767 return nil, gensupport.WrapError(err)
2768 }
2769 ret := &Session{
2770 ServerResponse: googleapi.ServerResponse{
2771 Header: res.Header,
2772 HTTPStatusCode: res.StatusCode,
2773 },
2774 }
2775 target := &ret
2776 if err := gensupport.DecodeResponse(target, res); err != nil {
2777 return nil, err
2778 }
2779 return ret, nil
2780 }
2781
View as plain text