twitter-conduit-0.6.1: Twitter API package with conduit interface and Streaming API support.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Web.Twitter.Conduit.Base

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 #

Methods

parseResponseBody :: Response (ConduitM () ByteString (ResourceT IO) ()) -> ResourceT IO (Response a) Source #

#### Instances

Instances details

ResponseBodyType NoContent Source # |
Instance details Defined in Web.Twitter.Conduit.Base Methods parseResponseBody :: Response (ConduitM () ByteString (ResourceT IO) ()) -> ResourceT IO (Response NoContent) Source #
FromJSON a => ResponseBodyType a Source # |
Instance details Defined in Web.Twitter.Conduit.Base Methods parseResponseBody :: Response (ConduitM () ByteString (ResourceT IO) ()) -> ResourceT IO (Response a) Source #

type NoContent = () Source #

getResponse :: MonadResource m => TWInfo -> Manager -> Request -> m (Response (ConduitM () ByteString m ())) Source #

call Source #

Arguments

:: 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.

call' Source #

Arguments

:: 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.

callWithResponse Source #

Arguments

:: 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
    print $ responseStatus res
    print $ responseHeaders res
    print $ responseBody 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
    print $ responseStatus res
    print $ responseHeaders res
    print $ responseBody (res :: Value)

checkResponse :: Response Value -> Either TwitterError Value Source #

sourceWithMaxId Source #

Arguments

:: (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`.

sourceWithMaxId' Source #

Arguments

:: (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`.

sourceWithCursor Source #

Arguments

:: (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`.

sourceWithCursor' Source #

Arguments

:: (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 #

Arguments

:: (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 #

Arguments

:: 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`.

endpoint :: String Source #

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 #