-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlambda-layer-openapi-spec.yaml
More file actions
238 lines (225 loc) · 6.36 KB
/
lambda-layer-openapi-spec.yaml
File metadata and controls
238 lines (225 loc) · 6.36 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
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
openapi: 3.0.0
info:
title: Notifications
description: Adds, Updates, Reads, and Deletes contacts and sends text messages
version: 1.0.0
tags:
- name: Contacts
description: |
Operations to manage maintenance of contacts.
- name: Messages
description: |
Operations to manage maintenance of messages.
x-amazon-apigateway-cors:
allowOrigins:
- '*'
allowMethods:
- DELETE
- GET
- POST
- PUT
allowHeaders:
- authorization
- content-type
maxAge: 3600
paths:
/contacts:
post:
summary: Add a new contact
description: Create a new contact with the phone number and name. Returns contact id.
tags:
- Contacts
responses:
201:
$ref: '#/components/responses/Created'
400:
$ref: '#/components/responses/BadRequest'
500:
$ref: '#/components/responses/InternalServerError'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ContactModel'
/contacts/{contactId}:
parameters:
- $ref: '#/components/parameters/contactId'
get:
summary: Get Contact Details
description: Returns the contact name and phone number for a specific id
tags:
- Contacts
responses:
200:
description: The request succeeded and the contact is included in the response.
content:
application/json:
schema:
$ref: '#/components/schemas/ContactModel'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
put:
summary: Update an existing contact
description: Replaces the name and phone number for an existing contact with the data passed in the request body
tags:
- Contacts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ContactModel'
required: true
responses:
204:
$ref: '#/components/responses/NoContentUpdate'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
delete:
summary: Delete an existing contact
description: Deletes an existing contact and all messages sent to it from the system. This call is idempotent
tags:
- Contacts
responses:
204:
$ref: '#/components/responses/NoContentDelete'
/contacts/{contactId}/messages:
parameters:
- $ref: '#/components/parameters/contactId'
post:
summary: Send a message to a contact
description: Sends a text message to a contact. If Twilio is not configured, it just logs the message to the database.
tags:
- Messages
responses:
201:
$ref: '#/components/responses/Created'
400:
$ref: '#/components/responses/BadRequest'
404:
$ref: '#/components/responses/BadRequest'
500:
$ref: '#/components/responses/InternalServerError'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MessageModel'
get:
summary: Get all messages sent to a contact
description: Returns an array of all messages sent to a contact
tags:
- Messages
responses:
200:
description: The request succeeded and the messages are included in the response.
content:
application/json:
schema:
$ref: '#/components/schemas/AllMessagesModel'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
components:
parameters:
contactId:
name: contactId
in: path
description: Identifier for a contact
required: true
example: 09sl3415098gplmn
schema:
type: string
schemas:
ContactModel:
type: object
required:
- name
- phoneNumber
properties:
id:
type: string
name:
type: string
phoneNumber:
type: string
pattern: ^(1?(-?\d{3})-?)?(\d{3})(-?\d{4})$
example: 1-623-555-8704
comment:
type: string
MessageModel:
type: object
required:
- message
properties:
id:
type: string
message:
type: string
example: Hello, this is my example text message
contactDate:
type: string
contactId:
type: string
AllMessagesModel:
type: array
items:
$ref: '#/components/schemas/MessageModel'
responses:
Created: #201
description: The request succeeded and created a new contact or message
content:
application/json:
schema:
type: object
required:
- id
properties:
id:
type: string
NoContentUpdate: #204
description: The request succeeded and updated an existing contact
NoContentDelete: #204
description: The request finished processing and the contact was removed or did not exist
BadRequest: #400
description: The request was in an invalid format
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: The request was an an invalid format
required:
- message
NotFound: #404
description: The requested contact was not found
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: Could not find a contact with the specified id.
required:
- message
InternalServerError: #500
description: The server encountered an unexpected condition which prevented it from fulfilling the request.
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: An error occurred saving the item.
required:
- message