Bug 28463: Add summary to all routes
[koha.git] / api / v1 / swagger / paths / transfer_limits.yaml
1 ---
2 "/transfer_limits":
3   get:
4     x-mojo-to: TransferLimits#list
5     operationId: listTransferLimits
6     description: "This resource returns a list of existing transfer limits."
7     summary: List transfer limits
8     tags:
9     - transfer
10     parameters:
11     - name: to_library_id
12       in: query
13       description: Search on to_library_id
14       required: false
15       type: string
16     - name: from_library_id
17       in: query
18       description: Search on from_library_id
19       required: false
20       type: string
21     - name: item_type
22       in: query
23       description: Search on item_type
24       required: false
25       type: string
26     - name: collection_code
27       in: query
28       description: Search on collection_code
29       required: false
30       type: string
31     - "$ref": "../parameters.json#/match"
32     - "$ref": "../parameters.json#/order_by"
33     - "$ref": "../parameters.json#/page"
34     - "$ref": "../parameters.json#/per_page"
35     - "$ref": "../parameters.json#/q_param"
36     - "$ref": "../parameters.json#/q_body"
37     - "$ref": "../parameters.json#/q_header"
38     produces:
39     - application/json
40     responses:
41       '200':
42         description: A list of transfer limits
43         schema:
44           type: array
45           items:
46             "$ref": "../definitions.json#/transfer_limit"
47       '500':
48         description: Internal error
49         schema:
50           "$ref": "../definitions.json#/error"
51       '503':
52         description: Under maintenance
53         schema:
54           "$ref": "../definitions.json#/error"
55     x-koha-authorization:
56       permissions:
57         parameters: manage_transfers
58   post:
59     x-mojo-to: TransferLimits#add
60     operationId: addTransferLimit
61     description: "This resource accepts a new transfer limit and creates it if it does not already exist."
62     tags:
63     - transfer
64     summary: Add a transfer limit
65     parameters:
66     - name: body
67       in: body
68       description: A JSON object containing information about a new transfer limit
69       required: true
70       schema:
71         "$ref": "../definitions.json#/transfer_limit"
72     produces:
73     - application/json
74     responses:
75       '201':
76         description: Transfer limit added
77         schema:
78           "$ref": "../definitions.json#/transfer_limit"
79       '400':
80         description: Bad request
81         schema:
82           "$ref": "../definitions.json#/error"
83       '401':
84         description: Authentication required
85         schema:
86           "$ref": "../definitions.json#/error"
87       '403':
88         description: Access forbidden
89         schema:
90           "$ref": "../definitions.json#/error"
91       '409':
92         description: Conflict in creating resource
93         schema:
94           "$ref": "../definitions.json#/error"
95       '500':
96         description: Internal error
97         schema:
98           "$ref": "../definitions.json#/error"
99       '503':
100         description: Under maintenance
101         schema:
102           "$ref": "../definitions.json#/error"
103     x-koha-authorization:
104       permissions:
105         parameters: manage_transfers
106 "/transfer_limits/{limit_id}":
107   delete:
108     x-mojo-to: TransferLimits#delete
109     operationId: deleteTransferLimit
110     description: "This resource deletes a transfer limit for the given limit id"
111     tags:
112     - transfer
113     summary: Delete transfer limit
114     parameters:
115     - "$ref": "../parameters.json#/transfer_limit_id_pp"
116     produces:
117     - application/json
118     responses:
119       '204':
120         description: Transfer limit deleted
121         schema:
122           type: string
123       '401':
124         description: Authentication required
125         schema:
126           "$ref": "../definitions.json#/error"
127       '403':
128         description: Access forbidden
129         schema:
130           "$ref": "../definitions.json#/error"
131       '404':
132         description: Library not found
133         schema:
134           "$ref": "../definitions.json#/error"
135       '500':
136         description: Internal error
137         schema:
138           "$ref": "../definitions.json#/error"
139       '503':
140         description: Under maintenance
141         schema:
142           "$ref": "../definitions.json#/error"
143     x-koha-authorization:
144       permissions:
145         parameters: manage_transfers
146 "/transfer_limits/batch":
147   post:
148     x-mojo-to: TransferLimits#batch_add
149     operationId: batchAddTransferLimits
150     description: "This resource batch creates new transfer limits based on the given data.
151
152     For example, if the paramters `to_library_id: 'BranchA'` and `item_type: 'BOOK'` are passed in
153     new transfer limits for `BOOK`s will be created, with one transfer limit each for all the
154     branches defined in Koha. Given 4 branches, 3 limits would be created:
155
156
157     * to_library_id: 'BranchA', from_library_id: 'BranchB', item_type: 'BOOK'
158
159     * to_library_id: 'BranchA', from_library_id: 'BranchC', item_type: 'BOOK'
160
161     * to_library_id: 'BranchA', from_library_id: 'BranchD', item_type: 'BOOK'
162
163
164     The body of the query would look like
165     ```
166     {
167         'to_library_id': 'BranchA',
168         'item_type': 'BOOK'
169
170     }
171     ```
172
173
174     As another example, imagine we have an itemtype that is never supposed to be transferred to another library.
175     If we call that itemtype `LOCAL_ONLY` we would need to just pass `item_type: 'LOCAL_ONLY'`, which would create transfer
176     limits for all libraries, meaning those items would never be allowed to transfer to another
177     library. The body of the query would look like
178     ```
179     {
180         'item_type': 'LOCAL_ONLY'
181     }
182     ```"
183     tags:
184     - transfer
185     summary: Batch add transfer limits
186     parameters:
187     - name: body
188       in: body
189       description: A JSON object containing information about new transfer limits.
190       required: true
191       schema:
192         type: object
193         properties:
194           to_library_id:
195             type: string
196             description: Internal library id for which library the item is going to
197           from_library_id:
198             type: string
199             description: Internal library id for which library the item is coming
200               from
201           item_type:
202             type:
203             - string
204             - 'null'
205             description: Itemtype defining the type for this limi
206           collection_code:
207             type:
208             - string
209             - 'null'
210             description: Authorized value for the collection code associated with
211               this limit
212         additionalProperties: false
213     produces:
214     - application/json
215     responses:
216       '201':
217         description: A list of transfer limits
218         schema:
219           type: array
220           items:
221             "$ref": "../definitions.json#/transfer_limit"
222       '500':
223         description: Internal error
224         schema:
225           "$ref": "../definitions.json#/error"
226       '503':
227         description: Under maintenance
228         schema:
229           "$ref": "../definitions.json#/error"
230     x-koha-authorization:
231       permissions:
232         parameters: manage_transfers
233   delete:
234     x-mojo-to: TransferLimits#batch_delete
235     operationId: batchDeleteTransferLimits
236     description: 'This endpoint works just like [the POST version](#op-post-transfer_limits-batch), except it deletes transfer in batch
237       rather than creating them.'
238     tags:
239     - transfer
240     summary: Batch delete transfer limits
241     parameters:
242     - name: body
243       in: body
244       description: A JSON object containing information about new transfer limits.
245       required: true
246       schema:
247         type: object
248         properties:
249           to_library_id:
250             type: string
251             description: Internal library id for which library the item is going to
252           from_library_id:
253             type: string
254             description: Internal library id for which library the item is coming
255               from
256           item_type:
257             type:
258             - string
259             - 'null'
260             description: Itemtype defining the type for this limi
261           collection_code:
262             type:
263             - string
264             - 'null'
265             description: Authorized value for the collection code associated with
266               this limit
267         additionalProperties: false
268     produces:
269     - application/json
270     responses:
271       '204':
272         description: Transfer limits deleted
273         schema:
274           type: string
275       '401':
276         description: Authentication required
277         schema:
278           "$ref": "../definitions.json#/error"
279       '403':
280         description: Access forbidden
281         schema:
282           "$ref": "../definitions.json#/error"
283       '404':
284         description: Library not found
285         schema:
286           "$ref": "../definitions.json#/error"
287       '500':
288         description: Internal error
289         schema:
290           "$ref": "../definitions.json#/error"
291       '503':
292         description: Under maintenance
293         schema:
294           "$ref": "../definitions.json#/error"
295     x-koha-authorization:
296       permissions:
297         parameters: manage_transfers