-
Notifications
You must be signed in to change notification settings - Fork 2
/
sideko_openapi.yaml
349 lines (329 loc) · 9.66 KB
/
sideko_openapi.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
openapi: 3.0.3
info:
title: Sideko API
description: Sideko API
version: "0.1.0"
security:
- ApiKeyAuth: []
servers:
- url: https://api.sideko.dev
paths:
# Auth exchange
/v1/auth/exchange_key:
get:
summary: Exchange one-time auth key for api key
operationId: exchange_code_for_key
parameters:
- name: code
in: query
required: true
schema:
type: string
security: []
responses:
"200":
description: API key
content:
application/json:
schema:
$ref: "#/components/schemas/ApiKey"
# CLI-specific
/v1/cli/updates/{cli_version}:
get:
summary: Checks if current CLI has updates
operationId: cli_check_updates
security: []
parameters:
- name: cli_version
required: true
in: path
schema:
type: string
description: semver of running cli
example: 0.1.0
responses:
"200":
description: List of updates at different levels available for cli
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/CliUpdate"
# Stateless Operations
/v1/stateless/generate_sdk:
post:
summary: Generate SDK outside of Sideko's versioning flow
operationId: stateless_generate_sdk
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/StatelessGenerateSdk"
responses:
"201":
description: Generated SDK source code as a .tar.gz
content:
application/octet-stream:
schema:
type: string
format: binary
"400":
description: Error generating SDK
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
# API Project
/v1/api_project:
post:
summary: Create a new API Project
operationId: create_api_project
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewApiProject"
responses:
"201":
description: API Project created
content:
application/json:
schema:
$ref: "#/components/schemas/ApiProject"
get:
summary: List API Projects
operationId: list_api_projects
responses:
"200":
description: List of API projects you have access to
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/ApiProject"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
# API Project Version
/v1/api_project/{project_id}/version:
parameters:
- name: project_id
in: path
required: true
schema:
type: string
get:
summary: List versions of a specific API Project
operationId: list_api_versions
responses:
"200":
description: A JSON array of versions
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/ApiVersion"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Create a new version for a specific API Project
operationId: create_api_version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewApiVersion"
responses:
"201":
description: Version created
content:
application/json:
schema:
$ref: "#/components/schemas/ApiVersion"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-sideko-key
description: API key authentication using the x-sideko-key header
schemas:
ApiKey:
type: object
required:
- api_key
properties:
api_key:
type: string
example:
value: sk_live_1234abcd
CliUpdate:
type: object
required:
- severity
- message
properties:
severity:
$ref: "#/components/schemas/CliUpdateSeverity"
message:
type: string
example:
value: Requires update to 0.2.0 for security patch
CliUpdateSeverity:
type: string
enum:
- info
- suggested
- required
StatelessGenerateSdk:
type: object
required:
- language
- openapi
properties:
openapi:
type: string
description: OpenAPI content in YAML or JSON format
example:
description: OpenAPI Sample in YAML format
value: "openapi: 3.0.0 info: {title: Sample API, description: 'Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.', version: 0.1.9} servers: [{url: 'http://api.example.com/v1', description: 'Optional server description, e.g. Main (production) server'}, {url: 'http://staging-api.example.com', description: 'Optional server description, e.g. Internal staging server for testing'}] paths: {/users: {get: {summary: 'Returns a list of users.', description: 'Optional extended description in CommonMark or HTML.', responses: {'200': {description: 'A JSON array of user names', content: {application/json: {schema: {type: array, items: {type: string}}}}}}}}}"
language:
$ref: "#/components/schemas/GenerationLanguage"
package_name:
type: string
description: Name of the SDK package to be generated
example:
value: my_sdk
base_url:
type: string
description: The default base url to be set in the generated SDK
example:
value: http://127.0.0.1:8080/api
GenerationLanguage:
type: string
description: Programming languages available for SDK generation
enum:
- python
- go
- rust
- ruby
- typescript
# Error
ErrorCode:
type: string
description: Various error codes that are returned as part of a non-200 response
enum:
- forbidden
- unauthorized
- not_found
- internal_server_error
- Bad Request
- unavailable_subdomain
- invalid_openapi
- invalid_url
Error:
type: object
required:
- error
- description
properties:
error:
$ref: "#/components/schemas/ErrorCode"
description:
type: string
example:
value: Bad request
ApiProject:
type: object
required:
- id
- title
- created_at
properties:
id:
type: string
format: uuid
title:
type: string
created_at:
type: string
format: date-time
NewApiProject:
type: object
required:
- title
properties:
title:
type: string
example: A New API Project
ApiVersion:
type: object
required:
- id
- semver
- api_project_id
- created_at
properties:
id:
type: string
format: uuid
semver:
type: string
api_project_id:
type: string
format: uuid
created_at:
type: string
format: date-time
NewApiVersion:
type: object
required:
- semver
- openapi
properties:
semver:
type: string
description: Semantic Version of the API
openapi:
type: string
description: An OpenAPI Specification in JSON or YAML Format
OpenAPI:
type: object
required:
- openapi
- is_valid
properties:
openapi:
type: string
description: OpenAPI content as a string in JSON format
example:
description: OpenAPI Sample in YAML format
value: "openapi: 3.0.0 info: {title: Sample API, description: 'Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.', version: 0.1.9} servers: [{url: 'http://api.example.com/v1', description: 'Optional server description, e.g. Main (production) server'}, {url: 'http://staging-api.example.com', description: 'Optional server description, e.g. Internal staging server for testing'}] paths: {/users: {get: {summary: 'Returns a list of users.', description: 'Optional extended description in CommonMark or HTML.', responses: {'200': {description: 'A JSON array of user names', content: {application/json: {schema: {type: array, items: {type: string}}}}}}}}}"
is_valid:
type: boolean
description: Whether or not your OpenAPI Specification is valid