diff --git a/Servant-API-Alternative.html b/Servant-API-Alternative.html index 40677d7d..86c34f0b 100644 --- a/Servant-API-Alternative.html +++ b/Servant-API-Alternative.html @@ -1,7 +1,7 @@ Servant.API.Alternative

servant-0.2

Safe HaskellNone
LanguageHaskell2010

Servant.API.Alternative

Synopsis

Documentation

data a :<|> b infixr 8 Source

Union of two APIs, first takes precedence in case of overlap.

Example:

type MyApi = "books" :> Get [Book] -- GET /books
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Alternative

Synopsis

Documentation

data a :<|> b infixr 8 Source

Union of two APIs, first takes precedence in case of overlap.

Example:

type MyApi = "books" :> Get [Book] -- GET /books
         :<|> "books" :> ReqBody Book :> Post Book -- POST /books

Constructors

a :<|> b infixr 8 

Instances

(HasServer a, HasServer b) => HasServer ((:<|>) a b)

A server for a :<|> b first tries to match the request again the route represented by a and if it fails tries b. You must provide a request handler for each route.

type MyApi = "books" :> Get [Book] -- GET /books
diff --git a/Servant-API-Capture.html b/Servant-API-Capture.html
index 30f0100e..81d58e8b 100644
--- a/Servant-API-Capture.html
+++ b/Servant-API-Capture.html
@@ -1,7 +1,7 @@
 Servant.API.Capture
Safe HaskellNone
LanguageHaskell2010

Servant.API.Capture

Synopsis

Documentation

data Capture sym a Source

Capture a value from the request path under a certain type a.

Example:

           -- GET /books/:isbn
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Capture

Synopsis

Documentation

data Capture sym a Source

Capture a value from the request path under a certain type a.

Example:

           -- GET /books/:isbn
 type MyApi = "books" :> Capture "isbn" Text :> Get Book

Instances

(KnownSymbol capture, FromText a, HasServer sublayout) => HasServer ((:>) * (Capture Symbol * capture a) sublayout)

If you use Capture in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified by the Capture. diff --git a/Servant-API-Delete.html b/Servant-API-Delete.html index 30c49f0d..28d1fb38 100644 --- a/Servant-API-Delete.html +++ b/Servant-API-Delete.html @@ -1,7 +1,7 @@ Servant.API.Delete

Safe HaskellNone
LanguageHaskell2010

Servant.API.Delete

Synopsis

Documentation

data Delete Source

Combinator for DELETE requests.

Example:

           -- DELETE /books/:isbn
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Delete

Synopsis

Documentation

data Delete Source

Combinator for DELETE requests.

Example:

           -- DELETE /books/:isbn
 type MyApi = "books" :> Capture "isbn" Text :> Delete

Instances

HasServer Delete

If you have a Delete endpoint in your API, the handler for this endpoint is meant to delete a resource.

The code of the handler will, just like diff --git a/Servant-API-Get.html b/Servant-API-Get.html index 3b3d294c..9bf56af2 100644 --- a/Servant-API-Get.html +++ b/Servant-API-Get.html @@ -1,7 +1,7 @@ Servant.API.Get

Safe HaskellNone
LanguageHaskell2010

Servant.API.Get

Synopsis

Documentation

data Get a Source

Endpoint for simple GET requests. Serves the result as JSON.

Example:

type MyApi = "books" :> Get [Book]

Instances

VLinkHelper * (Get x) 
ToJSON result => HasServer (Get result)

When implementing the handler for a Get endpoint, +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Get

Synopsis

Documentation

data Get a Source

Endpoint for simple GET requests. Serves the result as JSON.

Example:

type MyApi = "books" :> Get [Book]

Instances

VLinkHelper * (Get x) 
ToJSON result => HasServer (Get result)

When implementing the handler for a Get endpoint, just like for Delete, Post and Put, the handler code runs in the EitherT (Int, String) IO monad, where the Int represents diff --git a/Servant-API-Post.html b/Servant-API-Post.html index 3fe7bf2d..28aeea0f 100644 --- a/Servant-API-Post.html +++ b/Servant-API-Post.html @@ -1,7 +1,7 @@ Servant.API.Post

Safe HaskellNone
LanguageHaskell2010

Servant.API.Post

Synopsis

Documentation

data Post a Source

Endpoint for POST requests. The type variable represents the type of the +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Post

Synopsis

Documentation

data Post a Source

Endpoint for POST requests. The type variable represents the type of the response body (not the request body, use RQBody for that).

Example:

           -- POST /books
            -- with a JSON encoded Book as the request body
diff --git a/Servant-API-Put.html b/Servant-API-Put.html
index 745cfe56..761daee8 100644
--- a/Servant-API-Put.html
+++ b/Servant-API-Put.html
@@ -1,7 +1,7 @@
 Servant.API.Put
