-
Notifications
You must be signed in to change notification settings - Fork 2
/
openapi.yaml
187 lines (187 loc) · 5.03 KB
/
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
openapi: 3.1.0
info:
title: Dingify Event Management
description: API for managing users, their events, and projects.
version: 1.0.0
servers:
- url: https://api.dingify.workers.dev/api
description: The production server.
security:
- api_key: []
tags:
- name: events
description: Operations related to event management.
paths:
/events:
post:
tags:
- events
operationId: create
summary: Log a new event
description: Logs a new event for a user in a specified channel.
requestBody:
description: Details of the event to log.
content:
application/json:
schema:
$ref: "#/components/schemas/EventCreate"
responses:
"201":
description: Event logged successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/EventResponse"
"400":
description: Invalid input data.
"401":
description: API key is required
content:
application/json:
schema:
$ref: "#/components/schemas/UnauthorizedError"
"404":
description: Channel or project not found.
get:
tags:
- events
operationId: getEvents
summary: Retrieve all events
description: Retrieves all logged events that the user has access to.
responses:
"200":
description: List of events retrieved successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/EventsResponse"
"401":
description: API key is required
content:
application/json:
schema:
$ref: "#/components/schemas/UnauthorizedError"
components:
securitySchemes:
api_key:
type: apiKey
name: X-API-KEY
in: header
schemas:
EventResponse:
type: object
properties:
ok:
type: boolean
example: true
message:
type: string
example: Event logged!
event:
$ref: "#/components/schemas/Event"
Event:
type: object
properties:
id:
type: string
description: The ID of the event.
example: clwj5o92a0001adaz8mcbxqja
name:
type: string
description: The name of the event.
example: You got a new payment
channelId:
type: string
description: The ID of the channel associated with the event.
example: new-channel-name
userId:
type: string
description: The ID of the user associated with the event.
example: user-999
icon:
type: string
description: An optional icon for visual representation of the event.
example: icon_event.png
notify:
type: boolean
description: Flag indicating whether users should be notified about the event.
example: true
tags:
type: object
additionalProperties:
type: string
description: Tags providing additional context or categorization for the event.
example:
Networking: Yes
Tech: Yes
createdAt:
type: string
format: date-time
description: The timestamp when the event was created.
example: 2024-05-23T11:14:27.682Z
required:
- id
- name
- channelId
- userId
- icon
- notify
- createdAt
EventCreate:
type: object
properties:
name:
type: string
description: The name of the event.
example: You got a new payment
channel:
type: string
description: The channel name where the event is registered.
example: new-channel-name
userId:
type: string
description: The ID of the user associated with the event.
example: user-999
icon:
type: string
description: An optional icon representing the event.
example: 🎉
notify:
type: boolean
description: Whether to notify users about the event.
example: true
tags:
type: object
additionalProperties:
type: string
description: Additional tags providing context for the event.
example:
plan: premium
cycle: monthly
required:
- name
- channel
- notify
- userId
EventsResponse:
type: object
properties:
ok:
type: boolean
example: true
events:
type: array
items:
$ref: "#/components/schemas/Event"
UnauthorizedError:
required:
- ok
- message
type: object
properties:
ok:
type: boolean
example: false
message:
type: string
example: API key is required