This repository has been archived by the owner on Aug 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yml
557 lines (528 loc) · 15.2 KB
/
openapi.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
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
openapi: 3.0.1
info:
title: Justin Sexton Portfolio Mail Web API
description: API used to interface with Justin Sexton's portfolio contact message data.
version: 0.1.0
servers:
- url: https://api.justinsexton.net/contact
tags:
- name: mail
description: Contact messages
paths:
/mail:
get:
tags:
- mail
summary: Retrieve all contact messages
operationId: getContactMessages
parameters:
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
responses:
200:
description: Contact messages were successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/ContactMessagesResponse"
415:
description: Unsupported media type
security:
- BearerAuth: []
post:
tags:
- mail
summary: Creates a new contact message
operationId: addContactMessage
parameters:
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
requestBody:
description: Contact message object that will be sent
content:
application/json:
schema:
$ref: "#/components/schemas/ContactMessageCreationForm"
required: true
responses:
201:
description: New contact messages was successfully created
content:
application/json:
schema:
$ref: "#/components/schemas/ContactMessageResponse"
400:
description: Invalid contact message request body
/mail/{id}:
get:
tags:
- mail
summary: Retrieve a single contact message from a given id
operationId: getContactMessageById
parameters:
- name: id
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
responses:
200:
description: Contact message was successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/ContactMessageResponse"
404:
description: Contact message not found
security:
- BearerAuth: []
patch:
tags:
- mail
summary: Updated an exsiting contact message
operationId: updateContactMessage
parameters:
- name: id
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
requestBody:
description: The request body used to update an existing contact message
content:
application/json:
schema:
$ref: "#/components/schemas/ContactMessageUpdateForm"
responses:
200:
description: Contact message was successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/ContactMessageResponse"
404:
description: Contact message not found
security:
- BearerAuth: []
/mail/{id}/sender:
get:
tags:
- mail
summary: Retrieves a contact messages sender information
operationId: getContactMessageSenderById
parameters:
- name: id
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
responses:
200:
description: Contact message sender was successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/SenderResponse"
404:
description: Contact message not found
security:
- BearerAuth: []
/mail/{id}/readers:
get:
tags:
- mail
summary: Retrieves which users have read a contact message instance
operationId: getContactMessageReadersById
parameters:
- name: id
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
responses:
200:
description: Contact message readers were successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/ReadersResponse"
404:
description: Contact message not found
security:
- BearerAuth: []
post:
tags:
- mail
summary: Add new reader instance to the specified contact message
operationId: addContactMessageReader
parameters:
- name: id
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
requestBody:
description: The request body used to create a new reader instance
content:
application/json:
schema:
$ref: "#/components/schemas/ReaderCreationForm"
responses:
201:
description: Reader successfully added to contact message reader list
content:
application/json:
schema:
$ref: "#/components/schemas/ReaderResponse"
404:
description: Contact message not found
security:
- BearerAuth: []
/mail/{mailId}/readers/{readerId}:
get:
tags:
- mail
summary: Retrieve an existing reader instance attached under a specified contact message
operationId: getContactMessageReaderById
parameters:
- name: mailId
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: readerId
in: path
required: true
description: Reader identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
responses:
200:
description: Contact message reader was successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/ReaderResponse"
404:
description: Contact message or reader not found
security:
- BearerAuth: []
patch:
tags:
- mail
summary: Update an existing reader instance attached under a specified contact message
operationId: updateContactMessageReader
parameters:
- name: mailId
in: path
required: true
description: Contact message identifier in the form of a UUID
schema:
type: string
- name: readerId
in: path
required: true
description: Reader identifier in the form of a UUID
schema:
type: string
- name: x-portfolio-version
in: header
description: Specifies version of API
schema:
type: string
requestBody:
description: The request body used to update an existing reader instance
content:
application/json:
schema:
$ref: "#/components/schemas/ReaderUpdateForm"
responses:
200:
description: Contact message reader was successfully updated
content:
application/json:
schema:
$ref: "#/components/schemas/ReaderUpdatedResponse"
404:
description: Contact message or reader not found
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
schemas:
ContactMessage:
description: Entity that represents a message sent by someone trying to reach out through the portfolio
type: object
properties:
id:
type: string
message:
type: string
reason:
type: string
enum:
- Business
- Question
- Feedback
- Other
responded:
type: boolean
archived:
type: boolean
sender:
$ref: "#/components/schemas/Sender"
readers:
$ref: "#/components/schemas/ReaderCollection"
timeCreated:
type: string
lastUpdated:
type: string
ContactMessageUpdateForm:
type: object
properties:
responded:
type: boolean
archived:
type: boolean
ContactMessages:
type: object
properties:
contactMessageCount:
type: integer
contactMessages:
type: array
items:
$ref: "#/components/schemas/ContactMessage"
ContactMessageCreationForm:
description: Form used to create new contact messages
type: object
required:
- sender
- reason
- message
properties:
sender:
$ref: "#/components/schemas/SenderCreationForm"
reason:
type: string
enum:
- Business
- Question
- Other
message:
type: string
ContactMessageResponse:
description: Response that contains a single contact message
type: object
properties:
success:
type: boolean
meta:
$ref: "#/components/schemas/Meta"
data:
$ref: "#/components/schemas/ContactMessage"
ContactMessagesResponse:
description: Response that contains multiple contact messages
type: object
properties:
success:
type: boolean
meta:
$ref: "#/components/schemas/Meta"
data:
$ref: "#/components/schemas/ContactMessages"
ErrorDetail:
description: Describes in detail what went wrong when attempting to process a request
type: object
properties:
fieldName:
type: string
description:
type: string
Meta:
description: Contains meta information about the response
type: object
properties:
message:
type: string
errorDetails:
type: array
items:
$ref: "#/components/schemas/ErrorDetail"
paginationDetails:
$ref: "#/components/schemas/PaginationDetails"
schemas:
description: Contains details about the response detail. This object is dynamic and depends on the given scenario
type: object
PaginationDetails:
description: Meta data regarding pagination
type: object
properties:
page:
description: Value identifying which page was returned within the response
type: number
limit:
description: Value identifying how many elements are on the returned page
type: number
Reader:
description: Denotes a user that has read the message and when.
type: object
properties:
userId:
description: Identifer identifying the user that read the message
type: string
flagged:
type: boolean
lastReadTime:
description: Time user last read this message
type: string
ReaderCollection:
description: Details involve the read status of a message instance
type: object
properties:
flaggedByAny:
description: Property denoting if any of the readers have flagged the contact message
type: boolean
flaggedByYou:
description: Property denoting if any of the reader ids match with the authorized requester
type: boolean
readByAny:
type: boolean
readByYou:
type: boolean
readerCount:
type: integer
readerList:
type: array
items:
$ref: "#/components/schemas/Reader"
ReaderCreationForm:
description: Form used to create to reader instance
type: object
required:
- userId
properties:
userId:
type: string
flagged:
type: boolean
default: false
ReaderResponse:
description: Response that contains a retrieved reader from a specified contact message
type: object
properties:
success:
type: boolean
meta:
$ref: "#/components/schemas/Meta"
data:
$ref: "#/components/schemas/Reader"
ReadersResponse:
description: Response that contains a contact message's reader instances
type: object
properties:
success:
type: boolean
meta:
$ref: "#/components/schemas/Meta"
data:
$ref: "#/components/schemas/ReaderCollection"
ReaderUpdateForm:
description: Form used to update a reader instance
type: object
properties:
flagged:
type: boolean
markRead:
description: Used to mark that a reader last read time should be updated to whenever the server recieves this request
default: false
type: boolean
ReaderUpdatedResponse:
description: Response that contains the result of updating a specific reader instance
type: object
properties:
success:
type: boolean
meta:
$ref: "#/components/schemas/Meta"
data:
$ref: "#/components/schemas/Reader"
Sender:
description: Details involving who sent the contact message
type: object
properties:
alias:
type: string
email:
type: string
phone:
type: string
ip:
type: string
userAgent:
type: string
SenderCreationForm:
description: Details involving who is sending a contact message
type: object
properties:
alias:
type: string
email:
type: string
phone:
type: string
SenderResponse:
description: Response that contains a contact message's sender instance
type: object
properties:
success:
type: boolean
meta:
$ref: "#/components/schemas/Meta"
data:
$ref: "#/components/schemas/Sender"