-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yml
184 lines (180 loc) · 4.87 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
openapi: 3.0.0
info:
description: e-commerce application REST API built with Node.js/Express, and Postgres.
version: 1.0.0
title: E-commerce REST API
contact:
email: mmohammad3@outlook.com
host: www.heroku.com
servers:
- url: https://e-commerce-api-node.herokuapp.com
description: "production server"
- url: http://localhost:5000
description: localhost server is for development purposes only
paths:
/auth/register:
post:
tags:
- Users
summary: Registers a new user.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- password
- first_name
- last_name
- is_admin
properties:
email:
type: string
example: new_user@email.com
password:
type: string
example: 123456
first_name:
type: string
example: Mojib
last_name:
type: string
example: Mohammad
phone:
type: string
example: 4152222222
is_admin:
type: boolean
example: true or false
responses:
200:
description: 200 Success and returns the created user record
409:
description: 409 conflict (if the user record exists)
500:
description: 500 Internal Server Error
/auth/login:
post:
tags:
- Users
summary: Registers a new user.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- username
- password
- is_admin
properties:
username:
type: string
example: new_user@email.com
password:
type: string
example: 123456
responses:
200:
description: 200 Success and logs in the user
schema:
type: object
401:
description: 401 Unauthorized. Incorrect username or email
500:
description: 500 Internal Server Error
/users/{id}:
get:
tags:
- Users
summary: Get a user record by a given ID
parameters:
- name: id
in: path
required: true
description: A user ID to find a user by
schema:
type: integer
minimum: 1
responses:
200:
description: 200 Success and returns the user record
schema:
type: object
404:
description: 404 If a user with the given ID doesn't exist
500:
description: 500 Internal Server Error
put:
tags:
- Users
summary: Update a user record by a given ID
description: Update user record
parameters:
- name: id
in: path
required: true
description: A user ID to update
schema:
type: integer
minimum: 1
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- password
- first_name
- last_name
- is_admin
properties:
email:
type: string
example: john_doe@email.com
password:
type: string
example: John1235
first_name:
type: string
example: John
last_name:
type: string
example: Doe
responses:
200:
description: 200 Success and returns the updated user record
schema:
type: object
items:
404:
description: 404 A user with the given ID was not found
500:
description: 500 Internal Server Error
/addresses/user:
get:
tags:
- Address
summary: Get a user address by a signed in user
description: Get a given user address record
responses:
200:
description: A address object for a signed in user
content:
application/json:
schema:
type: object
items:
403:
description: Forbidden, Please sign in
400:
description: Bad request the route doesn't exist
404:
description: A address with the given user ID was not found
500:
description: 500 Internal Server Error