Bug 30979: Add public endpoints
[koha.git] / api / v1 / swagger / paths / public_patrons.yaml
1 ---
2 "/public/patrons/{patron_id}/password":
3   post:
4     x-mojo-to: Patrons::Password#set_public
5     operationId: setPatronPasswordPublic
6     tags:
7       - patrons
8     summary: Set password for a patron (public)
9     parameters:
10       - $ref: "../swagger.yaml#/parameters/patron_id_pp"
11       - name: body
12         in: body
13         description: A JSON object containing password information
14         schema:
15           type: object
16           properties:
17             password:
18               description: New password (plain text)
19               type: string
20             password_repeated:
21               description: Repeated new password (plain text)
22               type: string
23             old_password:
24               description: Patron's original password
25               type: string
26           required:
27             - password
28             - password_repeated
29             - old_password
30           additionalProperties: false
31     produces:
32       - application/json
33     responses:
34       "200":
35         description: Password changed
36       "400":
37         description: Bad request
38         schema:
39           $ref: "../swagger.yaml#/definitions/error"
40       "401":
41         description: Authentication required
42         schema:
43           $ref: "../swagger.yaml#/definitions/error"
44       "403":
45         description: Access forbidden
46         schema:
47           $ref: "../swagger.yaml#/definitions/error"
48       "404":
49         description: Patron not found
50         schema:
51           $ref: "../swagger.yaml#/definitions/error"
52       "500":
53         description: |
54           Internal server error. Possible `error_code` attribute values:
55
56           * `internal_server_error`
57         schema:
58           $ref: "../swagger.yaml#/definitions/error"
59       "503":
60         description: Under maintenance
61         schema:
62           $ref: "../swagger.yaml#/definitions/error"
63     x-koha-authorization:
64       allow-owner: true
65 "/public/patrons/{patron_id}/checkouts":
66   post:
67     x-mojo-to: Checkouts#add
68     operationId: addCheckoutPublic
69     tags:
70       - checkouts
71       - patrons
72     summary: Add a new checkout
73     parameters:
74       - $ref: "../swagger.yaml#/parameters/patron_id_pp"
75       - name: body
76         in: body
77         description: A JSON object containing information about the new checkout
78         required: true
79         schema:
80           $ref: "../swagger.yaml#/definitions/checkout"
81       - name: confirmation
82         in: query
83         description: A JWT confirmation token
84         required: false
85         type: string
86     produces:
87       - application/json
88     responses:
89       "201":
90         description: Created checkout
91         schema:
92           $ref: "../swagger.yaml#/definitions/checkout"
93       "400":
94         description: Missing or wrong parameters
95         schema:
96           $ref: "../swagger.yaml#/definitions/error"
97       "401":
98         description: Authentication required
99         schema:
100           $ref: "../swagger.yaml#/definitions/error"
101       "403":
102         description: Cannot create checkout
103         schema:
104           $ref: "../swagger.yaml#/definitions/error"
105       "409":
106         description: Conflict in creating checkout
107         schema:
108           $ref: "../swagger.yaml#/definitions/error"
109       "412":
110         description: Precondition failed
111         schema:
112           $ref: "../swagger.yaml#/definitions/error"
113       "500":
114         description: |
115           Internal server error. Possible `error_code` attribute values:
116
117           * `internal_server_error`
118         schema:
119           $ref: "../swagger.yaml#/definitions/error"
120       "503":
121         description: Under maintenance
122         schema:
123           $ref: "../swagger.yaml#/definitions/error"
124     x-koha-authorization:
125       allow-owner: true
126 "/public/patrons/{patron_id}/guarantors/can_see_charges":
127   put:
128     x-mojo-to: Patrons#guarantors_can_see_charges
129     operationId: setPatronGuarantorsCanSeeCharges
130     tags:
131       - patrons
132     summary: Set if guarantors can see charges (public)
133     parameters:
134       - $ref: "../swagger.yaml#/parameters/patron_id_pp"
135       - name: body
136         in: body
137         description: A boolean representing if guarantors should be able to see the
138           patron's charges
139         required: true
140         schema:
141           type: object
142           properties:
143             allowed:
144               type: boolean
145           additionalProperties: false
146     produces:
147       - application/json
148     responses:
149       "200":
150         description: Charges view policy for guarantors changed
151       "400":
152         description: Bad request
153         schema:
154           $ref: "../swagger.yaml#/definitions/error"
155       "401":
156         description: Authentication required
157         schema:
158           $ref: "../swagger.yaml#/definitions/error"
159       "403":
160         description: Access forbidden
161         schema:
162           $ref: "../swagger.yaml#/definitions/error"
163       "404":
164         description: Patron not found
165         schema:
166           $ref: "../swagger.yaml#/definitions/error"
167       "500":
168         description: |
169           Internal server error. Possible `error_code` attribute values:
170
171           * `internal_server_error`
172         schema:
173           $ref: "../swagger.yaml#/definitions/error"
174       "503":
175         description: Under maintenance
176         schema:
177           $ref: "../swagger.yaml#/definitions/error"
178     x-koha-authorization:
179       allow-owner: true
180 "/public/patrons/{patron_id}/guarantors/can_see_checkouts":
181   put:
182     x-mojo-to: Patrons#guarantors_can_see_checkouts
183     operationId: setPatronGuarantorsCanSeeCheckouts
184     tags:
185       - patrons
186     summary: Set if guarantors can see checkouts
187     parameters:
188       - $ref: "../swagger.yaml#/parameters/patron_id_pp"
189       - name: body
190         in: body
191         description: A boolean representing if guarantors should be able to see the
192           patron's checkouts
193         required: true
194         schema:
195           type: object
196           properties:
197             allowed:
198               type: boolean
199           additionalProperties: false
200     produces:
201       - application/json
202     responses:
203       "200":
204         description: Check-out view policy for guarantors changed
205       "400":
206         description: Bad request
207         schema:
208           $ref: "../swagger.yaml#/definitions/error"
209       "401":
210         description: Authentication required
211         schema:
212           $ref: "../swagger.yaml#/definitions/error"
213       "403":
214         description: Access forbidden
215         schema:
216           $ref: "../swagger.yaml#/definitions/error"
217       "404":
218         description: Patron not found
219         schema:
220           $ref: "../swagger.yaml#/definitions/error"
221       "500":
222         description: |
223           Internal server error. Possible `error_code` attribute values:
224
225           * `internal_server_error`
226         schema:
227           $ref: "../swagger.yaml#/definitions/error"
228       "503":
229         description: Under maintenance
230         schema:
231           $ref: "../swagger.yaml#/definitions/error"
232     x-koha-authorization:
233       allow-owner: true
234 "/public/patrons/{patron_id}/holds/{hold_id}":
235   delete:
236     x-mojo-to: Patrons::Holds#delete_public
237     operationId: cancelPatronHoldPublic
238     tags:
239       - patrons
240     summary: Cancel a patron's hold (public)
241     parameters:
242       - $ref: "../swagger.yaml#/parameters/patron_id_pp"
243       - $ref: "../swagger.yaml#/parameters/hold_id_pp"
244     produces:
245       - application/json
246     responses:
247       "202":
248         description: Hold cancellation request accepted
249       "204":
250         description: Hold cancelled
251       "400":
252         description: Bad request
253         schema:
254           $ref: "../swagger.yaml#/definitions/error"
255       "401":
256         description: Authentication required
257         schema:
258           $ref: "../swagger.yaml#/definitions/error"
259       "403":
260         description: Access forbidden
261         schema:
262           $ref: "../swagger.yaml#/definitions/error"
263       "404":
264         description: Hold not found
265         schema:
266           $ref: "../swagger.yaml#/definitions/error"
267       "500":
268         description: |
269           Internal server error. Possible `error_code` attribute values:
270
271           * `internal_server_error`
272         schema:
273           $ref: "../swagger.yaml#/definitions/error"
274       "503":
275         description: Under maintenance
276         schema:
277           $ref: "../swagger.yaml#/definitions/error"
278     x-koha-authorization:
279       allow-owner: true