DigitalOcean-0.1.1.0: A client library for the DigitalOcean API

Safe HaskellNone
LanguageHaskell2010

Net.DigitalOcean.Request

Synopsis

Documentation

  • Request wrappers

get :: (FromJSON a, Error e, MonadError e m, MonadIO m) => String -> String -> Config -> m a Source

Send a GET request to the given endpoint, and parse the result via handleResp

post :: (ToJSON a, FromJSON b, Error e, MonadError e m, MonadIO m) => String -> String -> a -> Config -> m b Source

Send a POST request to the given endpoint, and parse the result via handleResp

put :: (ToJSON a, FromJSON b, Error e, MonadError e m, MonadIO m) => String -> String -> a -> Config -> m b Source

Send a PUT request to the given endpoint, and parse the result via handleResp

delete :: (Error e, MonadError e m, MonadIO m) => String -> Config -> m () Source

Send a DELETE request to the given endpoint, and parse the result via handleResp

  • Lower level methods

handleResp :: (FromJSON a, Error e, MonadError e m, MonadIO m) => String -> Response ByteString -> m a Source

Given a raw response, extract the json element "key", and then parse. Also error should the status code != 2xx

url :: String -> String Source

Get the url for an endpoint