Safe HaskellNone
LanguageHaskell2010

Servant.API.Put

Synopsis

Documentation

data Put a Source

Endpoint for PUT requests, usually used to update a ressource. +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Put

Synopsis

Documentation

data Put a Source

Endpoint for PUT requests, usually used to update a ressource. The type a is the type of the response body that's returned.

Example:

-- PUT /books/:isbn
 -- with a Book as request body, returning the updated Book
 type MyApi = "books" :> Capture "isbn" Text :> ReqBody Book :> Put Book

Instances

ToJSON a => HasServer (Put a)

When implementing the handler for a Put endpoint, diff --git a/Servant-API-QueryParam.html b/Servant-API-QueryParam.html index ff1ea9d7..e06394fa 100644 --- a/Servant-API-QueryParam.html +++ b/Servant-API-QueryParam.html @@ -1,7 +1,7 @@ Servant.API.QueryParam

Safe HaskellNone
LanguageHaskell2010

Servant.API.QueryParam

Synopsis

Documentation

data QueryParam sym a Source

Lookup the value associated to the sym query string parameter +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.QueryParam

Synopsis

Documentation

data QueryParam sym a Source

Lookup the value associated to the sym query string parameter and try to extract it as a value of type a.

Example:

-- /books?author=<author name>
 type MyApi = "books" :> QueryParam "author" Text :> Get [Book]

Instances

(KnownSymbol sym, FromText a, HasServer sublayout) => HasServer ((:>) * (QueryParam Symbol * sym a) sublayout)

If you use QueryParam "author" Text in one of the endpoints for your API, this automatically requires your server-side handler to be a function diff --git a/Servant-API-Raw.html b/Servant-API-Raw.html index 21834152..51dfd7fc 100644 --- a/Servant-API-Raw.html +++ b/Servant-API-Raw.html @@ -1,7 +1,7 @@ Servant.API.Raw

Safe HaskellNone
LanguageHaskell2010

Servant.API.Raw

Synopsis

Documentation

data Raw Source

Endpoint for plugging in your own Wai Applications.

The given Application will get the request as received by the server, potentially with +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Raw

Synopsis

Documentation

data Raw Source

Endpoint for plugging in your own Wai Applications.

The given Application will get the request as received by the server, potentially with a modified (stripped) pathInfo if the Application is being routed with :>.

In addition to just letting you plug in your existing WAI Applications, this can also be used with serveDirectory to serve static files stored in a particular directory on your filesystem, or to serve diff --git a/Servant-API-ReqBody.html b/Servant-API-ReqBody.html index fa32de1a..6696c2a0 100644 --- a/Servant-API-ReqBody.html +++ b/Servant-API-ReqBody.html @@ -1,7 +1,7 @@ Servant.API.ReqBody

Safe HaskellNone
LanguageHaskell2010

Servant.API.ReqBody

Synopsis

Documentation

data ReqBody a Source

Extract the request body as a value of type a.

Example:

           -- POST /books
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.ReqBody

Synopsis

Documentation

data ReqBody a Source

Extract the request body as a value of type a.

Example:

           -- POST /books
 type MyApi = "books" :> ReqBody Book :> Post Book

Instances

(FromJSON a, HasServer sublayout) => HasServer ((:>) * (ReqBody * a) sublayout)

If you use ReqBody in one of the endpoints for your API, this automatically requires your server-side handler to be a function that takes an argument of the type specified by ReqBody. diff --git a/Servant-API-Sub.html b/Servant-API-Sub.html index 6376dd4a..464947fd 100644 --- a/Servant-API-Sub.html +++ b/Servant-API-Sub.html @@ -1,7 +1,7 @@ Servant.API.Sub

Safe HaskellNone
LanguageHaskell2010

Servant.API.Sub

Synopsis

Documentation

data path :> a infixr 9 Source

The contained API (second argument) can be found under ("/" ++ path) +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API.Sub

Synopsis

Documentation

data path :> a infixr 9 Source

The contained API (second argument) can be found under ("/" ++ path) (path being the first argument).

Example:

-- GET /hello/world
 -- returning a JSON encoded World value
 type MyApi = "hello" :> "world" :> Get World

Constructors

(Proxy path) :> a infixr 9 

Instances

(KnownSymbol s, VLinkHelper * e) => VLinkHelper * ((:>) Symbol s e) 
(KnownSymbol capture, FromText a, HasServer sublayout) => HasServer ((:>) * (Capture Symbol * capture a) sublayout)

If you use Capture in one of the endpoints for your API, diff --git a/Servant-API.html b/Servant-API.html index de67263d..68ce77c5 100644 --- a/Servant-API.html +++ b/Servant-API.html @@ -1,4 +1,4 @@ Servant.API

