Safe Haskell | None |
---|---|
Language | Haskell2010 |
Access of car-specific APIs.
Synopsis
- type Car = ReaderT CarEnv
- runCar :: MonadIO m => IO AuthInfo -> VehicleID -> Car m a -> m a
- runNamedCar :: MonadIO m => Text -> IO AuthInfo -> Car m a -> m a
- type VehicleID = Text
- vehicleData :: MonadIO m => Car m VehicleData
- nearbyChargers :: MonadIO m => Car m [Charger]
- type VehicleData = ByteString
- isUserPresent :: VehicleData -> Bool
- isCharging :: VehicleData -> Bool
- teslaTS :: VehicleData -> UTCTime
- maybeTeslaTS :: VehicleData -> Maybe UTCTime
- data Door
- data OpenState a
- doors :: VehicleData -> Maybe [OpenState Door]
- openDoors :: VehicleData -> [Door]
- data Location = Location {}
- data DestinationCharger = DestinationCharger {}
- data Supercharger = Supercharger {}
- data Charger
- superchargers :: [Charger] -> [Supercharger]
- destinationChargers :: [Charger] -> [DestinationCharger]
- lat :: Lens' Location Double
- lon :: Lens' Location Double
- _SC :: Prism' Charger Supercharger
- _DC :: Prism' Charger DestinationCharger
- name :: HasName s a => Lens' s a
- location :: HasLocation s a => Lens' s a
- distance_miles :: HasDistance_miles s a => Lens' s a
- available_stalls :: HasAvailable_stalls s a => Lens' s a
- total_stalls :: HasTotal_stalls s a => Lens' s a
- site_closed :: HasSite_closed s a => Lens' s a
- vehicleURL :: VehicleID -> String -> String
- authInfo :: MonadIO m => Car m AuthInfo
- vehicleID :: Monad m => Car m VehicleID
Car Monad and related types.
runCar :: MonadIO m => IO AuthInfo -> VehicleID -> Car m a -> m a Source #
Run a Car Monad with the given Vehicle ID
runNamedCar :: MonadIO m => Text -> IO AuthInfo -> Car m a -> m a Source #
Run a Car Monad by looking up a car by name.
Requests
vehicleData :: MonadIO m => Car m VehicleData Source #
Fetch the VehicleData.
Convenience functions for examining VehicleData
type VehicleData = ByteString Source #
Giant blob of VehicleData describing all known state of the vehicle.
This is not separated into discrete A VehicleIDfields because that's easy enough to do with Aeson and Lens when you need it but some convenience methods for common | A VehicleIDaccesses are available in this module.
isUserPresent :: VehicleData -> Bool Source #
True if a user is present in the vehicle.
isCharging :: VehicleData -> Bool Source #
True of the vehicle is currently charging.
teslaTS :: VehicleData -> UTCTime Source #
Get the timestamp from this VehicleData or error if there isn't one.
maybeTeslaTS :: VehicleData -> Maybe UTCTime Source #
Get the timestamp from this VehicleData if present.
The various doors.
openDoors :: VehicleData -> [Door] Source #
Return a list of open doors.
Charger Info
Location, Location, Location.
Instances
Show Location Source # | |
Generic Location Source # | |
FromJSON Location Source # | |
type Rep Location Source # | |
Defined in Tesla.Car type Rep Location = D1 (MetaData "Location" "Tesla.Car" "tesla-0.1.0.0-JB5wsXtyQxgGsyRjC0YcSi" False) (C1 (MetaCons "Location" PrefixI True) (S1 (MetaSel (Just "_lat") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double) :*: S1 (MetaSel (Just "_lon") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double))) |
data DestinationCharger Source #
A destination charger (provided by nearbyChargers).
Instances
data Supercharger Source #
A supercharger (provided by nearbyChargers).
Supercharger | |
|
Instances
Eitehr a Supercharger or Destination charger.
superchargers :: [Charger] -> [Supercharger] Source #
Return only the superchargers from a Charger list.
destinationChargers :: [Charger] -> [DestinationCharger] Source #
Return only the destination chargers from a Charger list.
Lenses
distance_miles :: HasDistance_miles s a => Lens' s a Source #
available_stalls :: HasAvailable_stalls s a => Lens' s a Source #
total_stalls :: HasTotal_stalls s a => Lens' s a Source #
site_closed :: HasSite_closed s a => Lens' s a Source #