You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3710 lines
139 KiB

  1. // Package fitness provides access to the Fitness.
  2. //
  3. // See https://developers.google.com/fit/rest/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/fitness/v1"
  8. // ...
  9. // fitnessService, err := fitness.New(oauthHttpClient)
  10. package fitness // import "google.golang.org/api/fitness/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "fitness:v1"
  41. const apiName = "fitness"
  42. const apiVersion = "v1"
  43. const basePath = "https://www.googleapis.com/fitness/v1/users/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View your activity information in Google Fit
  47. FitnessActivityReadScope = "https://www.googleapis.com/auth/fitness.activity.read"
  48. // View and store your activity information in Google Fit
  49. FitnessActivityWriteScope = "https://www.googleapis.com/auth/fitness.activity.write"
  50. // View blood glucose data in Google Fit
  51. FitnessBloodGlucoseReadScope = "https://www.googleapis.com/auth/fitness.blood_glucose.read"
  52. // View and store blood glucose data in Google Fit
  53. FitnessBloodGlucoseWriteScope = "https://www.googleapis.com/auth/fitness.blood_glucose.write"
  54. // View blood pressure data in Google Fit
  55. FitnessBloodPressureReadScope = "https://www.googleapis.com/auth/fitness.blood_pressure.read"
  56. // View and store blood pressure data in Google Fit
  57. FitnessBloodPressureWriteScope = "https://www.googleapis.com/auth/fitness.blood_pressure.write"
  58. // View body sensor information in Google Fit
  59. FitnessBodyReadScope = "https://www.googleapis.com/auth/fitness.body.read"
  60. // View and store body sensor data in Google Fit
  61. FitnessBodyWriteScope = "https://www.googleapis.com/auth/fitness.body.write"
  62. // View body temperature data in Google Fit
  63. FitnessBodyTemperatureReadScope = "https://www.googleapis.com/auth/fitness.body_temperature.read"
  64. // View and store body temperature data in Google Fit
  65. FitnessBodyTemperatureWriteScope = "https://www.googleapis.com/auth/fitness.body_temperature.write"
  66. // View your stored location data in Google Fit
  67. FitnessLocationReadScope = "https://www.googleapis.com/auth/fitness.location.read"
  68. // View and store your location data in Google Fit
  69. FitnessLocationWriteScope = "https://www.googleapis.com/auth/fitness.location.write"
  70. // View nutrition information in Google Fit
  71. FitnessNutritionReadScope = "https://www.googleapis.com/auth/fitness.nutrition.read"
  72. // View and store nutrition information in Google Fit
  73. FitnessNutritionWriteScope = "https://www.googleapis.com/auth/fitness.nutrition.write"
  74. // View oxygen saturation data in Google Fit
  75. FitnessOxygenSaturationReadScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.read"
  76. // View and store oxygen saturation data in Google Fit
  77. FitnessOxygenSaturationWriteScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.write"
  78. // View reproductive health data in Google Fit
  79. FitnessReproductiveHealthReadScope = "https://www.googleapis.com/auth/fitness.reproductive_health.read"
  80. // View and store reproductive health data in Google Fit
  81. FitnessReproductiveHealthWriteScope = "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  82. )
  83. func New(client *http.Client) (*Service, error) {
  84. if client == nil {
  85. return nil, errors.New("client is nil")
  86. }
  87. s := &Service{client: client, BasePath: basePath}
  88. s.Users = NewUsersService(s)
  89. return s, nil
  90. }
  91. type Service struct {
  92. client *http.Client
  93. BasePath string // API endpoint base URL
  94. UserAgent string // optional additional User-Agent fragment
  95. Users *UsersService
  96. }
  97. func (s *Service) userAgent() string {
  98. if s.UserAgent == "" {
  99. return googleapi.UserAgent
  100. }
  101. return googleapi.UserAgent + " " + s.UserAgent
  102. }
  103. func NewUsersService(s *Service) *UsersService {
  104. rs := &UsersService{s: s}
  105. rs.DataSources = NewUsersDataSourcesService(s)
  106. rs.Dataset = NewUsersDatasetService(s)
  107. rs.Sessions = NewUsersSessionsService(s)
  108. return rs
  109. }
  110. type UsersService struct {
  111. s *Service
  112. DataSources *UsersDataSourcesService
  113. Dataset *UsersDatasetService
  114. Sessions *UsersSessionsService
  115. }
  116. func NewUsersDataSourcesService(s *Service) *UsersDataSourcesService {
  117. rs := &UsersDataSourcesService{s: s}
  118. rs.DataPointChanges = NewUsersDataSourcesDataPointChangesService(s)
  119. rs.Datasets = NewUsersDataSourcesDatasetsService(s)
  120. return rs
  121. }
  122. type UsersDataSourcesService struct {
  123. s *Service
  124. DataPointChanges *UsersDataSourcesDataPointChangesService
  125. Datasets *UsersDataSourcesDatasetsService
  126. }
  127. func NewUsersDataSourcesDataPointChangesService(s *Service) *UsersDataSourcesDataPointChangesService {
  128. rs := &UsersDataSourcesDataPointChangesService{s: s}
  129. return rs
  130. }
  131. type UsersDataSourcesDataPointChangesService struct {
  132. s *Service
  133. }
  134. func NewUsersDataSourcesDatasetsService(s *Service) *UsersDataSourcesDatasetsService {
  135. rs := &UsersDataSourcesDatasetsService{s: s}
  136. return rs
  137. }
  138. type UsersDataSourcesDatasetsService struct {
  139. s *Service
  140. }
  141. func NewUsersDatasetService(s *Service) *UsersDatasetService {
  142. rs := &UsersDatasetService{s: s}
  143. return rs
  144. }
  145. type UsersDatasetService struct {
  146. s *Service
  147. }
  148. func NewUsersSessionsService(s *Service) *UsersSessionsService {
  149. rs := &UsersSessionsService{s: s}
  150. return rs
  151. }
  152. type UsersSessionsService struct {
  153. s *Service
  154. }
  155. type AggregateBucket struct {
  156. // Activity: Available for Bucket.Type.ACTIVITY_TYPE,
  157. // Bucket.Type.ACTIVITY_SEGMENT
  158. Activity int64 `json:"activity,omitempty"`
  159. // Dataset: There will be one dataset per AggregateBy in the request.
  160. Dataset []*Dataset `json:"dataset,omitempty"`
  161. // EndTimeMillis: The end time for the aggregated data, in milliseconds
  162. // since epoch, inclusive.
  163. EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
  164. // Session: Available for Bucket.Type.SESSION
  165. Session *Session `json:"session,omitempty"`
  166. // StartTimeMillis: The start time for the aggregated data, in
  167. // milliseconds since epoch, inclusive.
  168. StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
  169. // Type: The type of a bucket signifies how the data aggregation is
  170. // performed in the bucket.
  171. //
  172. // Possible values:
  173. // "activitySegment"
  174. // "activityType"
  175. // "session"
  176. // "time"
  177. // "unknown"
  178. Type string `json:"type,omitempty"`
  179. // ForceSendFields is a list of field names (e.g. "Activity") to
  180. // unconditionally include in API requests. By default, fields with
  181. // empty values are omitted from API requests. However, any non-pointer,
  182. // non-interface field appearing in ForceSendFields will be sent to the
  183. // server regardless of whether the field is empty or not. This may be
  184. // used to include empty fields in Patch requests.
  185. ForceSendFields []string `json:"-"`
  186. // NullFields is a list of field names (e.g. "Activity") to include in
  187. // API requests with the JSON null value. By default, fields with empty
  188. // values are omitted from API requests. However, any field with an
  189. // empty value appearing in NullFields will be sent to the server as
  190. // null. It is an error if a field in this list has a non-empty value.
  191. // This may be used to include null fields in Patch requests.
  192. NullFields []string `json:"-"`
  193. }
  194. func (s *AggregateBucket) MarshalJSON() ([]byte, error) {
  195. type NoMethod AggregateBucket
  196. raw := NoMethod(*s)
  197. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  198. }
  199. // AggregateBy: The specification of which data to aggregate.
  200. type AggregateBy struct {
  201. // DataSourceId: A data source ID to aggregate. Mutually exclusive of
  202. // dataTypeName. Only data from the specified data source ID will be
  203. // included in the aggregation. The dataset in the response will have
  204. // the same data source ID.
  205. DataSourceId string `json:"dataSourceId,omitempty"`
  206. // DataTypeName: The data type to aggregate. All data sources providing
  207. // this data type will contribute data to the aggregation. The response
  208. // will contain a single dataset for this data type name. The dataset
  209. // will have a data source ID of
  210. // derived:com.google.:com.google.android.gms:aggregated
  211. DataTypeName string `json:"dataTypeName,omitempty"`
  212. // ForceSendFields is a list of field names (e.g. "DataSourceId") to
  213. // unconditionally include in API requests. By default, fields with
  214. // empty values are omitted from API requests. However, any non-pointer,
  215. // non-interface field appearing in ForceSendFields will be sent to the
  216. // server regardless of whether the field is empty or not. This may be
  217. // used to include empty fields in Patch requests.
  218. ForceSendFields []string `json:"-"`
  219. // NullFields is a list of field names (e.g. "DataSourceId") to include
  220. // in API requests with the JSON null value. By default, fields with
  221. // empty values are omitted from API requests. However, any field with
  222. // an empty value appearing in NullFields will be sent to the server as
  223. // null. It is an error if a field in this list has a non-empty value.
  224. // This may be used to include null fields in Patch requests.
  225. NullFields []string `json:"-"`
  226. }
  227. func (s *AggregateBy) MarshalJSON() ([]byte, error) {
  228. type NoMethod AggregateBy
  229. raw := NoMethod(*s)
  230. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  231. }
  232. // AggregateRequest: Next id: 10
  233. type AggregateRequest struct {
  234. // AggregateBy: The specification of data to be aggregated. At least one
  235. // aggregateBy spec must be provided. All data that is specified will be
  236. // aggregated using the same bucketing criteria. There will be one
  237. // dataset in the response for every aggregateBy spec.
  238. AggregateBy []*AggregateBy `json:"aggregateBy,omitempty"`
  239. // BucketByActivitySegment: Specifies that data be aggregated each
  240. // activity segment recored for a user. Similar to
  241. // bucketByActivitySegment, but bucketing is done for each activity
  242. // segment rather than all segments of the same type. Mutually exclusive
  243. // of other bucketing specifications.
  244. BucketByActivitySegment *BucketByActivity `json:"bucketByActivitySegment,omitempty"`
  245. // BucketByActivityType: Specifies that data be aggregated by the type
  246. // of activity being performed when the data was recorded. All data that
  247. // was recorded during a certain activity type (for the given time
  248. // range) will be aggregated into the same bucket. Data that was
  249. // recorded while the user was not active will not be included in the
  250. // response. Mutually exclusive of other bucketing specifications.
  251. BucketByActivityType *BucketByActivity `json:"bucketByActivityType,omitempty"`
  252. // BucketBySession: Specifies that data be aggregated by user sessions.
  253. // Data that does not fall within the time range of a session will not
  254. // be included in the response. Mutually exclusive of other bucketing
  255. // specifications.
  256. BucketBySession *BucketBySession `json:"bucketBySession,omitempty"`
  257. // BucketByTime: Specifies that data be aggregated by a single time
  258. // interval. Mutually exclusive of other bucketing specifications.
  259. BucketByTime *BucketByTime `json:"bucketByTime,omitempty"`
  260. // EndTimeMillis: The end of a window of time. Data that intersects with
  261. // this time window will be aggregated. The time is in milliseconds
  262. // since epoch, inclusive.
  263. EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
  264. // FilteredDataQualityStandard: A list of acceptable data quality
  265. // standards. Only data points which conform to at least one of the
  266. // specified data quality standards will be returned. If the list is
  267. // empty, all data points are returned.
  268. //
  269. // Possible values:
  270. // "dataQualityBloodGlucoseIso151972003"
  271. // "dataQualityBloodGlucoseIso151972013"
  272. // "dataQualityBloodPressureAami"
  273. // "dataQualityBloodPressureBhsAA"
  274. // "dataQualityBloodPressureBhsAB"
  275. // "dataQualityBloodPressureBhsBA"
  276. // "dataQualityBloodPressureBhsBB"
  277. // "dataQualityBloodPressureEsh2002"
  278. // "dataQualityBloodPressureEsh2010"
  279. // "dataQualityUnknown"
  280. FilteredDataQualityStandard []string `json:"filteredDataQualityStandard,omitempty"`
  281. // StartTimeMillis: The start of a window of time. Data that intersects
  282. // with this time window will be aggregated. The time is in milliseconds
  283. // since epoch, inclusive.
  284. StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
  285. // ForceSendFields is a list of field names (e.g. "AggregateBy") to
  286. // unconditionally include in API requests. By default, fields with
  287. // empty values are omitted from API requests. However, any non-pointer,
  288. // non-interface field appearing in ForceSendFields will be sent to the
  289. // server regardless of whether the field is empty or not. This may be
  290. // used to include empty fields in Patch requests.
  291. ForceSendFields []string `json:"-"`
  292. // NullFields is a list of field names (e.g. "AggregateBy") to include
  293. // in API requests with the JSON null value. By default, fields with
  294. // empty values are omitted from API requests. However, any field with
  295. // an empty value appearing in NullFields will be sent to the server as
  296. // null. It is an error if a field in this list has a non-empty value.
  297. // This may be used to include null fields in Patch requests.
  298. NullFields []string `json:"-"`
  299. }
  300. func (s *AggregateRequest) MarshalJSON() ([]byte, error) {
  301. type NoMethod AggregateRequest
  302. raw := NoMethod(*s)
  303. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  304. }
  305. type AggregateResponse struct {
  306. // Bucket: A list of buckets containing the aggregated data.
  307. Bucket []*AggregateBucket `json:"bucket,omitempty"`
  308. // ServerResponse contains the HTTP response code and headers from the
  309. // server.
  310. googleapi.ServerResponse `json:"-"`
  311. // ForceSendFields is a list of field names (e.g. "Bucket") to
  312. // unconditionally include in API requests. By default, fields with
  313. // empty values are omitted from API requests. However, any non-pointer,
  314. // non-interface field appearing in ForceSendFields will be sent to the
  315. // server regardless of whether the field is empty or not. This may be
  316. // used to include empty fields in Patch requests.
  317. ForceSendFields []string `json:"-"`
  318. // NullFields is a list of field names (e.g. "Bucket") to include in API
  319. // requests with the JSON null value. By default, fields with empty
  320. // values are omitted from API requests. However, any field with an
  321. // empty value appearing in NullFields will be sent to the server as
  322. // null. It is an error if a field in this list has a non-empty value.
  323. // This may be used to include null fields in Patch requests.
  324. NullFields []string `json:"-"`
  325. }
  326. func (s *AggregateResponse) MarshalJSON() ([]byte, error) {
  327. type NoMethod AggregateResponse
  328. raw := NoMethod(*s)
  329. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  330. }
  331. type Application struct {
  332. // DetailsUrl: An optional URI that can be used to link back to the
  333. // application.
  334. DetailsUrl string `json:"detailsUrl,omitempty"`
  335. // Name: The name of this application. This is required for REST
  336. // clients, but we do not enforce uniqueness of this name. It is
  337. // provided as a matter of convenience for other developers who would
  338. // like to identify which REST created an Application or Data Source.
  339. Name string `json:"name,omitempty"`
  340. // PackageName: Package name for this application. This is used as a
  341. // unique identifier when created by Android applications, but cannot be
  342. // specified by REST clients. REST clients will have their developer
  343. // project number reflected into the Data Source data stream IDs,
  344. // instead of the packageName.
  345. PackageName string `json:"packageName,omitempty"`
  346. // Version: Version of the application. You should update this field
  347. // whenever the application changes in a way that affects the
  348. // computation of the data.
  349. Version string `json:"version,omitempty"`
  350. // ForceSendFields is a list of field names (e.g. "DetailsUrl") to
  351. // unconditionally include in API requests. By default, fields with
  352. // empty values are omitted from API requests. However, any non-pointer,
  353. // non-interface field appearing in ForceSendFields will be sent to the
  354. // server regardless of whether the field is empty or not. This may be
  355. // used to include empty fields in Patch requests.
  356. ForceSendFields []string `json:"-"`
  357. // NullFields is a list of field names (e.g. "DetailsUrl") to include in
  358. // API requests with the JSON null value. By default, fields with empty
  359. // values are omitted from API requests. However, any field with an
  360. // empty value appearing in NullFields will be sent to the server as
  361. // null. It is an error if a field in this list has a non-empty value.
  362. // This may be used to include null fields in Patch requests.
  363. NullFields []string `json:"-"`
  364. }
  365. func (s *Application) MarshalJSON() ([]byte, error) {
  366. type NoMethod Application
  367. raw := NoMethod(*s)
  368. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  369. }
  370. type BucketByActivity struct {
  371. // ActivityDataSourceId: The default activity stream will be used if a
  372. // specific activityDataSourceId is not specified.
  373. ActivityDataSourceId string `json:"activityDataSourceId,omitempty"`
  374. // MinDurationMillis: Specifies that only activity segments of duration
  375. // longer than minDurationMillis are considered and used as a container
  376. // for aggregated data.
  377. MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"`
  378. // ForceSendFields is a list of field names (e.g.
  379. // "ActivityDataSourceId") to unconditionally include in API requests.
  380. // By default, fields with empty values are omitted from API requests.
  381. // However, any non-pointer, non-interface field appearing in
  382. // ForceSendFields will be sent to the server regardless of whether the
  383. // field is empty or not. This may be used to include empty fields in
  384. // Patch requests.
  385. ForceSendFields []string `json:"-"`
  386. // NullFields is a list of field names (e.g. "ActivityDataSourceId") to
  387. // include in API requests with the JSON null value. By default, fields
  388. // with empty values are omitted from API requests. However, any field
  389. // with an empty value appearing in NullFields will be sent to the
  390. // server as null. It is an error if a field in this list has a
  391. // non-empty value. This may be used to include null fields in Patch
  392. // requests.
  393. NullFields []string `json:"-"`
  394. }
  395. func (s *BucketByActivity) MarshalJSON() ([]byte, error) {
  396. type NoMethod BucketByActivity
  397. raw := NoMethod(*s)
  398. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  399. }
  400. type BucketBySession struct {
  401. // MinDurationMillis: Specifies that only sessions of duration longer
  402. // than minDurationMillis are considered and used as a container for
  403. // aggregated data.
  404. MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"`
  405. // ForceSendFields is a list of field names (e.g. "MinDurationMillis")
  406. // to unconditionally include in API requests. By default, fields with
  407. // empty values are omitted from API requests. However, any non-pointer,
  408. // non-interface field appearing in ForceSendFields will be sent to the
  409. // server regardless of whether the field is empty or not. This may be
  410. // used to include empty fields in Patch requests.
  411. ForceSendFields []string `json:"-"`
  412. // NullFields is a list of field names (e.g. "MinDurationMillis") to
  413. // include in API requests with the JSON null value. By default, fields
  414. // with empty values are omitted from API requests. However, any field
  415. // with an empty value appearing in NullFields will be sent to the
  416. // server as null. It is an error if a field in this list has a
  417. // non-empty value. This may be used to include null fields in Patch
  418. // requests.
  419. NullFields []string `json:"-"`
  420. }
  421. func (s *BucketBySession) MarshalJSON() ([]byte, error) {
  422. type NoMethod BucketBySession
  423. raw := NoMethod(*s)
  424. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  425. }
  426. type BucketByTime struct {
  427. // DurationMillis: Specifies that result buckets aggregate data by
  428. // exactly durationMillis time frames. Time frames that contain no data
  429. // will be included in the response with an empty dataset.
  430. DurationMillis int64 `json:"durationMillis,omitempty,string"`
  431. Period *BucketByTimePeriod `json:"period,omitempty"`
  432. // ForceSendFields is a list of field names (e.g. "DurationMillis") to
  433. // unconditionally include in API requests. By default, fields with
  434. // empty values are omitted from API requests. However, any non-pointer,
  435. // non-interface field appearing in ForceSendFields will be sent to the
  436. // server regardless of whether the field is empty or not. This may be
  437. // used to include empty fields in Patch requests.
  438. ForceSendFields []string `json:"-"`
  439. // NullFields is a list of field names (e.g. "DurationMillis") to
  440. // include in API requests with the JSON null value. By default, fields
  441. // with empty values are omitted from API requests. However, any field
  442. // with an empty value appearing in NullFields will be sent to the
  443. // server as null. It is an error if a field in this list has a
  444. // non-empty value. This may be used to include null fields in Patch
  445. // requests.
  446. NullFields []string `json:"-"`
  447. }
  448. func (s *BucketByTime) MarshalJSON() ([]byte, error) {
  449. type NoMethod BucketByTime
  450. raw := NoMethod(*s)
  451. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  452. }
  453. type BucketByTimePeriod struct {
  454. // TimeZoneId: org.joda.timezone.DateTimeZone
  455. TimeZoneId string `json:"timeZoneId,omitempty"`
  456. // Possible values:
  457. // "day"
  458. // "month"
  459. // "week"
  460. Type string `json:"type,omitempty"`
  461. Value int64 `json:"value,omitempty"`
  462. // ForceSendFields is a list of field names (e.g. "TimeZoneId") to
  463. // unconditionally include in API requests. By default, fields with
  464. // empty values are omitted from API requests. However, any non-pointer,
  465. // non-interface field appearing in ForceSendFields will be sent to the
  466. // server regardless of whether the field is empty or not. This may be
  467. // used to include empty fields in Patch requests.
  468. ForceSendFields []string `json:"-"`
  469. // NullFields is a list of field names (e.g. "TimeZoneId") to include in
  470. // API requests with the JSON null value. By default, fields with empty
  471. // values are omitted from API requests. However, any field with an
  472. // empty value appearing in NullFields will be sent to the server as
  473. // null. It is an error if a field in this list has a non-empty value.
  474. // This may be used to include null fields in Patch requests.
  475. NullFields []string `json:"-"`
  476. }
  477. func (s *BucketByTimePeriod) MarshalJSON() ([]byte, error) {
  478. type NoMethod BucketByTimePeriod
  479. raw := NoMethod(*s)
  480. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  481. }
  482. // DataPoint: Represents a single data point, generated by a particular
  483. // data source. A data point holds a value for each field, an end
  484. // timestamp and an optional start time. The exact semantics of each of
  485. // these attributes are specified in the documentation for the
  486. // particular data type.
  487. //
  488. // A data point can represent an instantaneous measurement, reading or
  489. // input observation, as well as averages or aggregates over a time
  490. // interval. Check the data type documentation to determine which is the
  491. // case for a particular data type.
  492. //
  493. // Data points always contain one value for each field of the data type.
  494. type DataPoint struct {
  495. // ComputationTimeMillis: Used for version checking during
  496. // transformation; that is, a datapoint can only replace another
  497. // datapoint that has an older computation time stamp.
  498. ComputationTimeMillis int64 `json:"computationTimeMillis,omitempty,string"`
  499. // DataTypeName: The data type defining the format of the values in this
  500. // data point.
  501. DataTypeName string `json:"dataTypeName,omitempty"`
  502. // EndTimeNanos: The end time of the interval represented by this data
  503. // point, in nanoseconds since epoch.
  504. EndTimeNanos int64 `json:"endTimeNanos,omitempty,string"`
  505. // ModifiedTimeMillis: Indicates the last time this data point was
  506. // modified. Useful only in contexts where we are listing the data
  507. // changes, rather than representing the current state of the data.
  508. ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"`
  509. // OriginDataSourceId: If the data point is contained in a dataset for a
  510. // derived data source, this field will be populated with the data
  511. // source stream ID that created the data point originally.
  512. OriginDataSourceId string `json:"originDataSourceId,omitempty"`
  513. // RawTimestampNanos: The raw timestamp from the original SensorEvent.
  514. RawTimestampNanos int64 `json:"rawTimestampNanos,omitempty,string"`
  515. // StartTimeNanos: The start time of the interval represented by this
  516. // data point, in nanoseconds since epoch.
  517. StartTimeNanos int64 `json:"startTimeNanos,omitempty,string"`
  518. // Value: Values of each data type field for the data point. It is
  519. // expected that each value corresponding to a data type field will
  520. // occur in the same order that the field is listed with in the data
  521. // type specified in a data source.
  522. //
  523. // Only one of integer and floating point fields will be populated,
  524. // depending on the format enum value within data source's type field.
  525. Value []*Value `json:"value,omitempty"`
  526. // ForceSendFields is a list of field names (e.g.
  527. // "ComputationTimeMillis") to unconditionally include in API requests.
  528. // By default, fields with empty values are omitted from API requests.
  529. // However, any non-pointer, non-interface field appearing in
  530. // ForceSendFields will be sent to the server regardless of whether the
  531. // field is empty or not. This may be used to include empty fields in
  532. // Patch requests.
  533. ForceSendFields []string `json:"-"`
  534. // NullFields is a list of field names (e.g. "ComputationTimeMillis") to
  535. // include in API requests with the JSON null value. By default, fields
  536. // with empty values are omitted from API requests. However, any field
  537. // with an empty value appearing in NullFields will be sent to the
  538. // server as null. It is an error if a field in this list has a
  539. // non-empty value. This may be used to include null fields in Patch
  540. // requests.
  541. NullFields []string `json:"-"`
  542. }
  543. func (s *DataPoint) MarshalJSON() ([]byte, error) {
  544. type NoMethod DataPoint
  545. raw := NoMethod(*s)
  546. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  547. }
  548. // DataSource: Definition of a unique source of sensor data. Data
  549. // sources can expose raw data coming from hardware sensors on local or
  550. // companion devices. They can also expose derived data, created by
  551. // transforming or merging other data sources. Multiple data sources can
  552. // exist for the same data type. Every data point inserted into or read
  553. // from this service has an associated data source.
  554. //
  555. // The data source contains enough information to uniquely identify its
  556. // data, including the hardware device and the application that
  557. // collected and/or transformed the data. It also holds useful metadata,
  558. // such as the hardware and application versions, and the device
  559. // type.
  560. //
  561. // Each data source produces a unique stream of data, with a unique
  562. // identifier. Not all changes to data source affect the stream
  563. // identifier, so that data collected by updated versions of the same
  564. // application/device can still be considered to belong to the same data
  565. // stream.
  566. type DataSource struct {
  567. // Application: Information about an application which feeds sensor data
  568. // into the platform.
  569. Application *Application `json:"application,omitempty"`
  570. // Possible values:
  571. // "dataQualityBloodGlucoseIso151972003"
  572. // "dataQualityBloodGlucoseIso151972013"
  573. // "dataQualityBloodPressureAami"
  574. // "dataQualityBloodPressureBhsAA"
  575. // "dataQualityBloodPressureBhsAB"
  576. // "dataQualityBloodPressureBhsBA"
  577. // "dataQualityBloodPressureBhsBB"
  578. // "dataQualityBloodPressureEsh2002"
  579. // "dataQualityBloodPressureEsh2010"
  580. // "dataQualityUnknown"
  581. DataQualityStandard []string `json:"dataQualityStandard,omitempty"`
  582. // DataStreamId: A unique identifier for the data stream produced by
  583. // this data source. The identifier includes:
  584. //
  585. //
  586. // - The physical device's manufacturer, model, and serial number (UID).
  587. //
  588. // - The application's package name or name. Package name is used when
  589. // the data source was created by an Android application. The developer
  590. // project number is used when the data source was created by a REST
  591. // client.
  592. // - The data source's type.
  593. // - The data source's stream name. Note that not all attributes of the
  594. // data source are used as part of the stream identifier. In particular,
  595. // the version of the hardware/the application isn't used. This allows
  596. // us to preserve the same stream through version updates. This also
  597. // means that two DataSource objects may represent the same data stream
  598. // even if they're not equal.
  599. //
  600. // The exact format of the data stream ID created by an Android
  601. // application is:
  602. // type:dataType.name:application.packageName:device.manufacturer:device.
  603. // model:device.uid:dataStreamName
  604. //
  605. // The exact format of the data stream ID created by a REST client is:
  606. // type:dataType.name:developer project
  607. // number:device.manufacturer:device.model:device.uid:dataStreamName
  608. //
  609. //
  610. // When any of the optional fields that comprise of the data stream ID
  611. // are blank, they will be omitted from the data stream ID. The minimum
  612. // viable data stream ID would be: type:dataType.name:developer project
  613. // number
  614. //
  615. // Finally, the developer project number is obfuscated when read by any
  616. // REST or Android client that did not create the data source. Only the
  617. // data source creator will see the developer project number in clear
  618. // and normal form.
  619. DataStreamId string `json:"dataStreamId,omitempty"`
  620. // DataStreamName: The stream name uniquely identifies this particular
  621. // data source among other data sources of the same type from the same
  622. // underlying producer. Setting the stream name is optional, but should
  623. // be done whenever an application exposes two streams for the same data
  624. // type, or when a device has two equivalent sensors.
  625. DataStreamName string `json:"dataStreamName,omitempty"`
  626. // DataType: The data type defines the schema for a stream of data being
  627. // collected by, inserted into, or queried from the Fitness API.
  628. DataType *DataType `json:"dataType,omitempty"`
  629. // Device: Representation of an integrated device (such as a phone or a
  630. // wearable) that can hold sensors.
  631. Device *Device `json:"device,omitempty"`
  632. // Name: An end-user visible name for this data source.
  633. Name string `json:"name,omitempty"`
  634. // Type: A constant describing the type of this data source. Indicates
  635. // whether this data source produces raw or derived data.
  636. //
  637. // Possible values:
  638. // "derived"
  639. // "raw"
  640. Type string `json:"type,omitempty"`
  641. // ServerResponse contains the HTTP response code and headers from the
  642. // server.
  643. googleapi.ServerResponse `json:"-"`
  644. // ForceSendFields is a list of field names (e.g. "Application") to
  645. // unconditionally include in API requests. By default, fields with
  646. // empty values are omitted from API requests. However, any non-pointer,
  647. // non-interface field appearing in ForceSendFields will be sent to the
  648. // server regardless of whether the field is empty or not. This may be
  649. // used to include empty fields in Patch requests.
  650. ForceSendFields []string `json:"-"`
  651. // NullFields is a list of field names (e.g. "Application") to include
  652. // in API requests with the JSON null value. By default, fields with
  653. // empty values are omitted from API requests. However, any field with
  654. // an empty value appearing in NullFields will be sent to the server as
  655. // null. It is an error if a field in this list has a non-empty value.
  656. // This may be used to include null fields in Patch requests.
  657. NullFields []string `json:"-"`
  658. }
  659. func (s *DataSource) MarshalJSON() ([]byte, error) {
  660. type NoMethod DataSource
  661. raw := NoMethod(*s)
  662. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  663. }
  664. type DataType struct {
  665. // Field: A field represents one dimension of a data type.
  666. Field []*DataTypeField `json:"field,omitempty"`
  667. // Name: Each data type has a unique, namespaced, name. All data types
  668. // in the com.google namespace are shared as part of the platform.
  669. Name string `json:"name,omitempty"`
  670. // ForceSendFields is a list of field names (e.g. "Field") to
  671. // unconditionally include in API requests. By default, fields with
  672. // empty values are omitted from API requests. However, any non-pointer,
  673. // non-interface field appearing in ForceSendFields will be sent to the
  674. // server regardless of whether the field is empty or not. This may be
  675. // used to include empty fields in Patch requests.
  676. ForceSendFields []string `json:"-"`
  677. // NullFields is a list of field names (e.g. "Field") to include in API
  678. // requests with the JSON null value. By default, fields with empty
  679. // values are omitted from API requests. However, any field with an
  680. // empty value appearing in NullFields will be sent to the server as
  681. // null. It is an error if a field in this list has a non-empty value.
  682. // This may be used to include null fields in Patch requests.
  683. NullFields []string `json:"-"`
  684. }
  685. func (s *DataType) MarshalJSON() ([]byte, error) {
  686. type NoMethod DataType
  687. raw := NoMethod(*s)
  688. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  689. }
  690. // DataTypeField: In case of multi-dimensional data (such as an
  691. // accelerometer with x, y, and z axes) each field represents one
  692. // dimension. Each data type field has a unique name which identifies
  693. // it. The field also defines the format of the data (int, float,
  694. // etc.).
  695. //
  696. // This message is only instantiated in code and not used for wire comms
  697. // or stored in any way.
  698. type DataTypeField struct {
  699. // Format: The different supported formats for each field in a data
  700. // type.
  701. //
  702. // Possible values:
  703. // "blob"
  704. // "floatList"
  705. // "floatPoint"
  706. // "integer"
  707. // "integerList"
  708. // "map"
  709. // "string"
  710. Format string `json:"format,omitempty"`
  711. // Name: Defines the name and format of data. Unlike data type names,
  712. // field names are not namespaced, and only need to be unique within the
  713. // data type.
  714. Name string `json:"name,omitempty"`
  715. Optional bool `json:"optional,omitempty"`
  716. // ForceSendFields is a list of field names (e.g. "Format") to
  717. // unconditionally include in API requests. By default, fields with
  718. // empty values are omitted from API requests. However, any non-pointer,
  719. // non-interface field appearing in ForceSendFields will be sent to the
  720. // server regardless of whether the field is empty or not. This may be
  721. // used to include empty fields in Patch requests.
  722. ForceSendFields []string `json:"-"`
  723. // NullFields is a list of field names (e.g. "Format") to include in API
  724. // requests with the JSON null value. By default, fields with empty
  725. // values are omitted from API requests. However, any field with an
  726. // empty value appearing in NullFields will be sent to the server as
  727. // null. It is an error if a field in this list has a non-empty value.
  728. // This may be used to include null fields in Patch requests.
  729. NullFields []string `json:"-"`
  730. }
  731. func (s *DataTypeField) MarshalJSON() ([]byte, error) {
  732. type NoMethod DataTypeField
  733. raw := NoMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  735. }
  736. // Dataset: A dataset represents a projection container for data points.
  737. // They do not carry any info of their own. Datasets represent a set of
  738. // data points from a particular data source. A data point can be found
  739. // in more than one dataset.
  740. type Dataset struct {
  741. // DataSourceId: The data stream ID of the data source that created the
  742. // points in this dataset.
  743. DataSourceId string `json:"dataSourceId,omitempty"`
  744. // MaxEndTimeNs: The largest end time of all data points in this
  745. // possibly partial representation of the dataset. Time is in
  746. // nanoseconds from epoch. This should also match the first part of the
  747. // dataset identifier.
  748. MaxEndTimeNs int64 `json:"maxEndTimeNs,omitempty,string"`
  749. // MinStartTimeNs: The smallest start time of all data points in this
  750. // possibly partial representation of the dataset. Time is in
  751. // nanoseconds from epoch. This should also match the first part of the
  752. // dataset identifier.
  753. MinStartTimeNs int64 `json:"minStartTimeNs,omitempty,string"`
  754. // NextPageToken: This token will be set when a dataset is received in
  755. // response to a GET request and the dataset is too large to be included
  756. // in a single response. Provide this value in a subsequent GET request
  757. // to return the next page of data points within this dataset.
  758. NextPageToken string `json:"nextPageToken,omitempty"`
  759. // Point: A partial list of data points contained in the dataset,
  760. // ordered by largest endTimeNanos first. This list is considered
  761. // complete when retrieving a small dataset and partial when patching a
  762. // dataset or retrieving a dataset that is too large to include in a
  763. // single response.
  764. Point []*DataPoint `json:"point,omitempty"`
  765. // ServerResponse contains the HTTP response code and headers from the
  766. // server.
  767. googleapi.ServerResponse `json:"-"`
  768. // ForceSendFields is a list of field names (e.g. "DataSourceId") to
  769. // unconditionally include in API requests. By default, fields with
  770. // empty values are omitted from API requests. However, any non-pointer,
  771. // non-interface field appearing in ForceSendFields will be sent to the
  772. // server regardless of whether the field is empty or not. This may be
  773. // used to include empty fields in Patch requests.
  774. ForceSendFields []string `json:"-"`
  775. // NullFields is a list of field names (e.g. "DataSourceId") to include
  776. // in API requests with the JSON null value. By default, fields with
  777. // empty values are omitted from API requests. However, any field with
  778. // an empty value appearing in NullFields will be sent to the server as
  779. // null. It is an error if a field in this list has a non-empty value.
  780. // This may be used to include null fields in Patch requests.
  781. NullFields []string `json:"-"`
  782. }
  783. func (s *Dataset) MarshalJSON() ([]byte, error) {
  784. type NoMethod Dataset
  785. raw := NoMethod(*s)
  786. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  787. }
  788. // Device: Representation of an integrated device (such as a phone or a
  789. // wearable) that can hold sensors. Each sensor is exposed as a data
  790. // source.
  791. //
  792. // The main purpose of the device information contained in this class is
  793. // to identify the hardware of a particular data source. This can be
  794. // useful in different ways, including:
  795. // - Distinguishing two similar sensors on different devices (the step
  796. // counter on two nexus 5 phones, for instance)
  797. // - Display the source of data to the user (by using the device make /
  798. // model)
  799. // - Treat data differently depending on sensor type (accelerometers on
  800. // a watch may give different patterns than those on a phone)
  801. // - Build different analysis models for each device/version.
  802. type Device struct {
  803. // Manufacturer: Manufacturer of the product/hardware.
  804. Manufacturer string `json:"manufacturer,omitempty"`
  805. // Model: End-user visible model name for the device.
  806. Model string `json:"model,omitempty"`
  807. // Type: A constant representing the type of the device.
  808. //
  809. // Possible values:
  810. // "chestStrap"
  811. // "headMounted"
  812. // "phone"
  813. // "scale"
  814. // "tablet"
  815. // "unknown"
  816. // "watch"
  817. Type string `json:"type,omitempty"`
  818. // Uid: The serial number or other unique ID for the hardware. This
  819. // field is obfuscated when read by any REST or Android client that did
  820. // not create the data source. Only the data source creator will see the
  821. // uid field in clear and normal form.
  822. Uid string `json:"uid,omitempty"`
  823. // Version: Version string for the device hardware/software.
  824. Version string `json:"version,omitempty"`
  825. // ForceSendFields is a list of field names (e.g. "Manufacturer") to
  826. // unconditionally include in API requests. By default, fields with
  827. // empty values are omitted from API requests. However, any non-pointer,
  828. // non-interface field appearing in ForceSendFields will be sent to the
  829. // server regardless of whether the field is empty or not. This may be
  830. // used to include empty fields in Patch requests.
  831. ForceSendFields []string `json:"-"`
  832. // NullFields is a list of field names (e.g. "Manufacturer") to include
  833. // in API requests with the JSON null value. By default, fields with
  834. // empty values are omitted from API requests. However, any field with
  835. // an empty value appearing in NullFields will be sent to the server as
  836. // null. It is an error if a field in this list has a non-empty value.
  837. // This may be used to include null fields in Patch requests.
  838. NullFields []string `json:"-"`
  839. }
  840. func (s *Device) MarshalJSON() ([]byte, error) {
  841. type NoMethod Device
  842. raw := NoMethod(*s)
  843. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  844. }
  845. type ListDataPointChangesResponse struct {
  846. // DataSourceId: The data stream ID of the data source with data point
  847. // changes.
  848. DataSourceId string `json:"dataSourceId,omitempty"`
  849. // DeletedDataPoint: Deleted data points for the user. Note, for
  850. // modifications this should be parsed before handling insertions.
  851. DeletedDataPoint []*DataPoint `json:"deletedDataPoint,omitempty"`
  852. // InsertedDataPoint: Inserted data points for the user.
  853. InsertedDataPoint []*DataPoint `json:"insertedDataPoint,omitempty"`
  854. // NextPageToken: The continuation token, which is used to page through
  855. // large result sets. Provide this value in a subsequent request to
  856. // return the next page of results.
  857. NextPageToken string `json:"nextPageToken,omitempty"`
  858. // ServerResponse contains the HTTP response code and headers from the
  859. // server.
  860. googleapi.ServerResponse `json:"-"`
  861. // ForceSendFields is a list of field names (e.g. "DataSourceId") to
  862. // unconditionally include in API requests. By default, fields with
  863. // empty values are omitted from API requests. However, any non-pointer,
  864. // non-interface field appearing in ForceSendFields will be sent to the
  865. // server regardless of whether the field is empty or not. This may be
  866. // used to include empty fields in Patch requests.
  867. ForceSendFields []string `json:"-"`
  868. // NullFields is a list of field names (e.g. "DataSourceId") to include
  869. // in API requests with the JSON null value. By default, fields with
  870. // empty values are omitted from API requests. However, any field with
  871. // an empty value appearing in NullFields will be sent to the server as
  872. // null. It is an error if a field in this list has a non-empty value.
  873. // This may be used to include null fields in Patch requests.
  874. NullFields []string `json:"-"`
  875. }
  876. func (s *ListDataPointChangesResponse) MarshalJSON() ([]byte, error) {
  877. type NoMethod ListDataPointChangesResponse
  878. raw := NoMethod(*s)
  879. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  880. }
  881. type ListDataSourcesResponse struct {
  882. // DataSource: A previously created data source.
  883. DataSource []*DataSource `json:"dataSource,omitempty"`
  884. // ServerResponse contains the HTTP response code and headers from the
  885. // server.
  886. googleapi.ServerResponse `json:"-"`
  887. // ForceSendFields is a list of field names (e.g. "DataSource") to
  888. // unconditionally include in API requests. By default, fields with
  889. // empty values are omitted from API requests. However, any non-pointer,
  890. // non-interface field appearing in ForceSendFields will be sent to the
  891. // server regardless of whether the field is empty or not. This may be
  892. // used to include empty fields in Patch requests.
  893. ForceSendFields []string `json:"-"`
  894. // NullFields is a list of field names (e.g. "DataSource") to include in
  895. // API requests with the JSON null value. By default, fields with empty
  896. // values are omitted from API requests. However, any field with an
  897. // empty value appearing in NullFields will be sent to the server as
  898. // null. It is an error if a field in this list has a non-empty value.
  899. // This may be used to include null fields in Patch requests.
  900. NullFields []string `json:"-"`
  901. }
  902. func (s *ListDataSourcesResponse) MarshalJSON() ([]byte, error) {
  903. type NoMethod ListDataSourcesResponse
  904. raw := NoMethod(*s)
  905. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  906. }
  907. type ListSessionsResponse struct {
  908. // DeletedSession: If includeDeleted is set to true in the request, this
  909. // list will contain sessions deleted with original end times that are
  910. // within the startTime and endTime frame.
  911. DeletedSession []*Session `json:"deletedSession,omitempty"`
  912. // HasMoreData: Flag to indicate server has more data to transfer
  913. HasMoreData bool `json:"hasMoreData,omitempty"`
  914. // NextPageToken: The continuation token, which is used to page through
  915. // large result sets. Provide this value in a subsequent request to
  916. // return the next page of results.
  917. NextPageToken string `json:"nextPageToken,omitempty"`
  918. // Session: Sessions with an end time that is between startTime and
  919. // endTime of the request.
  920. Session []*Session `json:"session,omitempty"`
  921. // ServerResponse contains the HTTP response code and headers from the
  922. // server.
  923. googleapi.ServerResponse `json:"-"`
  924. // ForceSendFields is a list of field names (e.g. "DeletedSession") to
  925. // unconditionally include in API requests. By default, fields with
  926. // empty values are omitted from API requests. However, any non-pointer,
  927. // non-interface field appearing in ForceSendFields will be sent to the
  928. // server regardless of whether the field is empty or not. This may be
  929. // used to include empty fields in Patch requests.
  930. ForceSendFields []string `json:"-"`
  931. // NullFields is a list of field names (e.g. "DeletedSession") to
  932. // include in API requests with the JSON null value. By default, fields
  933. // with empty values are omitted from API requests. However, any field
  934. // with an empty value appearing in NullFields will be sent to the
  935. // server as null. It is an error if a field in this list has a
  936. // non-empty value. This may be used to include null fields in Patch
  937. // requests.
  938. NullFields []string `json:"-"`
  939. }
  940. func (s *ListSessionsResponse) MarshalJSON() ([]byte, error) {
  941. type NoMethod ListSessionsResponse
  942. raw := NoMethod(*s)
  943. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  944. }
  945. // MapValue: Holder object for the value of an entry in a map field of a
  946. // data point.
  947. //
  948. // A map value supports a subset of the formats that the regular Value
  949. // supports.
  950. type MapValue struct {
  951. // FpVal: Floating point value.
  952. FpVal float64 `json:"fpVal,omitempty"`
  953. // ForceSendFields is a list of field names (e.g. "FpVal") to
  954. // unconditionally include in API requests. By default, fields with
  955. // empty values are omitted from API requests. However, any non-pointer,
  956. // non-interface field appearing in ForceSendFields will be sent to the
  957. // server regardless of whether the field is empty or not. This may be
  958. // used to include empty fields in Patch requests.
  959. ForceSendFields []string `json:"-"`
  960. // NullFields is a list of field names (e.g. "FpVal") to include in API
  961. // requests with the JSON null value. By default, fields with empty
  962. // values are omitted from API requests. However, any field with an
  963. // empty value appearing in NullFields will be sent to the server as
  964. // null. It is an error if a field in this list has a non-empty value.
  965. // This may be used to include null fields in Patch requests.
  966. NullFields []string `json:"-"`
  967. }
  968. func (s *MapValue) MarshalJSON() ([]byte, error) {
  969. type NoMethod MapValue
  970. raw := NoMethod(*s)
  971. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  972. }
  973. func (s *MapValue) UnmarshalJSON(data []byte) error {
  974. type NoMethod MapValue
  975. var s1 struct {
  976. FpVal gensupport.JSONFloat64 `json:"fpVal"`
  977. *NoMethod
  978. }
  979. s1.NoMethod = (*NoMethod)(s)
  980. if err := json.Unmarshal(data, &s1); err != nil {
  981. return err
  982. }
  983. s.FpVal = float64(s1.FpVal)
  984. return nil
  985. }
  986. // Session: Sessions contain metadata, such as a user-friendly name and
  987. // time interval information.
  988. type Session struct {
  989. // ActiveTimeMillis: Session active time. While start_time_millis and
  990. // end_time_millis define the full session time, the active time can be
  991. // shorter and specified by active_time_millis. If the inactive time
  992. // during the session is known, it should also be inserted via a
  993. // com.google.activity.segment data point with a STILL activity value
  994. ActiveTimeMillis int64 `json:"activeTimeMillis,omitempty,string"`
  995. // ActivityType: The type of activity this session represents.
  996. ActivityType int64 `json:"activityType,omitempty"`
  997. // Application: The application that created the session.
  998. Application *Application `json:"application,omitempty"`
  999. // Description: A description for this session.
  1000. Description string `json:"description,omitempty"`
  1001. // EndTimeMillis: An end time, in milliseconds since epoch, inclusive.
  1002. EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
  1003. // Id: A client-generated identifier that is unique across all sessions
  1004. // owned by this particular user.
  1005. Id string `json:"id,omitempty"`
  1006. // ModifiedTimeMillis: A timestamp that indicates when the session was
  1007. // last modified.
  1008. ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"`
  1009. // Name: A human readable name of the session.
  1010. Name string `json:"name,omitempty"`
  1011. // StartTimeMillis: A start time, in milliseconds since epoch,
  1012. // inclusive.
  1013. StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
  1014. // ServerResponse contains the HTTP response code and headers from the
  1015. // server.
  1016. googleapi.ServerResponse `json:"-"`
  1017. // ForceSendFields is a list of field names (e.g. "ActiveTimeMillis") to
  1018. // unconditionally include in API requests. By default, fields with
  1019. // empty values are omitted from API requests. However, any non-pointer,
  1020. // non-interface field appearing in ForceSendFields will be sent to the
  1021. // server regardless of whether the field is empty or not. This may be
  1022. // used to include empty fields in Patch requests.
  1023. ForceSendFields []string `json:"-"`
  1024. // NullFields is a list of field names (e.g. "ActiveTimeMillis") to
  1025. // include in API requests with the JSON null value. By default, fields
  1026. // with empty values are omitted from API requests. However, any field
  1027. // with an empty value appearing in NullFields will be sent to the
  1028. // server as null. It is an error if a field in this list has a
  1029. // non-empty value. This may be used to include null fields in Patch
  1030. // requests.
  1031. NullFields []string `json:"-"`
  1032. }
  1033. func (s *Session) MarshalJSON() ([]byte, error) {
  1034. type NoMethod Session
  1035. raw := NoMethod(*s)
  1036. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1037. }
  1038. // Value: Holder object for the value of a single field in a data
  1039. // point.
  1040. //
  1041. // A field value has a particular format and is only ever set to one of
  1042. // an integer or a floating point value. LINT.IfChange
  1043. type Value struct {
  1044. // FpVal: Floating point value. When this is set, other values must not
  1045. // be set.
  1046. FpVal float64 `json:"fpVal,omitempty"`
  1047. // IntVal: Integer value. When this is set, other values must not be
  1048. // set.
  1049. IntVal int64 `json:"intVal,omitempty"`
  1050. // MapVal: Map value. The valid key space and units for the
  1051. // corresponding value of each entry should be documented as part of the
  1052. // data type definition. Keys should be kept small whenever possible.
  1053. // Data streams with large keys and high data frequency may be down
  1054. // sampled.
  1055. MapVal []*ValueMapValEntry `json:"mapVal,omitempty"`
  1056. // StringVal: String value. When this is set, other values must not be
  1057. // set. Strings should be kept small whenever possible. Data streams
  1058. // with large string values and high data frequency may be down sampled.
  1059. StringVal string `json:"stringVal,omitempty"`
  1060. // ForceSendFields is a list of field names (e.g. "FpVal") to
  1061. // unconditionally include in API requests. By default, fields with
  1062. // empty values are omitted from API requests. However, any non-pointer,
  1063. // non-interface field appearing in ForceSendFields will be sent to the
  1064. // server regardless of whether the field is empty or not. This may be
  1065. // used to include empty fields in Patch requests.
  1066. ForceSendFields []string `json:"-"`
  1067. // NullFields is a list of field names (e.g. "FpVal") to include in API
  1068. // requests with the JSON null value. By default, fields with empty
  1069. // values are omitted from API requests. However, any field with an
  1070. // empty value appearing in NullFields will be sent to the server as
  1071. // null. It is an error if a field in this list has a non-empty value.
  1072. // This may be used to include null fields in Patch requests.
  1073. NullFields []string `json:"-"`
  1074. }
  1075. func (s *Value) MarshalJSON() ([]byte, error) {
  1076. type NoMethod Value
  1077. raw := NoMethod(*s)
  1078. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1079. }
  1080. func (s *Value) UnmarshalJSON(data []byte) error {
  1081. type NoMethod Value
  1082. var s1 struct {
  1083. FpVal gensupport.JSONFloat64 `json:"fpVal"`
  1084. *NoMethod
  1085. }
  1086. s1.NoMethod = (*NoMethod)(s)
  1087. if err := json.Unmarshal(data, &s1); err != nil {
  1088. return err
  1089. }
  1090. s.FpVal = float64(s1.FpVal)
  1091. return nil
  1092. }
  1093. type ValueMapValEntry struct {
  1094. Key string `json:"key,omitempty"`
  1095. Value *MapValue `json:"value,omitempty"`
  1096. // ForceSendFields is a list of field names (e.g. "Key") to
  1097. // unconditionally include in API requests. By default, fields with
  1098. // empty values are omitted from API requests. However, any non-pointer,
  1099. // non-interface field appearing in ForceSendFields will be sent to the
  1100. // server regardless of whether the field is empty or not. This may be
  1101. // used to include empty fields in Patch requests.
  1102. ForceSendFields []string `json:"-"`
  1103. // NullFields is a list of field names (e.g. "Key") to include in API
  1104. // requests with the JSON null value. By default, fields with empty
  1105. // values are omitted from API requests. However, any field with an
  1106. // empty value appearing in NullFields will be sent to the server as
  1107. // null. It is an error if a field in this list has a non-empty value.
  1108. // This may be used to include null fields in Patch requests.
  1109. NullFields []string `json:"-"`
  1110. }
  1111. func (s *ValueMapValEntry) MarshalJSON() ([]byte, error) {
  1112. type NoMethod ValueMapValEntry
  1113. raw := NoMethod(*s)
  1114. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1115. }
  1116. // method id "fitness.users.dataSources.create":
  1117. type UsersDataSourcesCreateCall struct {
  1118. s *Service
  1119. userId string
  1120. datasource *DataSource
  1121. urlParams_ gensupport.URLParams
  1122. ctx_ context.Context
  1123. header_ http.Header
  1124. }
  1125. // Create: Creates a new data source that is unique across all data
  1126. // sources belonging to this user. The data stream ID field can be
  1127. // omitted and will be generated by the server with the correct format.
  1128. // The data stream ID is an ordered combination of some fields from the
  1129. // data source. In addition to the data source fields reflected into the
  1130. // data source ID, the developer project number that is authenticated
  1131. // when creating the data source is included. This developer project
  1132. // number is obfuscated when read by any other developer reading public
  1133. // data types.
  1134. func (r *UsersDataSourcesService) Create(userId string, datasource *DataSource) *UsersDataSourcesCreateCall {
  1135. c := &UsersDataSourcesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1136. c.userId = userId
  1137. c.datasource = datasource
  1138. return c
  1139. }
  1140. // Fields allows partial responses to be retrieved. See
  1141. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1142. // for more information.
  1143. func (c *UsersDataSourcesCreateCall) Fields(s ...googleapi.Field) *UsersDataSourcesCreateCall {
  1144. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1145. return c
  1146. }
  1147. // Context sets the context to be used in this call's Do method. Any
  1148. // pending HTTP request will be aborted if the provided context is
  1149. // canceled.
  1150. func (c *UsersDataSourcesCreateCall) Context(ctx context.Context) *UsersDataSourcesCreateCall {
  1151. c.ctx_ = ctx
  1152. return c
  1153. }
  1154. // Header returns an http.Header that can be modified by the caller to
  1155. // add HTTP headers to the request.
  1156. func (c *UsersDataSourcesCreateCall) Header() http.Header {
  1157. if c.header_ == nil {
  1158. c.header_ = make(http.Header)
  1159. }
  1160. return c.header_
  1161. }
  1162. func (c *UsersDataSourcesCreateCall) doRequest(alt string) (*http.Response, error) {
  1163. reqHeaders := make(http.Header)
  1164. for k, v := range c.header_ {
  1165. reqHeaders[k] = v
  1166. }
  1167. reqHeaders.Set("User-Agent", c.s.userAgent())
  1168. var body io.Reader = nil
  1169. body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
  1170. if err != nil {
  1171. return nil, err
  1172. }
  1173. reqHeaders.Set("Content-Type", "application/json")
  1174. c.urlParams_.Set("alt", alt)
  1175. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources")
  1176. urls += "?" + c.urlParams_.Encode()
  1177. req, _ := http.NewRequest("POST", urls, body)
  1178. req.Header = reqHeaders
  1179. googleapi.Expand(req.URL, map[string]string{
  1180. "userId": c.userId,
  1181. })
  1182. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1183. }
  1184. // Do executes the "fitness.users.dataSources.create" call.
  1185. // Exactly one of *DataSource or error will be non-nil. Any non-2xx
  1186. // status code is an error. Response headers are in either
  1187. // *DataSource.ServerResponse.Header or (if a response was returned at
  1188. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1189. // to check whether the returned error was because
  1190. // http.StatusNotModified was returned.
  1191. func (c *UsersDataSourcesCreateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1192. gensupport.SetOptions(c.urlParams_, opts...)
  1193. res, err := c.doRequest("json")
  1194. if res != nil && res.StatusCode == http.StatusNotModified {
  1195. if res.Body != nil {
  1196. res.Body.Close()
  1197. }
  1198. return nil, &googleapi.Error{
  1199. Code: res.StatusCode,
  1200. Header: res.Header,
  1201. }
  1202. }
  1203. if err != nil {
  1204. return nil, err
  1205. }
  1206. defer googleapi.CloseBody(res)
  1207. if err := googleapi.CheckResponse(res); err != nil {
  1208. return nil, err
  1209. }
  1210. ret := &DataSource{
  1211. ServerResponse: googleapi.ServerResponse{
  1212. Header: res.Header,
  1213. HTTPStatusCode: res.StatusCode,
  1214. },
  1215. }
  1216. target := &ret
  1217. if err := gensupport.DecodeResponse(target, res); err != nil {
  1218. return nil, err
  1219. }
  1220. return ret, nil
  1221. // {
  1222. // "description": "Creates a new data source that is unique across all data sources belonging to this user. The data stream ID field can be omitted and will be generated by the server with the correct format. The data stream ID is an ordered combination of some fields from the data source. In addition to the data source fields reflected into the data source ID, the developer project number that is authenticated when creating the data source is included. This developer project number is obfuscated when read by any other developer reading public data types.",
  1223. // "httpMethod": "POST",
  1224. // "id": "fitness.users.dataSources.create",
  1225. // "parameterOrder": [
  1226. // "userId"
  1227. // ],
  1228. // "parameters": {
  1229. // "userId": {
  1230. // "description": "Create the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  1231. // "location": "path",
  1232. // "required": true,
  1233. // "type": "string"
  1234. // }
  1235. // },
  1236. // "path": "{userId}/dataSources",
  1237. // "request": {
  1238. // "$ref": "DataSource"
  1239. // },
  1240. // "response": {
  1241. // "$ref": "DataSource"
  1242. // },
  1243. // "scopes": [
  1244. // "https://www.googleapis.com/auth/fitness.activity.write",
  1245. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  1246. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  1247. // "https://www.googleapis.com/auth/fitness.body.write",
  1248. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  1249. // "https://www.googleapis.com/auth/fitness.location.write",
  1250. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  1251. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  1252. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  1253. // ]
  1254. // }
  1255. }
  1256. // method id "fitness.users.dataSources.delete":
  1257. type UsersDataSourcesDeleteCall struct {
  1258. s *Service
  1259. userId string
  1260. dataSourceId string
  1261. urlParams_ gensupport.URLParams
  1262. ctx_ context.Context
  1263. header_ http.Header
  1264. }
  1265. // Delete: Deletes the specified data source. The request will fail if
  1266. // the data source contains any data points.
  1267. func (r *UsersDataSourcesService) Delete(userId string, dataSourceId string) *UsersDataSourcesDeleteCall {
  1268. c := &UsersDataSourcesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1269. c.userId = userId
  1270. c.dataSourceId = dataSourceId
  1271. return c
  1272. }
  1273. // Fields allows partial responses to be retrieved. See
  1274. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1275. // for more information.
  1276. func (c *UsersDataSourcesDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDeleteCall {
  1277. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1278. return c
  1279. }
  1280. // Context sets the context to be used in this call's Do method. Any
  1281. // pending HTTP request will be aborted if the provided context is
  1282. // canceled.
  1283. func (c *UsersDataSourcesDeleteCall) Context(ctx context.Context) *UsersDataSourcesDeleteCall {
  1284. c.ctx_ = ctx
  1285. return c
  1286. }
  1287. // Header returns an http.Header that can be modified by the caller to
  1288. // add HTTP headers to the request.
  1289. func (c *UsersDataSourcesDeleteCall) Header() http.Header {
  1290. if c.header_ == nil {
  1291. c.header_ = make(http.Header)
  1292. }
  1293. return c.header_
  1294. }
  1295. func (c *UsersDataSourcesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1296. reqHeaders := make(http.Header)
  1297. for k, v := range c.header_ {
  1298. reqHeaders[k] = v
  1299. }
  1300. reqHeaders.Set("User-Agent", c.s.userAgent())
  1301. var body io.Reader = nil
  1302. c.urlParams_.Set("alt", alt)
  1303. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1304. urls += "?" + c.urlParams_.Encode()
  1305. req, _ := http.NewRequest("DELETE", urls, body)
  1306. req.Header = reqHeaders
  1307. googleapi.Expand(req.URL, map[string]string{
  1308. "userId": c.userId,
  1309. "dataSourceId": c.dataSourceId,
  1310. })
  1311. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1312. }
  1313. // Do executes the "fitness.users.dataSources.delete" call.
  1314. // Exactly one of *DataSource or error will be non-nil. Any non-2xx
  1315. // status code is an error. Response headers are in either
  1316. // *DataSource.ServerResponse.Header or (if a response was returned at
  1317. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1318. // to check whether the returned error was because
  1319. // http.StatusNotModified was returned.
  1320. func (c *UsersDataSourcesDeleteCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1321. gensupport.SetOptions(c.urlParams_, opts...)
  1322. res, err := c.doRequest("json")
  1323. if res != nil && res.StatusCode == http.StatusNotModified {
  1324. if res.Body != nil {
  1325. res.Body.Close()
  1326. }
  1327. return nil, &googleapi.Error{
  1328. Code: res.StatusCode,
  1329. Header: res.Header,
  1330. }
  1331. }
  1332. if err != nil {
  1333. return nil, err
  1334. }
  1335. defer googleapi.CloseBody(res)
  1336. if err := googleapi.CheckResponse(res); err != nil {
  1337. return nil, err
  1338. }
  1339. ret := &DataSource{
  1340. ServerResponse: googleapi.ServerResponse{
  1341. Header: res.Header,
  1342. HTTPStatusCode: res.StatusCode,
  1343. },
  1344. }
  1345. target := &ret
  1346. if err := gensupport.DecodeResponse(target, res); err != nil {
  1347. return nil, err
  1348. }
  1349. return ret, nil
  1350. // {
  1351. // "description": "Deletes the specified data source. The request will fail if the data source contains any data points.",
  1352. // "httpMethod": "DELETE",
  1353. // "id": "fitness.users.dataSources.delete",
  1354. // "parameterOrder": [
  1355. // "userId",
  1356. // "dataSourceId"
  1357. // ],
  1358. // "parameters": {
  1359. // "dataSourceId": {
  1360. // "description": "The data stream ID of the data source to delete.",
  1361. // "location": "path",
  1362. // "required": true,
  1363. // "type": "string"
  1364. // },
  1365. // "userId": {
  1366. // "description": "Retrieve a data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  1367. // "location": "path",
  1368. // "required": true,
  1369. // "type": "string"
  1370. // }
  1371. // },
  1372. // "path": "{userId}/dataSources/{dataSourceId}",
  1373. // "response": {
  1374. // "$ref": "DataSource"
  1375. // },
  1376. // "scopes": [
  1377. // "https://www.googleapis.com/auth/fitness.activity.write",
  1378. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  1379. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  1380. // "https://www.googleapis.com/auth/fitness.body.write",
  1381. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  1382. // "https://www.googleapis.com/auth/fitness.location.write",
  1383. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  1384. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  1385. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  1386. // ]
  1387. // }
  1388. }
  1389. // method id "fitness.users.dataSources.get":
  1390. type UsersDataSourcesGetCall struct {
  1391. s *Service
  1392. userId string
  1393. dataSourceId string
  1394. urlParams_ gensupport.URLParams
  1395. ifNoneMatch_ string
  1396. ctx_ context.Context
  1397. header_ http.Header
  1398. }
  1399. // Get: Returns the specified data source.
  1400. func (r *UsersDataSourcesService) Get(userId string, dataSourceId string) *UsersDataSourcesGetCall {
  1401. c := &UsersDataSourcesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1402. c.userId = userId
  1403. c.dataSourceId = dataSourceId
  1404. return c
  1405. }
  1406. // Fields allows partial responses to be retrieved. See
  1407. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1408. // for more information.
  1409. func (c *UsersDataSourcesGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesGetCall {
  1410. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1411. return c
  1412. }
  1413. // IfNoneMatch sets the optional parameter which makes the operation
  1414. // fail if the object's ETag matches the given value. This is useful for
  1415. // getting updates only after the object has changed since the last
  1416. // request. Use googleapi.IsNotModified to check whether the response
  1417. // error from Do is the result of In-None-Match.
  1418. func (c *UsersDataSourcesGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesGetCall {
  1419. c.ifNoneMatch_ = entityTag
  1420. return c
  1421. }
  1422. // Context sets the context to be used in this call's Do method. Any
  1423. // pending HTTP request will be aborted if the provided context is
  1424. // canceled.
  1425. func (c *UsersDataSourcesGetCall) Context(ctx context.Context) *UsersDataSourcesGetCall {
  1426. c.ctx_ = ctx
  1427. return c
  1428. }
  1429. // Header returns an http.Header that can be modified by the caller to
  1430. // add HTTP headers to the request.
  1431. func (c *UsersDataSourcesGetCall) Header() http.Header {
  1432. if c.header_ == nil {
  1433. c.header_ = make(http.Header)
  1434. }
  1435. return c.header_
  1436. }
  1437. func (c *UsersDataSourcesGetCall) doRequest(alt string) (*http.Response, error) {
  1438. reqHeaders := make(http.Header)
  1439. for k, v := range c.header_ {
  1440. reqHeaders[k] = v
  1441. }
  1442. reqHeaders.Set("User-Agent", c.s.userAgent())
  1443. if c.ifNoneMatch_ != "" {
  1444. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1445. }
  1446. var body io.Reader = nil
  1447. c.urlParams_.Set("alt", alt)
  1448. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1449. urls += "?" + c.urlParams_.Encode()
  1450. req, _ := http.NewRequest("GET", urls, body)
  1451. req.Header = reqHeaders
  1452. googleapi.Expand(req.URL, map[string]string{
  1453. "userId": c.userId,
  1454. "dataSourceId": c.dataSourceId,
  1455. })
  1456. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1457. }
  1458. // Do executes the "fitness.users.dataSources.get" call.
  1459. // Exactly one of *DataSource or error will be non-nil. Any non-2xx
  1460. // status code is an error. Response headers are in either
  1461. // *DataSource.ServerResponse.Header or (if a response was returned at
  1462. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1463. // to check whether the returned error was because
  1464. // http.StatusNotModified was returned.
  1465. func (c *UsersDataSourcesGetCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1466. gensupport.SetOptions(c.urlParams_, opts...)
  1467. res, err := c.doRequest("json")
  1468. if res != nil && res.StatusCode == http.StatusNotModified {
  1469. if res.Body != nil {
  1470. res.Body.Close()
  1471. }
  1472. return nil, &googleapi.Error{
  1473. Code: res.StatusCode,
  1474. Header: res.Header,
  1475. }
  1476. }
  1477. if err != nil {
  1478. return nil, err
  1479. }
  1480. defer googleapi.CloseBody(res)
  1481. if err := googleapi.CheckResponse(res); err != nil {
  1482. return nil, err
  1483. }
  1484. ret := &DataSource{
  1485. ServerResponse: googleapi.ServerResponse{
  1486. Header: res.Header,
  1487. HTTPStatusCode: res.StatusCode,
  1488. },
  1489. }
  1490. target := &ret
  1491. if err := gensupport.DecodeResponse(target, res); err != nil {
  1492. return nil, err
  1493. }
  1494. return ret, nil
  1495. // {
  1496. // "description": "Returns the specified data source.",
  1497. // "httpMethod": "GET",
  1498. // "id": "fitness.users.dataSources.get",
  1499. // "parameterOrder": [
  1500. // "userId",
  1501. // "dataSourceId"
  1502. // ],
  1503. // "parameters": {
  1504. // "dataSourceId": {
  1505. // "description": "The data stream ID of the data source to retrieve.",
  1506. // "location": "path",
  1507. // "required": true,
  1508. // "type": "string"
  1509. // },
  1510. // "userId": {
  1511. // "description": "Retrieve a data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  1512. // "location": "path",
  1513. // "required": true,
  1514. // "type": "string"
  1515. // }
  1516. // },
  1517. // "path": "{userId}/dataSources/{dataSourceId}",
  1518. // "response": {
  1519. // "$ref": "DataSource"
  1520. // },
  1521. // "scopes": [
  1522. // "https://www.googleapis.com/auth/fitness.activity.read",
  1523. // "https://www.googleapis.com/auth/fitness.activity.write",
  1524. // "https://www.googleapis.com/auth/fitness.blood_glucose.read",
  1525. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  1526. // "https://www.googleapis.com/auth/fitness.blood_pressure.read",
  1527. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  1528. // "https://www.googleapis.com/auth/fitness.body.read",
  1529. // "https://www.googleapis.com/auth/fitness.body.write",
  1530. // "https://www.googleapis.com/auth/fitness.body_temperature.read",
  1531. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  1532. // "https://www.googleapis.com/auth/fitness.location.read",
  1533. // "https://www.googleapis.com/auth/fitness.location.write",
  1534. // "https://www.googleapis.com/auth/fitness.nutrition.read",
  1535. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  1536. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
  1537. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  1538. // "https://www.googleapis.com/auth/fitness.reproductive_health.read",
  1539. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  1540. // ]
  1541. // }
  1542. }
  1543. // method id "fitness.users.dataSources.list":
  1544. type UsersDataSourcesListCall struct {
  1545. s *Service
  1546. userId string
  1547. urlParams_ gensupport.URLParams
  1548. ifNoneMatch_ string
  1549. ctx_ context.Context
  1550. header_ http.Header
  1551. }
  1552. // List: Lists all data sources that are visible to the developer, using
  1553. // the OAuth scopes provided. The list is not exhaustive; the user may
  1554. // have private data sources that are only visible to other developers,
  1555. // or calls using other scopes.
  1556. func (r *UsersDataSourcesService) List(userId string) *UsersDataSourcesListCall {
  1557. c := &UsersDataSourcesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1558. c.userId = userId
  1559. return c
  1560. }
  1561. // DataTypeName sets the optional parameter "dataTypeName": The names of
  1562. // data types to include in the list. If not specified, all data sources
  1563. // will be returned.
  1564. func (c *UsersDataSourcesListCall) DataTypeName(dataTypeName ...string) *UsersDataSourcesListCall {
  1565. c.urlParams_.SetMulti("dataTypeName", append([]string{}, dataTypeName...))
  1566. return c
  1567. }
  1568. // Fields allows partial responses to be retrieved. See
  1569. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1570. // for more information.
  1571. func (c *UsersDataSourcesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesListCall {
  1572. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1573. return c
  1574. }
  1575. // IfNoneMatch sets the optional parameter which makes the operation
  1576. // fail if the object's ETag matches the given value. This is useful for
  1577. // getting updates only after the object has changed since the last
  1578. // request. Use googleapi.IsNotModified to check whether the response
  1579. // error from Do is the result of In-None-Match.
  1580. func (c *UsersDataSourcesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesListCall {
  1581. c.ifNoneMatch_ = entityTag
  1582. return c
  1583. }
  1584. // Context sets the context to be used in this call's Do method. Any
  1585. // pending HTTP request will be aborted if the provided context is
  1586. // canceled.
  1587. func (c *UsersDataSourcesListCall) Context(ctx context.Context) *UsersDataSourcesListCall {
  1588. c.ctx_ = ctx
  1589. return c
  1590. }
  1591. // Header returns an http.Header that can be modified by the caller to
  1592. // add HTTP headers to the request.
  1593. func (c *UsersDataSourcesListCall) Header() http.Header {
  1594. if c.header_ == nil {
  1595. c.header_ = make(http.Header)
  1596. }
  1597. return c.header_
  1598. }
  1599. func (c *UsersDataSourcesListCall) doRequest(alt string) (*http.Response, error) {
  1600. reqHeaders := make(http.Header)
  1601. for k, v := range c.header_ {
  1602. reqHeaders[k] = v
  1603. }
  1604. reqHeaders.Set("User-Agent", c.s.userAgent())
  1605. if c.ifNoneMatch_ != "" {
  1606. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1607. }
  1608. var body io.Reader = nil
  1609. c.urlParams_.Set("alt", alt)
  1610. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources")
  1611. urls += "?" + c.urlParams_.Encode()
  1612. req, _ := http.NewRequest("GET", urls, body)
  1613. req.Header = reqHeaders
  1614. googleapi.Expand(req.URL, map[string]string{
  1615. "userId": c.userId,
  1616. })
  1617. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1618. }
  1619. // Do executes the "fitness.users.dataSources.list" call.
  1620. // Exactly one of *ListDataSourcesResponse or error will be non-nil. Any
  1621. // non-2xx status code is an error. Response headers are in either
  1622. // *ListDataSourcesResponse.ServerResponse.Header or (if a response was
  1623. // returned at all) in error.(*googleapi.Error).Header. Use
  1624. // googleapi.IsNotModified to check whether the returned error was
  1625. // because http.StatusNotModified was returned.
  1626. func (c *UsersDataSourcesListCall) Do(opts ...googleapi.CallOption) (*ListDataSourcesResponse, error) {
  1627. gensupport.SetOptions(c.urlParams_, opts...)
  1628. res, err := c.doRequest("json")
  1629. if res != nil && res.StatusCode == http.StatusNotModified {
  1630. if res.Body != nil {
  1631. res.Body.Close()
  1632. }
  1633. return nil, &googleapi.Error{
  1634. Code: res.StatusCode,
  1635. Header: res.Header,
  1636. }
  1637. }
  1638. if err != nil {
  1639. return nil, err
  1640. }
  1641. defer googleapi.CloseBody(res)
  1642. if err := googleapi.CheckResponse(res); err != nil {
  1643. return nil, err
  1644. }
  1645. ret := &ListDataSourcesResponse{
  1646. ServerResponse: googleapi.ServerResponse{
  1647. Header: res.Header,
  1648. HTTPStatusCode: res.StatusCode,
  1649. },
  1650. }
  1651. target := &ret
  1652. if err := gensupport.DecodeResponse(target, res); err != nil {
  1653. return nil, err
  1654. }
  1655. return ret, nil
  1656. // {
  1657. // "description": "Lists all data sources that are visible to the developer, using the OAuth scopes provided. The list is not exhaustive; the user may have private data sources that are only visible to other developers, or calls using other scopes.",
  1658. // "httpMethod": "GET",
  1659. // "id": "fitness.users.dataSources.list",
  1660. // "parameterOrder": [
  1661. // "userId"
  1662. // ],
  1663. // "parameters": {
  1664. // "dataTypeName": {
  1665. // "description": "The names of data types to include in the list. If not specified, all data sources will be returned.",
  1666. // "location": "query",
  1667. // "repeated": true,
  1668. // "type": "string"
  1669. // },
  1670. // "userId": {
  1671. // "description": "List data sources for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  1672. // "location": "path",
  1673. // "required": true,
  1674. // "type": "string"
  1675. // }
  1676. // },
  1677. // "path": "{userId}/dataSources",
  1678. // "response": {
  1679. // "$ref": "ListDataSourcesResponse"
  1680. // },
  1681. // "scopes": [
  1682. // "https://www.googleapis.com/auth/fitness.activity.read",
  1683. // "https://www.googleapis.com/auth/fitness.activity.write",
  1684. // "https://www.googleapis.com/auth/fitness.blood_glucose.read",
  1685. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  1686. // "https://www.googleapis.com/auth/fitness.blood_pressure.read",
  1687. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  1688. // "https://www.googleapis.com/auth/fitness.body.read",
  1689. // "https://www.googleapis.com/auth/fitness.body.write",
  1690. // "https://www.googleapis.com/auth/fitness.body_temperature.read",
  1691. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  1692. // "https://www.googleapis.com/auth/fitness.location.read",
  1693. // "https://www.googleapis.com/auth/fitness.location.write",
  1694. // "https://www.googleapis.com/auth/fitness.nutrition.read",
  1695. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  1696. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
  1697. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  1698. // "https://www.googleapis.com/auth/fitness.reproductive_health.read",
  1699. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  1700. // ]
  1701. // }
  1702. }
  1703. // method id "fitness.users.dataSources.patch":
  1704. type UsersDataSourcesPatchCall struct {
  1705. s *Service
  1706. userId string
  1707. dataSourceId string
  1708. datasource *DataSource
  1709. urlParams_ gensupport.URLParams
  1710. ctx_ context.Context
  1711. header_ http.Header
  1712. }
  1713. // Patch: Updates the specified data source. The dataStreamId, dataType,
  1714. // type, dataStreamName, and device properties with the exception of
  1715. // version, cannot be modified.
  1716. //
  1717. // Data sources are identified by their dataStreamId. This method
  1718. // supports patch semantics.
  1719. func (r *UsersDataSourcesService) Patch(userId string, dataSourceId string, datasource *DataSource) *UsersDataSourcesPatchCall {
  1720. c := &UsersDataSourcesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1721. c.userId = userId
  1722. c.dataSourceId = dataSourceId
  1723. c.datasource = datasource
  1724. return c
  1725. }
  1726. // Fields allows partial responses to be retrieved. See
  1727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1728. // for more information.
  1729. func (c *UsersDataSourcesPatchCall) Fields(s ...googleapi.Field) *UsersDataSourcesPatchCall {
  1730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1731. return c
  1732. }
  1733. // Context sets the context to be used in this call's Do method. Any
  1734. // pending HTTP request will be aborted if the provided context is
  1735. // canceled.
  1736. func (c *UsersDataSourcesPatchCall) Context(ctx context.Context) *UsersDataSourcesPatchCall {
  1737. c.ctx_ = ctx
  1738. return c
  1739. }
  1740. // Header returns an http.Header that can be modified by the caller to
  1741. // add HTTP headers to the request.
  1742. func (c *UsersDataSourcesPatchCall) Header() http.Header {
  1743. if c.header_ == nil {
  1744. c.header_ = make(http.Header)
  1745. }
  1746. return c.header_
  1747. }
  1748. func (c *UsersDataSourcesPatchCall) doRequest(alt string) (*http.Response, error) {
  1749. reqHeaders := make(http.Header)
  1750. for k, v := range c.header_ {
  1751. reqHeaders[k] = v
  1752. }
  1753. reqHeaders.Set("User-Agent", c.s.userAgent())
  1754. var body io.Reader = nil
  1755. body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
  1756. if err != nil {
  1757. return nil, err
  1758. }
  1759. reqHeaders.Set("Content-Type", "application/json")
  1760. c.urlParams_.Set("alt", alt)
  1761. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1762. urls += "?" + c.urlParams_.Encode()
  1763. req, _ := http.NewRequest("PATCH", urls, body)
  1764. req.Header = reqHeaders
  1765. googleapi.Expand(req.URL, map[string]string{
  1766. "userId": c.userId,
  1767. "dataSourceId": c.dataSourceId,
  1768. })
  1769. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1770. }
  1771. // Do executes the "fitness.users.dataSources.patch" call.
  1772. // Exactly one of *DataSource or error will be non-nil. Any non-2xx
  1773. // status code is an error. Response headers are in either
  1774. // *DataSource.ServerResponse.Header or (if a response was returned at
  1775. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1776. // to check whether the returned error was because
  1777. // http.StatusNotModified was returned.
  1778. func (c *UsersDataSourcesPatchCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1779. gensupport.SetOptions(c.urlParams_, opts...)
  1780. res, err := c.doRequest("json")
  1781. if res != nil && res.StatusCode == http.StatusNotModified {
  1782. if res.Body != nil {
  1783. res.Body.Close()
  1784. }
  1785. return nil, &googleapi.Error{
  1786. Code: res.StatusCode,
  1787. Header: res.Header,
  1788. }
  1789. }
  1790. if err != nil {
  1791. return nil, err
  1792. }
  1793. defer googleapi.CloseBody(res)
  1794. if err := googleapi.CheckResponse(res); err != nil {
  1795. return nil, err
  1796. }
  1797. ret := &DataSource{
  1798. ServerResponse: googleapi.ServerResponse{
  1799. Header: res.Header,
  1800. HTTPStatusCode: res.StatusCode,
  1801. },
  1802. }
  1803. target := &ret
  1804. if err := gensupport.DecodeResponse(target, res); err != nil {
  1805. return nil, err
  1806. }
  1807. return ret, nil
  1808. // {
  1809. // "description": "Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified.\n\nData sources are identified by their dataStreamId. This method supports patch semantics.",
  1810. // "httpMethod": "PATCH",
  1811. // "id": "fitness.users.dataSources.patch",
  1812. // "parameterOrder": [
  1813. // "userId",
  1814. // "dataSourceId"
  1815. // ],
  1816. // "parameters": {
  1817. // "dataSourceId": {
  1818. // "description": "The data stream ID of the data source to update.",
  1819. // "location": "path",
  1820. // "required": true,
  1821. // "type": "string"
  1822. // },
  1823. // "userId": {
  1824. // "description": "Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  1825. // "location": "path",
  1826. // "required": true,
  1827. // "type": "string"
  1828. // }
  1829. // },
  1830. // "path": "{userId}/dataSources/{dataSourceId}",
  1831. // "request": {
  1832. // "$ref": "DataSource"
  1833. // },
  1834. // "response": {
  1835. // "$ref": "DataSource"
  1836. // },
  1837. // "scopes": [
  1838. // "https://www.googleapis.com/auth/fitness.activity.write",
  1839. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  1840. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  1841. // "https://www.googleapis.com/auth/fitness.body.write",
  1842. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  1843. // "https://www.googleapis.com/auth/fitness.location.write",
  1844. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  1845. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  1846. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  1847. // ]
  1848. // }
  1849. }
  1850. // method id "fitness.users.dataSources.update":
  1851. type UsersDataSourcesUpdateCall struct {
  1852. s *Service
  1853. userId string
  1854. dataSourceId string
  1855. datasource *DataSource
  1856. urlParams_ gensupport.URLParams
  1857. ctx_ context.Context
  1858. header_ http.Header
  1859. }
  1860. // Update: Updates the specified data source. The dataStreamId,
  1861. // dataType, type, dataStreamName, and device properties with the
  1862. // exception of version, cannot be modified.
  1863. //
  1864. // Data sources are identified by their dataStreamId.
  1865. func (r *UsersDataSourcesService) Update(userId string, dataSourceId string, datasource *DataSource) *UsersDataSourcesUpdateCall {
  1866. c := &UsersDataSourcesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1867. c.userId = userId
  1868. c.dataSourceId = dataSourceId
  1869. c.datasource = datasource
  1870. return c
  1871. }
  1872. // Fields allows partial responses to be retrieved. See
  1873. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1874. // for more information.
  1875. func (c *UsersDataSourcesUpdateCall) Fields(s ...googleapi.Field) *UsersDataSourcesUpdateCall {
  1876. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1877. return c
  1878. }
  1879. // Context sets the context to be used in this call's Do method. Any
  1880. // pending HTTP request will be aborted if the provided context is
  1881. // canceled.
  1882. func (c *UsersDataSourcesUpdateCall) Context(ctx context.Context) *UsersDataSourcesUpdateCall {
  1883. c.ctx_ = ctx
  1884. return c
  1885. }
  1886. // Header returns an http.Header that can be modified by the caller to
  1887. // add HTTP headers to the request.
  1888. func (c *UsersDataSourcesUpdateCall) Header() http.Header {
  1889. if c.header_ == nil {
  1890. c.header_ = make(http.Header)
  1891. }
  1892. return c.header_
  1893. }
  1894. func (c *UsersDataSourcesUpdateCall) doRequest(alt string) (*http.Response, error) {
  1895. reqHeaders := make(http.Header)
  1896. for k, v := range c.header_ {
  1897. reqHeaders[k] = v
  1898. }
  1899. reqHeaders.Set("User-Agent", c.s.userAgent())
  1900. var body io.Reader = nil
  1901. body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
  1902. if err != nil {
  1903. return nil, err
  1904. }
  1905. reqHeaders.Set("Content-Type", "application/json")
  1906. c.urlParams_.Set("alt", alt)
  1907. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1908. urls += "?" + c.urlParams_.Encode()
  1909. req, _ := http.NewRequest("PUT", urls, body)
  1910. req.Header = reqHeaders
  1911. googleapi.Expand(req.URL, map[string]string{
  1912. "userId": c.userId,
  1913. "dataSourceId": c.dataSourceId,
  1914. })
  1915. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1916. }
  1917. // Do executes the "fitness.users.dataSources.update" call.
  1918. // Exactly one of *DataSource or error will be non-nil. Any non-2xx
  1919. // status code is an error. Response headers are in either
  1920. // *DataSource.ServerResponse.Header or (if a response was returned at
  1921. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1922. // to check whether the returned error was because
  1923. // http.StatusNotModified was returned.
  1924. func (c *UsersDataSourcesUpdateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1925. gensupport.SetOptions(c.urlParams_, opts...)
  1926. res, err := c.doRequest("json")
  1927. if res != nil && res.StatusCode == http.StatusNotModified {
  1928. if res.Body != nil {
  1929. res.Body.Close()
  1930. }
  1931. return nil, &googleapi.Error{
  1932. Code: res.StatusCode,
  1933. Header: res.Header,
  1934. }
  1935. }
  1936. if err != nil {
  1937. return nil, err
  1938. }
  1939. defer googleapi.CloseBody(res)
  1940. if err := googleapi.CheckResponse(res); err != nil {
  1941. return nil, err
  1942. }
  1943. ret := &DataSource{
  1944. ServerResponse: googleapi.ServerResponse{
  1945. Header: res.Header,
  1946. HTTPStatusCode: res.StatusCode,
  1947. },
  1948. }
  1949. target := &ret
  1950. if err := gensupport.DecodeResponse(target, res); err != nil {
  1951. return nil, err
  1952. }
  1953. return ret, nil
  1954. // {
  1955. // "description": "Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified.\n\nData sources are identified by their dataStreamId.",
  1956. // "httpMethod": "PUT",
  1957. // "id": "fitness.users.dataSources.update",
  1958. // "parameterOrder": [
  1959. // "userId",
  1960. // "dataSourceId"
  1961. // ],
  1962. // "parameters": {
  1963. // "dataSourceId": {
  1964. // "description": "The data stream ID of the data source to update.",
  1965. // "location": "path",
  1966. // "required": true,
  1967. // "type": "string"
  1968. // },
  1969. // "userId": {
  1970. // "description": "Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  1971. // "location": "path",
  1972. // "required": true,
  1973. // "type": "string"
  1974. // }
  1975. // },
  1976. // "path": "{userId}/dataSources/{dataSourceId}",
  1977. // "request": {
  1978. // "$ref": "DataSource"
  1979. // },
  1980. // "response": {
  1981. // "$ref": "DataSource"
  1982. // },
  1983. // "scopes": [
  1984. // "https://www.googleapis.com/auth/fitness.activity.write",
  1985. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  1986. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  1987. // "https://www.googleapis.com/auth/fitness.body.write",
  1988. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  1989. // "https://www.googleapis.com/auth/fitness.location.write",
  1990. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  1991. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  1992. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  1993. // ]
  1994. // }
  1995. }
  1996. // method id "fitness.users.dataSources.dataPointChanges.list":
  1997. type UsersDataSourcesDataPointChangesListCall struct {
  1998. s *Service
  1999. userId string
  2000. dataSourceId string
  2001. urlParams_ gensupport.URLParams
  2002. ifNoneMatch_ string
  2003. ctx_ context.Context
  2004. header_ http.Header
  2005. }
  2006. // List: Queries for user's data point changes for a particular data
  2007. // source.
  2008. func (r *UsersDataSourcesDataPointChangesService) List(userId string, dataSourceId string) *UsersDataSourcesDataPointChangesListCall {
  2009. c := &UsersDataSourcesDataPointChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2010. c.userId = userId
  2011. c.dataSourceId = dataSourceId
  2012. return c
  2013. }
  2014. // Limit sets the optional parameter "limit": If specified, no more than
  2015. // this many data point changes will be included in the response.
  2016. func (c *UsersDataSourcesDataPointChangesListCall) Limit(limit int64) *UsersDataSourcesDataPointChangesListCall {
  2017. c.urlParams_.Set("limit", fmt.Sprint(limit))
  2018. return c
  2019. }
  2020. // PageToken sets the optional parameter "pageToken": The continuation
  2021. // token, which is used to page through large result sets. To get the
  2022. // next page of results, set this parameter to the value of
  2023. // nextPageToken from the previous response.
  2024. func (c *UsersDataSourcesDataPointChangesListCall) PageToken(pageToken string) *UsersDataSourcesDataPointChangesListCall {
  2025. c.urlParams_.Set("pageToken", pageToken)
  2026. return c
  2027. }
  2028. // Fields allows partial responses to be retrieved. See
  2029. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2030. // for more information.
  2031. func (c *UsersDataSourcesDataPointChangesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesDataPointChangesListCall {
  2032. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2033. return c
  2034. }
  2035. // IfNoneMatch sets the optional parameter which makes the operation
  2036. // fail if the object's ETag matches the given value. This is useful for
  2037. // getting updates only after the object has changed since the last
  2038. // request. Use googleapi.IsNotModified to check whether the response
  2039. // error from Do is the result of In-None-Match.
  2040. func (c *UsersDataSourcesDataPointChangesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesDataPointChangesListCall {
  2041. c.ifNoneMatch_ = entityTag
  2042. return c
  2043. }
  2044. // Context sets the context to be used in this call's Do method. Any
  2045. // pending HTTP request will be aborted if the provided context is
  2046. // canceled.
  2047. func (c *UsersDataSourcesDataPointChangesListCall) Context(ctx context.Context) *UsersDataSourcesDataPointChangesListCall {
  2048. c.ctx_ = ctx
  2049. return c
  2050. }
  2051. // Header returns an http.Header that can be modified by the caller to
  2052. // add HTTP headers to the request.
  2053. func (c *UsersDataSourcesDataPointChangesListCall) Header() http.Header {
  2054. if c.header_ == nil {
  2055. c.header_ = make(http.Header)
  2056. }
  2057. return c.header_
  2058. }
  2059. func (c *UsersDataSourcesDataPointChangesListCall) doRequest(alt string) (*http.Response, error) {
  2060. reqHeaders := make(http.Header)
  2061. for k, v := range c.header_ {
  2062. reqHeaders[k] = v
  2063. }
  2064. reqHeaders.Set("User-Agent", c.s.userAgent())
  2065. if c.ifNoneMatch_ != "" {
  2066. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2067. }
  2068. var body io.Reader = nil
  2069. c.urlParams_.Set("alt", alt)
  2070. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/dataPointChanges")
  2071. urls += "?" + c.urlParams_.Encode()
  2072. req, _ := http.NewRequest("GET", urls, body)
  2073. req.Header = reqHeaders
  2074. googleapi.Expand(req.URL, map[string]string{
  2075. "userId": c.userId,
  2076. "dataSourceId": c.dataSourceId,
  2077. })
  2078. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2079. }
  2080. // Do executes the "fitness.users.dataSources.dataPointChanges.list" call.
  2081. // Exactly one of *ListDataPointChangesResponse or error will be
  2082. // non-nil. Any non-2xx status code is an error. Response headers are in
  2083. // either *ListDataPointChangesResponse.ServerResponse.Header or (if a
  2084. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2085. // googleapi.IsNotModified to check whether the returned error was
  2086. // because http.StatusNotModified was returned.
  2087. func (c *UsersDataSourcesDataPointChangesListCall) Do(opts ...googleapi.CallOption) (*ListDataPointChangesResponse, error) {
  2088. gensupport.SetOptions(c.urlParams_, opts...)
  2089. res, err := c.doRequest("json")
  2090. if res != nil && res.StatusCode == http.StatusNotModified {
  2091. if res.Body != nil {
  2092. res.Body.Close()
  2093. }
  2094. return nil, &googleapi.Error{
  2095. Code: res.StatusCode,
  2096. Header: res.Header,
  2097. }
  2098. }
  2099. if err != nil {
  2100. return nil, err
  2101. }
  2102. defer googleapi.CloseBody(res)
  2103. if err := googleapi.CheckResponse(res); err != nil {
  2104. return nil, err
  2105. }
  2106. ret := &ListDataPointChangesResponse{
  2107. ServerResponse: googleapi.ServerResponse{
  2108. Header: res.Header,
  2109. HTTPStatusCode: res.StatusCode,
  2110. },
  2111. }
  2112. target := &ret
  2113. if err := gensupport.DecodeResponse(target, res); err != nil {
  2114. return nil, err
  2115. }
  2116. return ret, nil
  2117. // {
  2118. // "description": "Queries for user's data point changes for a particular data source.",
  2119. // "httpMethod": "GET",
  2120. // "id": "fitness.users.dataSources.dataPointChanges.list",
  2121. // "parameterOrder": [
  2122. // "userId",
  2123. // "dataSourceId"
  2124. // ],
  2125. // "parameters": {
  2126. // "dataSourceId": {
  2127. // "description": "The data stream ID of the data source that created the dataset.",
  2128. // "location": "path",
  2129. // "required": true,
  2130. // "type": "string"
  2131. // },
  2132. // "limit": {
  2133. // "description": "If specified, no more than this many data point changes will be included in the response.",
  2134. // "format": "int32",
  2135. // "location": "query",
  2136. // "type": "integer"
  2137. // },
  2138. // "pageToken": {
  2139. // "description": "The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response.",
  2140. // "location": "query",
  2141. // "type": "string"
  2142. // },
  2143. // "userId": {
  2144. // "description": "List data points for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  2145. // "location": "path",
  2146. // "required": true,
  2147. // "type": "string"
  2148. // }
  2149. // },
  2150. // "path": "{userId}/dataSources/{dataSourceId}/dataPointChanges",
  2151. // "response": {
  2152. // "$ref": "ListDataPointChangesResponse"
  2153. // },
  2154. // "scopes": [
  2155. // "https://www.googleapis.com/auth/fitness.activity.read",
  2156. // "https://www.googleapis.com/auth/fitness.activity.write",
  2157. // "https://www.googleapis.com/auth/fitness.blood_glucose.read",
  2158. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  2159. // "https://www.googleapis.com/auth/fitness.blood_pressure.read",
  2160. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  2161. // "https://www.googleapis.com/auth/fitness.body.read",
  2162. // "https://www.googleapis.com/auth/fitness.body.write",
  2163. // "https://www.googleapis.com/auth/fitness.body_temperature.read",
  2164. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  2165. // "https://www.googleapis.com/auth/fitness.location.read",
  2166. // "https://www.googleapis.com/auth/fitness.location.write",
  2167. // "https://www.googleapis.com/auth/fitness.nutrition.read",
  2168. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  2169. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
  2170. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  2171. // "https://www.googleapis.com/auth/fitness.reproductive_health.read",
  2172. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  2173. // ]
  2174. // }
  2175. }
  2176. // Pages invokes f for each page of results.
  2177. // A non-nil error returned from f will halt the iteration.
  2178. // The provided context supersedes any context provided to the Context method.
  2179. func (c *UsersDataSourcesDataPointChangesListCall) Pages(ctx context.Context, f func(*ListDataPointChangesResponse) error) error {
  2180. c.ctx_ = ctx
  2181. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2182. for {
  2183. x, err := c.Do()
  2184. if err != nil {
  2185. return err
  2186. }
  2187. if err := f(x); err != nil {
  2188. return err
  2189. }
  2190. if x.NextPageToken == "" {
  2191. return nil
  2192. }
  2193. c.PageToken(x.NextPageToken)
  2194. }
  2195. }
  2196. // method id "fitness.users.dataSources.datasets.delete":
  2197. type UsersDataSourcesDatasetsDeleteCall struct {
  2198. s *Service
  2199. userId string
  2200. dataSourceId string
  2201. datasetId string
  2202. urlParams_ gensupport.URLParams
  2203. ctx_ context.Context
  2204. header_ http.Header
  2205. }
  2206. // Delete: Performs an inclusive delete of all data points whose start
  2207. // and end times have any overlap with the time range specified by the
  2208. // dataset ID. For most data types, the entire data point will be
  2209. // deleted. For data types where the time span represents a consistent
  2210. // value (such as com.google.activity.segment), and a data point
  2211. // straddles either end point of the dataset, only the overlapping
  2212. // portion of the data point will be deleted.
  2213. func (r *UsersDataSourcesDatasetsService) Delete(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsDeleteCall {
  2214. c := &UsersDataSourcesDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2215. c.userId = userId
  2216. c.dataSourceId = dataSourceId
  2217. c.datasetId = datasetId
  2218. return c
  2219. }
  2220. // CurrentTimeMillis sets the optional parameter "currentTimeMillis":
  2221. // The client's current time in milliseconds since epoch.
  2222. func (c *UsersDataSourcesDatasetsDeleteCall) CurrentTimeMillis(currentTimeMillis int64) *UsersDataSourcesDatasetsDeleteCall {
  2223. c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis))
  2224. return c
  2225. }
  2226. // ModifiedTimeMillis sets the optional parameter "modifiedTimeMillis":
  2227. // When the operation was performed on the client.
  2228. func (c *UsersDataSourcesDatasetsDeleteCall) ModifiedTimeMillis(modifiedTimeMillis int64) *UsersDataSourcesDatasetsDeleteCall {
  2229. c.urlParams_.Set("modifiedTimeMillis", fmt.Sprint(modifiedTimeMillis))
  2230. return c
  2231. }
  2232. // Fields allows partial responses to be retrieved. See
  2233. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2234. // for more information.
  2235. func (c *UsersDataSourcesDatasetsDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsDeleteCall {
  2236. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2237. return c
  2238. }
  2239. // Context sets the context to be used in this call's Do method. Any
  2240. // pending HTTP request will be aborted if the provided context is
  2241. // canceled.
  2242. func (c *UsersDataSourcesDatasetsDeleteCall) Context(ctx context.Context) *UsersDataSourcesDatasetsDeleteCall {
  2243. c.ctx_ = ctx
  2244. return c
  2245. }
  2246. // Header returns an http.Header that can be modified by the caller to
  2247. // add HTTP headers to the request.
  2248. func (c *UsersDataSourcesDatasetsDeleteCall) Header() http.Header {
  2249. if c.header_ == nil {
  2250. c.header_ = make(http.Header)
  2251. }
  2252. return c.header_
  2253. }
  2254. func (c *UsersDataSourcesDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2255. reqHeaders := make(http.Header)
  2256. for k, v := range c.header_ {
  2257. reqHeaders[k] = v
  2258. }
  2259. reqHeaders.Set("User-Agent", c.s.userAgent())
  2260. var body io.Reader = nil
  2261. c.urlParams_.Set("alt", alt)
  2262. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
  2263. urls += "?" + c.urlParams_.Encode()
  2264. req, _ := http.NewRequest("DELETE", urls, body)
  2265. req.Header = reqHeaders
  2266. googleapi.Expand(req.URL, map[string]string{
  2267. "userId": c.userId,
  2268. "dataSourceId": c.dataSourceId,
  2269. "datasetId": c.datasetId,
  2270. })
  2271. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2272. }
  2273. // Do executes the "fitness.users.dataSources.datasets.delete" call.
  2274. func (c *UsersDataSourcesDatasetsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2275. gensupport.SetOptions(c.urlParams_, opts...)
  2276. res, err := c.doRequest("json")
  2277. if err != nil {
  2278. return err
  2279. }
  2280. defer googleapi.CloseBody(res)
  2281. if err := googleapi.CheckResponse(res); err != nil {
  2282. return err
  2283. }
  2284. return nil
  2285. // {
  2286. // "description": "Performs an inclusive delete of all data points whose start and end times have any overlap with the time range specified by the dataset ID. For most data types, the entire data point will be deleted. For data types where the time span represents a consistent value (such as com.google.activity.segment), and a data point straddles either end point of the dataset, only the overlapping portion of the data point will be deleted.",
  2287. // "httpMethod": "DELETE",
  2288. // "id": "fitness.users.dataSources.datasets.delete",
  2289. // "parameterOrder": [
  2290. // "userId",
  2291. // "dataSourceId",
  2292. // "datasetId"
  2293. // ],
  2294. // "parameters": {
  2295. // "currentTimeMillis": {
  2296. // "description": "The client's current time in milliseconds since epoch.",
  2297. // "format": "int64",
  2298. // "location": "query",
  2299. // "type": "string"
  2300. // },
  2301. // "dataSourceId": {
  2302. // "description": "The data stream ID of the data source that created the dataset.",
  2303. // "location": "path",
  2304. // "required": true,
  2305. // "type": "string"
  2306. // },
  2307. // "datasetId": {
  2308. // "description": "Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: \"startTime-endTime\" where startTime and endTime are 64 bit integers.",
  2309. // "location": "path",
  2310. // "required": true,
  2311. // "type": "string"
  2312. // },
  2313. // "modifiedTimeMillis": {
  2314. // "description": "When the operation was performed on the client.",
  2315. // "format": "int64",
  2316. // "location": "query",
  2317. // "type": "string"
  2318. // },
  2319. // "userId": {
  2320. // "description": "Delete a dataset for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  2321. // "location": "path",
  2322. // "required": true,
  2323. // "type": "string"
  2324. // }
  2325. // },
  2326. // "path": "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}",
  2327. // "scopes": [
  2328. // "https://www.googleapis.com/auth/fitness.activity.write",
  2329. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  2330. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  2331. // "https://www.googleapis.com/auth/fitness.body.write",
  2332. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  2333. // "https://www.googleapis.com/auth/fitness.location.write",
  2334. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  2335. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  2336. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  2337. // ]
  2338. // }
  2339. }
  2340. // method id "fitness.users.dataSources.datasets.get":
  2341. type UsersDataSourcesDatasetsGetCall struct {
  2342. s *Service
  2343. userId string
  2344. dataSourceId string
  2345. datasetId string
  2346. urlParams_ gensupport.URLParams
  2347. ifNoneMatch_ string
  2348. ctx_ context.Context
  2349. header_ http.Header
  2350. }
  2351. // Get: Returns a dataset containing all data points whose start and end
  2352. // times overlap with the specified range of the dataset minimum start
  2353. // time and maximum end time. Specifically, any data point whose start
  2354. // time is less than or equal to the dataset end time and whose end time
  2355. // is greater than or equal to the dataset start time.
  2356. func (r *UsersDataSourcesDatasetsService) Get(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsGetCall {
  2357. c := &UsersDataSourcesDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2358. c.userId = userId
  2359. c.dataSourceId = dataSourceId
  2360. c.datasetId = datasetId
  2361. return c
  2362. }
  2363. // Limit sets the optional parameter "limit": If specified, no more than
  2364. // this many data points will be included in the dataset. If there are
  2365. // more data points in the dataset, nextPageToken will be set in the
  2366. // dataset response.
  2367. func (c *UsersDataSourcesDatasetsGetCall) Limit(limit int64) *UsersDataSourcesDatasetsGetCall {
  2368. c.urlParams_.Set("limit", fmt.Sprint(limit))
  2369. return c
  2370. }
  2371. // PageToken sets the optional parameter "pageToken": The continuation
  2372. // token, which is used to page through large datasets. To get the next
  2373. // page of a dataset, set this parameter to the value of nextPageToken
  2374. // from the previous response. Each subsequent call will yield a partial
  2375. // dataset with data point end timestamps that are strictly smaller than
  2376. // those in the previous partial response.
  2377. func (c *UsersDataSourcesDatasetsGetCall) PageToken(pageToken string) *UsersDataSourcesDatasetsGetCall {
  2378. c.urlParams_.Set("pageToken", pageToken)
  2379. return c
  2380. }
  2381. // Fields allows partial responses to be retrieved. See
  2382. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2383. // for more information.
  2384. func (c *UsersDataSourcesDatasetsGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsGetCall {
  2385. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2386. return c
  2387. }
  2388. // IfNoneMatch sets the optional parameter which makes the operation
  2389. // fail if the object's ETag matches the given value. This is useful for
  2390. // getting updates only after the object has changed since the last
  2391. // request. Use googleapi.IsNotModified to check whether the response
  2392. // error from Do is the result of In-None-Match.
  2393. func (c *UsersDataSourcesDatasetsGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesDatasetsGetCall {
  2394. c.ifNoneMatch_ = entityTag
  2395. return c
  2396. }
  2397. // Context sets the context to be used in this call's Do method. Any
  2398. // pending HTTP request will be aborted if the provided context is
  2399. // canceled.
  2400. func (c *UsersDataSourcesDatasetsGetCall) Context(ctx context.Context) *UsersDataSourcesDatasetsGetCall {
  2401. c.ctx_ = ctx
  2402. return c
  2403. }
  2404. // Header returns an http.Header that can be modified by the caller to
  2405. // add HTTP headers to the request.
  2406. func (c *UsersDataSourcesDatasetsGetCall) Header() http.Header {
  2407. if c.header_ == nil {
  2408. c.header_ = make(http.Header)
  2409. }
  2410. return c.header_
  2411. }
  2412. func (c *UsersDataSourcesDatasetsGetCall) doRequest(alt string) (*http.Response, error) {
  2413. reqHeaders := make(http.Header)
  2414. for k, v := range c.header_ {
  2415. reqHeaders[k] = v
  2416. }
  2417. reqHeaders.Set("User-Agent", c.s.userAgent())
  2418. if c.ifNoneMatch_ != "" {
  2419. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2420. }
  2421. var body io.Reader = nil
  2422. c.urlParams_.Set("alt", alt)
  2423. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
  2424. urls += "?" + c.urlParams_.Encode()
  2425. req, _ := http.NewRequest("GET", urls, body)
  2426. req.Header = reqHeaders
  2427. googleapi.Expand(req.URL, map[string]string{
  2428. "userId": c.userId,
  2429. "dataSourceId": c.dataSourceId,
  2430. "datasetId": c.datasetId,
  2431. })
  2432. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2433. }
  2434. // Do executes the "fitness.users.dataSources.datasets.get" call.
  2435. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  2436. // code is an error. Response headers are in either
  2437. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  2438. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2439. // check whether the returned error was because http.StatusNotModified
  2440. // was returned.
  2441. func (c *UsersDataSourcesDatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2442. gensupport.SetOptions(c.urlParams_, opts...)
  2443. res, err := c.doRequest("json")
  2444. if res != nil && res.StatusCode == http.StatusNotModified {
  2445. if res.Body != nil {
  2446. res.Body.Close()
  2447. }
  2448. return nil, &googleapi.Error{
  2449. Code: res.StatusCode,
  2450. Header: res.Header,
  2451. }
  2452. }
  2453. if err != nil {
  2454. return nil, err
  2455. }
  2456. defer googleapi.CloseBody(res)
  2457. if err := googleapi.CheckResponse(res); err != nil {
  2458. return nil, err
  2459. }
  2460. ret := &Dataset{
  2461. ServerResponse: googleapi.ServerResponse{
  2462. Header: res.Header,
  2463. HTTPStatusCode: res.StatusCode,
  2464. },
  2465. }
  2466. target := &ret
  2467. if err := gensupport.DecodeResponse(target, res); err != nil {
  2468. return nil, err
  2469. }
  2470. return ret, nil
  2471. // {
  2472. // "description": "Returns a dataset containing all data points whose start and end times overlap with the specified range of the dataset minimum start time and maximum end time. Specifically, any data point whose start time is less than or equal to the dataset end time and whose end time is greater than or equal to the dataset start time.",
  2473. // "httpMethod": "GET",
  2474. // "id": "fitness.users.dataSources.datasets.get",
  2475. // "parameterOrder": [
  2476. // "userId",
  2477. // "dataSourceId",
  2478. // "datasetId"
  2479. // ],
  2480. // "parameters": {
  2481. // "dataSourceId": {
  2482. // "description": "The data stream ID of the data source that created the dataset.",
  2483. // "location": "path",
  2484. // "required": true,
  2485. // "type": "string"
  2486. // },
  2487. // "datasetId": {
  2488. // "description": "Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: \"startTime-endTime\" where startTime and endTime are 64 bit integers.",
  2489. // "location": "path",
  2490. // "required": true,
  2491. // "type": "string"
  2492. // },
  2493. // "limit": {
  2494. // "description": "If specified, no more than this many data points will be included in the dataset. If there are more data points in the dataset, nextPageToken will be set in the dataset response.",
  2495. // "format": "int32",
  2496. // "location": "query",
  2497. // "type": "integer"
  2498. // },
  2499. // "pageToken": {
  2500. // "description": "The continuation token, which is used to page through large datasets. To get the next page of a dataset, set this parameter to the value of nextPageToken from the previous response. Each subsequent call will yield a partial dataset with data point end timestamps that are strictly smaller than those in the previous partial response.",
  2501. // "location": "query",
  2502. // "type": "string"
  2503. // },
  2504. // "userId": {
  2505. // "description": "Retrieve a dataset for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  2506. // "location": "path",
  2507. // "required": true,
  2508. // "type": "string"
  2509. // }
  2510. // },
  2511. // "path": "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}",
  2512. // "response": {
  2513. // "$ref": "Dataset"
  2514. // },
  2515. // "scopes": [
  2516. // "https://www.googleapis.com/auth/fitness.activity.read",
  2517. // "https://www.googleapis.com/auth/fitness.activity.write",
  2518. // "https://www.googleapis.com/auth/fitness.blood_glucose.read",
  2519. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  2520. // "https://www.googleapis.com/auth/fitness.blood_pressure.read",
  2521. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  2522. // "https://www.googleapis.com/auth/fitness.body.read",
  2523. // "https://www.googleapis.com/auth/fitness.body.write",
  2524. // "https://www.googleapis.com/auth/fitness.body_temperature.read",
  2525. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  2526. // "https://www.googleapis.com/auth/fitness.location.read",
  2527. // "https://www.googleapis.com/auth/fitness.location.write",
  2528. // "https://www.googleapis.com/auth/fitness.nutrition.read",
  2529. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  2530. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
  2531. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  2532. // "https://www.googleapis.com/auth/fitness.reproductive_health.read",
  2533. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  2534. // ]
  2535. // }
  2536. }
  2537. // Pages invokes f for each page of results.
  2538. // A non-nil error returned from f will halt the iteration.
  2539. // The provided context supersedes any context provided to the Context method.
  2540. func (c *UsersDataSourcesDatasetsGetCall) Pages(ctx context.Context, f func(*Dataset) error) error {
  2541. c.ctx_ = ctx
  2542. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2543. for {
  2544. x, err := c.Do()
  2545. if err != nil {
  2546. return err
  2547. }
  2548. if err := f(x); err != nil {
  2549. return err
  2550. }
  2551. if x.NextPageToken == "" {
  2552. return nil
  2553. }
  2554. c.PageToken(x.NextPageToken)
  2555. }
  2556. }
  2557. // method id "fitness.users.dataSources.datasets.patch":
  2558. type UsersDataSourcesDatasetsPatchCall struct {
  2559. s *Service
  2560. userId string
  2561. dataSourceId string
  2562. datasetId string
  2563. dataset *Dataset
  2564. urlParams_ gensupport.URLParams
  2565. ctx_ context.Context
  2566. header_ http.Header
  2567. }
  2568. // Patch: Adds data points to a dataset. The dataset need not be
  2569. // previously created. All points within the given dataset will be
  2570. // returned with subsquent calls to retrieve this dataset. Data points
  2571. // can belong to more than one dataset. This method does not use patch
  2572. // semantics.
  2573. func (r *UsersDataSourcesDatasetsService) Patch(userId string, dataSourceId string, datasetId string, dataset *Dataset) *UsersDataSourcesDatasetsPatchCall {
  2574. c := &UsersDataSourcesDatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2575. c.userId = userId
  2576. c.dataSourceId = dataSourceId
  2577. c.datasetId = datasetId
  2578. c.dataset = dataset
  2579. return c
  2580. }
  2581. // CurrentTimeMillis sets the optional parameter "currentTimeMillis":
  2582. // The client's current time in milliseconds since epoch. Note that the
  2583. // minStartTimeNs and maxEndTimeNs properties in the request body are in
  2584. // nanoseconds instead of milliseconds.
  2585. func (c *UsersDataSourcesDatasetsPatchCall) CurrentTimeMillis(currentTimeMillis int64) *UsersDataSourcesDatasetsPatchCall {
  2586. c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis))
  2587. return c
  2588. }
  2589. // Fields allows partial responses to be retrieved. See
  2590. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2591. // for more information.
  2592. func (c *UsersDataSourcesDatasetsPatchCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsPatchCall {
  2593. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2594. return c
  2595. }
  2596. // Context sets the context to be used in this call's Do method. Any
  2597. // pending HTTP request will be aborted if the provided context is
  2598. // canceled.
  2599. func (c *UsersDataSourcesDatasetsPatchCall) Context(ctx context.Context) *UsersDataSourcesDatasetsPatchCall {
  2600. c.ctx_ = ctx
  2601. return c
  2602. }
  2603. // Header returns an http.Header that can be modified by the caller to
  2604. // add HTTP headers to the request.
  2605. func (c *UsersDataSourcesDatasetsPatchCall) Header() http.Header {
  2606. if c.header_ == nil {
  2607. c.header_ = make(http.Header)
  2608. }
  2609. return c.header_
  2610. }
  2611. func (c *UsersDataSourcesDatasetsPatchCall) doRequest(alt string) (*http.Response, error) {
  2612. reqHeaders := make(http.Header)
  2613. for k, v := range c.header_ {
  2614. reqHeaders[k] = v
  2615. }
  2616. reqHeaders.Set("User-Agent", c.s.userAgent())
  2617. var body io.Reader = nil
  2618. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  2619. if err != nil {
  2620. return nil, err
  2621. }
  2622. reqHeaders.Set("Content-Type", "application/json")
  2623. c.urlParams_.Set("alt", alt)
  2624. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
  2625. urls += "?" + c.urlParams_.Encode()
  2626. req, _ := http.NewRequest("PATCH", urls, body)
  2627. req.Header = reqHeaders
  2628. googleapi.Expand(req.URL, map[string]string{
  2629. "userId": c.userId,
  2630. "dataSourceId": c.dataSourceId,
  2631. "datasetId": c.datasetId,
  2632. })
  2633. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2634. }
  2635. // Do executes the "fitness.users.dataSources.datasets.patch" call.
  2636. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  2637. // code is an error. Response headers are in either
  2638. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  2639. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2640. // check whether the returned error was because http.StatusNotModified
  2641. // was returned.
  2642. func (c *UsersDataSourcesDatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2643. gensupport.SetOptions(c.urlParams_, opts...)
  2644. res, err := c.doRequest("json")
  2645. if res != nil && res.StatusCode == http.StatusNotModified {
  2646. if res.Body != nil {
  2647. res.Body.Close()
  2648. }
  2649. return nil, &googleapi.Error{
  2650. Code: res.StatusCode,
  2651. Header: res.Header,
  2652. }
  2653. }
  2654. if err != nil {
  2655. return nil, err
  2656. }
  2657. defer googleapi.CloseBody(res)
  2658. if err := googleapi.CheckResponse(res); err != nil {
  2659. return nil, err
  2660. }
  2661. ret := &Dataset{
  2662. ServerResponse: googleapi.ServerResponse{
  2663. Header: res.Header,
  2664. HTTPStatusCode: res.StatusCode,
  2665. },
  2666. }
  2667. target := &ret
  2668. if err := gensupport.DecodeResponse(target, res); err != nil {
  2669. return nil, err
  2670. }
  2671. return ret, nil
  2672. // {
  2673. // "description": "Adds data points to a dataset. The dataset need not be previously created. All points within the given dataset will be returned with subsquent calls to retrieve this dataset. Data points can belong to more than one dataset. This method does not use patch semantics.",
  2674. // "httpMethod": "PATCH",
  2675. // "id": "fitness.users.dataSources.datasets.patch",
  2676. // "parameterOrder": [
  2677. // "userId",
  2678. // "dataSourceId",
  2679. // "datasetId"
  2680. // ],
  2681. // "parameters": {
  2682. // "currentTimeMillis": {
  2683. // "description": "The client's current time in milliseconds since epoch. Note that the minStartTimeNs and maxEndTimeNs properties in the request body are in nanoseconds instead of milliseconds.",
  2684. // "format": "int64",
  2685. // "location": "query",
  2686. // "type": "string"
  2687. // },
  2688. // "dataSourceId": {
  2689. // "description": "The data stream ID of the data source that created the dataset.",
  2690. // "location": "path",
  2691. // "required": true,
  2692. // "type": "string"
  2693. // },
  2694. // "datasetId": {
  2695. // "description": "Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: \"startTime-endTime\" where startTime and endTime are 64 bit integers.",
  2696. // "location": "path",
  2697. // "required": true,
  2698. // "type": "string"
  2699. // },
  2700. // "userId": {
  2701. // "description": "Patch a dataset for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  2702. // "location": "path",
  2703. // "required": true,
  2704. // "type": "string"
  2705. // }
  2706. // },
  2707. // "path": "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}",
  2708. // "request": {
  2709. // "$ref": "Dataset"
  2710. // },
  2711. // "response": {
  2712. // "$ref": "Dataset"
  2713. // },
  2714. // "scopes": [
  2715. // "https://www.googleapis.com/auth/fitness.activity.write",
  2716. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  2717. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  2718. // "https://www.googleapis.com/auth/fitness.body.write",
  2719. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  2720. // "https://www.googleapis.com/auth/fitness.location.write",
  2721. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  2722. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  2723. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  2724. // ]
  2725. // }
  2726. }
  2727. // Pages invokes f for each page of results.
  2728. // A non-nil error returned from f will halt the iteration.
  2729. // The provided context supersedes any context provided to the Context method.
  2730. func (c *UsersDataSourcesDatasetsPatchCall) Pages(ctx context.Context, f func(*Dataset) error) error {
  2731. c.ctx_ = ctx
  2732. defer func(pt string) { c.dataset.NextPageToken = pt }(c.dataset.NextPageToken) // reset paging to original point
  2733. for {
  2734. x, err := c.Do()
  2735. if err != nil {
  2736. return err
  2737. }
  2738. if err := f(x); err != nil {
  2739. return err
  2740. }
  2741. if x.NextPageToken == "" {
  2742. return nil
  2743. }
  2744. c.dataset.NextPageToken = x.NextPageToken
  2745. }
  2746. }
  2747. // method id "fitness.users.dataset.aggregate":
  2748. type UsersDatasetAggregateCall struct {
  2749. s *Service
  2750. userId string
  2751. aggregaterequest *AggregateRequest
  2752. urlParams_ gensupport.URLParams
  2753. ctx_ context.Context
  2754. header_ http.Header
  2755. }
  2756. // Aggregate: Aggregates data of a certain type or stream into buckets
  2757. // divided by a given type of boundary. Multiple data sets of multiple
  2758. // types and from multiple sources can be aggreated into exactly one
  2759. // bucket type per request.
  2760. func (r *UsersDatasetService) Aggregate(userId string, aggregaterequest *AggregateRequest) *UsersDatasetAggregateCall {
  2761. c := &UsersDatasetAggregateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2762. c.userId = userId
  2763. c.aggregaterequest = aggregaterequest
  2764. return c
  2765. }
  2766. // Fields allows partial responses to be retrieved. See
  2767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2768. // for more information.
  2769. func (c *UsersDatasetAggregateCall) Fields(s ...googleapi.Field) *UsersDatasetAggregateCall {
  2770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2771. return c
  2772. }
  2773. // Context sets the context to be used in this call's Do method. Any
  2774. // pending HTTP request will be aborted if the provided context is
  2775. // canceled.
  2776. func (c *UsersDatasetAggregateCall) Context(ctx context.Context) *UsersDatasetAggregateCall {
  2777. c.ctx_ = ctx
  2778. return c
  2779. }
  2780. // Header returns an http.Header that can be modified by the caller to
  2781. // add HTTP headers to the request.
  2782. func (c *UsersDatasetAggregateCall) Header() http.Header {
  2783. if c.header_ == nil {
  2784. c.header_ = make(http.Header)
  2785. }
  2786. return c.header_
  2787. }
  2788. func (c *UsersDatasetAggregateCall) doRequest(alt string) (*http.Response, error) {
  2789. reqHeaders := make(http.Header)
  2790. for k, v := range c.header_ {
  2791. reqHeaders[k] = v
  2792. }
  2793. reqHeaders.Set("User-Agent", c.s.userAgent())
  2794. var body io.Reader = nil
  2795. body, err := googleapi.WithoutDataWrapper.JSONReader(c.aggregaterequest)
  2796. if err != nil {
  2797. return nil, err
  2798. }
  2799. reqHeaders.Set("Content-Type", "application/json")
  2800. c.urlParams_.Set("alt", alt)
  2801. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataset:aggregate")
  2802. urls += "?" + c.urlParams_.Encode()
  2803. req, _ := http.NewRequest("POST", urls, body)
  2804. req.Header = reqHeaders
  2805. googleapi.Expand(req.URL, map[string]string{
  2806. "userId": c.userId,
  2807. })
  2808. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2809. }
  2810. // Do executes the "fitness.users.dataset.aggregate" call.
  2811. // Exactly one of *AggregateResponse or error will be non-nil. Any
  2812. // non-2xx status code is an error. Response headers are in either
  2813. // *AggregateResponse.ServerResponse.Header or (if a response was
  2814. // returned at all) in error.(*googleapi.Error).Header. Use
  2815. // googleapi.IsNotModified to check whether the returned error was
  2816. // because http.StatusNotModified was returned.
  2817. func (c *UsersDatasetAggregateCall) Do(opts ...googleapi.CallOption) (*AggregateResponse, error) {
  2818. gensupport.SetOptions(c.urlParams_, opts...)
  2819. res, err := c.doRequest("json")
  2820. if res != nil && res.StatusCode == http.StatusNotModified {
  2821. if res.Body != nil {
  2822. res.Body.Close()
  2823. }
  2824. return nil, &googleapi.Error{
  2825. Code: res.StatusCode,
  2826. Header: res.Header,
  2827. }
  2828. }
  2829. if err != nil {
  2830. return nil, err
  2831. }
  2832. defer googleapi.CloseBody(res)
  2833. if err := googleapi.CheckResponse(res); err != nil {
  2834. return nil, err
  2835. }
  2836. ret := &AggregateResponse{
  2837. ServerResponse: googleapi.ServerResponse{
  2838. Header: res.Header,
  2839. HTTPStatusCode: res.StatusCode,
  2840. },
  2841. }
  2842. target := &ret
  2843. if err := gensupport.DecodeResponse(target, res); err != nil {
  2844. return nil, err
  2845. }
  2846. return ret, nil
  2847. // {
  2848. // "description": "Aggregates data of a certain type or stream into buckets divided by a given type of boundary. Multiple data sets of multiple types and from multiple sources can be aggreated into exactly one bucket type per request.",
  2849. // "httpMethod": "POST",
  2850. // "id": "fitness.users.dataset.aggregate",
  2851. // "parameterOrder": [
  2852. // "userId"
  2853. // ],
  2854. // "parameters": {
  2855. // "userId": {
  2856. // "description": "Aggregate data for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  2857. // "location": "path",
  2858. // "required": true,
  2859. // "type": "string"
  2860. // }
  2861. // },
  2862. // "path": "{userId}/dataset:aggregate",
  2863. // "request": {
  2864. // "$ref": "AggregateRequest"
  2865. // },
  2866. // "response": {
  2867. // "$ref": "AggregateResponse"
  2868. // },
  2869. // "scopes": [
  2870. // "https://www.googleapis.com/auth/fitness.activity.read",
  2871. // "https://www.googleapis.com/auth/fitness.activity.write",
  2872. // "https://www.googleapis.com/auth/fitness.blood_glucose.read",
  2873. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  2874. // "https://www.googleapis.com/auth/fitness.blood_pressure.read",
  2875. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  2876. // "https://www.googleapis.com/auth/fitness.body.read",
  2877. // "https://www.googleapis.com/auth/fitness.body.write",
  2878. // "https://www.googleapis.com/auth/fitness.body_temperature.read",
  2879. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  2880. // "https://www.googleapis.com/auth/fitness.location.read",
  2881. // "https://www.googleapis.com/auth/fitness.location.write",
  2882. // "https://www.googleapis.com/auth/fitness.nutrition.read",
  2883. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  2884. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
  2885. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  2886. // "https://www.googleapis.com/auth/fitness.reproductive_health.read",
  2887. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  2888. // ]
  2889. // }
  2890. }
  2891. // method id "fitness.users.sessions.delete":
  2892. type UsersSessionsDeleteCall struct {
  2893. s *Service
  2894. userId string
  2895. sessionId string
  2896. urlParams_ gensupport.URLParams
  2897. ctx_ context.Context
  2898. header_ http.Header
  2899. }
  2900. // Delete: Deletes a session specified by the given session ID.
  2901. func (r *UsersSessionsService) Delete(userId string, sessionId string) *UsersSessionsDeleteCall {
  2902. c := &UsersSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2903. c.userId = userId
  2904. c.sessionId = sessionId
  2905. return c
  2906. }
  2907. // CurrentTimeMillis sets the optional parameter "currentTimeMillis":
  2908. // The client's current time in milliseconds since epoch.
  2909. func (c *UsersSessionsDeleteCall) CurrentTimeMillis(currentTimeMillis int64) *UsersSessionsDeleteCall {
  2910. c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis))
  2911. return c
  2912. }
  2913. // Fields allows partial responses to be retrieved. See
  2914. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2915. // for more information.
  2916. func (c *UsersSessionsDeleteCall) Fields(s ...googleapi.Field) *UsersSessionsDeleteCall {
  2917. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2918. return c
  2919. }
  2920. // Context sets the context to be used in this call's Do method. Any
  2921. // pending HTTP request will be aborted if the provided context is
  2922. // canceled.
  2923. func (c *UsersSessionsDeleteCall) Context(ctx context.Context) *UsersSessionsDeleteCall {
  2924. c.ctx_ = ctx
  2925. return c
  2926. }
  2927. // Header returns an http.Header that can be modified by the caller to
  2928. // add HTTP headers to the request.
  2929. func (c *UsersSessionsDeleteCall) Header() http.Header {
  2930. if c.header_ == nil {
  2931. c.header_ = make(http.Header)
  2932. }
  2933. return c.header_
  2934. }
  2935. func (c *UsersSessionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2936. reqHeaders := make(http.Header)
  2937. for k, v := range c.header_ {
  2938. reqHeaders[k] = v
  2939. }
  2940. reqHeaders.Set("User-Agent", c.s.userAgent())
  2941. var body io.Reader = nil
  2942. c.urlParams_.Set("alt", alt)
  2943. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}")
  2944. urls += "?" + c.urlParams_.Encode()
  2945. req, _ := http.NewRequest("DELETE", urls, body)
  2946. req.Header = reqHeaders
  2947. googleapi.Expand(req.URL, map[string]string{
  2948. "userId": c.userId,
  2949. "sessionId": c.sessionId,
  2950. })
  2951. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2952. }
  2953. // Do executes the "fitness.users.sessions.delete" call.
  2954. func (c *UsersSessionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2955. gensupport.SetOptions(c.urlParams_, opts...)
  2956. res, err := c.doRequest("json")
  2957. if err != nil {
  2958. return err
  2959. }
  2960. defer googleapi.CloseBody(res)
  2961. if err := googleapi.CheckResponse(res); err != nil {
  2962. return err
  2963. }
  2964. return nil
  2965. // {
  2966. // "description": "Deletes a session specified by the given session ID.",
  2967. // "httpMethod": "DELETE",
  2968. // "id": "fitness.users.sessions.delete",
  2969. // "parameterOrder": [
  2970. // "userId",
  2971. // "sessionId"
  2972. // ],
  2973. // "parameters": {
  2974. // "currentTimeMillis": {
  2975. // "description": "The client's current time in milliseconds since epoch.",
  2976. // "format": "int64",
  2977. // "location": "query",
  2978. // "type": "string"
  2979. // },
  2980. // "sessionId": {
  2981. // "description": "The ID of the session to be deleted.",
  2982. // "location": "path",
  2983. // "required": true,
  2984. // "type": "string"
  2985. // },
  2986. // "userId": {
  2987. // "description": "Delete a session for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  2988. // "location": "path",
  2989. // "required": true,
  2990. // "type": "string"
  2991. // }
  2992. // },
  2993. // "path": "{userId}/sessions/{sessionId}",
  2994. // "scopes": [
  2995. // "https://www.googleapis.com/auth/fitness.activity.write"
  2996. // ]
  2997. // }
  2998. }
  2999. // method id "fitness.users.sessions.list":
  3000. type UsersSessionsListCall struct {
  3001. s *Service
  3002. userId string
  3003. urlParams_ gensupport.URLParams
  3004. ifNoneMatch_ string
  3005. ctx_ context.Context
  3006. header_ http.Header
  3007. }
  3008. // List: Lists sessions previously created.
  3009. func (r *UsersSessionsService) List(userId string) *UsersSessionsListCall {
  3010. c := &UsersSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3011. c.userId = userId
  3012. return c
  3013. }
  3014. // EndTime sets the optional parameter "endTime": An RFC3339 timestamp.
  3015. // Only sessions ending between the start and end times will be included
  3016. // in the response.
  3017. func (c *UsersSessionsListCall) EndTime(endTime string) *UsersSessionsListCall {
  3018. c.urlParams_.Set("endTime", endTime)
  3019. return c
  3020. }
  3021. // IncludeDeleted sets the optional parameter "includeDeleted": If true,
  3022. // deleted sessions will be returned. When set to true, sessions
  3023. // returned in this response will only have an ID and will not have any
  3024. // other fields.
  3025. func (c *UsersSessionsListCall) IncludeDeleted(includeDeleted bool) *UsersSessionsListCall {
  3026. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3027. return c
  3028. }
  3029. // PageToken sets the optional parameter "pageToken": The continuation
  3030. // token, which is used to page through large result sets. To get the
  3031. // next page of results, set this parameter to the value of
  3032. // nextPageToken from the previous response.
  3033. func (c *UsersSessionsListCall) PageToken(pageToken string) *UsersSessionsListCall {
  3034. c.urlParams_.Set("pageToken", pageToken)
  3035. return c
  3036. }
  3037. // StartTime sets the optional parameter "startTime": An RFC3339
  3038. // timestamp. Only sessions ending between the start and end times will
  3039. // be included in the response.
  3040. func (c *UsersSessionsListCall) StartTime(startTime string) *UsersSessionsListCall {
  3041. c.urlParams_.Set("startTime", startTime)
  3042. return c
  3043. }
  3044. // Fields allows partial responses to be retrieved. See
  3045. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3046. // for more information.
  3047. func (c *UsersSessionsListCall) Fields(s ...googleapi.Field) *UsersSessionsListCall {
  3048. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3049. return c
  3050. }
  3051. // IfNoneMatch sets the optional parameter which makes the operation
  3052. // fail if the object's ETag matches the given value. This is useful for
  3053. // getting updates only after the object has changed since the last
  3054. // request. Use googleapi.IsNotModified to check whether the response
  3055. // error from Do is the result of In-None-Match.
  3056. func (c *UsersSessionsListCall) IfNoneMatch(entityTag string) *UsersSessionsListCall {
  3057. c.ifNoneMatch_ = entityTag
  3058. return c
  3059. }
  3060. // Context sets the context to be used in this call's Do method. Any
  3061. // pending HTTP request will be aborted if the provided context is
  3062. // canceled.
  3063. func (c *UsersSessionsListCall) Context(ctx context.Context) *UsersSessionsListCall {
  3064. c.ctx_ = ctx
  3065. return c
  3066. }
  3067. // Header returns an http.Header that can be modified by the caller to
  3068. // add HTTP headers to the request.
  3069. func (c *UsersSessionsListCall) Header() http.Header {
  3070. if c.header_ == nil {
  3071. c.header_ = make(http.Header)
  3072. }
  3073. return c.header_
  3074. }
  3075. func (c *UsersSessionsListCall) doRequest(alt string) (*http.Response, error) {
  3076. reqHeaders := make(http.Header)
  3077. for k, v := range c.header_ {
  3078. reqHeaders[k] = v
  3079. }
  3080. reqHeaders.Set("User-Agent", c.s.userAgent())
  3081. if c.ifNoneMatch_ != "" {
  3082. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3083. }
  3084. var body io.Reader = nil
  3085. c.urlParams_.Set("alt", alt)
  3086. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions")
  3087. urls += "?" + c.urlParams_.Encode()
  3088. req, _ := http.NewRequest("GET", urls, body)
  3089. req.Header = reqHeaders
  3090. googleapi.Expand(req.URL, map[string]string{
  3091. "userId": c.userId,
  3092. })
  3093. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3094. }
  3095. // Do executes the "fitness.users.sessions.list" call.
  3096. // Exactly one of *ListSessionsResponse or error will be non-nil. Any
  3097. // non-2xx status code is an error. Response headers are in either
  3098. // *ListSessionsResponse.ServerResponse.Header or (if a response was
  3099. // returned at all) in error.(*googleapi.Error).Header. Use
  3100. // googleapi.IsNotModified to check whether the returned error was
  3101. // because http.StatusNotModified was returned.
  3102. func (c *UsersSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) {
  3103. gensupport.SetOptions(c.urlParams_, opts...)
  3104. res, err := c.doRequest("json")
  3105. if res != nil && res.StatusCode == http.StatusNotModified {
  3106. if res.Body != nil {
  3107. res.Body.Close()
  3108. }
  3109. return nil, &googleapi.Error{
  3110. Code: res.StatusCode,
  3111. Header: res.Header,
  3112. }
  3113. }
  3114. if err != nil {
  3115. return nil, err
  3116. }
  3117. defer googleapi.CloseBody(res)
  3118. if err := googleapi.CheckResponse(res); err != nil {
  3119. return nil, err
  3120. }
  3121. ret := &ListSessionsResponse{
  3122. ServerResponse: googleapi.ServerResponse{
  3123. Header: res.Header,
  3124. HTTPStatusCode: res.StatusCode,
  3125. },
  3126. }
  3127. target := &ret
  3128. if err := gensupport.DecodeResponse(target, res); err != nil {
  3129. return nil, err
  3130. }
  3131. return ret, nil
  3132. // {
  3133. // "description": "Lists sessions previously created.",
  3134. // "httpMethod": "GET",
  3135. // "id": "fitness.users.sessions.list",
  3136. // "parameterOrder": [
  3137. // "userId"
  3138. // ],
  3139. // "parameters": {
  3140. // "endTime": {
  3141. // "description": "An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response.",
  3142. // "location": "query",
  3143. // "type": "string"
  3144. // },
  3145. // "includeDeleted": {
  3146. // "description": "If true, deleted sessions will be returned. When set to true, sessions returned in this response will only have an ID and will not have any other fields.",
  3147. // "location": "query",
  3148. // "type": "boolean"
  3149. // },
  3150. // "pageToken": {
  3151. // "description": "The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response.",
  3152. // "location": "query",
  3153. // "type": "string"
  3154. // },
  3155. // "startTime": {
  3156. // "description": "An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response.",
  3157. // "location": "query",
  3158. // "type": "string"
  3159. // },
  3160. // "userId": {
  3161. // "description": "List sessions for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  3162. // "location": "path",
  3163. // "required": true,
  3164. // "type": "string"
  3165. // }
  3166. // },
  3167. // "path": "{userId}/sessions",
  3168. // "response": {
  3169. // "$ref": "ListSessionsResponse"
  3170. // },
  3171. // "scopes": [
  3172. // "https://www.googleapis.com/auth/fitness.activity.read",
  3173. // "https://www.googleapis.com/auth/fitness.activity.write",
  3174. // "https://www.googleapis.com/auth/fitness.blood_glucose.read",
  3175. // "https://www.googleapis.com/auth/fitness.blood_glucose.write",
  3176. // "https://www.googleapis.com/auth/fitness.blood_pressure.read",
  3177. // "https://www.googleapis.com/auth/fitness.blood_pressure.write",
  3178. // "https://www.googleapis.com/auth/fitness.body.read",
  3179. // "https://www.googleapis.com/auth/fitness.body.write",
  3180. // "https://www.googleapis.com/auth/fitness.body_temperature.read",
  3181. // "https://www.googleapis.com/auth/fitness.body_temperature.write",
  3182. // "https://www.googleapis.com/auth/fitness.location.read",
  3183. // "https://www.googleapis.com/auth/fitness.location.write",
  3184. // "https://www.googleapis.com/auth/fitness.nutrition.read",
  3185. // "https://www.googleapis.com/auth/fitness.nutrition.write",
  3186. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
  3187. // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
  3188. // "https://www.googleapis.com/auth/fitness.reproductive_health.read",
  3189. // "https://www.googleapis.com/auth/fitness.reproductive_health.write"
  3190. // ]
  3191. // }
  3192. }
  3193. // Pages invokes f for each page of results.
  3194. // A non-nil error returned from f will halt the iteration.
  3195. // The provided context supersedes any context provided to the Context method.
  3196. func (c *UsersSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error {
  3197. c.ctx_ = ctx
  3198. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3199. for {
  3200. x, err := c.Do()
  3201. if err != nil {
  3202. return err
  3203. }
  3204. if err := f(x); err != nil {
  3205. return err
  3206. }
  3207. if x.NextPageToken == "" {
  3208. return nil
  3209. }
  3210. c.PageToken(x.NextPageToken)
  3211. }
  3212. }
  3213. // method id "fitness.users.sessions.update":
  3214. type UsersSessionsUpdateCall struct {
  3215. s *Service
  3216. userId string
  3217. sessionId string
  3218. session *Session
  3219. urlParams_ gensupport.URLParams
  3220. ctx_ context.Context
  3221. header_ http.Header
  3222. }
  3223. // Update: Updates or insert a given session.
  3224. func (r *UsersSessionsService) Update(userId string, sessionId string, session *Session) *UsersSessionsUpdateCall {
  3225. c := &UsersSessionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3226. c.userId = userId
  3227. c.sessionId = sessionId
  3228. c.session = session
  3229. return c
  3230. }
  3231. // CurrentTimeMillis sets the optional parameter "currentTimeMillis":
  3232. // The client's current time in milliseconds since epoch.
  3233. func (c *UsersSessionsUpdateCall) CurrentTimeMillis(currentTimeMillis int64) *UsersSessionsUpdateCall {
  3234. c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis))
  3235. return c
  3236. }
  3237. // Fields allows partial responses to be retrieved. See
  3238. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3239. // for more information.
  3240. func (c *UsersSessionsUpdateCall) Fields(s ...googleapi.Field) *UsersSessionsUpdateCall {
  3241. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3242. return c
  3243. }
  3244. // Context sets the context to be used in this call's Do method. Any
  3245. // pending HTTP request will be aborted if the provided context is
  3246. // canceled.
  3247. func (c *UsersSessionsUpdateCall) Context(ctx context.Context) *UsersSessionsUpdateCall {
  3248. c.ctx_ = ctx
  3249. return c
  3250. }
  3251. // Header returns an http.Header that can be modified by the caller to
  3252. // add HTTP headers to the request.
  3253. func (c *UsersSessionsUpdateCall) Header() http.Header {
  3254. if c.header_ == nil {
  3255. c.header_ = make(http.Header)
  3256. }
  3257. return c.header_
  3258. }
  3259. func (c *UsersSessionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3260. reqHeaders := make(http.Header)
  3261. for k, v := range c.header_ {
  3262. reqHeaders[k] = v
  3263. }
  3264. reqHeaders.Set("User-Agent", c.s.userAgent())
  3265. var body io.Reader = nil
  3266. body, err := googleapi.WithoutDataWrapper.JSONReader(c.session)
  3267. if err != nil {
  3268. return nil, err
  3269. }
  3270. reqHeaders.Set("Content-Type", "application/json")
  3271. c.urlParams_.Set("alt", alt)
  3272. urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}")
  3273. urls += "?" + c.urlParams_.Encode()
  3274. req, _ := http.NewRequest("PUT", urls, body)
  3275. req.Header = reqHeaders
  3276. googleapi.Expand(req.URL, map[string]string{
  3277. "userId": c.userId,
  3278. "sessionId": c.sessionId,
  3279. })
  3280. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3281. }
  3282. // Do executes the "fitness.users.sessions.update" call.
  3283. // Exactly one of *Session or error will be non-nil. Any non-2xx status
  3284. // code is an error. Response headers are in either
  3285. // *Session.ServerResponse.Header or (if a response was returned at all)
  3286. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3287. // check whether the returned error was because http.StatusNotModified
  3288. // was returned.
  3289. func (c *UsersSessionsUpdateCall) Do(opts ...googleapi.CallOption) (*Session, error) {
  3290. gensupport.SetOptions(c.urlParams_, opts...)
  3291. res, err := c.doRequest("json")
  3292. if res != nil && res.StatusCode == http.StatusNotModified {
  3293. if res.Body != nil {
  3294. res.Body.Close()
  3295. }
  3296. return nil, &googleapi.Error{
  3297. Code: res.StatusCode,
  3298. Header: res.Header,
  3299. }
  3300. }
  3301. if err != nil {
  3302. return nil, err
  3303. }
  3304. defer googleapi.CloseBody(res)
  3305. if err := googleapi.CheckResponse(res); err != nil {
  3306. return nil, err
  3307. }
  3308. ret := &Session{
  3309. ServerResponse: googleapi.ServerResponse{
  3310. Header: res.Header,
  3311. HTTPStatusCode: res.StatusCode,
  3312. },
  3313. }
  3314. target := &ret
  3315. if err := gensupport.DecodeResponse(target, res); err != nil {
  3316. return nil, err
  3317. }
  3318. return ret, nil
  3319. // {
  3320. // "description": "Updates or insert a given session.",
  3321. // "httpMethod": "PUT",
  3322. // "id": "fitness.users.sessions.update",
  3323. // "parameterOrder": [
  3324. // "userId",
  3325. // "sessionId"
  3326. // ],
  3327. // "parameters": {
  3328. // "currentTimeMillis": {
  3329. // "description": "The client's current time in milliseconds since epoch.",
  3330. // "format": "int64",
  3331. // "location": "query",
  3332. // "type": "string"
  3333. // },
  3334. // "sessionId": {
  3335. // "description": "The ID of the session to be created.",
  3336. // "location": "path",
  3337. // "required": true,
  3338. // "type": "string"
  3339. // },
  3340. // "userId": {
  3341. // "description": "Create sessions for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.",
  3342. // "location": "path",
  3343. // "required": true,
  3344. // "type": "string"
  3345. // }
  3346. // },
  3347. // "path": "{userId}/sessions/{sessionId}",
  3348. // "request": {
  3349. // "$ref": "Session"
  3350. // },
  3351. // "response": {
  3352. // "$ref": "Session"
  3353. // },
  3354. // "scopes": [
  3355. // "https://www.googleapis.com/auth/fitness.activity.write"
  3356. // ]
  3357. // }
  3358. }