Safe HaskellNone
LanguageHaskell2010

Servant.API

Combinators

Type-level combinator for expressing subrouting: :>

Type-level combinator for alternative endpoints: :<|>

Accessing information from the request

Capturing parts of the url path as parsed values: Capture

Retrieving parameters from the query string of the URI: QueryParam

Accessing the request body as a JSON-encoded type: ReqBody

Actual endpoints, distinguished by HTTP method

GET requests

POST requests

DELETE requests

PUT requests

Untyped endpoints

Plugging in a wai Application, serving directories

Utilities

QuasiQuotes for endpoints

module Servant.QQ

Type-safe internal URLs

\ No newline at end of file +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.API

Combinators

Type-level combinator for expressing subrouting: :>

Type-level combinator for alternative endpoints: :<|>

Accessing information from the request

Capturing parts of the url path as parsed values: Capture

Retrieving parameters from the query string of the URI: QueryParam

Accessing the request body as a JSON-encoded type: ReqBody

Actual endpoints, distinguished by HTTP method

GET requests

POST requests

DELETE requests

PUT requests

Untyped endpoints

Plugging in a wai Application, serving directories

Utilities

QuasiQuotes for endpoints

module Servant.QQ

Type-safe internal URLs

\ No newline at end of file diff --git a/Servant-Common-Text.html b/Servant-Common-Text.html index 8ce17b95..be547e71 100644 --- a/Servant-Common-Text.html +++ b/Servant-Common-Text.html @@ -1,7 +1,7 @@ Servant.Common.Text
Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.Common.Text

Synopsis

Documentation

class FromText a where Source

For getting values from url captures and query string parameters

Methods

fromText :: Text -> Maybe a Source

Instances

FromText Bool
fromText "true"  = Just True
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.Common.Text

Synopsis

Documentation

class FromText a where Source

For getting values from url captures and query string parameters

Methods

fromText :: Text -> Maybe a Source

class ToText a where Source

For putting values in paths and query string parameters

Methods

toText :: a -> Text Source

\ No newline at end of file diff --git a/Servant-QQ.html b/Servant-QQ.html index 0f12ce8c..1ebf37b6 100644 --- a/Servant-QQ.html +++ b/Servant-QQ.html @@ -1,7 +1,7 @@ Servant.QQ
Safe HaskellNone
LanguageHaskell2010

Servant.QQ

Description

QuasiQuoting utilities for API types.

sitemap allows you to write your type in a very natural way:

[sitemap|
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.QQ

Description

QuasiQuoting utilities for API types.

sitemap allows you to write your type in a very natural way:

[sitemap|
 PUT        hello                 String -> ()
 POST       hello/p:Int           String -> ()
 GET        hello/?name:String    Int
diff --git a/Servant-Server.html b/Servant-Server.html
index c52cc4ae..8a12442c 100644
--- a/Servant-Server.html
+++ b/Servant-Server.html
@@ -1,7 +1,7 @@
 Servant.Server
Safe HaskellNone
LanguageHaskell2010

Servant.Server

Description

This module lets you implement Servers for defined APIs. You'll +

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.Server

Description

This module lets you implement Servers for defined APIs. You'll most likely just need serve.

Implementing Servers

serve :: HasServer layout => Proxy layout -> Server layout -> Application Source

serve allows you to implement an API and produce a wai Application.

Example:

type MyApi = "books" :> Get [Book] -- GET /books
         :<|> "books" :> ReqBody Book :> Post Book -- POST /books
 
diff --git a/Servant-Utils-Links.html b/Servant-Utils-Links.html
index 1a0ddc64..4a8c1bee 100644
--- a/Servant-Utils-Links.html
+++ b/Servant-Utils-Links.html
@@ -1,7 +1,7 @@
 Servant.Utils.Links
Safe HaskellNone
LanguageHaskell2010

Servant.Utils.Links

Description

Type safe internal links.

Provides the function mkLink:

  type API = Proxy ("hello" :> Get Int
+

servant-0.2: A family of combinators for defining webservices APIs and serving them

Safe HaskellNone
LanguageHaskell2010

Servant.Utils.Links

Description

Type safe internal links.

Provides the function mkLink:

  type API = Proxy ("hello" :> Get Int
                :| "bye" :> QueryParam "name" String :> Post Bool)
 
   api :: API
diff --git a/Servant-Utils-StaticFiles.html b/Servant-Utils-StaticFiles.html
index 8198ec69..522d1be2 100644
--- a/Servant-Utils-StaticFiles.html
+++ b/Servant-Utils-StaticFiles.html
@@ -1,7 +1,7 @@
 Servant.Utils.StaticFiles
Safe HaskellNone
LanguageHaskell2010

Servant.Utils.StaticFiles

Description

This module defines a sever-side handler that lets you serve static files.