0 | ||| Accept a content type
 1 | module Pact.API.Accept
 2 |
 3 | import public Data.Mime.Apache.Model
 4 | import Data.Mime.Apache
 5 |
 6 | ||| Plain text content type
 7 | public export
 8 | data PlainTextAccept : Type where
 9 |
10 | ||| JSON content type
11 | public export
12 | data JSONAccept : Type where
13 |
14 | ||| XMLAccept content type
15 | public export
16 | data XMLAccept : Type where
17 |
18 | ||| Form URL encoded content type
19 | public export
20 | data FormUrlEncodedAccept : Type where
21 |
22 | ||| Octet stream content type
23 | public export
24 | data OctetStreamAccept : Type where
25 |
26 | ||| Accept a content type.
27 | public export
28 | interface Accept ctype where
29 |   ||| Get the content type.
30 |   contentType : Mime
31 |
32 | --- Implementations
33 | public export
34 | implementation Accept PlainTextAccept where
35 |   contentType  = TEXT_PLAIN
36 |
37 | public export
38 | implementation Accept JSONAccept where
39 |   contentType  = APPLICATION_JSON 
40 |
41 | public export
42 | implementation Accept FormUrlEncodedAccept where
43 |   contentType  = APPLICATION_X_WWW_FORM_URLENCODED
44 |
45 | public export
46 | implementation Accept OctetStreamAccept where
47 |   contentType  = APPLICATION_OCTET_STREAM
48 |
49 | public export
50 | implementation Accept XMLAccept where
51 |   contentType  = APPLICATION_XML