Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class ResponseBodyType a where
- parseResponseBody :: Response (ConduitM () ByteString (ResourceT IO) ()) -> ResourceT IO (Response a)
- type NoContent = ()
- getResponse :: MonadResource m => TWInfo -> Manager -> Request -> m (Response (ConduitM () ByteString m ()))
- call :: ResponseBodyType responseType => TWInfo -> Manager -> APIRequest apiName responseType -> IO responseType
- call' :: ResponseBodyType value => TWInfo -> Manager -> APIRequest apiName responseType -> IO value
- callWithResponse :: ResponseBodyType responseType => TWInfo -> Manager -> APIRequest apiName responseType -> IO (Response responseType)
- callWithResponse' :: ResponseBodyType value => TWInfo -> Manager -> APIRequest apiName responseType -> IO (Response value)
- checkResponse :: Response Value -> Either TwitterError Value
- sourceWithMaxId :: (MonadIO m, FromJSON responseType, AsStatus responseType, HasParam "max_id" Integer supports) => TWInfo -> Manager -> APIRequest supports [responseType] -> ConduitT () responseType m ()
- sourceWithMaxId' :: (MonadIO m, HasParam "max_id" Integer supports) => TWInfo -> Manager -> APIRequest supports [responseType] -> ConduitT () Value m ()
- sourceWithCursor :: (MonadIO m, FromJSON responseType, KnownSymbol ck, HasParam "cursor" Integer supports) => TWInfo -> Manager -> APIRequest supports (WithCursor Integer ck responseType) -> ConduitT () responseType m ()
- sourceWithCursor' :: (MonadIO m, KnownSymbol ck, HasParam "cursor" Integer supports) => TWInfo -> Manager -> APIRequest supports (WithCursor Integer ck responseType) -> ConduitT () Value m ()
- sourceWithSearchResult :: (MonadIO m, FromJSON responseType) => TWInfo -> Manager -> APIRequest supports (SearchResult [responseType]) -> m (SearchResult (ConduitT () responseType m ()))
- sourceWithSearchResult' :: MonadIO m => TWInfo -> Manager -> APIRequest supports (SearchResult [responseType]) -> m (SearchResult (ConduitT () Value m ()))
- endpoint :: String
- makeRequest :: APIRequest apiName responseType -> IO Request
- sinkJSON :: MonadThrow m => ConduitT ByteString o m Value
- sinkFromJSON :: (FromJSON a, MonadThrow m) => ConduitT ByteString o m a
Documentation
class ResponseBodyType a where Source #
parseResponseBody :: Response (ConduitM () ByteString (ResourceT IO) ()) -> ResourceT IO (Response a) Source #
Instances
FromJSON a => ResponseBodyType a Source # | |
Defined in Web.Twitter.Conduit.Base | |
ResponseBodyType NoContent Source # | |
Defined in Web.Twitter.Conduit.Base |
getResponse :: MonadResource m => TWInfo -> Manager -> Request -> m (Response (ConduitM () ByteString m ())) Source #
:: ResponseBodyType responseType | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest apiName responseType | |
-> IO responseType |
Perform an APIRequest
and then provide the response which is mapped to a suitable type of
twitter-types.
Example:
user <-call
twInfo mgr $accountVerifyCredentials
print user
If you need raw JSON value which is parsed by aeson,
use call'
to obtain it.
:: ResponseBodyType value | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest apiName responseType | |
-> IO value |
Perform an APIRequest
and then provide the response.
The response of this function is not restrict to responseType
,
so you can choose an arbitrarily type of FromJSON instances.
:: ResponseBodyType responseType | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest apiName responseType | |
-> IO (Response responseType) |
Perform an APIRequest
and then provide the Response
.
Example:
res <-callWithResponse
twInfo mgr $accountVerifyCredentials
responseStatus
resresponseHeaders
resresponseBody
res
callWithResponse' :: ResponseBodyType value => TWInfo -> Manager -> APIRequest apiName responseType -> IO (Response value) Source #
Perform an APIRequest
and then provide the Response
.
The response of this function is not restrict to responseType
,
so you can choose an arbitrarily type of FromJSON instances.
Example:
res <-callWithResponse'
twInfo mgr $accountVerifyCredentials
responseStatus
resresponseHeaders
resresponseBody
(res :: Value)
:: (MonadIO m, FromJSON responseType, AsStatus responseType, HasParam "max_id" Integer supports) | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest supports [responseType] | |
-> ConduitT () responseType m () |
A wrapper function to perform multiple API request with changing max_id
parameter.
This function cooperate with instances of HasMaxIdParam
.
:: (MonadIO m, HasParam "max_id" Integer supports) | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest supports [responseType] | |
-> ConduitT () Value m () |
A wrapper function to perform multiple API request with changing max_id
parameter.
The response of this function is not restrict to responseType
,
so you can choose an arbitrarily type of FromJSON instances.
This function cooperate with instances of HasMaxIdParam
.
:: (MonadIO m, FromJSON responseType, KnownSymbol ck, HasParam "cursor" Integer supports) | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest supports (WithCursor Integer ck responseType) | |
-> ConduitT () responseType m () |
A wrapper function to perform multiple API request with changing cursor
parameter.
This function cooperate with instances of HasCursorParam
.
:: (MonadIO m, KnownSymbol ck, HasParam "cursor" Integer supports) | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest supports (WithCursor Integer ck responseType) | |
-> ConduitT () Value m () |
A wrapper function to perform multiple API request with changing cursor
parameter.
The response of this function is not restrict to responseType
,
so you can choose an arbitrarily type of FromJSON instances.
This function cooperate with instances of HasCursorParam
.
sourceWithSearchResult Source #
:: (MonadIO m, FromJSON responseType) | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest supports (SearchResult [responseType]) | |
-> m (SearchResult (ConduitT () responseType m ())) |
A wrapper function to perform multiple API request with SearchResult
.
sourceWithSearchResult' Source #
:: MonadIO m | |
=> TWInfo | Twitter Setting |
-> Manager | |
-> APIRequest supports (SearchResult [responseType]) | |
-> m (SearchResult (ConduitT () Value m ())) |
A wrapper function to perform multiple API request with SearchResult
.
makeRequest :: APIRequest apiName responseType -> IO Request Source #
sinkJSON :: MonadThrow m => ConduitT ByteString o m Value Source #
sinkFromJSON :: (FromJSON a, MonadThrow m) => ConduitT ByteString o m a Source #