on master help sign in
polish up cabal file, add a README
commitfe3bd998aa8fc523d04f16eaab391c4429f29173 authorAlp Mestanogullari <alpmestan@gmail.com> dateMon 8 Dec 2014, 11:10 (12 years ago) parent8c7cc95
2 files changed+44−3
README.md+22 servant-client.cabal+22−3
README.mdnew file+22
@@ -0,0 +1,22 @@
1+# servant-client
2+
3+[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-client.svg)](http://travis-ci.org/haskell-servant/servant-client)
4+
5+![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
6+
7+This library lets you derive automatically Haskell functions that let you query each endpoint of a *servant* webservice.
8+
9+## Example
10+
11+``` haskell
12+type MyApi = "books" :> Get [Book] -- GET /books
13+ :<|> "books" :> ReqBody Book :> Post Book -- POST /books
14+
15+myApi :: Proxy MyApi
16+myApi = Proxy
17+
18+getAllBooks :: BaseUrl -> EitherT String IO [Book]
19+postNewBook :: Book -> BaseUrl -> EitherT String IO Book
20+-- 'client' allows you to produce operations to query an API from a client.
21+(getAllBooks :<|> postNewBook) = client myApi
22+```
servant-client.cabal+22−3
@@ -1,7 +1,21 @@
11name: servant-client
22version: 0.2
3−-- synopsis:
4−-- description:
3+synopsis: automatical derivation of haskell functions that let you query servant webservices
4+description:
5+ This library lets you derive automatically Haskell functions that
6+ let you query each endpoint of a <http://hackage.haskell.org/package/servant servant> webservice.
7+ .
8+ Example below.
9+ .
10+ > type MyApi = "books" :> Get [Book] -- GET /books
11+ > :<|> "books" :> ReqBody Book :> Post Book -- POST /books
12+ >
13+ > myApi :: Proxy MyApi
14+ > myApi = Proxy
15+ >
16+ > getAllBooks :: BaseUrl -> EitherT String IO [Book]
17+ > postNewBook :: Book -> BaseUrl -> EitherT String IO Book
18+ > (getAllBooks :<|> postNewBook) = client myApi
519license: BSD3
620license-file: LICENSE
721author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
@@ -11,6 +25,11 @@ category: Web
1125build-type: Simple
1226cabal-version: >=1.10
1327tested-with: GHC >= 7.8
28+homepage: http://haskell-servant.github.io/
29+Bug-reports: http://github.com/haskell-servant/servant-client/issues
30+source-repository head
31+ type: git
32+ location: http://github.com/haskell-servant/servant-client.git
1433
1534library
1635 exposed-modules:
@@ -34,7 +53,7 @@ library
3453 , transformers
3554 hs-source-dirs: src
3655 default-language: Haskell2010
37− ghc-options: -O0 -Wall
56+ ghc-options: -Wall
3857
3958test-suite spec
4059 type: exitcode-stdio-1.0