-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.yaml
More file actions
185 lines (185 loc) · 5.18 KB
/
swagger.yaml
File metadata and controls
185 lines (185 loc) · 5.18 KB
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
openapi: 3.0.0
info:
title: MotionHUB API
description: It's a simple API where you can store the details of your videos, like title, description and duration. It uses in-memory database. It means it will only store data while running and when you stop the application all data will be lost.
version: 1.0.1
contact:
name: Rodrigo Molter
url: 'https://www.linkedin.com/in/rodrigo-molter/'
email: 'rodrigo.molter@gmail.com'
servers:
- url: http://localhost:3333
description: Local server
paths:
/videos:
get:
summary: Return all the videos avaiable. You can have a search query param to filter for the video title.
parameters:
- in: query
name: search
schema:
type: string
description: Filter videos by title.
responses:
'200':
description: Return all the videos found
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Video'
'404':
description: Resource not found
content:
application/json:
schema:
type: object
properties:
error:
type: string
post:
summary: Create a new video
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title:
type: string
description:
type: string
duration:
type: integer
responses:
'201':
description: The video was successfully created!
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
'400':
description: Bad request - Fields title, description, and duration are required or duration must be a number.
content:
application/json:
schema:
type: object
properties:
error:
type: string
'404':
description: Not found any video with the given id.
content:
application/json:
schema:
type: object
properties:
error:
type: string
'/videos/{id}':
get:
summary: List you a specific video filtered by its id.
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
description: The video was found successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
'404':
description: Not found any video with the given id.
content:
application/json:
schema:
type: object
properties:
error:
type: string
put:
summary: Updates the current video on the database based on the given id
parameters:
- in: path
name: id
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
responses:
'200':
description: The video was updated successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
'400':
description: Bad request - Fields title, description, and duration are required
content:
application/json:
schema:
type: object
properties:
error:
type: string
'404':
description: Not found any video with the given id.
content:
application/json:
schema:
type: object
properties:
error:
type: string
delete:
summary: Delete a video by ID
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'204':
description: The video was deleted successfully.
'404':
description: Resource not found
content:
application/json:
schema:
type: object
properties:
error:
type: string
components:
schemas:
Video:
type: object
properties:
id:
type: string
description: Unique identifier for the video
title:
type: string
description: Title of the video
description:
type: string
description: Description of the video
duration:
type: integer
description: Duration of the video in seconds
required:
- title
- description
- duration