module Network.Pushbullet.Client where
import Network.Pushbullet.Api
import Network.Pushbullet.Types
import Servant.Client
import Servant.Common.Req ( addHeader )
import Servant.API hiding ( addHeader )
createPush
:: Auth
-> Push 'New
-> ClientM (Push 'Existing)
getPushes
:: Auth
-> Maybe PushbulletTime
-> Maybe Bool
-> Maybe Int
-> Maybe Cursor
-> ClientM (Paginated ExistingPushes)
createEphemeral :: Auth -> Ephemeral -> ClientM TrivialObject
getMe :: Auth -> ClientM User
getDevices
:: Auth
-> Maybe Bool
-> Maybe Cursor
-> ClientM (Paginated ExistingDevices)
createDevice
:: Auth
-> Device 'New
-> ClientM (Device 'Existing)
deleteDevice
:: Auth
-> DeviceId
-> ClientM TrivialObject
getSmsThreads
:: Auth
-> Permanent 'ThreadList
-> ClientM SmsThreads
getSmsMessages
:: Auth
-> Permanent 'MessageList
-> ClientM SmsMessages
(createPush :<|> getPushes)
:<|> createEphemeral
:<|> getMe
:<|> (getDevices :<|> createDevice :<|> deleteDevice)
:<|> (getSmsThreads :<|> getSmsMessages)
= client pushbulletApi
pushbulletAuth :: PushbulletKey -> Auth
pushbulletAuth key = mkAuthenticateReq key f where
f = addHeader "Access-Token"
type Auth = AuthenticateReq (AuthProtect PushbulletAuth)
type instance AuthClientData (AuthProtect PushbulletAuth) = PushbulletKey