Skip to content

Commit 943fea6

Browse files
committed
Bug 38050: create public CRUD list endpoint definitions
This patch creates the yaml definitions for the public CRUD enpoints for lists/virtualshelves
1 parent a8dbf34 commit 943fea6

File tree

3 files changed

+291
-1
lines changed

3 files changed

+291
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
type: object
3+
properties:
4+
list_id:
5+
description: Internal identifier for the list
6+
type: integer
7+
readOnly: true
8+
name:
9+
description: List name
10+
type: string
11+
creation_date:
12+
description: Date the list was created
13+
type: string
14+
format: date-time
15+
readOnly: true
16+
updated_on_date:
17+
description: Date the list was last updated
18+
type: string
19+
format: date-time
20+
readOnly: true
21+
owner_id:
22+
description: Internal identifier for the owning patron
23+
type: integer
24+
readOnly: true
25+
allow_change_from_owner:
26+
description: If the owner can change the contents
27+
type: boolean
28+
default: true
29+
allow_change_from_others:
30+
description: If others can change the contents
31+
type: boolean
32+
default: false
33+
public:
34+
description: If the list is public
35+
type: boolean
36+
default: true
37+
default_sort_field:
38+
description: The field this list is sorted on by default
39+
type: string
40+
default: 'title'
41+
allow_change_from_permitted_staff:
42+
description: If only permitted staff can change the contents
43+
type: boolean
44+
default: false
45+
allow_change_from_staff:
46+
description: If staff can change the contents
47+
type: boolean
48+
default: false
49+
additionalProperties: false
50+
required:
51+
- list_id
52+
- name
53+
- creation_date
54+
- updated_on_date
55+
- allow_change_from_owner
56+
- allow_change_from_others
57+
- public
+229
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
---
2+
"/public/lists":
3+
get:
4+
x-mojo-to: Lists#list_public
5+
operationId: listListsPublic
6+
description: "This resource returns a list of existing bibliographic lists."
7+
summary: List bibliographic lists
8+
tags:
9+
- lists
10+
parameters:
11+
- name: only_mine
12+
in: query
13+
description: Only return the users' lists
14+
required: false
15+
type: string
16+
- name: only_public
17+
in: query
18+
description: Only return public lists
19+
required: false
20+
type: string
21+
- $ref: "../swagger.yaml#/parameters/match"
22+
- $ref: "../swagger.yaml#/parameters/order_by"
23+
- $ref: "../swagger.yaml#/parameters/page"
24+
- $ref: "../swagger.yaml#/parameters/per_page"
25+
- $ref: "../swagger.yaml#/parameters/q_param"
26+
- $ref: "../swagger.yaml#/parameters/q_body"
27+
- $ref: "../swagger.yaml#/parameters/request_id_header"
28+
produces:
29+
- application/json
30+
responses:
31+
"200":
32+
description: A list of lists
33+
schema:
34+
type: array
35+
items:
36+
$ref: "../swagger.yaml#/definitions/public_list"
37+
"400":
38+
description: |
39+
Bad request. Possible `error_code` attribute values:
40+
41+
* `bad_request`
42+
* `invalid_query`
43+
* `only_mine_forbidden`
44+
schema:
45+
$ref: "../swagger.yaml#/definitions/error"
46+
"403":
47+
description: Access forbidden
48+
schema:
49+
$ref: "../swagger.yaml#/definitions/error"
50+
"500":
51+
description: |
52+
Internal server error. Possible `error_code` attribute values:
53+
54+
* `internal_server_error`
55+
schema:
56+
$ref: "../swagger.yaml#/definitions/error"
57+
"503":
58+
description: Under maintenance
59+
schema:
60+
$ref: "../swagger.yaml#/definitions/error"
61+
62+
post:
63+
x-mojo-to: Lists#public_create
64+
operationId: createPublicList
65+
tags:
66+
- lists
67+
summary: Create a new list you own
68+
description: "This resource creates a bibliographic list owned by the authenticated user."
69+
produces:
70+
- application/json
71+
parameters:
72+
- name: body
73+
in: body
74+
description: A JSON object containing information about the new list
75+
required: true
76+
schema:
77+
$ref: "../swagger.yaml#/definitions/public_list"
78+
responses:
79+
"201":
80+
description: List added
81+
schema:
82+
$ref: "../swagger.yaml#/definitions/public_list"
83+
"400":
84+
description: Bad request
85+
schema:
86+
$ref: "../swagger.yaml#/definitions/error"
87+
"401":
88+
description: Authentication required
89+
schema:
90+
$ref: "../swagger.yaml#/definitions/error"
91+
"403":
92+
description: Access forbidden
93+
schema:
94+
$ref: "../swagger.yaml#/definitions/error"
95+
"500":
96+
description: |
97+
Internal server error. Possible `error_code` attribute values:
98+
99+
* `internal_server_error`
100+
schema:
101+
$ref: "../swagger.yaml#/definitions/error"
102+
"503":
103+
description: Under maintenance
104+
schema:
105+
$ref: "../swagger.yaml#/definitions/error"
106+
107+
/public/lists/{list_id}:
108+
get:
109+
x-mojo-to: Lists#public_read
110+
operationId: getPublicList
111+
description: "This resource returns information on a specific existing bibliographic list."
112+
tags:
113+
- lists
114+
summary: Retrieve a specific public list or a list you own
115+
produces:
116+
- application/json
117+
parameters:
118+
- $ref: "../swagger.yaml#/parameters/list_id_pp"
119+
responses:
120+
"200":
121+
description: OK
122+
schema:
123+
$ref: "../swagger.yaml#/definitions/public_list"
124+
"400":
125+
description: Bad request
126+
schema:
127+
$ref: "../swagger.yaml#/definitions/error"
128+
"403":
129+
description: Access forbidden
130+
schema:
131+
$ref: "../swagger.yaml#/definitions/error"
132+
"404":
133+
description: Not found
134+
schema:
135+
$ref: "../swagger.yaml#/definitions/error"
136+
"500":
137+
description: |
138+
Internal server error. Possible `error_code` attribute values:
139+
140+
* `internal_server_error`
141+
schema:
142+
$ref: "../swagger.yaml#/definitions/error"
143+
"503":
144+
description: Under maintenance
145+
schema:
146+
$ref: "../swagger.yaml#/definitions/error"
147+
put:
148+
x-mojo-to: Lists#public_update
149+
operationId: updatePublicList
150+
tags:
151+
- lists
152+
description: 'Update a specific list that you own'
153+
summary: Update a specific list you own
154+
produces:
155+
- application/json
156+
parameters:
157+
- $ref: "../swagger.yaml#/parameters/list_id_pp"
158+
- name: body
159+
in: body
160+
description: A list object
161+
required: true
162+
schema:
163+
$ref: "../swagger.yaml#/definitions/list"
164+
responses:
165+
"200":
166+
description: A list
167+
schema:
168+
$ref: "../swagger.yaml#/definitions/list"
169+
"400":
170+
description: Bad request
171+
schema:
172+
$ref: "../swagger.yaml#/definitions/error"
173+
"401":
174+
description: Authentication required
175+
schema:
176+
$ref: "../swagger.yaml#/definitions/error"
177+
"403":
178+
description: Access forbidden
179+
schema:
180+
$ref: "../swagger.yaml#/definitions/error"
181+
"404":
182+
description: Not found
183+
schema:
184+
$ref: "../swagger.yaml#/definitions/error"
185+
"500":
186+
description: |
187+
Internal server error. Possible `error_code` attribute values:
188+
189+
* `internal_server_error`
190+
schema:
191+
$ref: "../swagger.yaml#/definitions/error"
192+
"503":
193+
description: Under maintenance
194+
schema:
195+
$ref: "../swagger.yaml#/definitions/error"
196+
197+
delete:
198+
x-mojo-to: Lists#public_delete
199+
operationId: deletePublicList
200+
tags:
201+
- lists
202+
summary: Delete a specific list you own
203+
produces:
204+
- application/json
205+
parameters:
206+
- $ref: "../swagger.yaml#/parameters/list_id_pp"
207+
responses:
208+
"204":
209+
description: List deleted
210+
"401":
211+
description: Authentication required
212+
schema:
213+
$ref: "../swagger.yaml#/definitions/error"
214+
"403":
215+
description: Access forbidden
216+
schema:
217+
$ref: "../swagger.yaml#/definitions/error"
218+
"404":
219+
description: List not found
220+
schema:
221+
$ref: "../swagger.yaml#/definitions/error"
222+
"500":
223+
description: Internal error
224+
schema:
225+
$ref: "../swagger.yaml#/definitions/error"
226+
"503":
227+
description: Under maintenance
228+
schema:
229+
$ref: "../swagger.yaml#/definitions/error"

api/v1/swagger/swagger.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ definitions:
156156
$ref: ./definitions/preservation_train_item.yaml
157157
preservation_processing:
158158
$ref: ./definitions/preservation_processing.yaml
159+
public_list:
160+
$ref: ./definitions/public_list.yaml
159161
quote:
160162
$ref: ./definitions/quote.yaml
161163
recall:
@@ -516,7 +518,9 @@ paths:
516518
"/public/libraries/{library_id}":
517519
$ref: "./paths/libraries.yaml#/~1public~1libraries~1{library_id}"
518520
"/public/lists":
519-
$ref: "./paths/lists.yaml#/~1public~1lists"
521+
$ref: "./paths/public_lists.yaml#/~1public~1lists"
522+
"/public/lists/{list_id}":
523+
$ref: "./paths/public_lists.yaml#/~1public~1lists~1{list_id}"
520524
"/public/oauth/login/{provider_code}/{interface}":
521525
$ref: ./paths/public_oauth.yaml#/~1public~1oauth~1login~1{provider_code}~1{interface}
522526
"/public/patrons/{patron_id}/article_requests/{article_request_id}":

0 commit comments

Comments
 (0)