servant-0.20.1: A family of combinators for defining webservices APIs

Safe Haskell | Safe-Inferred
Language | Haskell2010

Servant.API.Verbs

Synopsis

- type Delete = Verb 'DELETE 200
- type DeleteAccepted = Verb 'DELETE 202
- type DeleteNoContent = NoContentVerb 'DELETE
- type DeleteNonAuthoritative = Verb 'DELETE 203
- type Get = Verb 'GET 200
- type GetAccepted = Verb 'GET 202
- type GetNoContent = NoContentVerb 'GET
- type GetNonAuthoritative = Verb 'GET 203
- type GetPartialContent = Verb 'GET 206
- type GetResetContent = Verb 'GET 205
- data NoContentVerb (method :: k1)
- type Patch = Verb 'PATCH 200
- type PatchAccepted = Verb 'PATCH 202
- type PatchNoContent = NoContentVerb 'PATCH
- type PatchNonAuthoritative = Verb 'PATCH 203
- type Post = Verb 'POST 200
- type PostAccepted = Verb 'POST 202
- type PostCreated = Verb 'POST 201
- type PostNoContent = NoContentVerb 'POST
- type PostNonAuthoritative = Verb 'POST 203
- type PostResetContent = Verb 'POST 205
- type Put = Verb 'PUT 200
- type PutAccepted = Verb 'PUT 202
- type PutCreated = Verb 'PUT 201
- type PutNoContent = NoContentVerb 'PUT
- type PutNonAuthoritative = Verb 'PUT 203
- class ReflectMethod a where
  - reflectMethod :: Proxy a -> Method
- data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) (a :: *)
- type HeadNoContent = NoContentVerb 'HEAD
- type DeleteResetContent = Verb 'DELETE 205
- type PatchResetContent = Verb 'PATCH 205
- type PutResetContent = Verb 'PUT 205
- data StdMethod
  - = GET
  - | POST
  - | HEAD
  - | PUT
  - | DELETE
  - | TRACE
  - | CONNECT
  - | OPTIONS
  - | PATCH

# Documentation

type Delete = Verb 'DELETE 200 #

`DELETE` with 200 status code.

type DeleteAccepted = Verb 'DELETE 202 #

`DELETE` with 202 status code.

type DeleteNoContent = NoContentVerb 'DELETE #

`DELETE` with 204 status code.

type DeleteNonAuthoritative = Verb 'DELETE 203 #

`DELETE` with 203 status code.

type Get = Verb 'GET 200 #

`GET` with 200 status code.

type GetAccepted = Verb 'GET 202 #

`GET` with 202 status code.

type GetNoContent = NoContentVerb 'GET #

`GET` with 204 status code.

type GetNonAuthoritative = Verb 'GET 203 #

`GET` with 203 status code.

type GetPartialContent = Verb 'GET 206 #

`GET` with 206 status code.

type GetResetContent = Verb 'GET 205 #

`GET` with 205 status code.

data NoContentVerb (method :: k1) #

`NoContentVerb` is a specific type to represent `NoContent` responses. It does not require either a list of content types (because there's no content) or a status code (because it should always be 204).

#### Instances

Instances details

HasLink (NoContentVerb m :: Type) # |
Instance details Defined in Servant.Links Associated Types type MkLink (NoContentVerb m) a # Methods toLink :: (Link -> a) -> Proxy (NoContentVerb m) -> Link -> MkLink (NoContentVerb m) a #
Generic (NoContentVerb method) # |
Instance details Defined in Servant.API.Verbs Associated Types type Rep (NoContentVerb method) :: Type -> Type # Methods from :: NoContentVerb method -> Rep (NoContentVerb method) x to :: Rep (NoContentVerb method) x -> NoContentVerb method
type MkLink (NoContentVerb m :: Type) r # |
Instance details Defined in Servant.Links type MkLink (NoContentVerb m :: Type) r = r
type Rep (NoContentVerb method) # |
Instance details Defined in Servant.API.Verbs type Rep (NoContentVerb method) = D1 ('MetaData "NoContentVerb" "Servant.API.Verbs" "servant-0.20.1-2y7DLWEzubY4ToLPQej775" 'False) (V1 :: Type -> Type)

type Patch = Verb 'PATCH 200 #

`PATCH` with 200 status code.

type PatchAccepted = Verb 'PATCH 202 #

`PATCH` with 202 status code.

type PatchNoContent = NoContentVerb 'PATCH #

`PATCH` with 204 status code.

type PatchNonAuthoritative = Verb 'PATCH 203 #

`PATCH` with 203 status code.

type Post = Verb 'POST 200 #

`POST` with 200 status code.

type PostAccepted = Verb 'POST 202 #

`POST` with 202 status code.

type PostCreated = Verb 'POST 201 #

`POST` with 201 status code.

type PostNoContent = NoContentVerb 'POST #

`POST` with 204 status code.

type PostNonAuthoritative = Verb 'POST 203 #

`POST` with 203 status code.

type PostResetContent = Verb 'POST 205 #

`POST` with 205 status code.

type Put = Verb 'PUT 200 #

`PUT` with 200 status code.

type PutAccepted = Verb 'PUT 202 #

`PUT` with 202 status code.

type PutCreated = Verb 'PUT 201 #

`PUT` with 201 status code.

type PutNoContent = NoContentVerb 'PUT #

`PUT` with 204 status code.

type PutNonAuthoritative = Verb 'PUT 203 #

`PUT` with 203 status code.

class ReflectMethod a where #

Methods

reflectMethod :: Proxy a -> Method #

#### Instances

Instances details

ReflectMethod 'CONNECT # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'CONNECT -> Method #
ReflectMethod 'DELETE # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'DELETE -> Method #
ReflectMethod 'GET # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'GET -> Method #
ReflectMethod 'HEAD # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'HEAD -> Method #
ReflectMethod 'OPTIONS # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'OPTIONS -> Method #
ReflectMethod 'PATCH # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'PATCH -> Method #
ReflectMethod 'POST # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'POST -> Method #
ReflectMethod 'PUT # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'PUT -> Method #
ReflectMethod 'TRACE # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'TRACE -> Method #

data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) (a :: *) #

