Bug 18137: Make /holds Mojolicious::Plugin::OpenAPI compatible
[koha.git] / api / v1 / swagger / paths / holds.json
1 {
2   "/holds": {
3     "get": {
4       "x-mojo-to": "Hold#list",
5       "operationId": "listHolds",
6       "tags": ["patrons", "holds"],
7       "parameters": [
8         {
9           "name": "reserve_id",
10           "in": "query",
11           "description": "Internal reserve identifier",
12           "type": "integer"
13         },
14         {
15           "$ref": "../parameters.json#/borrowernumberQueryParam"
16         },
17         {
18           "name": "reservedate",
19           "in": "query",
20           "description": "Reserve date",
21           "type": "string"
22         },
23         {
24           "name": "biblionumber",
25           "in": "query",
26           "description": "Internal biblio identifier",
27           "type": "integer"
28         },
29         {
30           "name": "branchcode",
31           "in": "query",
32           "description": "Branch code",
33           "type": "string"
34         },
35         {
36           "name": "notificationdate",
37           "in": "query",
38           "description": "Notification date",
39           "type": "string"
40         },
41         {
42           "name": "reminderdate",
43           "in": "query",
44           "description": "Reminder date",
45           "type": "string"
46         },
47         {
48           "name": "cancellationdate",
49           "in": "query",
50           "description": "Cancellation date",
51           "type": "string"
52         },
53         {
54           "name": "reservenotes",
55           "in": "query",
56           "description": "Reserve notes",
57           "type": "string"
58         },
59         {
60           "name": "priority",
61           "in": "query",
62           "description": "Priority",
63           "type": "integer"
64         },
65         {
66           "name": "found",
67           "in": "query",
68           "description": "Found status",
69           "type": "string"
70         },
71         {
72           "name": "timestamp",
73           "in": "query",
74           "description": "Time of latest update",
75           "type": "string"
76         },
77         {
78           "name": "itemnumber",
79           "in": "query",
80           "description": "Internal item identifier",
81           "type": "integer"
82         },
83         {
84           "name": "waitingdate",
85           "in": "query",
86           "description": "Date the item was marked as waiting for the patron",
87           "type": "string"
88         },
89         {
90           "name": "expirationdate",
91           "in": "query",
92           "description": "Date the hold expires",
93           "type": "string"
94         },
95         {
96           "name": "lowestPriority",
97           "in": "query",
98           "description": "Lowest priority",
99           "type": "integer"
100         },
101         {
102           "name": "suspend",
103           "in": "query",
104           "description": "Suspended",
105           "type": "integer"
106         },
107         {
108           "name": "suspend_until",
109           "in": "query",
110           "description": "Suspended until",
111           "type": "string"
112         }
113       ],
114       "produces": ["application/json"],
115       "responses": {
116         "200": {
117           "description": "A list of holds",
118           "schema": {
119             "$ref": "../definitions.json#/holds"
120           }
121         },
122         "401": {
123           "description": "Authentication required",
124           "schema": {
125             "$ref": "../definitions.json#/error"
126           }
127         },
128         "403": {
129           "description": "Hold not allowed",
130           "schema": {
131             "$ref": "../definitions.json#/error"
132           }
133         },
134         "404": {
135           "description": "Borrower not found",
136           "schema": {
137             "$ref": "../definitions.json#/error"
138           }
139         },
140         "500": {
141           "description": "Internal server error",
142           "schema": {
143             "$ref": "../definitions.json#/error"
144           }
145         },
146         "503": {
147           "description": "Under maintenance",
148           "schema": {
149             "$ref": "../definitions.json#/error"
150           }
151         }
152       },
153       "x-koha-authorization": {
154         "allow-owner": true,
155         "allow-guarantor": true,
156         "permissions": {
157           "borrowers": "1"
158         }
159       }
160     },
161     "post": {
162       "x-mojo-to": "Hold#add",
163       "operationId": "addHold",
164       "tags": ["patrons", "holds"],
165       "parameters": [{
166           "name": "body",
167           "in": "body",
168           "description": "A JSON object containing informations about the new hold",
169           "required": true,
170           "schema": {
171             "type": "object",
172             "properties": {
173               "borrowernumber": {
174                 "description": "Borrower internal identifier",
175                 "type": "integer"
176               },
177               "biblionumber": {
178                 "description": "Biblio internal identifier",
179                 "type": "integer"
180               },
181               "itemnumber": {
182                 "description": "Item internal identifier",
183                 "type": "integer"
184               },
185               "branchcode": {
186                 "description": "Pickup location",
187                 "type": "string"
188               },
189               "expirationdate": {
190                 "description": "Hold end date",
191                 "type": "string",
192                 "format": "date"
193               }
194             }
195           }
196         }
197       ],
198       "consumes": ["application/json"],
199       "produces": ["application/json"],
200       "responses": {
201         "201": {
202           "description": "Created hold",
203           "schema": {
204             "$ref": "../definitions.json#/hold"
205           }
206         },
207         "400": {
208           "description": "Missing or wrong parameters",
209           "schema": {
210             "$ref": "../definitions.json#/error"
211           }
212         },
213         "401": {
214           "description": "Authentication required",
215           "schema": {
216             "$ref": "../definitions.json#/error"
217           }
218         },
219         "403": {
220           "description": "Hold not allowed",
221           "schema": {
222             "$ref": "../definitions.json#/error"
223           }
224         },
225         "404": {
226           "description": "Borrower not found",
227           "schema": {
228             "$ref": "../definitions.json#/error"
229           }
230         },
231         "500": {
232           "description": "Internal server error",
233           "schema": {
234             "$ref": "../definitions.json#/error"
235           }
236         },
237         "503": {
238           "description": "Under maintenance",
239           "schema": {
240             "$ref": "../definitions.json#/error"
241           }
242         }
243       },
244       "x-koha-authorization": {
245         "allow-owner": true,
246         "permissions": {
247           "reserveforothers": "1"
248         }
249       }
250     }
251   },
252   "/holds/{reserve_id}": {
253     "put": {
254       "x-mojo-to": "Hold#edit",
255       "operationId": "editHold",
256       "tags": ["holds"],
257       "parameters": [{
258           "$ref": "../parameters.json#/holdIdPathParam"
259         }, {
260           "name": "body",
261           "in": "body",
262           "description": "A JSON object containing fields to modify",
263           "required": true,
264           "schema": {
265             "type": "object",
266             "properties": {
267               "priority": {
268                 "description": "Position in waiting queue",
269                 "type": "integer",
270                 "minimum": 1
271               },
272               "branchcode": {
273                 "description": "Pickup location",
274                 "type": "string"
275               },
276               "suspend_until": {
277                 "description": "Suspend until",
278                 "type": "string",
279                 "format": "date"
280               }
281             }
282           }
283         }
284       ],
285       "consumes": ["application/json"],
286       "produces": ["application/json"],
287       "responses": {
288         "200": {
289           "description": "Updated hold",
290           "schema": {
291             "$ref": "../definitions.json#/hold"
292           }
293         },
294         "400": {
295           "description": "Missing or wrong parameters",
296           "schema": {
297             "$ref": "../definitions.json#/error"
298           }
299         },
300         "401": {
301           "description": "Authentication required",
302           "schema": {
303             "$ref": "../definitions.json#/error"
304           }
305         },
306         "403": {
307           "description": "Hold not allowed",
308           "schema": {
309             "$ref": "../definitions.json#/error"
310           }
311         },
312         "404": {
313           "description": "Hold not found",
314           "schema": {
315             "$ref": "../definitions.json#/error"
316           }
317         },
318         "500": {
319           "description": "Internal server error",
320           "schema": {
321             "$ref": "../definitions.json#/error"
322           }
323         },
324         "503": {
325           "description": "Under maintenance",
326           "schema": {
327             "$ref": "../definitions.json#/error"
328           }
329         }
330       },
331       "x-koha-authorization": {
332         "allow-owner": true,
333         "allow-guarantor": true,
334         "permissions": {
335           "reserveforothers": "1"
336         }
337       }
338     },
339     "delete": {
340       "x-mojo-to": "Hold#delete",
341       "operationId": "deleteHold",
342       "tags": ["holds"],
343       "parameters": [{
344           "$ref": "../parameters.json#/holdIdPathParam"
345         }
346       ],
347       "produces": ["application/json"],
348       "responses": {
349         "200": {
350           "description": "Successful deletion",
351           "schema": {
352             "type": "object"
353           }
354         },
355         "401": {
356           "description": "Authentication required",
357           "schema": {
358             "$ref": "../definitions.json#/error"
359           }
360         },
361         "403": {
362           "description": "Hold not allowed",
363           "schema": {
364             "$ref": "../definitions.json#/error"
365           }
366         },
367         "404": {
368           "description": "Hold not found",
369           "schema": {
370             "$ref": "../definitions.json#/error"
371           }
372         },
373         "500": {
374           "description": "Internal server error",
375           "schema": {
376             "$ref": "../definitions.json#/error"
377           }
378         },
379         "503": {
380           "description": "Under maintenance",
381           "schema": {
382             "$ref": "../definitions.json#/error"
383           }
384         }
385       },
386       "x-koha-authorization": {
387         "permissions": {
388           "reserveforothers": "1"
389         }
390       }
391     }
392   }
393 }