Portability | portable |
---|---|
Stability | none |
Maintainer | uzytkownik2@gmail.com |
This module contains the common features and common interface.
- class Connection c where
- articleFromID :: c -> String -> IO (Maybe Article)
- articleFromNo :: c -> Group -> Integer -> IO (Maybe Article)
- groupFromName :: c -> String -> IO (Maybe Group)
- forGroups :: c -> (Group -> IO a) -> IO [a]
- forNewGroups :: c -> UTCTime -> (Group -> IO a) -> IO [a]
- forArticles :: c -> Group -> (Article -> IO a) -> IO [a]
- forNewArticles :: c -> Group -> UTCTime -> (Article -> IO a) -> IO [a]
- listGroups :: c -> IO [Group]
- listNewGroups :: c -> UTCTime -> IO [Group]
- listArticles :: c -> Group -> IO [Article]
- listNewArticles :: c -> Group -> UTCTime -> IO [Article]
- fetchArticle :: c -> Article -> IO Article
- fetchArticleHeader :: c -> Article -> IO Article
- fetchArticleBody :: c -> Article -> IO Article
- fetchArticleLazy :: c -> Article -> IO Article
- fetchArticleHeaderLazy :: c -> Article -> IO Article
- fetchArticleBodyLazy :: c -> Article -> IO Article
- fetchGroup :: c -> Group -> IO Group
- post :: c -> ByteString -> IO ()
- disconnect :: c -> IO ()
- data Article = Article {}
- data Group = Group {}
- data NNTPError
Classes
class Connection c whereSource
:: c | Connection |
-> String | ID of the article |
-> IO (Maybe Article) | Returns the article | Returns the Article of given number from given Group. Please note that it may or may not fetch the header and body. Preferred is lazy loading. |
Returns the Article for given ID. Please note that it may or may not fetch the header and body. Preferred is lazy loading.
If you need to fetch the article you may use:
articleFromID c >=> maybe (return Nothing) (fmap Just . fetchArticleLazy)
:: c | Connection |
-> Group | Group |
-> Integer | Number of article in group |
-> IO (Maybe Article) | The article | Returns the Group of given name. |
:: c | Connection |
-> (Group -> IO a) | Function called each time |
-> IO [a] | Collected values | Iterates over new group on server collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call. |
Iterates over every group on server collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call.
:: c | Connection |
-> UTCTime | Groups only newer thet this time will be returned |
-> (Group -> IO a) | Function called each time |
-> IO [a] | Collected values | Iterates over the articles in group collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call. |
:: c | Connection |
-> Group | Group which we iterate |
-> (Article -> IO a) | Function called each time |
-> IO [a] | Collected values | Iterates over the new articles in group collecting values. Please note that the function may be called before all I/O operations finished and the implementation may or may not allaw to call other NNTP functions during the call. |
:: c | Connection |
-> Group | Group which we iterate |
-> UTCTime | Articles only newer thet this time will be returned |
-> (Article -> IO a) | Function called each time |
-> IO [a] | Collected values |
Lists the groups. It has default implementation.
:: c | Connection |
-> UTCTime | Groups only newer thet this time will be returned |
-> IO [Group] | List of groups |
Lists the new groups. It has default implementation.
Lists the articles. It has default implementation.
:: c | Connection |
-> Group | Group which we list |
-> UTCTime | Articles only newer thet this time will be returned |
-> IO [Article] | List of articles |
Lists the new articles. It has default implementation.
Fetch the article. It has default implementation defined in terms
of fetchArticleHeader
and fetchArticleBody
.
Fetch the article header. It has default implementation defined in
terms of fetchArticle
.
Fetch the article header. It has default implementation defined in
terms of fetchArticle
.
Fetchs the article only if it is not fetched. It has default implementation.
Fetchs the article header if it is not fetched. It has default implementation.
Fetchs the article body if it is not fetched. It has default implementation.
Updates group.
:: c | Connection |
-> ByteString | Article content |
-> IO () |
Posts an article.
Disconnects gently
Types
Represents a single article. Please note that except the splitting into header and body no parsing is done.
Article | |
|
Represents a single group.
Group | |
|
Errors
Indicates an error of handling NNTP connection. Please note that this should
indicate client errors only (with the exception of ServiceDiscontinued
and
in some cases PostingFailed
).
NoSuchGroup | Indicates that operation was performed on group that does not exists. |
NoSuchArticle | Indicates that operation was performed on article that does not exists. |
PostingFailed | Indicates that posting operation failed for some reason. |
PostingNotAllowed | Indicates that posting is not allowed. |
ServiceDiscontinued | Indicates that service was discontinued |