-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yml
172 lines (171 loc) · 3.94 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
swagger: "2.0"
info:
description: "This is the RolloBot API. You can find out more about it at https://github.com/sberlin/RolloBot"
version: "1.0.0"
title: "RolloBot"
license:
name: "MIT License"
url: "https://github.com/sberlin/RolloBot/blob/master/LICENSE"
basePath: "/"
tags:
- name: "motor"
description: "Interact with a motor via GPIO"
schemes:
- "http"
paths:
/motor/{motorId}:
get:
tags:
- "motor"
summary: "Find motor by ID"
description: "Returns a single motor"
produces:
- "application/json"
parameters:
- name: "motorId"
in: "path"
description: "ID of motor to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "OK"
schema:
$ref: "#/definitions/Motor"
400:
description: "Invalid motor id"
404:
description: "Motor not found"
/motor:
get:
tags:
- "motor"
summary: "Get all known motors"
description: "Returns multiple motors"
produces:
- "application/json"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Motor"
post:
tags:
- "motor"
summary: "Create a new motor"
description: ""
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Motor object"
required: true
schema:
$ref: "#/definitions/Motor"
responses:
400:
description: "Motor parameters missing in request body"
404:
description: "POST request does not accept path parameters"
put:
tags:
- "motor"
summary: "Change the motor's state"
description: ""
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Motor state object"
required: true
schema:
$ref: "#/definitions/MotorState"
responses:
400:
description: "Only setting motor state=[started|stopped] supported"
404:
description: "Motor id is missing"
delete:
tags:
- "motor"
summary: "Deletes a motor"
description: ""
produces:
- "application/json"
parameters:
- name: "motorId"
in: "path"
description: "Motor id to delete"
required: true
type: "integer"
format: "int64"
responses:
400:
description: "Motor id is missing"
404:
description: "Motor not found"
definitions:
Motor:
type: "object"
required:
- "pwm"
- "fwd"
- "rev"
- "model"
properties:
id:
type: "integer"
format: "int64"
pwm:
type: "number"
format: "int64"
example: "7"
fwd:
type: "number"
format: "int64"
example: "8"
rev:
type: "number"
format: "int64"
example: "9"
model:
type: "string"
description: "type of hardware model"
enum:
- "RASPBERRY_PI"
- "NEONIOUS_ONE"
- "MOCK"
MotorState:
type: "object"
required:
- "state"
properties:
speed:
description: "Speed the motor should have when started"
type: "number"
format: "float"
minimum: 0
maximum: 1
seconds:
description: "Amount of seconds to change the motor's state for"
type: "integer"
format: "int64"
state:
description: "New state of the motor"
type: "string"
enum:
- "started"
- "stopped"
reverse:
type: "boolean"
description: "Reverse the motor's direction"
default: false