0 | ||| Verbs for HTTP methods
  1 | module Pact.API.Verb
  2 |
  3 | import public Pact.WAI.Method
  4 | import public Pact.WAI.StatusCode
  5 |
  6 | ||| Verb is a record that contains the HTTP method, status code, accept type, and response type
  7 | public export
  8 | record Verb where
  9 |   constructor MkVerb
 10 |   ||| HTTP method
 11 |   method : Method
 12 |   ||| HTTP status code
 13 |   status : StatusCode
 14 |   ||| Accept type
 15 |   accept : Type
 16 |   ||| Response type
 17 |   response : Type
 18 |
 19 | public export
 20 | VerbAccept: Verb -> Type
 21 | VerbAccept (MkVerb _ _ accept _) = accept
 22 |
 23 | public export
 24 | VerbResponse: Verb -> Type
 25 | VerbResponse (MkVerb _ _ _ response) = response
 26 |
 27 | --- 200 ---
 28 |
 29 | ||| Head verb
 30 | public export
 31 | Head' : StatusCode -> Type -> Type -> Verb
 32 | Head' = MkVerb HEAD 
 33 |
 34 | ||| Get verb
 35 | public export
 36 | Get' : StatusCode -> Type -> Type -> Verb
 37 | Get' = MkVerb GET 
 38 |
 39 | ||| Post verb
 40 | public export
 41 | Post' : StatusCode -> Type -> Type -> Verb
 42 | Post' = MkVerb POST 
 43 |
 44 | ||| Put verb
 45 | public export
 46 | Put' : StatusCode -> Type -> Type -> Verb
 47 | Put' = MkVerb PUT 
 48 |
 49 | ||| Delete verb
 50 | public export
 51 | Delete' : StatusCode -> Type -> Type -> Verb
 52 | Delete' = MkVerb DELETE 
 53 |
 54 | ||| Patch verb
 55 | public export
 56 | Patch' : StatusCode -> Type -> Type -> Verb
 57 | Patch' = MkVerb PATCH 
 58 |
 59 | ||| Head verb with code 200
 60 | public export
 61 | Head : Type -> Type -> Verb
 62 | Head = Head' code_200
 63 |
 64 | ||| Get verb with code 200
 65 | public export
 66 | Get : Type -> Type -> Verb
 67 | Get = Get' code_200
 68 |
 69 | ||| Post verb with code 201
 70 | public export
 71 | Post : Type -> Type -> Verb
 72 | Post = Post' code_201
 73 |
 74 | ||| Put verb with code 200
 75 | public export
 76 | Put : Type -> Type -> Verb
 77 | Put = Put' code_200
 78 |
 79 | ||| Delete verb with code 200
 80 | public export
 81 | Delete : Type -> Type -> Verb
 82 | Delete = Delete' code_200
 83 |
 84 | ||| Patch verb with code 200
 85 | public export
 86 | Patch : Type -> Type -> Verb
 87 | Patch = Patch' code_200
 88 |
 89 | ||| Post verb with code 201 (Created)
 90 | public export
 91 | PostCreated : Type -> Type -> Verb
 92 | PostCreated = Post' code_201
 93 |
 94 | ||| Put verb with code 201 (Created)
 95 | public export
 96 | PutCreated : Type -> Type -> Verb
 97 | PutCreated = Put' code_201
 98 |
 99 | ||| Get verb with code 202 (Accepted)
100 | public export
101 | GetAccepted : Type -> Type -> Verb
102 | GetAccepted = Get' code_202
103 |
104 | ||| Post verb with code 202 (Accepted)
105 | public export
106 | PostAccepted : Type -> Type -> Verb
107 | PostAccepted = Post' code_202
108 |
109 | ||| Delete verb with code 202 (Accepted)
110 | public export
111 | DeleteAccepted : Type -> Type -> Verb
112 | DeleteAccepted = Delete' code_202
113 |
114 | ||| Patch verb with code 202 (Accepted)
115 | public export
116 | PatchAccepted : Type -> Type -> Verb
117 | PatchAccepted = Patch' code_202
118 |
119 | ||| Put verb with code 202 (Accepted)
120 | public export
121 | PutAccepted : Type -> Type -> Verb
122 | PutAccepted = Put' code_202
123 |
124 | ||| Get verb with code 203 (Non-Authoritative)
125 | public export
126 | GetNonAuthoritative : Type -> Type -> Verb
127 | GetNonAuthoritative = Get' code_203
128 |
129 | ||| Post verb with code 203 (Non-Authoritative)
130 | public export
131 | PostNonAuthoritative : Type -> Type -> Verb
132 | PostNonAuthoritative = Post' code_203
133 |
134 | ||| Delete verb with code 203 (Non-Authoritative)
135 | public export
136 | DeleteNonAuthoritative : Type -> Type -> Verb
137 | DeleteNonAuthoritative = Delete' code_203
138 |
139 | ||| Patch verb with code 203 (Non-Authoritative)
140 | public export
141 | PatchNonAuthoritative : Type -> Type -> Verb
142 | PatchNonAuthoritative = Patch' code_203
143 |
144 | ||| Put verb with code 203 (Non-Authoritative)
145 | public export
146 | PutNonAuthoritative : Type -> Type -> Verb
147 | PutNonAuthoritative = Put' code_203
148 |
149 | ||| Get verb with code 204 (No Content)
150 | public export
151 | GetNoContent : Type -> Type -> Verb
152 | GetNoContent = Get' code_204
153 |
154 | ||| Post verb with code 204 (No Content)
155 | public export
156 | PostNoContent : Type -> Type -> Verb
157 | PostNoContent = Post' code_204
158 |
159 | ||| Delete verb with code 204 (No Content)
160 | public export
161 | DeleteNoContent : Type -> Type -> Verb
162 | DeleteNoContent = Delete' code_204
163 |
164 | ||| Patch verb with code 204 (No Content)
165 | public export
166 | PatchNoContent : Type -> Type -> Verb
167 | PatchNoContent = Patch' code_204
168 |
169 | ||| Put verb with code 204 (No Content)
170 | public export
171 | PutNoContent : Type -> Type -> Verb
172 | PutNoContent = Put' code_204
173 |
174 | ||| Head verb with code 204 (No Content)
175 | public export
176 | HeadNoContent : Type -> Type -> Verb
177 | HeadNoContent = Head' code_204
178 |
179 | ||| Head verb with code 205 (Reset Content)
180 | public export
181 | HeadResetContent : Type -> Type -> Verb
182 | HeadResetContent = Head' code_205
183 |
184 | ||| Get verb with code 205 (Reset Content)
185 | public export
186 | GetResetContent : Type -> Type -> Verb
187 | GetResetContent = Get' code_205
188 |
189 | ||| Post verb with code 205 (Reset Content)
190 | public export
191 | PostResetContent : Type -> Type -> Verb
192 | PostResetContent = Post' code_205
193 |
194 | ||| Delete verb with code 205 (Reset Content)
195 | public export
196 | DeleteResetContent : Type -> Type -> Verb
197 | DeleteResetContent = Delete' code_205
198 |
199 | ||| Patch verb with code 205 (Reset Content)
200 | public export
201 | PatchResetContent : Type -> Type -> Verb
202 | PatchResetContent = Patch' code_205
203 |
204 | ||| Put verb with code 205 (Reset Content)
205 | public export
206 | PutResetContent : Type -> Type -> Verb
207 | PutResetContent = Put' code_205
208 |