/
swagger.yml
330 lines (306 loc) · 6.53 KB
/
swagger.yml
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
consumes:
- application/json
info:
title: Yet another expense splitter
version: 1.0.0
paths: {}
produces:
- application/json
schemes:
- http
swagger: "2.0"
paths:
/login:
post:
summary: Creates a new session - login
operationId: createSession
tags:
- session
parameters:
- name: credentials
in: body
description: User credentials
required: true
schema:
$ref: '#/definitions/credentials'
responses:
200:
description: login
schema:
$ref: "#/definitions/jwtToken"
401:
$ref: "#/definitions/401"
/users:
post:
summary: Create user - signup
operationId: createUser
tags:
- users
parameters:
- name: user
in: body
description: User to be created
required: true
schema:
$ref: '#/definitions/newUser'
responses:
200:
description: create user - signup
schema:
$ref: "#/definitions/user"
422:
$ref: "#/definitions/422"
get:
summary: List other users
operationId: listUsers
tags:
- users
parameters:
- $ref: "#/definitions/authorizationHeader"
responses:
200:
description: list the other users
schema:
$ref: "#/definitions/users"
401:
$ref: "#/definitions/401"
/expenses:
get:
summary: List of all expenses owed to logged in user
operationId: getExpenses
tags:
- expenses
parameters:
- $ref: "#/definitions/authorizationHeader"
responses:
200:
description: list expenses
schema:
$ref: "#/definitions/expenses"
401:
$ref: "#/definitions/401"
post:
summary: Create a new expense
operationId: createExpense
tags:
- expenses
parameters:
- $ref: "#/definitions/authorizationHeader"
- name: expense
in: body
description: Expense fields
required: true
schema:
$ref: '#/definitions/newExpense'
responses:
200:
schema:
$ref: "#/definitions/expense"
401:
$ref: "#/definitions/401"
422:
$ref: "#/definitions/422"
/payables:
get:
summary: List of all payables owed by logged in user
operationId: getPayables
tags:
- payables
parameters:
- $ref: "#/definitions/authorizationHeader"
responses:
200:
description: list payables
schema:
$ref: "#/definitions/payables"
401:
$ref: "#/definitions/401"
/payables/{payableID}:
put:
summary: Updates the given payable
operationId: updatePayableById
tags:
- payables
parameters:
- $ref: "#/definitions/authorizationHeader"
- name: payableID
in: path
description: ID of payable to update
required: true
type: integer
format: uint
- name: payable
in: body
description: Payable fields to update
required: true
schema:
$ref: '#/definitions/newPayable'
responses:
200:
schema:
$ref: "#/definitions/payable"
401:
$ref: "#/definitions/401"
422:
$ref: "#/definitions/422"
definitions:
credentials:
type: object
properties:
Username:
type: string
Password:
type: string
jwtToken:
type: object
properties:
token:
type: string
readOnly: true
authorizationHeader:
name: Authorization
in: header
description: JWT Auth Token as - "Bearer {jwtToken}"
schema:
type: string
pattern: Bearer \w+.\w+.\w+
user:
allOf:
- $ref: "#/definitions/newUserWithoutPassword"
required:
- ID
properties:
ID:
type: integer
readOnly: true
CreatedAt:
type: dateTime
UpdatedAt:
type: dateTime
DeletedAt:
type: dateTime
newUserWithoutPassword:
type: object
required:
- Username
- FirstName
- LastName
- MobileNumber
properties:
Username:
type: string
FirstName:
type: string
LastName:
type: string
MobileNumber:
type: string
newUser:
allOf:
- $ref: "#/definitions/newUserWithoutPassword"
required:
- Password
properties:
Password:
type: string
users:
type: array
items:
$ref: '#/definitions/user'
expense:
type: object
allOf:
- $ref: "#/definitions/newExpenseWithoutPayables"
required:
- ID
properties:
ID:
type: integer
format: uint
CreatedBy:
type: integer
format: uint
CreatedAt:
type: dateTime
UpdatedAt:
type: dateTime
DeletedAt:
type: dateTime
Payables:
$ref: "#/definitions/payables"
newExpenseWithoutPayables:
type: object
properties:
Amount:
type: number
format: float64
Place:
type: string
newExpense:
type: object
allOf:
- $ref: "#/definitions/newExpenseWithoutPayables"
required:
- Amount
- Place
properties:
Payables:
$ref: "#/definitions/newPayables"
expenses:
type: array
items:
$ref: '#/definitions/expense'
payable:
type: object
allOf:
- $ref: "#/definitions/newPayable"
required:
- ID
properties:
ID:
type: integer
format: uint
CreatedAt:
type: dateTime
UpdatedAt:
type: dateTime
DeletedAt:
type: dateTime
ExpenseID:
type: integer
format: uint
newPayable:
type: object
required:
- UserID
- Status
- AmountOwed
- RatioInPercentage
properties:
UserID:
type: integer
format: uint
RatioInPercentage:
type: number
format: float64
AmountOwed:
type: number
format: float64
Status:
type: string
newPayables:
type: array
items:
$ref: '#/definitions/newPayable'
payables:
type: array
items:
$ref: '#/definitions/payable'
401:
description: unauthorized
schema:
type: string
422:
description: Unprocessable entity
schema:
type: string