tesla-0.7.4.0: Tesla API client.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Tesla.Car.Command

Description

Executing commands within the Car Monad.

Synopsis

Documentation

newtype Time Source #

Data type representing local time in minutes since midnight.

Constructors

Time (Finite 1440) 

Instances

Instances details
ToJSON Time Source # 
Instance details

Defined in Tesla.Car.Command

Methods

toJSON :: Time -> Value

toEncoding :: Time -> Encoding

toJSONList :: [Time] -> Value

toEncodingList :: [Time] -> Encoding

Num Time Source # 
Instance details

Defined in Tesla.Car.Command

Methods

(+) :: Time -> Time -> Time #

(-) :: Time -> Time -> Time #

(*) :: Time -> Time -> Time #

negate :: Time -> Time #

abs :: Time -> Time #

signum :: Time -> Time #

fromInteger :: Integer -> Time #

Show Time Source # 
Instance details

Defined in Tesla.Car.Command

Methods

showsPrec :: Int -> Time -> ShowS #

show :: Time -> String #

showList :: [Time] -> ShowS #

FormValue Time Source # 
Instance details

Defined in Tesla.Car.Command

mkTime :: Finite 24 -> Finite 60 -> Time Source #

Make a Time with the given hours and minutes.

fromTime :: Time -> (Finite 24, Finite 60) Source #

Get the hours and minutes out of a Time.

newtype Percent Source #

A type representing a whole number percnetage between 0 and 100 (inclusive).

Constructors

Percent (Finite 101) 

Instances

Instances details
ToJSON Percent Source # 
Instance details

Defined in Tesla.Car.Command

Methods

toJSON :: Percent -> Value

toEncoding :: Percent -> Encoding

toJSONList :: [Percent] -> Value

toEncodingList :: [Percent] -> Encoding

Read Percent Source # 
Instance details

Defined in Tesla.Car.Command

Show Percent Source # 
Instance details

Defined in Tesla.Car.Command

runCmd :: MonadIO m => String -> [Pair] -> Car m CommandResponse Source #

Run a command with a JSON payload.

runCmd' :: MonadIO m => String -> Car m CommandResponse Source #

Run command without a payload

type CommandResponse = Either Text () Source #

A CommandResponse wraps an Either such that Left represents a failure message and Right suggests the command was successful.

data Car m a Source #

Car Monad for accessing car-specific things.

Instances

Instances details
MonadFail m => MonadFail (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

fail :: String -> Car m a #

MonadIO m => MonadIO (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

liftIO :: IO a -> Car m a #

Applicative m => Applicative (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

pure :: a -> Car m a #

(<*>) :: Car m (a -> b) -> Car m a -> Car m b #

liftA2 :: (a -> b -> c) -> Car m a -> Car m b -> Car m c #

(*>) :: Car m a -> Car m b -> Car m b #

(<*) :: Car m a -> Car m b -> Car m a #

Functor m => Functor (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

fmap :: (a -> b) -> Car m a -> Car m b #

(<$) :: a -> Car m b -> Car m a #

Monad m => Monad (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

(>>=) :: Car m a -> (a -> Car m b) -> Car m b #

(>>) :: Car m a -> Car m b -> Car m b #

return :: a -> Car m a #

MonadCatch m => MonadCatch (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

catch :: Exception e => Car m a -> (e -> Car m a) -> Car m a #

MonadMask m => MonadMask (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

mask :: ((forall a. Car m a -> Car m a) -> Car m b) -> Car m b #

uninterruptibleMask :: ((forall a. Car m a -> Car m a) -> Car m b) -> Car m b #

generalBracket :: Car m a -> (a -> ExitCase b -> Car m c) -> (a -> Car m b) -> Car m (b, c) #

MonadThrow m => MonadThrow (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

throwM :: Exception e => e -> Car m a #

MonadLogger m => MonadLogger (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Car m ()

MonadUnliftIO m => MonadUnliftIO (Car m) Source # 
Instance details

Defined in Tesla.Car

Methods

withRunInIO :: ((forall a. Car m a -> IO a) -> IO b) -> Car m b

(.=) :: (KeyValue kv, ToJSON v) => Key -> v -> kv #

TH support for generating commands.

mkCommand :: String -> String -> Q [Dec] Source #

Build a simple named command car that posts to the given named endpoint.

mkCommands :: [String] -> Q [Dec] Source #

Build a bunch of commands from a list of named endpoints, defining functions by removing the common prefix.

mkNamedCommands :: [(String, String)] -> Q [Dec] Source #

Make commands with given names.

Orphan instances

FormValue Bool Source # 
Instance details