{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module Network.API.Mandrill.Users.Types where
import Data.Char
import Data.Time
import qualified Data.Text as T
import Control.Monad
import Data.Monoid
import Data.Aeson
import Data.Aeson.Types
import Data.Aeson.TH
import Lens.Micro.TH (makeLenses)
import Network.API.Mandrill.Types
data UsersRq = UsersRq {
_ureq_key :: !MandrillKey
} deriving Show
makeLenses ''UsersRq
deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''UsersRq
data MandrillStats = MandrillStats {
_msts_sent :: Int
, _msts_hard_bounces :: Int
, _msts_soft_bounces :: Int
, _msts_rejects :: Int
, _msts_complaints :: Int
, _msts_unsubs :: Int
, _msts_opens :: Int
, _msts_unique_opens :: Int
, _msts_clicks :: Int
, _msts_unique_clicks :: Int
} deriving Show
makeLenses ''MandrillStats
deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillStats
data UserStats = UserStats {
_usts_today :: MandrillStats
, _usts_last_7_days :: MandrillStats
, _usts_last_30_days :: MandrillStats
, _usts_last_60_days :: MandrillStats
, _usts_last_90_days :: MandrillStats
, _usts_all_time :: MandrillStats
} deriving Show
makeLenses ''UserStats
deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''UserStats
data UsersInfoResponse = UsersInfoResponse {
_usir_username :: !T.Text
, _usir_created_at :: MandrillDate
, _usir_public_id :: !T.Text
, _usir_reputation :: !Int
, _usir_hourly_quota :: !Int
, _usir_backlog :: !Int
, _usir_stats :: UserStats
} deriving Show
makeLenses ''UsersInfoResponse
deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''UsersInfoResponse
newtype UsersPingResponse = UsersPingResponse T.Text deriving Show
deriveFromJSON defaultOptions ''UsersPingResponse
instance ToJSON UsersPingResponse where
toJSON (UsersPingResponse t) = String t
data UsersPing2Response = UsersPing2Response {
_usrr_PING :: T.Text
} deriving Show
deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''UsersPing2Response
data UsersSendersResponse = UsersResponse {
_usrr_address :: !T.Text
, _usrr_created_at :: MandrillDate
, _usrr_sent :: !Int
, _usrr_hard_bounces :: !Int
, _usrr_soft_bounces :: !Int
, _usrr_rejects :: !Int
, _usrr_complaints :: !Int
, _usrr_unsubs :: !Int
, _usrr_opens :: !Int
, _usrr_clicks :: !Int
, _usrr_unique_opens :: !Int
, _usrr_unique_clicks :: !Int
} deriving Show
makeLenses ''UsersSendersResponse
deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''UsersSendersResponse