Copyright | (c) Yiğit Özkavcı, 2017 |
---|---|
License | WTFPL |
Maintainer | yigitozkavci8@gmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
This module controls all the data flow and client interface required to interact with the library.
- type Id = String
- type ApiKey = String
- newtype Client = Client {}
- getClient :: String -> Client
- data Resource
- data Operation
- baseUrl :: String
- getUrl :: Operation -> String
- fetchResource :: Client -> Operation -> IO ByteString
- getPage :: Client -> Id -> IO (Either String Page)
- getPages :: Client -> IO (Either String [Page])
- getNewsPhotoGallery :: Client -> Id -> IO (Either String NewsPhotoGallery)
- getNewsPhotoGalleries :: Client -> IO (Either String [NewsPhotoGallery])
- getColumn :: Client -> Id -> IO (Either String Column)
- getColumns :: Client -> IO (Either String [Column])
- getPath :: Client -> Id -> IO (Either String Path)
- getPaths :: Client -> IO (Either String [Path])
- getWriter :: Client -> Id -> IO (Either String Writer)
- getWriters :: Client -> IO (Either String [Writer])
- getArticle :: Client -> Id -> IO (Either String Article)
- getArticles :: Client -> IO (Either String [Article])
Documentation
getClient :: String -> Client Source #
This is how you construct the client. Takes apiKey as an argument
Each of these resources represent services. These are used for passing service-spesific data such as endpoint string
For now, Hurriyet API only consists of 2 operations. As we have more, new operations will be added into here
getUrl :: Operation -> String Source #
This method constructs url given the operation. Operation already contains enough data to construct the url
fetchResource :: Client -> Operation -> IO ByteString Source #
Given a client and a operation, this method can conquer the world. But prefers not to and returns a bytestring representing json string of the response body
getNewsPhotoGallery :: Client -> Id -> IO (Either String NewsPhotoGallery) Source #
Get a single news photo gallery
getNewsPhotoGalleries :: Client -> IO (Either String [NewsPhotoGallery]) Source #
Get all news photo galleries