项目作者: yigitozkavci

项目描述 :
Haskell bindings for Hurriyet API
高级语言: Haskell
项目地址: git://github.com/yigitozkavci/hurriyet-haskell.git
创建时间: 2017-01-26T09:09:42Z
项目社区:https://github.com/yigitozkavci/hurriyet-haskell

开源协议:MIT License

下载


hurriyet-haskell

Haskell bindings for Hurriyet API - http://developers.hurriyet.com.tr/

Getting Started

This section provides just enough material to get you started. For a more sophisticated
illustration of the library, visit https://hackage.haskell.org/package/hurriyet for documentation.

To get started, do the following steps:

  • Install the package $ cabal install hurriyet
  • Go and get your api key from http://developers.hurriyet.com.tr/ while the package is being installed
  • And start using it! See below for examples

Examples

Get the list of articles

  1. import Hurriyet
  2. import Hurriyet.Services
  3. client :: Client
  4. client = getClient "<API KEY>"
  5. main = do
  6. response <- withClient client getArticles
  7. case response of
  8. Left err -> print err
  9. Right articles -> print articles

Get the metadata of the first file of the first article

  1. import Hurriyet
  2. import Hurriyet.Services
  3. import Hurriyet.Services.Article
  4. import Hurriyet.Services.File
  5. client :: Client
  6. client = getClient "<API KEY>"
  7. main = do
  8. response <- withClient client getArticles
  9. case response of
  10. Left err -> print err
  11. Right (article:_) -> print . metadata . head $ files article

Note that in order to use any accessor method for any of the services, you should import the relative service. See here for more detailed information regarding services.

Contributing

This library is currently maintained by me, and appreciate any contributions even if they just update the docs.
There are beginner-friendly issues in here, and I encourage you to see if you can contribute in any way.

LICENSE

MIT License