-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
333 lines (316 loc) · 8.36 KB
/
swagger.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
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
331
332
333
swagger: "2.0"
info:
description: "An application that connects users with available businesses."
version: "1.0.0"
title: "WeConnect web application"
termsOfService: "http://swagger.io/terms/"
contact:
email: "[email protected]"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "we-connect-api.herokuapp.com"
basePath: "/api/v1"
tags:
- name: "Users"
description: "API for user"
- name: "Businesses"
description: "API for businesses"
schemes:
- "https"
paths:
/auth/signup:
post:
tags:
- "Users"
summary: "Add a new user"
description: "Add a new user to the application"
operationId: "addUser"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "user"
description: "Registers new user"
required: true
schema:
$ref: "#/definitions/UserSignUp"
responses:
201:
description: "Signed up successfully"
/auth/login:
post:
tags:
- "Users"
summary: "Login User"
description: "Logs in a registered user"
operationId: "loginUser"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "user"
description: "Logs in a registered user"
required: true
schema:
$ref: "#/definitions/UserLogin"
responses:
200:
description: "Logged in successfully"
401:
description: "Error logging in"
/businesses:
post:
tags:
- "Businesses"
summary: "Register a business"
description: "Register a new business"
operationId: "createdNewBusiness"
produces:
- "application/json"
parameters:
- in: "body"
name: "businesses"
description: "Creating a new business in WeConnect"
required: true
schema:
$ref: "#/definitions/RegisterBusiness"
responses:
200:
description: "business successfuly created"
400:
description: "Error occured"
get:
tags:
- "Businesses"
summary: "Gets all businesses"
produces:
- "application/json"
parameters: []
responses:
200:
description: "Businesses listed successfully"
/businesses/{businessId}:
get:
tags:
- "Businesses"
summary: "Find business by ID"
description: "Returns a single business"
produces:
- "application/json"
parameters:
- name: "businessId"
in: "path"
description: "ID to fetch a business"
required: true
type: "integer"
schema:
$ref: "#/definitions/RegisterBusinessModel"
responses:
200:
description: "successful operation"
404:
description: "Business not found"
put:
tags:
- "Businesses"
summary: "Updates a business profile"
description: "Updates a single business"
operationId: "updateBusiness"
consumes:
- "application/x-www-form-urlencoded"
produces:
- "application/json"
parameters:
- name: "businessId"
in: "path"
description: "ID of Business that needs to be updated"
required: true
type: "integer"
format: "int64"
- name: "body"
in: "body"
description: "Updated name of the business"
required: true
schema:
$ref: "#/definitions/RegisterBusinessModel"
responses:
200:
description: "Business update successful"
404:
description: "Business with id does not found"
delete:
tags:
- "Businesses"
summary: "Deletes a Business"
description: "Delete Business"
operationId: "deleteBusiness"
produces:
- "application/json"
parameters:
- name: "businessId"
in: "path"
description: "The id of the business that needs to be deleted"
required: true
type: "integer"
responses:
200:
description: "Successfully deleted"
404:
description: "Business not found"
/businesses/{businessId}/reviews:
post:
tags:
- "Businesses"
summary: "Add a business review"
description: "Add a business review"
produces:
- "application/json"
parameters:
- name: "businessId"
in: "body"
description: "Adding a new business review"
required: true
- name: "body"
in: "body"
description: "user object to add to database"
required: true
schema:
$ref: "#/definitions/ReviewModel"
responses:
200:
description: "Review was successfully added"
404:
description: "Cannot add review, business with id does not exist"
get:
tags:
- "Businesses"
summary: "Gets all business reviews for a particular business"
description: "Gets all business reviews for a particular business by id"
operationId: "AllBusinessReview"
produces:
- "application/json"
parameters:
- name: "businessId"
in: "path"
description: "Id to get business reviews"
required: true
type: "integer"
responses:
200:
description: "Review list loaded successfully"
404:
description: "Cannot get Review, business with id does not exist"
/businesses?location=location:
get:
tags:
- "Businesses"
summary: "Gets a business with specified location"
produces:
- "application/json"
parameters:
- in: "query"
name: "location"
description: "Location to get a business"
schema:
type: "string"
responses:
200:
description: "Search was successful"
schema:
$ref: "#/definitions/RegisterBusinessModel"
404:
description: "Business under location [locationName] not found"
/businesses?category=category:
get:
tags:
- "Businesses"
summary: "Gets a business under the specified category"
produces:
- "application/json"
parameters:
- name: "category"
in: "query"
description: "Searches for a business category as specified in the query parameter"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/RegisterBusinessModel"
404:
description: "Business under category[categoryName] does not exist"
definitions:
UserSignUp:
type: "object"
required: ["email", "password"]
properties:
email:
type: "string"
uniqueItems: false
password:
type: "string"
uniqueItems: true
UserLogin:
type: "object"
required: ["email", "password"]
properties:
email:
type: "string"
uniqueItems: true
password:
type: "string"
uniqueItems: true
RegisterBusinessModel:
type: "object"
required: ["businessName", "email","location","category","phoneNumber","description"]
properties:
businessName:
type: "string"
uniqueItems: true
email:
type: "string"
uniqueItems: true
description:
type: "string"
uniqueItems: true
phoneNumber:
type: "string"
uniqueItems: true
category:
type: "string"
uniqueItems: true
location:
type: "string"
uniqueItems: true
getBusinessModel:
type: "object"
required: ["business"]
properties:
message:
type: "string"
business:
type: "object"
getAllBusinessModel:
type: "object"
required: ["message"]
properties:
message:
type: "string"
businesses:
type: "array"
business:
type : "object"
addReviewModel:
type: "object"
required: ["content", "businessId"]
properties:
reviewId:
type: "string"
content:
type: "string"
businessId:
type: "integer"