{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.Resource.Fitness.Users.DataSet.Aggregate
(
UsersDataSetAggregateResource
, usersDataSetAggregate
, UsersDataSetAggregate
, udsaPayload
, udsaUserId
) where
import Network.Google.Fitness.Types
import Network.Google.Prelude
type UsersDataSetAggregateResource =
"fitness" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"dataset:aggregate" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] AggregateRequest :>
Post '[JSON] AggregateResponse
-- | 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.
--
-- /See:/ 'usersDataSetAggregate' smart constructor.
data UsersDataSetAggregate = UsersDataSetAggregate'
{ _udsaPayload :: !AggregateRequest
, _udsaUserId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'UsersDataSetAggregate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'udsaPayload'
--
-- * 'udsaUserId'
usersDataSetAggregate
:: AggregateRequest -- ^ 'udsaPayload'
-> Text -- ^ 'udsaUserId'
-> UsersDataSetAggregate
usersDataSetAggregate pUdsaPayload_ pUdsaUserId_ =
UsersDataSetAggregate'
{ _udsaPayload = pUdsaPayload_
, _udsaUserId = pUdsaUserId_
}
-- | Multipart request metadata.
udsaPayload :: Lens' UsersDataSetAggregate AggregateRequest
udsaPayload
= lens _udsaPayload (\ s a -> s{_udsaPayload = a})
-- | Aggregate data for the person identified. Use me to indicate the
-- authenticated user. Only me is supported at this time.
udsaUserId :: Lens' UsersDataSetAggregate Text
udsaUserId
= lens _udsaUserId (\ s a -> s{_udsaUserId = a})
instance GoogleRequest UsersDataSetAggregate where
type Rs UsersDataSetAggregate = AggregateResponse
type Scopes UsersDataSetAggregate =
'["https://www.googleapis.com/auth/fitness.activity.read",
"https://www.googleapis.com/auth/fitness.activity.write",
"https://www.googleapis.com/auth/fitness.body.read",
"https://www.googleapis.com/auth/fitness.body.write",
"https://www.googleapis.com/auth/fitness.location.read",
"https://www.googleapis.com/auth/fitness.location.write",
"https://www.googleapis.com/auth/fitness.nutrition.read",
"https://www.googleapis.com/auth/fitness.nutrition.write"]
requestClient UsersDataSetAggregate'{..}
= go _udsaUserId (Just AltJSON) _udsaPayload
fitnessService
where go
= buildClient
(Proxy :: Proxy UsersDataSetAggregateResource)
mempty