-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathstage.glowing.ai.yaml
313 lines (309 loc) · 10.2 KB
/
stage.glowing.ai.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
openapi: 3.0.0
info:
title: Glowing AI APIs
version: 1.0.0
servers:
- url: https://stage.glowing.ai/api/v1
paths:
/user:
post:
summary: Register user using a valid mobile number. Existing user requires only mobile number. Only first time user requires to give their name. The user will get an OTP on success.
operationId: registerUser
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
phone_number:
type: string
description: The user's mobile number
name:
type: string
description: The user's name
required:
- phone_number
responses:
"201":
description: User created and OTP sent successfully
content:
application/json:
schema:
type: object
properties:
response:
type: string
description: OTP created successfully
"400":
description: Parameter Missing
"403":
description: Please Wait for 30 seconds before requesting for another OTP
"404":
description: Name is missing in the request.
"422":
description: Unable to save the user
"500":
description: Internal server error
/otp:
post:
summary: Verify OTP for a user
operationId: verifyOTP
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
phone_number:
type: string
description: The user's mobile number
otp:
type: string
description: The OTP code to verify
required:
- phone_number
- otp
responses:
"200":
description: Authentication successful
"400":
description: Parameter Missing
"401":
description: Invalid OTP
"422":
description: OTP verification failed
"500":
description: Internal server error
/schedule:
get:
summary: Retrieve the SMS schedules for the user's registered mobile number.
operationId: getScheduleByPhoneNumber
parameters:
- in: query
name: phone_number
schema:
type: string
description: The mobile number of the user used to register.
required: true
responses:
'200':
description: Schedule retrieved successfully
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Schedule'
'400':
description: Parameter Missing
'401':
description: Session Expired. Please register again
'404':
description: User not found or no schedules found for the specified mobile number
'500':
description: Internal server error
post:
summary: Create a new schedule to send SMS to the user's registered mobile number. if the user is setting up a schedule for today and the scheduled time has already passed, the system should begin sending messages from the next day onwards.
description: Create a feature for users to schedule SMS notifications to their registered numbers. Users can schedule up to 3 unique schedules. Messages sent for each schedule equal the number of days from the start date and end date.
operationId: createSchedule
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
phone_number:
type: string
description: The user's registered mobile number
name:
type: string
description: The unique name of the schedule.
local_time:
type: string
format: time
description: The time at which the messages to be sent in 24 hour format.
start_date:
type: string
format: date
description: The start date for sending messages. the difference between start_date and the present date is not be more than 7 days.
end_date:
type: string
format: date
description: The end date for sending messages. It can't be after 21 days from the present date.
time_zone:
type: string
description: user's time zone. example - Asia/Kolkata.
messages:
type: array
description: Messages to send, each containing less than 155 characters.
items:
type: string
maxItems: 21
required:
- phone_number
- name
- local_time
- start_date
- end_date
- time_zone
- messages
responses:
'201':
description: Schedule created successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Schedule'
'400':
description: Parameter missing.
'401':
description: Session expired. Please register again.
'404':
description: User not found.
'422':
description: Unable to save the schedule. Please check the parameters.
'429':
description: You have reached the maximum number of schedules allowed. Please delete some schedules to create new ones.
'500':
description: Internal server error.
put:
summary: Update an existing schedule in user's registered mobile number
description: A user can have a maximum of 3 active schedules.
operationId: updateSchedule
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
phone_number:
type: string
description: The user's registered mobile number
name:
type: string
description: The name of the schedule.
local_time:
type: string
format: time
description: The time at which the messages to be sent in 24-hour format.
start_date:
type: string
format: date
description: The start date for sending messages. the difference between start_date and the present date is not be more than 7 days.
end_date:
type: string
format: date
description: The end date for sending messages. It can't be after 21 days from the present date.
time_zone:
type: string
description: The local timezone in the format "Asia/Kolkata".
required:
- phone_number
- name
- local_time
- start_date
- end_date
- time_zone
responses:
'200':
description: Schedule updated successfully
content:
application/json:
schema:
type: object
properties:
name:
type: string
local_time:
type: string
format: date-time
start_date:
type: string
format: date-time
end_date:
type: string
format: date-time
time_zone:
type: string
is_active:
type: boolean
'400':
description: Parameter missing.
'401':
description: Session expired. Please register again.
'404':
description: User or schedule not found.
'422':
description: Cannot edit schedule.
'500':
description: Internal server error.
delete:
summary: Delete an existing SMS schedule in user's registered mobile number.
operationId: deleteSchedule
parameters:
- name: name
in: query
description: The name of the schedule to be deleted.
required: true
schema:
type: string
- name: phone_number
in: query
description: The user's registered mobile number.
required: true
schema:
type: string
responses:
"200":
description: Schedule deleted successfully.
"401":
description: Session expired. Please register again.
"404":
description: User or schedule not found.
"500":
description: Internal server error.
components:
schemas:
Schedule:
type: object
properties:
local_time:
type: string
format: date-time
example: "2023-04-21T12:12:10.000Z"
start_date:
type: string
format: date-time
example: "2023-04-27T00:00:00.000Z"
end_date:
type: string
format: date-time
example: "2023-04-28T00:00:00.000Z"
time_zone:
type: string
example: "Asia/Makassar"
is_active:
type: boolean
example: true
created_at:
type: string
format: date-time
example: "2023-04-21T19:08:16.936Z"
updated_at:
type: string
format: date-time
example: "2023-04-21T19:08:16.936Z"
required:
- id
- user_id
- local_time
- start_date
- end_date
- time_zone
- is_active
- created_at
- updated_at