-
Notifications
You must be signed in to change notification settings - Fork 2
/
APIs.yaml
282 lines (270 loc) · 6.68 KB
/
APIs.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
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
swagger: "2.0"
info:
description: |
OpenChat application used by Robert C. Martin and Sandro Mancuso in their Clean Coders series.
version: "1.0.0"
title: OpenChat
termsOfService: http://codurance.com/
contact:
name: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
host: localhost:4321
basePath: /v2
schemes:
- http
paths:
/users:
post:
tags:
- registration
summary: Register a new user.
description: ""
operationId: registration
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: New user information
required: true
schema:
$ref: "#/definitions/Registration"
responses:
"201":
description: User created.
schema:
$ref: "#/definitions/User"
"400":
description: Username already in use.
get:
tags:
- user
summary: Return all users.
operationId: allUsers
produces:
- application/json
responses:
"200":
description: Successful operation
schema:
type: array
items:
$ref: "#/definitions/User"
/login:
post:
tags:
- login
summary: User login
description: ""
operationId: login
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: user credentials
required: true
schema:
$ref: "#/definitions/Login"
responses:
"200":
description: User logged in.
schema:
$ref: "#/definitions/User"
"404":
description: Invalid credentials.
/users/{userId}/timeline:
post:
tags:
- post
summary: Create a new post. All posts are moderated. Posts containing inappropriate language will be refused. For now, words considered inappropriated are - orange, ice cream, elephant. More will be added in the future.
operationId: createPost
consumes:
- application/json
produces:
- application/json
parameters:
- in: path
name: userId
description: ID of the user creating the post.
required: true
type: string
format: UUID
- in: body
name: body
description: Post text
required: true
schema:
$ref: "#/definitions/NewPost"
responses:
"201":
description: Post created.
schema:
$ref: "#/definitions/Post"
"400":
description: Post contains inappropriate language.
"404":
description: User not found.
get:
tags:
- post
summary: Return the user's timeline. The timeline contains only posts from that specific user. Posts are in reverse chronological order.
operationId: timeline
produces:
- application/json
parameters:
- in: path
name: userId
description: ID of the user we want the timeline.
required: true
type: string
format: UUID
responses:
"200":
description: Successful operation
schema:
type: array
items:
$ref: "#/definitions/Post"
"404":
description: User not found.
/followings:
post:
tags:
- user
summary: Create a following relationship between users.
operationId: following
consumes:
- application/json
parameters:
- in: body
name: body
description: Following information
required: true
schema:
$ref: "#/definitions/Follow"
responses:
"201":
description: Following created.
"400":
description: Following already exist.
/followings/{followerId}/followees:
get:
tags:
- user
summary: Return users followed by a given user.
operationId: followees
produces:
- application/json
parameters:
- in: path
name: followerId
description: ID of the follower user.
required: true
type: string
format: UUID
responses:
"200":
description: Successful operation
schema:
type: array
items:
$ref: "#/definitions/User"
/users/{userId}/wall:
get:
tags:
- post
summary: Return the user's wall. The wall contains posts from the user itself and post from user's followees. Posts are in reverse chronological order.
operationId: wall
produces:
- application/json
parameters:
- in: path
name: userId
description: ID of the user we want the wall.
required: true
type: string
format: UUID
responses:
"200":
description: Successful operation
schema:
type: array
items:
$ref: "#/definitions/Post"
"404":
description: User not found.
definitions:
Registration:
type: object
properties:
username:
type: string
password:
type: string
about:
type: string
Login:
type: object
properties:
username:
type: string
password:
type: string
User:
type: object
properties:
id:
type: string
format: UUID
description: UUID
example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
username:
type: string
about:
type: string
NewPost:
type: object
properties:
text:
type: string
example: "Hello, I'm Alice"
Post:
type: object
properties:
postId:
type: string
format: UUID
description: UUID
example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
userId:
type: string
format: UUID
description: UUID
example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
text:
type: string
dateTime:
type: string
format: date-time
description: "yyyy-MM-ddTHH:mm:ssZ"
example: "2018-01-10T11:30:00Z"
Follow:
type: object
properties:
followerId:
type: string
format: UUID
description: UUID
example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
followeeId:
type: string
format: UUID
description: UUID
example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx