-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yml
378 lines (364 loc) · 8.51 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
openapi: 3.0.0
info:
title: The Give Hub API
description: API for The Give Hub crowdfunding platform connecting donors with remote projects
version: 1.0.0
contact:
name: The Give Hub Support
email: [email protected]
url: https://thegivehub.com
servers:
- url: https://api.thegivehub.com/v1
description: Production server
- url: https://staging-api.thegivehub.com/v1
description: Staging server
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
schemas:
Campaign:
type: object
required:
- title
- description
- targetAmount
- category
properties:
id:
type: string
format: uuid
title:
type: string
maxLength: 100
description:
type: string
targetAmount:
type: number
format: decimal
currentAmount:
type: number
format: decimal
category:
type: string
enum: [education, water, health, agriculture, infrastructure]
status:
type: string
enum: [draft, active, funded, completed, cancelled]
location:
type: object
properties:
country:
type: string
region:
type: string
coordinates:
type: object
properties:
latitude:
type: number
longitude:
type: number
milestones:
type: array
items:
$ref: '#/components/schemas/Milestone'
creator:
$ref: '#/components/schemas/User'
created:
type: string
format: date-time
updated:
type: string
format: date-time
Milestone:
type: object
required:
- description
- amount
properties:
id:
type: string
format: uuid
description:
type: string
amount:
type: number
format: decimal
status:
type: string
enum: [pending, verified, completed, failed]
verificationDocs:
type: array
items:
type: string
format: uri
verifiedBy:
type: string
format: uuid
completedAt:
type: string
format: date-time
User:
type: object
required:
- email
- username
properties:
id:
type: string
format: uuid
email:
type: string
format: email
username:
type: string
role:
type: string
enum: [donor, creator, nomad, admin]
profile:
type: object
properties:
firstName:
type: string
lastName:
type: string
avatar:
type: string
format: uri
wallet:
type: object
properties:
stellarAddress:
type: string
totalDonated:
type: number
format: decimal
Donation:
type: object
required:
- campaignId
- amount
properties:
id:
type: string
format: uuid
campaignId:
type: string
format: uuid
userId:
type: string
format: uuid
amount:
type: object
properties:
value:
type: number
format: decimal
currency:
type: string
transaction:
type: object
properties:
txHash:
type: string
status:
type: string
enum: [pending, completed, failed]
type:
type: string
enum: [one-time, recurring]
created:
type: string
format: date-time
ImpactMetric:
type: object
required:
- name
- value
- unit
properties:
id:
type: string
format: uuid
name:
type: string
value:
type: number
unit:
type: string
verificationMethod:
type: string
verifiedBy:
type: string
format: uuid
timestamp:
type: string
format: date-time
paths:
/campaigns:
get:
summary: List campaigns
parameters:
- name: category
in: query
schema:
type: string
- name: status
in: query
schema:
type: string
- name: page
in: query
schema:
type: integer
- name: limit
in: query
schema:
type: integer
responses:
'200':
description: List of campaigns
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Campaign'
post:
summary: Create a new campaign
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Campaign'
responses:
'201':
description: Campaign created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Campaign'
/campaigns/{campaignId}:
get:
summary: Get campaign details
parameters:
- name: campaignId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Campaign details
content:
application/json:
schema:
$ref: '#/components/schemas/Campaign'
/campaigns/{campaignId}/milestones:
post:
summary: Add milestone to campaign
security:
- BearerAuth: []
parameters:
- name: campaignId
in: path
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Milestone'
responses:
'201':
description: Milestone added successfully
/donations:
post:
summary: Create a donation
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Donation'
responses:
'201':
description: Donation processed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Donation'
/impact/metrics/{campaignId}:
post:
summary: Add impact metrics
security:
- BearerAuth: []
parameters:
- name: campaignId
in: path
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ImpactMetric'
responses:
'201':
description: Impact metrics added successfully
/auth/login:
post:
summary: Authenticate user
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- password
properties:
email:
type: string
format: email
password:
type: string
format: password
responses:
'200':
description: Authentication successful
content:
application/json:
schema:
type: object
properties:
accessToken:
type: string
refreshToken:
type: string
user:
$ref: '#/components/schemas/User'
security:
- ApiKeyAuth: []