{-# LANGUAGE OverloadedStrings #-}
module Tesla.Car.Command.Wake (
wakeUp
) where
import Control.Monad.IO.Class (MonadIO (..))
import Data.Aeson
import qualified Data.ByteString.Lazy as BL
import Tesla.Car (currentVehicleID, vehicleURL)
import Tesla.Car.Command
import Tesla.Internal.HTTP (jpostAuth)
wakeUp :: (FromJSON j, MonadIO m) => Car m j
wakeUp :: forall j (m :: * -> *). (FromJSON j, MonadIO m) => Car m j
wakeUp = forall (m :: * -> *). MonadReader CarEnv m => m VehicleID
currentVehicleID forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \VehicleID
v -> forall (m :: * -> *) j a.
(HasTeslaAuth m, FromJSON j, Postable a, MonadIO m) =>
String -> a -> m j
jpostAuth (VehicleID -> String -> String
vehicleURL VehicleID
v String
"wake_up") ByteString
BL.empty