This repository was archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopen-api.spec.yaml
218 lines (211 loc) · 5.63 KB
/
open-api.spec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
openapi: 3.0.0
info:
description: |
SafeIsh API - The most secure safebox
version: 1.0.0
title: SafeIsh API
paths:
/safebox:
post:
operationId: post-safebox
summary: Creates a new safebox
description: |
Creates a new safebox based on a non-empty name and a password.
tags:
- Safebox Controller
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSafeboxRequest'
responses:
'201':
description: Safebox correctly created
content:
application/json:
schema:
$ref: '#/components/schemas/CreatedSafebox'
'400':
description: Malformed expected data
'409':
description: Safebox already exists
'500':
description: Unexpected API error
'502':
description: A subsystem has failed
/safebox/{id}/open:
get:
operationId: open-safebox
summary: Open a safebox
description: |
Opens the safebox identified by the given ID and with the specified user & password.
tags:
- Safebox Controller
security:
- basicPassword: [ ]
parameters:
- in: path
name: id
description: Safebox id
required: true
schema:
type: string
responses:
'200':
description: Safebox correctly opened
content:
application/json:
schema:
$ref: '#/components/schemas/SafeboxKey'
'400':
description: Malformed expected data
'401':
description: Authorization failed
'403':
description: Bad credentials
'404':
description: Requested safebox does not exist
'423':
description: Requested safebox is locked
'500':
description: Unexpected API error
'502':
description: A subsystem has failed
/safebox/{id}/items:
get:
operationId: get-safebox-items
summary: Retrieves the content of a safebox
description:
Retrieves the currently stored contents in the safebox identified by the given ID and with the given opening token.
tags:
- Safebox Controller
security:
- bearerToken: [ ]
parameters:
- in: path
name: id
description: Safebox Id
required: true
schema:
type: string
responses:
'200':
description: Safebox contents correctly retrieved
content:
application/json:
schema:
$ref: '#/components/schemas/ItemList'
'400':
description: Malformed expected data
'401':
description: Authorization error
'404':
description: Requested safebox does not exist
'423':
description: Requested safebox is locked
'500':
description: Unexpected API error
'502':
description: A subsystem has failed
put:
operationId: put-safebox-items
summary: Add an items to a Safebox
description: |
Inserts new contents in the safebox identified by the given ID and with the given opening token.
tags:
- Safebox Controller
security:
- bearerToken: [ ]
parameters:
- in: path
name: id
description: Safebox id
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ItemList'
responses:
'201':
description: Content correctly added to the safebox
'400':
description: Malformed expected data
'401':
description: Authorization error
'404':
description: Requested safebox does not exist
'423':
description: Requested safebox is locked
'500':
description: Unexpected API error
'502':
description: A subsystem has failed
components:
schemas:
CreateSafeboxRequest:
description: 'Request for safebox creation'
type: object
properties:
name:
description: Safebox Name
type: string
password:
description: Safebox Password
type: string
required:
- name
- password
example:
name: Secure safebox 01
password: extremelySecurePassword
CreatedSafebox:
description: Response for user registration
type: object
properties:
id:
description: Safebox id
type: string
required:
- id
example:
id: f626c808-648c-41fe-865d-c6062f3e0899
SafeboxKey:
description: Response for login operation
type: object
properties:
token:
description: Token for future actions over an opening safebox
type: string
required:
- token
example:
token: RkbfZSW5MmcK3b7kcgg
ItemList:
description: Safebox items
type: object
properties:
items:
description: Safebox items
type: array
items:
type: string
required:
- items
example:
items:
- Safebox content 03
- Safebox content 02
- Safebox content 01
- New safebox content
securitySchemes:
bearerToken:
type: http
scheme: bearer
basicPassword:
type: http
scheme: basic