Copyright | (c) Jon Schoning 2015 |
---|---|
Maintainer | jonschoning@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- fromApiToken :: String -> PinboardConfig
- defaultPinboardConfig :: PinboardConfig
- data PinboardConfig = PinboardConfig {
- apiToken :: !ByteString
- maxRequestRateMills :: !Int
- lastRequestTime :: IORef UTCTime
- doThreadDelay :: PinboardConfig -> IO ()
- execLoggingT :: ExecLoggingT
- filterLoggingT :: LogSource -> LogLevel -> Bool
- runPinboard :: MonadUnliftIO m => PinboardConfig -> PinboardT m a -> m a
- runPinboardE :: MonadUnliftIO m => PinboardEnv -> PinboardT m a -> m a
- pinboardJson :: (MonadPinboard m, FromJSON a) => PinboardRequest -> m (Either PinboardError a)
- runPinboardSingleRaw :: PinboardConfig -> PinboardRequest -> IO (Response ByteString)
- runPinboardSingleRawBS :: PinboardConfig -> PinboardRequest -> IO (Either PinboardError ByteString)
- runPinboardSingleJson :: FromJSON a => PinboardConfig -> PinboardRequest -> IO (Either PinboardError a)
- sendPinboardRequest :: PinboardEnv -> PinboardRequest -> IO (Response ByteString)
- requestThreadDelay :: PinboardConfig -> IO ()
- newMgr :: IO Manager
- mgrFail :: Monad m => PinboardErrorType -> SomeException -> m (Either PinboardError b)
- parseJSONResponse :: FromJSON a => Response ByteString -> Either PinboardError a
- decodeJSONResponse :: FromJSON a => ByteString -> Either PinboardError a
- checkStatusCodeResponse :: Response ByteString -> Either PinboardError ()
- checkStatusCode :: Int -> Either PinboardError ()
- addErrMsg :: Text -> PinboardError -> PinboardError
- createParserErr :: Text -> PinboardError
- httpStatusPinboardError :: PinboardErrorHTTPCode -> Either PinboardError a
- module Pinboard.Logging
- module Pinboard.Util
- module Pinboard.Error
- module Pinboard.Types
Config
fromApiToken :: String -> PinboardConfig Source #
Create a default PinboardConfig using the supplied apiToken (ex: "use:ABCDEF0123456789ABCD")
The PinboardConfig provides authentication via apiToken
data PinboardConfig Source #
PinboardConfig | |
|
Instances
Show PinboardConfig Source # | |
Defined in Pinboard.Types showsPrec :: Int -> PinboardConfig -> ShowS # show :: PinboardConfig -> String # showList :: [PinboardConfig] -> ShowS # |
Monadic
runPinboard :: MonadUnliftIO m => PinboardConfig -> PinboardT m a -> m a Source #
Execute computations in the Pinboard monad
runPinboardE :: MonadUnliftIO m => PinboardEnv -> PinboardT m a -> m a Source #
Execute computations in the Pinboard monad (with specified http Manager)
pinboardJson :: (MonadPinboard m, FromJSON a) => PinboardRequest -> m (Either PinboardError a) Source #
Create a Pinboard value from a PinboardRequest w/ json deserialization
Single
runPinboardSingleRawBS :: PinboardConfig -> PinboardRequest -> IO (Either PinboardError ByteString) Source #
runPinboardSingleJson :: FromJSON a => PinboardConfig -> PinboardRequest -> IO (Either PinboardError a) Source #
Sending
sendPinboardRequest :: PinboardEnv -> PinboardRequest -> IO (Response ByteString) Source #
Delaying
requestThreadDelay :: PinboardConfig -> IO () Source #
delays the thread, if the time since the previous request is less than the configured maxRequestRateMills
Manager (http-client)
mgrFail :: Monad m => PinboardErrorType -> SomeException -> m (Either PinboardError b) Source #
JSON Handling
parseJSONResponse :: FromJSON a => Response ByteString -> Either PinboardError a Source #
decodeJSONResponse :: FromJSON a => ByteString -> Either PinboardError a Source #
Status Codes
checkStatusCode :: Int -> Either PinboardError () Source #
Error Helpers
addErrMsg :: Text -> PinboardError -> PinboardError Source #
createParserErr :: Text -> PinboardError Source #
Client Dependencies
module Pinboard.Logging
module Pinboard.Util
module Pinboard.Error
module Pinboard.Types