forked from OpenSourceFellows/amplify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
427 lines (427 loc) · 11 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
openapi: 3.0.0
servers:
- url: ''
info:
title: Amplify API
description: ''
version: 1.0.0
license:
name: MIT
url: https://github.com/ProgramEquity/amplify/blob/main/LICENSE
paths:
/api/campaigns:
get:
summary: Returns a JSON array of campaigns
operationId: ''
responses:
'200':
description: Campaigns response
content:
application/json:
schema:
type: object
properties:
Campaigns:
type: array
items:
$ref: '#/components/schemas/Campaign'
'500':
description: Error
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/Error'
/api/campaigns/{id}:
get:
summary: Returns a campaign based on its id
operationId: ''
responses:
'200':
description: Campaign response
content:
application/json:
schema:
$ref: '#/components/schemas/Campaign'
'400': null
'500':
description: Error
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/Error'
parameters:
- name: id
in: path
required: true
schema:
type: integer
/api/letter_versions/{campaignId}:
get:
summary: >-
Returns all versions of each letter, including the template id, sent out
for a campaign based on campaign ID
responses:
'200':
description: Letter Versions response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LetterVersion'
'500':
description: Error
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/Error'
parameters:
- name: campaignId
description: ID of campaign to return letter versions for
in: path
required: true
schema:
type: integer
/api/representatives/{zipCode}:
get:
summary: Returns representatives based on zip code
operationId: ''
description: >-
Returns Representatives based on zip code utilizing <a
href="https://developers.google.com/civic-information">Google's Civic
Information API</a>
externalDocs:
url: https://developers.google.com/civic-information
responses:
'200':
description: >-
Array of representatives, info found via <a
href="https://developers.google.com/civic-information">Google's
Civic Information API</a>
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Representative'
'400':
description: Invalid Zip Code Error
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/InvalidZipError'
'500':
description: Error
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/Error'
parameters:
- name: zipCode
description: >-
Zip code around which to search for representatives. Must be in the
form of a valid 5-digit or Zip+4 9-digit format.
in: path
required: true
schema:
type: string
maxLength: 10
/api/lob/createLetter:
summary: Create a letter to a representative
post:
description: ''
summary: ''
operationId: ''
externalDocs:
url: https://docs.lob.com/#operation/letter_create
requestBody:
$ref: '#/components/requestBodies/CreateLetter'
responses:
'200':
description: Letter sent successfully
content:
application/json:
schema:
type: object
properties:
expected_delivery_date:
type: string
'500':
description: >-
Something went wrong with payment, message will be "Payment is still
pending or has failed" or "Something failed! A refund of
${refund.amount} ${refund.currency} has been issued"
content:
application/json:
schema:
type: object
properties:
msg:
type: string
default: Payment is still pending or has failed
/api/lob/createAddress:
description: ''
post:
description: ''
summary: ''
operationId: ''
requestBody:
$ref: '#/components/requestBodies/CreateAddress'
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
address_id:
type: string
description: id from the addressResponse recieved from Lob
'400':
description: Address is not deliverable
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/lob/addressVerification:
description: ''
post:
description: ''
summary: ''
operationId: ''
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
responses:
'200': null
'400': null
'500': null
/api/lob/templates/{templateId}:
get:
summary: Returns a Lob letter template ID
operationId: ''
description: >-
Returns a Lob letter template ID from the the <a
href="https://docs.lob.com/#operation/template_retrieve">Lob's template
API</a>
externalDocs:
url: https://docs.lob.com/#operation/template_retrieve
parameters:
- name: templateId
description: ID of the Lob letter template
in: path
required: true
schema:
type: integer
responses: null
components:
schemas:
Campaign:
type: object
required:
- organization
- name
- cause
- type
- page_url
properties:
id:
type: integer
organization:
type: string
minLength: 1
maxLength: 255
name:
type: string
minLength: 1
maxLength: 255
cause:
type: string
enum:
- Civic Rights
- Education
- Climate Justice
type:
type: string
enum:
- Starter
- Accelerator
- Grant
page_url:
type: string
minLength: 1
logo_url:
type: string
minLength: 1
letters_goal:
type: integer
minimum: 0
donation_goal:
type: integer
minimum: 0
Error:
type: object
properties:
error:
type: string
LetterVersion:
type: object
required:
- campaign_id
- template_id
- office_division
properties:
id:
type: integer
campaign_id:
type: integer
minimum: 1
template_id:
type: string
minLength: 1
maxLength: 255
office_division:
type: string
default: Federal
enum:
- Federal
- State
- County
- Municipality
state:
type: string
nullable: true
minLength: 2
maxLength: 2
county:
type: string
nullable: true
minLength: 1
municipality:
type: string
nullable: true
minLength: 1
SocialMediaPage:
type: object
properties:
type:
type: string
url:
type: string
icon:
type: string
color:
type: string
Representative:
type: object
properties:
name:
type: string
title:
type: string
address_line1:
type: string
address_line2:
type: string
address_city:
type: string
address_state:
type: string
address_zip:
type: string
address_country:
type: string
default: US
email:
type: string
twitter:
type: string
facebook:
type: string
contactPage:
type: string
photoUrl:
type: string
socialMediaPages:
type: array
items:
$ref: '#/components/schemas/SocialMediaPage'
photoCroppingCSS:
type: string
InvalidZipError:
type: object
properties:
error:
type: string
default: >-
Invalid zip code format, valid examples are 84054-6013 or 84054. The
zip code used was {zip code}
Address:
type: object
properties:
name:
type: string
email:
type: string
company:
type: string
description:
type: string
line1:
type: string
line2:
type: string
city:
type: string
state:
type: string
zip:
type: string
requestBodies:
CreateLetter:
description: >-
A JSON object containing information to create a letter to a
representative via the <a
href="https://docs.lob.com/#operation/letter_create">Lob letter creation
API</a>
required: true
content:
application/json:
schema:
type: object
properties:
description:
type: string
maxLength: 255
to:
$ref: '#/components/schemas/Address'
from:
type: object
properties:
address_id:
type: integer
description: The address_id returned from /api/createAddress
template_id:
type: string
default: The Lob template_id created for this letter
CreateAddress:
description: Create an address to verify with lob
content:
application/json:
schema:
$ref: '#/components/schemas/Address'