polish up cabal file, add a README
This commit is contained in:
parent
8c7cc95b8c
commit
fe3bd998aa
2 changed files with 44 additions and 3 deletions
22
README.md
Normal file
22
README.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# servant-client
|
||||||
|
|
||||||
|
[](http://travis-ci.org/haskell-servant/servant-client)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This library lets you derive automatically Haskell functions that let you query each endpoint of a *servant* webservice.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
``` haskell
|
||||||
|
type MyApi = "books" :> Get [Book] -- GET /books
|
||||||
|
:<|> "books" :> ReqBody Book :> Post Book -- POST /books
|
||||||
|
|
||||||
|
myApi :: Proxy MyApi
|
||||||
|
myApi = Proxy
|
||||||
|
|
||||||
|
getAllBooks :: BaseUrl -> EitherT String IO [Book]
|
||||||
|
postNewBook :: Book -> BaseUrl -> EitherT String IO Book
|
||||||
|
-- 'client' allows you to produce operations to query an API from a client.
|
||||||
|
(getAllBooks :<|> postNewBook) = client myApi
|
||||||
|
```
|
|
@ -1,7 +1,21 @@
|
||||||
name: servant-client
|
name: servant-client
|
||||||
version: 0.2
|
version: 0.2
|
||||||
-- synopsis:
|
synopsis: automatical derivation of haskell functions that let you query servant webservices
|
||||||
-- description:
|
description:
|
||||||
|
This library lets you derive automatically Haskell functions that
|
||||||
|
let you query each endpoint of a <http://hackage.haskell.org/package/servant servant> webservice.
|
||||||
|
.
|
||||||
|
Example below.
|
||||||
|
.
|
||||||
|
> type MyApi = "books" :> Get [Book] -- GET /books
|
||||||
|
> :<|> "books" :> ReqBody Book :> Post Book -- POST /books
|
||||||
|
>
|
||||||
|
> myApi :: Proxy MyApi
|
||||||
|
> myApi = Proxy
|
||||||
|
>
|
||||||
|
> getAllBooks :: BaseUrl -> EitherT String IO [Book]
|
||||||
|
> postNewBook :: Book -> BaseUrl -> EitherT String IO Book
|
||||||
|
> (getAllBooks :<|> postNewBook) = client myApi
|
||||||
license: BSD3
|
license: BSD3
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
|
author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
|
||||||
|
@ -11,6 +25,11 @@ category: Web
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
tested-with: GHC >= 7.8
|
tested-with: GHC >= 7.8
|
||||||
|
homepage: http://haskell-servant.github.io/
|
||||||
|
Bug-reports: http://github.com/haskell-servant/servant-client/issues
|
||||||
|
source-repository head
|
||||||
|
type: git
|
||||||
|
location: http://github.com/haskell-servant/servant-client.git
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
|
@ -34,7 +53,7 @@ library
|
||||||
, transformers
|
, transformers
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -O0 -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
test-suite spec
|
test-suite spec
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue