Bug 35469: Add 'manage_bookings' subpermission to /checkouts
[koha.git] / api / v1 / swagger / paths / checkouts.yaml
1 ---
2 /checkouts:
3   get:
4     x-mojo-to: Checkouts#list
5     operationId: listCheckouts
6     tags:
7       - checkouts
8     summary: List checkouts
9     parameters:
10       - $ref: "../swagger.yaml#/parameters/patron_id_qp"
11       - $ref: "../swagger.yaml#/parameters/page"
12       - $ref: "../swagger.yaml#/parameters/per_page"
13       - $ref: "../swagger.yaml#/parameters/match"
14       - $ref: "../swagger.yaml#/parameters/order_by"
15       - $ref: "../swagger.yaml#/parameters/q_param"
16       - $ref: "../swagger.yaml#/parameters/q_body"
17       - $ref: "../swagger.yaml#/parameters/request_id_header"
18       - name: checked_in
19         in: query
20         description: By default, current checkouts are returned, when this is true then
21           checked in checkouts are returned as result.
22         type: boolean
23       - name: x-koha-embed
24         in: header
25         required: false
26         description: Embed list sent as a request header
27         type: array
28         items:
29           type: string
30           enum:
31             - issuer
32             - renewals
33         collectionFormat: csv
34     produces:
35       - application/json
36     responses:
37       "200":
38         description: A list of checkouts
39         schema:
40           $ref: "../swagger.yaml#/definitions/checkouts"
41       "403":
42         description: Access forbidden
43         schema:
44           $ref: "../swagger.yaml#/definitions/error"
45       "404":
46         description: Patron not found
47         schema:
48           $ref: "../swagger.yaml#/definitions/error"
49       "500":
50         description: |
51           Internal server error. Possible `error_code` attribute values:
52
53           * `internal_server_error`
54         schema:
55           $ref: "../swagger.yaml#/definitions/error"
56       "503":
57         description: Under maintenance
58         schema:
59           $ref: "../swagger.yaml#/definitions/error"
60     x-koha-authorization:
61       permissions:
62         - circulate: circulate_remaining_permissions
63         - circulate: manage_bookings
64   post:
65     x-mojo-to: Checkouts#add
66     operationId: addCheckout
67     tags:
68       - checkouts
69       - patrons
70     summary: Add a new checkout
71     parameters:
72       - name: body
73         in: body
74         description: A JSON object containing information about the new checkout
75         required: true
76         schema:
77           $ref: "../swagger.yaml#/definitions/checkout"
78       - name: confirmation
79         in: query
80         description: A JWT confirmation token
81         required: false
82         type: string
83     consumes:
84       - application/json
85     produces:
86       - application/json
87     responses:
88       "201":
89         description: Created checkout
90         schema:
91           $ref: "../swagger.yaml#/definitions/checkout"
92       "400":
93         description: Missing or wrong parameters
94         schema:
95           $ref: "../swagger.yaml#/definitions/error"
96       "401":
97         description: Authentication required
98         schema:
99           $ref: "../swagger.yaml#/definitions/error"
100       "403":
101         description: Cannot create checkout
102         schema:
103           $ref: "../swagger.yaml#/definitions/error"
104       "409":
105         description: Conflict in creating checkout
106         schema:
107           $ref: "../swagger.yaml#/definitions/error"
108       "412":
109         description: Precondition failed
110         schema:
111           $ref: "../swagger.yaml#/definitions/error"
112       "500":
113         description: |
114           Internal server error. Possible `error_code` attribute values:
115
116           * `internal_server_error`
117         schema:
118           $ref: "../swagger.yaml#/definitions/error"
119       "503":
120         description: Under maintenance
121         schema:
122           $ref: "../swagger.yaml#/definitions/error"
123     x-koha-authorization:
124       permissions:
125         circulate: circulate_remaining_permissions
126 "/checkouts/{checkout_id}":
127   get:
128     x-mojo-to: Checkouts#get
129     operationId: getCheckout
130     tags:
131       - checkouts
132     summary: Get checkout
133     parameters:
134       - $ref: "../swagger.yaml#/parameters/checkout_id_pp"
135       - name: x-koha-embed
136         in: header
137         required: false
138         description: Embed list sent as a request header
139         type: array
140         items:
141           type: string
142           enum:
143             - issuer
144             - renewals
145         collectionFormat: csv
146     produces:
147       - application/json
148     responses:
149       "200":
150         description: Updated borrower's checkout
151         schema:
152           $ref: "../swagger.yaml#/definitions/checkout"
153       "403":
154         description: Access forbidden
155         schema:
156           $ref: "../swagger.yaml#/definitions/error"
157       "404":
158         description: Checkout not found
159         schema:
160           $ref: "../swagger.yaml#/definitions/error"
161       "500":
162         description: |
163           Internal server error. Possible `error_code` attribute values:
164
165           * `internal_server_error`
166         schema:
167           $ref: "../swagger.yaml#/definitions/error"
168       "503":
169         description: Under maintenance
170         schema:
171           $ref: "../swagger.yaml#/definitions/error"
172     x-koha-authorization:
173       permissions:
174         circulate: circulate_remaining_permissions
175 "/checkouts/{checkout_id}/renewal":
176   post:
177     x-mojo-to: Checkouts#renew
178     operationId: renewCheckout
179     tags:
180       - checkouts
181     summary: Renew a checkout
182     parameters:
183       - $ref: "../swagger.yaml#/parameters/checkout_id_pp"
184       - $ref: "../swagger.yaml#/parameters/seen_pp"
185     produces:
186       - application/json
187     responses:
188       "201":
189         description: Updated borrower's checkout
190         schema:
191           $ref: "../swagger.yaml#/definitions/checkout"
192       "403":
193         description: Cannot renew checkout
194         schema:
195           $ref: "../swagger.yaml#/definitions/error"
196       "404":
197         description: Checkout not found
198         schema:
199           $ref: "../swagger.yaml#/definitions/error"
200       "500":
201         description: |
202           Internal server error. Possible `error_code` attribute values:
203
204           * `internal_server_error`
205         schema:
206           $ref: "../swagger.yaml#/definitions/error"
207       "503":
208         description: Under maintenance
209         schema:
210           $ref: "../swagger.yaml#/definitions/error"
211     x-koha-authorization:
212       permissions:
213         circulate: circulate_remaining_permissions
214 "/checkouts/{checkout_id}/renewals":
215   post:
216     x-mojo-to: Checkouts#renew
217     operationId: renewsCheckout
218     tags:
219       - checkouts
220     summary: Renew a checkout
221     parameters:
222       - $ref: "../swagger.yaml#/parameters/checkout_id_pp"
223       - $ref: "../swagger.yaml#/parameters/seen_pp"
224     produces:
225       - application/json
226     responses:
227       "201":
228         description: Updated borrower's checkout
229         schema:
230           $ref: "../swagger.yaml#/definitions/checkout"
231       "403":
232         description: Cannot renew checkout
233         schema:
234           $ref: "../swagger.yaml#/definitions/error"
235       "404":
236         description: Checkout not found
237         schema:
238           $ref: "../swagger.yaml#/definitions/error"
239       "500":
240         description: |
241           Internal server error. Possible `error_code` attribute values:
242
243           * `internal_server_error`
244         schema:
245           $ref: "../swagger.yaml#/definitions/error"
246       "503":
247         description: Under maintenance
248         schema:
249           $ref: "../swagger.yaml#/definitions/error"
250     x-koha-authorization:
251       permissions:
252         circulate: circulate_remaining_permissions
253   get:
254     x-mojo-to: Checkouts#get_renewals
255     operationId: getRenewals
256     tags:
257       - checkouts
258     summary: List renewals for a checkout
259     parameters:
260       - $ref: "../swagger.yaml#/parameters/checkout_id_pp"
261       - name: x-koha-embed
262         in: header
263         required: false
264         description: Embed list sent as a request header
265         type: array
266         items:
267           type: string
268           enum:
269             - renewer
270         collectionFormat: csv
271     produces:
272       - application/json
273     responses:
274       "200":
275         description: List of checkouts renewals
276         schema:
277           $ref: "../swagger.yaml#/definitions/renewals"
278       "403":
279         description: Access forbidden
280         schema:
281           $ref: "../swagger.yaml#/definitions/error"
282       "404":
283         description: Checkout not found
284         schema:
285           $ref: "../swagger.yaml#/definitions/error"
286       "500":
287         description: |
288           Internal server error. Possible `error_code` attribute values:
289
290           * `internal_server_error`
291         schema:
292           $ref: "../swagger.yaml#/definitions/error"
293       "503":
294         description: Under maintenance
295         schema:
296           $ref: "../swagger.yaml#/definitions/error"
297     x-koha-authorization:
298       permissions:
299         circulate: circulate_remaining_permissions
300 "/checkouts/{checkout_id}/allows_renewal":
301   get:
302     x-mojo-to: Checkouts#allows_renewal
303     operationId: allows_renewalCheckout
304     tags:
305       - checkouts
306     summary: Get renewability for a checkout
307     parameters:
308       - $ref: "../swagger.yaml#/parameters/checkout_id_pp"
309     produces:
310       - application/json
311     responses:
312       "200":
313         description: Checkout renewability information
314         schema:
315           $ref: "../swagger.yaml#/definitions/allows_renewal"
316       "403":
317         description: Forbidden
318         schema:
319           $ref: "../swagger.yaml#/definitions/error"
320       "404":
321         description: Checkout not found
322         schema:
323           $ref: "../swagger.yaml#/definitions/error"
324       "500":
325         description: |
326           Internal server error. Possible `error_code` attribute values:
327
328           * `internal_server_error`
329         schema:
330           $ref: "../swagger.yaml#/definitions/error"
331       "503":
332         description: Under maintenance
333         schema:
334           $ref: "../swagger.yaml#/definitions/error"
335     x-koha-authorization:
336       permissions:
337         circulate: circulate_remaining_permissions
338 "/checkouts/availability":
339   get:
340     x-mojo-to: Checkouts#get_availability
341     operationId: availabilityCheckouts
342     tags:
343       - checkouts
344     summary: Get checkout availability
345     parameters:
346       - $ref: "../swagger.yaml#/parameters/patron_id_qp"
347       - $ref: "../swagger.yaml#/parameters/item_id_qp"
348     produces:
349       - application/json
350     responses:
351       "200":
352         description: Availability
353         schema:
354           $ref: "../swagger.yaml#/definitions/checkout_availability"
355       "403":
356         description: Access forbidden
357         schema:
358           $ref: "../swagger.yaml#/definitions/error"
359       "500":
360         description: |
361           Internal server error. Possible `error_code` attribute values:
362
363           * `internal_server_error`
364         schema:
365           $ref: "../swagger.yaml#/definitions/error"
366       "503":
367         description: Under maintenance
368         schema:
369           $ref: "../swagger.yaml#/definitions/error"
370     x-koha-authorization:
371       permissions:
372         circulate: circulate_remaining_permissions
373 "/public/checkouts/availability":
374   get:
375     x-mojo-to: Checkouts#get_availability
376     operationId: availabilityCheckoutsPublic
377     tags:
378       - checkouts
379     summary: Get checkout availability
380     parameters:
381       - $ref: "../swagger.yaml#/parameters/patron_id_qp"
382       - $ref: "../swagger.yaml#/parameters/item_id_qp"
383     produces:
384       - application/json
385     responses:
386       "200":
387         description: Availability
388         schema:
389           type: "object"
390           properties:
391             blockers:
392               type: object
393             confirms:
394               type: object
395             warnings:
396               type: object
397             confirmation_token:
398               type: string
399           additionalProperties: false
400       "403":
401         description: Access forbidden
402         schema:
403           $ref: "../swagger.yaml#/definitions/error"
404       "500":
405         description: |
406           Internal server error. Possible `error_code` attribute values:
407
408           * `internal_server_error`
409         schema:
410           $ref: "../swagger.yaml#/definitions/error"
411       "503":
412         description: Under maintenance
413         schema:
414           $ref: "../swagger.yaml#/definitions/error"
415     x-koha-authorization:
416       allow-owner: true