-
Notifications
You must be signed in to change notification settings - Fork 15
/
api.yaml
226 lines (216 loc) · 5.21 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
openapi: 3.0.3
info:
title: Necsus API
description: The API for the Necsus chat room
version: 0.0.1.lol
servers:
- url: /
description: The Necsus server
tags:
- name: Information
- name: Actions
paths:
/api/messages:
get:
tags:
- Information
summary: List messages in a room, in chronological order.
parameters:
- in: query
name: room
required: true
description: The chat room name.
schema:
type: string
- in: query
name: since
description: List only messages strictly after this ID.
schema:
type: number
responses:
200:
description: Messages successfully fetched
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfMessage'
/api/bots:
get:
tags:
- Information
summary: List all bots in a room
parameters:
- in: query
name: room
required: true
description: The chat room name.
schema:
type: string
responses:
200:
description: Messages successfully fetched
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfBot'
/api/actions/message:
post:
tags:
- Actions
summary: Post a message to a room
description: 'Only the room, author, and text fields are required.'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
room:
type: string
example: 'test-room'
author:
type: string
example: 'AlarmBot'
text:
type: string
example: 'Hello there!'
image:
type: string
media:
type: string
state:
type: object
responses:
200:
description: 'The message that was posted, including its new ID.'
/api/actions/bot:
post:
tags:
- Actions
summary: Add or update a bot
requestBody:
description: Omit the `id` key to create a new bot.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Bot'
responses:
200:
description: Successful
delete:
tags:
- Actions
summary: Delete a bot
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
id:
type: integer
example: 2
responses:
200:
description: The bot that was deleted.
content:
application/json:
schema:
$ref: '#/components/schemas/Bot'
/api/actions/clear-room-messages:
post:
tags:
- Actions
summary: Clear all messages in a room
requestBody:
content:
application/json:
schema:
type: object
properties:
room:
type: string
example: 'test-room'
responses:
200:
description: The room was successfully cleared
/api/actions/clear-room-state:
post:
tags:
- Actions
summary: Clear the sticky bot state in a room.
requestBody:
content:
application/json:
schema:
type: object
properties:
room:
type: string
example: 'test-room'
responses:
200:
description: The room state was successfully cleared
components:
schemas:
Message:
type: object
properties:
id:
type: integer
example: 10
room:
type: string
example: 'test-room'
author:
type: string
example: 'James Curran'
when:
type: number
example: 1673053068.15579
text:
type: string
example: 'Good morning NCSS!'
image:
type: string
nullable: true
media:
type: string
nullable: true
state:
type: object
nullable: true
example: null
from_bot:
type: integer
example: 2
nullable: true
ArrayOfMessage:
type: array
items:
$ref: '#/components/schemas/Message'
Bot:
type: object
properties:
id:
type: integer
example: 2
room:
type: string
example: 'test-room'
name:
type: string
example: 'Alarm bot'
responds_to:
type: string
example: 'wake me in [0-9]+ \w+'
url:
type: string
example: 'https://bots.ncss.cloud/alarm-bot'
ArrayOfBot:
type: array
items:
$ref: '#/components/schemas/Bot'