Bug 16699: Split parameters and paths in Swagger
[koha.git] / api / v1 / paths / holds.json
1 {
2   "/holds": {
3     "get": {
4       "operationId": "listHolds",
5       "tags": ["borrowers", "holds"],
6       "parameters": [
7         {
8           "name": "reserve_id",
9           "in": "query",
10           "description": "Internal reserve identifier",
11           "type": "integer"
12         },
13         {
14           "name": "borrowernumber",
15           "in": "query",
16           "description": "Internal borrower identifier",
17           "type": "integer"
18         },
19         {
20           "name": "reservedate",
21           "in": "query",
22           "description": "Reserve date",
23           "type": "string"
24         },
25         {
26           "name": "biblionumber",
27           "in": "query",
28           "description": "Internal biblio identifier",
29           "type": "integer"
30         },
31         {
32           "name": "branchcode",
33           "in": "query",
34           "description": "Branch code",
35           "type": "string"
36         },
37         {
38           "name": "notificationdate",
39           "in": "query",
40           "description": "Notification date",
41           "type": "string"
42         },
43         {
44           "name": "reminderdate",
45           "in": "query",
46           "description": "Reminder date",
47           "type": "string"
48         },
49         {
50           "name": "cancellationdate",
51           "in": "query",
52           "description": "Cancellation date",
53           "type": "string"
54         },
55         {
56           "name": "reservenotes",
57           "in": "query",
58           "description": "Reserve notes",
59           "type": "string"
60         },
61         {
62           "name": "priority",
63           "in": "query",
64           "description": "Priority",
65           "type": "integer"
66         },
67         {
68           "name": "found",
69           "in": "query",
70           "description": "Found status",
71           "type": "string"
72         },
73         {
74           "name": "timestamp",
75           "in": "query",
76           "description": "Time of latest update",
77           "type": "string"
78         },
79         {
80           "name": "itemnumber",
81           "in": "query",
82           "description": "Internal item identifier",
83           "type": "integer"
84         },
85         {
86           "name": "waitingdate",
87           "in": "query",
88           "description": "Date the item was marked as waiting for the patron",
89           "type": "string"
90         },
91         {
92           "name": "expirationdate",
93           "in": "query",
94           "description": "Date the hold expires",
95           "type": "string"
96         },
97         {
98           "name": "lowestPriority",
99           "in": "query",
100           "description": "Lowest priority",
101           "type": "integer"
102         },
103         {
104           "name": "suspend",
105           "in": "query",
106           "description": "Suspended",
107           "type": "integer"
108         },
109         {
110           "name": "suspend_until",
111           "in": "query",
112           "description": "Suspended until",
113           "type": "string"
114         }
115       ],
116       "produces": ["application/json"],
117       "responses": {
118         "200": {
119           "description": "A list of holds",
120           "schema": {
121             "$ref": "../definitions.json#/holds"
122           }
123         },
124         "404": {
125           "description": "Borrower not found",
126           "schema": {
127             "$ref": "../definitions.json#/error"
128           }
129         }
130       }
131     },
132     "post": {
133       "operationId": "addHold",
134       "tags": ["borrowers", "holds"],
135       "parameters": [{
136           "name": "body",
137           "in": "body",
138           "description": "A JSON object containing informations about the new hold",
139           "required": true,
140           "schema": {
141             "type": "object",
142             "properties": {
143               "borrowernumber": {
144                 "description": "Borrower internal identifier",
145                 "type": "integer"
146               },
147               "biblionumber": {
148                 "description": "Biblio internal identifier",
149                 "type": "integer"
150               },
151               "itemnumber": {
152                 "description": "Item internal identifier",
153                 "type": "integer"
154               },
155               "branchcode": {
156                 "description": "Pickup location",
157                 "type": "string"
158               },
159               "expirationdate": {
160                 "description": "Hold end date",
161                 "type": "string",
162                 "format": "date"
163               }
164             }
165           }
166         }
167       ],
168       "consumes": ["application/json"],
169       "produces": ["application/json"],
170       "responses": {
171         "201": {
172           "description": "Created hold",
173           "schema": {
174             "$ref": "../definitions.json#/hold"
175           }
176         },
177         "400": {
178           "description": "Missing or wrong parameters",
179           "schema": {
180             "$ref": "../definitions.json#/error"
181           }
182         },
183         "403": {
184           "description": "Hold not allowed",
185           "schema": {
186             "$ref": "../definitions.json#/error"
187           }
188         },
189         "404": {
190           "description": "Borrower not found",
191           "schema": {
192             "$ref": "../definitions.json#/error"
193           }
194         },
195         "500": {
196           "description": "Internal error",
197           "schema": {
198             "$ref": "../definitions.json#/error"
199           }
200         }
201       }
202     }
203   },
204   "/holds/{reserve_id}": {
205     "put": {
206       "operationId": "editHold",
207       "tags": ["holds"],
208       "parameters": [{
209           "$ref": "../parameters.json#/holdIdPathParam"
210         }, {
211           "name": "body",
212           "in": "body",
213           "description": "A JSON object containing fields to modify",
214           "required": true,
215           "schema": {
216             "type": "object",
217             "properties": {
218               "priority": {
219                 "description": "Position in waiting queue",
220                 "type": "integer",
221                 "minimum": 1
222               },
223               "branchcode": {
224                 "description": "Pickup location",
225                 "type": "string"
226               },
227               "suspend_until": {
228                 "description": "Suspend until",
229                 "type": "string",
230                 "format": "date"
231               }
232             }
233           }
234         }
235       ],
236       "consumes": ["application/json"],
237       "produces": ["application/json"],
238       "responses": {
239         "200": {
240           "description": "Updated hold",
241           "schema": {
242             "$ref": "../definitions.json#/hold"
243           }
244         },
245         "400": {
246           "description": "Missing or wrong parameters",
247           "schema": {
248             "$ref": "../definitions.json#/error"
249           }
250         },
251         "404": {
252           "description": "Hold not found",
253           "schema": {
254             "$ref": "../definitions.json#/error"
255           }
256         }
257       }
258     },
259     "delete": {
260       "operationId": "deleteHold",
261       "tags": ["holds"],
262       "parameters": [{
263           "$ref": "../parameters.json#/holdIdPathParam"
264         }
265       ],
266       "produces": ["application/json"],
267       "responses": {
268         "200": {
269           "description": "Successful deletion",
270           "schema": {
271             "type": "object"
272           }
273         },
274         "404": {
275           "description": "Hold not found",
276           "schema": {
277             "$ref": "../definitions.json#/error"
278           }
279         }
280       }
281     }
282   }
283 }