-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoor-badge-reader.yaml
More file actions
139 lines (136 loc) · 3.49 KB
/
door-badge-reader.yaml
File metadata and controls
139 lines (136 loc) · 3.49 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
openapi: "3.1.0"
info:
version: 1.0.0
title: Door Badge Reader
description: |
A door badge reader service that demonstrates OpenAPI 3.1 webhooks.
Clients register for enterEvent and exitEvent webhooks. The server
randomly generates badge events and notifies all registered listeners.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
paths:
/api/webhook/{kind}:
post:
summary: Register a webhook
description: |
Registers a webhook for the given event kind. The server will POST
to the provided URL whenever an event of that kind occurs.
operationId: RegisterWebhook
parameters:
- name: kind
in: path
required: true
schema:
type: string
enum:
- enterEvent
- exitEvent
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookRegistration'
responses:
'201':
description: Webhook registered
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookRegistrationResponse'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/webhook/{id}:
delete:
summary: Deregister a webhook
description: Removes a previously registered webhook by its ID.
operationId: DeregisterWebhook
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Webhook deregistered
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
webhooks:
enterEvent:
post:
summary: Person entered the building
operationId: EnterEvent
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Person'
responses:
'200':
description: Event received
exitEvent:
post:
summary: Person exited the building
operationId: ExitEvent
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Person'
responses:
'200':
description: Event received
components:
schemas:
WebhookRegistration:
type: object
required:
- url
properties:
url:
type: string
format: uri
description: URL to receive webhook events
WebhookRegistrationResponse:
type: object
required:
- id
properties:
id:
type: string
format: uuid
description: Unique identifier for this webhook registration
Person:
type: object
required:
- name
properties:
name:
type: string
description: Name of the person who badged in or out
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
description: Error code
message:
type: string
description: Error message