`Verb` is a general type for representing HTTP verbs (a.k.a. methods). For convenience, type synonyms for each verb with a 200 response code are provided, but you are free to define your own:

    >>> type Post204 contentTypes a = Verb 'POST 204 contentTypes a

#### Instances

Instances details

HasLink (Verb m s ct a :: Type) # |
Instance details Defined in Servant.Links Associated Types type MkLink (Verb m s ct a) a # Methods toLink :: (Link -> a0) -> Proxy (Verb m s ct a) -> Link -> MkLink (Verb m s ct a) a0 #
Generic (Verb method statusCode contentTypes a) # |
Instance details Defined in Servant.API.Verbs Associated Types type Rep (Verb method statusCode contentTypes a) :: Type -> Type # Methods from :: Verb method statusCode contentTypes a -> Rep (Verb method statusCode contentTypes a) x to :: Rep (Verb method statusCode contentTypes a) x -> Verb method statusCode contentTypes a
AtLeastOneFragment (Verb m s ct typ) # | If fragment appeared in API endpoint twice, compile-time error would be raised.
    >>> -- type FailAPI = Fragment Bool :> Fragment Int :> Get '[JSON] NoContent
    >>> instance AtLeastOneFragment FailAPI
    ...
    ...Only one Fragment allowed per endpoint in api...
    ...
    ...In the instance declaration for...
Instance details Defined in Servant.API.TypeLevel
type MkLink (Verb m s ct a :: Type) r # |
Instance details Defined in Servant.Links type MkLink (Verb m s ct a :: Type) r = r
type Rep (Verb method statusCode contentTypes a) # |
Instance details Defined in Servant.API.Verbs type Rep (Verb method statusCode contentTypes a) = D1 ('MetaData "Verb" "Servant.API.Verbs" "servant-0.20.1-2y7DLWEzubY4ToLPQej775" 'False) (V1 :: Type -> Type)

type HeadNoContent = NoContentVerb 'HEAD #

`HEAD` with 204 status code.

type DeleteResetContent = Verb 'DELETE 205 #

`DELETE` with 205 status code.

type PatchResetContent = Verb 'PATCH 205 #

`PATCH` with 205 status code.

type PutResetContent = Verb 'PUT 205 #

`PUT` with 205 status code.

data StdMethod #

HTTP standard method (as defined by RFC 2616, and PATCH which is defined by RFC 5789).

Constructors

GET |
POST |
HEAD |
PUT |
DELETE |
TRACE |
CONNECT |
OPTIONS |
PATCH |

#### Instances

Instances details

Bounded StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods minBound :: StdMethod maxBound :: StdMethod
Enum StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods succ :: StdMethod -> StdMethod pred :: StdMethod -> StdMethod toEnum :: Int -> StdMethod fromEnum :: StdMethod -> Int enumFrom :: StdMethod -> [StdMethod] enumFromThen :: StdMethod -> StdMethod -> [StdMethod] enumFromTo :: StdMethod -> StdMethod -> [StdMethod] enumFromThenTo :: StdMethod -> StdMethod -> StdMethod -> [StdMethod]
Ix StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods range :: (StdMethod, StdMethod) -> [StdMethod] index :: (StdMethod, StdMethod) -> StdMethod -> Int unsafeIndex :: (StdMethod, StdMethod) -> StdMethod -> Int inRange :: (StdMethod, StdMethod) -> StdMethod -> Bool rangeSize :: (StdMethod, StdMethod) -> Int unsafeRangeSize :: (StdMethod, StdMethod) -> Int
Read StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods readsPrec :: Int -> ReadS StdMethod # readList :: ReadS [StdMethod] # readPrec :: ReadPrec StdMethod # readListPrec :: ReadPrec [StdMethod] #
Show StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods showsPrec :: Int -> StdMethod -> ShowS show :: StdMethod -> String showList :: [StdMethod] -> ShowS
Eq StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods (==) :: StdMethod -> StdMethod -> Bool (/=) :: StdMethod -> StdMethod -> Bool
Ord StdMethod |
Instance details Defined in Network.HTTP.Types.Method Methods compare :: StdMethod -> StdMethod -> Ordering (<) :: StdMethod -> StdMethod -> Bool (<=) :: StdMethod -> StdMethod -> Bool (>) :: StdMethod -> StdMethod -> Bool (>=) :: StdMethod -> StdMethod -> Bool max :: StdMethod -> StdMethod -> StdMethod min :: StdMethod -> StdMethod -> StdMethod
ReflectMethod 'CONNECT # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'CONNECT -> Method #
ReflectMethod 'DELETE # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'DELETE -> Method #
ReflectMethod 'GET # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'GET -> Method #
ReflectMethod 'HEAD # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'HEAD -> Method #
ReflectMethod 'OPTIONS # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'OPTIONS -> Method #
ReflectMethod 'PATCH # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'PATCH -> Method #
ReflectMethod 'POST # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'POST -> Method #
ReflectMethod 'PUT # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'PUT -> Method #
ReflectMethod 'TRACE # |
Instance details Defined in Servant.API.Verbs Methods reflectMethod :: Proxy 'TRACE -> Method #