This repository has been archived by the owner on Oct 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yml
200 lines (200 loc) · 4.76 KB
/
openapi.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
openapi: 3.0.0
info:
version: 0.0.1
title: FCC Pinterestclone App
license:
name: MIT
paths:
/images:
get:
summary: Get all images
operationId: getImages
responses:
200:
description: Returns all images
content:
application/json:
schema:
$ref: '#/components/schemas/Images'
500:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Images
post:
summary: Add new image (Only authenticated user can add images)
operationId: addImage
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddImage'
responses:
200:
description: Response for successfully added image
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
500:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
400:
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Images
/images/{imageId}:
put:
summary: Like image
operationId: likeImage
parameters:
- name: imageId
in: path
description: Id of an image to be liked
responses:
200:
description: Response for successful like
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
500:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
400:
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Images
delete:
summary: Delete an image
operationId: deleteImage
parameters:
- name: imageId
in: path
description: Id of an image to be deleted
responses:
200:
description: Response for successful deltion
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
500:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
400:
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Images
/users/{username}/images:
get:
summary: Get user's images
operationId: getUserImages
parameters:
- name: username
in: path
description: Username
responses:
200:
description: Returns user's all images
content:
application/json:
schema:
$ref: '#/components/schemas/Images'
500:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Users
/users/user:
get:
summary: Get user
operationId: getUser
responses:
200:
description: Return got user
content:
application/json:
schema:
$ref: '#/components/schemas/User'
tags:
- Users
/logout:
get:
summary: Logout user
operationId: logout
responses:
302:
description: Redirect to home
tags:
- Auth
components:
schemas:
Image:
type: object
properties:
_id:
type: string
required: true
url:
type: string
required: true
description:
type: string
likes:
type: number
required: true
author:
type: string
required: true
AddImage:
type: object
properties:
url:
type: string
required: true
description:
type: string
Images:
type: array
items:
$ref: '#/components/schemas/Image'
User:
type: object
items:
username:
type: string
required: true
profilePicture:
type: string
Success:
type: object
Error:
type: object