-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathapi.yaml
269 lines (267 loc) · 6.72 KB
/
api.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
openapi: "3.0.0"
info:
version: 1.0.0
title: Movies API
x-yc-apigateway:
service_account_id: ${MOVIES_API_SA_ID}
paths:
/{file+}:
options:
parameters:
- name: file
in: path
description: greedy param
required: false
schema:
type: string
description: Greedy options
operationId: greedyOptions
x-yc-apigateway-integration:
type: dummy
http_code: 200
content:
"*": ""
http_headers:
Allow: OPTIONS, GET, HEAD, POST
Access-Control-Allow-Origin: '*'
Access-Control-Allow-Headers: Content-Type, Authorization
/movies:
get:
description: Returns movies sorted by popularity
operationId: getMovies
#security:
# - httpBearerAuth: [ ]
parameters:
- name: limit
in: query
description: maximum number of results to return
required: false
schema:
type: integer
responses:
'200':
description: movies response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Movie'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-yc-apigateway-integration:
type: serverless_containers
container_id: ${MOVIES_API_CONTAINER_ID}
post:
description: Upsert movie
operationId: postMovie
#security:
# - httpBearerAuth: [ ]
requestBody:
description: Movie to upsert
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Movie'
responses:
'200':
description: movie response
content:
application/json:
schema:
$ref: '#/components/schemas/Movie'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-yc-apigateway-integration:
type: serverless_containers
container_id: ${MOVIES_API_CONTAINER_ID}
/movies/{id}:
parameters:
- name: id
in: path
description: ID of movie to delete
required: true
schema:
type: integer
get:
description: Returns movie based on the ID supplied
operationId: getMovieById
#security:
# - httpBearerAuth: [ ]
responses:
'200':
description: movie response
content:
application/json:
schema:
$ref: '#/components/schemas/Movie'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-yc-apigateway-integration:
type: serverless_containers
container_id: ${MOVIES_API_CONTAINER_ID}
delete:
description: deletes a single movie based on the ID supplied
operationId: deleteMovieById
#security:
# - httpBearerAuth: [ ]
responses:
'204':
description: movie deleted
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-yc-apigateway-integration:
type: serverless_containers
container_id: ${MOVIES_API_CONTAINER_ID}
/users/{userId}/votes:
post:
description: Post vote
operationId: postVote
#security:
# - httpBearerAuth: [ ]
parameters:
- name: userId
in: path
description: ID of user
required: true
schema:
type: string
requestBody:
description: Vote to post
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Vote'
responses:
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-yc-apigateway-integration:
type: cloud_datastreams
action: PutRecord
stream_name: ${MOVIES_DATABASE_PATH}/votes-stream
partition_key: '{userId}'
get:
description: Get vote
operationId: getVote
#security:
# - httpBearerAuth: [ ]
parameters:
- name: userId
in: path
description: ID of user
required: true
schema:
type: string
- name: movieId
in: query
description: ID of movie
required: true
schema:
type: number
responses:
'200':
description: vote response
content:
application/json:
schema:
$ref: '#/components/schemas/Vote'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-yc-apigateway-integration:
type: serverless_containers
container_id: ${MOVIES_API_CONTAINER_ID}
components:
schemas:
Movie:
type: object
required:
- id
- original_title
- type
properties:
id:
type: integer
title:
type: string
type:
type: string
original_title:
type: string
original_language:
type: string
release_date:
type: string
poster_path:
type: string
popularity:
type: number
video:
type: string
vote_count:
type: integer
vote_average:
type: number
rating:
type: number
genres:
type: string
backdrop_path:
type: string
adult:
type: string
overview:
type: string
Error:
type: object
required:
- message
properties:
message:
type: string
Vote:
type: object
required:
- movie_id
- user_id
- value
properties:
movie_id:
type: integer
user_id:
type: string
value:
type: integer
securitySchemes:
httpBearerAuth:
type: http
scheme: bearer
# x-yc-apigateway-authorizer:
# type: function
# function_id: ${AUTHORIZER_FUNCTION_ID}
# authorizer_result_ttl_in_seconds: 7200