@cheqd/studio 3.0.0-develop.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +1 -7
  4. package/dist/app.js.map +1 -1
  5. package/dist/controllers/admin/api-key.d.ts +2 -2
  6. package/dist/controllers/admin/api-key.js +2 -2
  7. package/dist/controllers/admin/prices.d.ts +1 -1
  8. package/dist/controllers/admin/prices.js +1 -1
  9. package/dist/controllers/admin/product.d.ts +0 -4
  10. package/dist/controllers/admin/product.d.ts.map +1 -1
  11. package/dist/controllers/admin/product.js +0 -4
  12. package/dist/controllers/admin/product.js.map +1 -1
  13. package/dist/controllers/admin/subscriptions.d.ts +21 -21
  14. package/dist/controllers/admin/subscriptions.js +21 -21
  15. package/dist/controllers/api/account.d.ts +4 -4
  16. package/dist/controllers/api/account.js +4 -4
  17. package/dist/middleware/auth/auth-gaurd.d.ts.map +1 -1
  18. package/dist/middleware/auth/auth-gaurd.js +1 -1
  19. package/dist/middleware/auth/auth-gaurd.js.map +1 -1
  20. package/dist/middleware/auth/user-info-fetcher/swagger-ui.js +1 -1
  21. package/dist/middleware/auth/user-info-fetcher/swagger-ui.js.map +1 -1
  22. package/dist/static/swagger-admin.json +873 -859
  23. package/dist/static/swagger-api.json +3044 -3011
  24. package/dist/types/swagger-admin-types.d.ts +10 -15
  25. package/dist/types/swagger-admin-types.d.ts.map +1 -1
  26. package/dist/types/swagger-admin-types.js +10 -15
  27. package/dist/types/swagger-admin-types.js.map +1 -1
  28. package/dist/types/swagger-api-types.d.ts +21 -8
  29. package/dist/types/swagger-api-types.d.ts.map +1 -1
  30. package/dist/types/swagger-api-types.js +21 -8
  31. package/dist/types/swagger-api-types.js.map +1 -1
  32. package/example.env +6 -0
  33. package/package.json +1 -1
@@ -28,380 +28,632 @@
28
28
  "name": "API Key"
29
29
  }
30
30
  ],
31
- "paths": {
32
- "/admin/api-key/create": {
33
- "post": {
34
- "summary": "Create a new API key",
35
- "description": "Create a new API key",
36
- "tags": [
37
- "API Key"
38
- ],
39
- "requestBody": {
40
- "content": {
41
- "application/json": {
42
- "schema": {
43
- "$ref": "#/components/schemas/APIKeyCreateRequestBody"
44
- }
31
+ "components": {
32
+ "securitySchemes": {
33
+ "ApiKeyAuth": {
34
+ "type": "apiKey",
35
+ "name": "x-api-key",
36
+ "in": "header"
37
+ }
38
+ },
39
+ "schemas": {
40
+ "PriceListResponseBody": {
41
+ "description": "A list of active prcies from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/list)",
42
+ "type": "object",
43
+ "properties": {
44
+ "prices": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "object",
48
+ "description": "A price object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/object)"
45
49
  }
46
50
  }
47
- },
48
- "responses": {
49
- "201": {
50
- "description": "A new API key has been created",
51
- "content": {
52
- "application/json": {
53
- "schema": {
54
- "$ref": "#/components/schemas/APIKeyCreateResponseBody"
55
- }
56
- }
51
+ }
52
+ },
53
+ "ProductListResponseBody": {
54
+ "type": "object",
55
+ "properties": {
56
+ "products": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "object",
60
+ "description": "A product object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/object)"
57
61
  }
58
- },
59
- "400": {
60
- "$ref": "#/components/schemas/APIKeyCreateUnsuccessfulResponseBody"
61
- },
62
- "401": {
63
- "$ref": "#/components/schemas/UnauthorizedError"
64
- },
65
- "500": {
66
- "$ref": "#/components/schemas/InternalError"
67
62
  }
68
63
  }
69
- }
70
- },
71
- "/admin/api-key/update": {
72
- "post": {
73
- "summary": "Update an existing API key",
74
- "description": "Update an existing API key",
75
- "tags": [
76
- "API Key"
77
- ],
78
- "requestBody": {
79
- "content": {
80
- "application/json": {
81
- "schema": {
82
- "$ref": "#/components/schemas/APIKeyUpdateRequestBody"
83
- }
84
- }
64
+ },
65
+ "ProductGetResponseBody": {
66
+ "description": "A product with or without prices inside. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/retrieve)",
67
+ "type": "object"
68
+ },
69
+ "InvalidRequest": {
70
+ "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.",
71
+ "type": "object",
72
+ "properties": {
73
+ "error": {
74
+ "type": "string",
75
+ "example": "InvalidRequest"
85
76
  }
86
- },
87
- "responses": {
88
- "200": {
89
- "description": "The API key has been updated",
90
- "content": {
91
- "application/json": {
92
- "schema": {
93
- "$ref": "#/components/schemas/APIKeyUpdateResponseBody"
94
- }
95
- }
96
- }
77
+ }
78
+ },
79
+ "InternalError": {
80
+ "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.",
81
+ "type": "object",
82
+ "properties": {
83
+ "error": {
84
+ "type": "string",
85
+ "example": "Internal Error"
86
+ }
87
+ }
88
+ },
89
+ "UnauthorizedError": {
90
+ "description": "Access token is missing or invalid",
91
+ "type": "object",
92
+ "properties": {
93
+ "error": {
94
+ "type": "string",
95
+ "example": "Unauthorized Error"
96
+ }
97
+ }
98
+ },
99
+ "SubscriptionCreateRequestBody": {
100
+ "description": "The request body for creating a subscription",
101
+ "type": "object",
102
+ "properties": {
103
+ "price": {
104
+ "type": "string",
105
+ "description": "The price id",
106
+ "example": "price_1234567890"
97
107
  },
98
- "400": {
99
- "$ref": "#/components/schemas/APIKeyUpdateUnsuccessfulResponseBody"
108
+ "successURL": {
109
+ "type": "string",
110
+ "description": "The URL to redirect to after the customer sucessfully completes the checkout",
111
+ "example": "https://example.com/success"
100
112
  },
101
- "401": {
102
- "$ref": "#/components/schemas/UnauthorizedError"
113
+ "cancelURL": {
114
+ "type": "string",
115
+ "description": "The URL to redirect to after the customer cancels the checkout",
116
+ "example": "https://example.com/cancel"
103
117
  },
104
- "500": {
105
- "$ref": "#/components/schemas/InternalError"
118
+ "quantity": {
119
+ "type": "number",
120
+ "description": "The quantity of the product",
121
+ "example": 1
122
+ },
123
+ "trialPeriodDays": {
124
+ "type": "number",
125
+ "description": "The number of days the customer has to pay for the product",
126
+ "example": 7
127
+ },
128
+ "idempotencyKey": {
129
+ "type": "string",
130
+ "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.",
131
+ "example": "abcdefghijklmnopqrstuvwxyz"
106
132
  }
107
133
  }
108
- }
109
- },
110
- "/admin/api-key/revoke": {
111
- "delete": {
112
- "summary": "Revoke an existing API key",
113
- "description": "Revoke an existing API key",
114
- "tags": [
115
- "API Key"
116
- ],
117
- "requestBody": {
118
- "content": {
119
- "application/json": {
120
- "schema": {
121
- "$ref": "#/components/schemas/APIKeyRevokeRequestBody"
134
+ },
135
+ "SubscriptionCreateResponseBody": {
136
+ "description": "The response body for creating a subscription",
137
+ "type": "object",
138
+ "properties": {
139
+ "subscription": {
140
+ "type": "object",
141
+ "description": "An object with link to checkout session. For more information see the [Stripe API documentation](https://docs.stripe.com/api/checkout/sessions/object)",
142
+ "properties": {
143
+ "sessionURL": {
144
+ "type": "string",
145
+ "description": "URL which user should follow to manage subscription"
122
146
  }
123
147
  }
124
148
  }
125
- },
126
- "responses": {
127
- "200": {
128
- "description": "The API key has been revoked",
129
- "content": {
130
- "application/json": {
131
- "schema": {
132
- "$ref": "#/components/schemas/APIKeyRevokeResponseBody"
133
- }
134
- }
135
- }
136
- },
137
- "400": {
138
- "$ref": "#/components/schemas/APIKeyRevokeUnsuccessfulResponseBody"
139
- },
140
- "401": {
141
- "$ref": "#/components/schemas/UnauthorizedError"
142
- },
143
- "500": {
144
- "$ref": "#/components/schemas/InternalError"
149
+ }
150
+ },
151
+ "SubscriptionUpdateRequestBody": {
152
+ "description": "The request body for updating a subscription",
153
+ "type": "object",
154
+ "properties": {
155
+ "returnURL": {
156
+ "type": "string",
157
+ "description": "URL which is used to redirect to the page with ability to update the subscription"
145
158
  }
146
159
  }
147
- }
148
- },
149
- "/admin/api-key/list": {
150
- "get": {
151
- "summary": "List all API keys",
152
- "description": "List all API keys",
153
- "tags": [
154
- "API Key"
155
- ],
156
- "responses": {
157
- "200": {
158
- "description": "A list of API keys",
159
- "content": {
160
- "application/json": {
161
- "schema": {
162
- "$ref": "#/components/schemas/APIKeyListResponseBody"
163
- }
160
+ },
161
+ "SubscriptionUpdateResponseBody": {
162
+ "description": "The response body for updating a subscription",
163
+ "type": "object",
164
+ "properties": {
165
+ "subscription": {
166
+ "type": "object",
167
+ "description": "Object with redirect url inside",
168
+ "properties": {
169
+ "sessionURL": {
170
+ "type": "string",
171
+ "description": "URL with session URL rediect to"
164
172
  }
165
173
  }
166
- },
167
- "400": {
168
- "$ref": "#/components/schemas/InvalidRequest"
169
- },
170
- "401": {
171
- "$ref": "#/components/schemas/UnauthorizedError"
172
- },
173
- "404": {
174
- "$ref": "#/components/schemas/NotFoundError"
175
- },
176
- "500": {
177
- "$ref": "#/components/schemas/InternalError"
178
174
  }
179
175
  }
180
- }
181
- },
182
- "/admin/api-key/get": {
183
- "get": {
184
- "summary": "Get an API key",
185
- "description": "Get an API key. If the API key is not provided, the latest not revoked API key it returns.",
186
- "tags": [
187
- "API Key"
188
- ],
189
- "parameters": [
190
- {
191
- "name": "apiKey",
192
- "in": "query",
193
- "required": false,
194
- "schema": {
195
- "type": "string"
176
+ },
177
+ "SubscriptionGetRequestBody": {
178
+ "description": "The request body for getting a subscription",
179
+ "type": "object",
180
+ "properties": {
181
+ "subscriptionId": {
182
+ "type": "string",
183
+ "description": "The subscription id",
184
+ "example": "sub_1234567890"
185
+ }
186
+ }
187
+ },
188
+ "SubscriptionGetResponseBody": {
189
+ "description": "The response body for getting a subscription",
190
+ "type": "object",
191
+ "properties": {
192
+ "subscription": {
193
+ "type": "object",
194
+ "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object)"
195
+ }
196
+ }
197
+ },
198
+ "SubscriptionListRequestBody": {
199
+ "description": "The request body for listing subscriptions",
200
+ "type": "object",
201
+ "properties": {
202
+ "customerId": {
203
+ "type": "string",
204
+ "description": "The Stripe customer id",
205
+ "example": "cus_1234567890"
206
+ }
207
+ }
208
+ },
209
+ "SubscriptionListResponseBody": {
210
+ "description": "The response body for listing subscriptions",
211
+ "type": "object",
212
+ "properties": {
213
+ "subscriptions": {
214
+ "type": "array",
215
+ "items": {
216
+ "type": "object",
217
+ "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]"
196
218
  }
197
219
  }
198
- ],
199
- "responses": {
200
- "200": {
220
+ }
221
+ },
222
+ "SubscriptionCancelRequestBody": {
223
+ "description": "The request body for canceling a subscription",
224
+ "type": "object",
225
+ "properties": {
226
+ "subscriptionId": {
227
+ "type": "string",
228
+ "description": "The subscription id",
229
+ "example": "sub_1234567890"
230
+ }
231
+ }
232
+ },
233
+ "SubscriptionCancelResponseBody": {
234
+ "description": "The response body for canceling a subscription",
235
+ "type": "object",
236
+ "properties": {
237
+ "subscription": {
238
+ "type": "object",
239
+ "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]"
240
+ },
241
+ "idempotencyKey": {
242
+ "type": "string",
243
+ "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.",
244
+ "example": "abcdefghijklmnopqrstuvwxyz"
245
+ }
246
+ }
247
+ },
248
+ "SubscriptionResumeRequestBody": {
249
+ "description": "The request body for resuming a subscription",
250
+ "type": "object",
251
+ "properties": {
252
+ "subscriptionId": {
253
+ "type": "string",
254
+ "description": "The subscription id",
255
+ "example": "sub_1234567890"
256
+ },
257
+ "idempotencyKey": {
258
+ "type": "string",
259
+ "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.",
260
+ "example": "abcdefghijklmnopqrstuvwxyz"
261
+ }
262
+ }
263
+ },
264
+ "SubscriptionResumeResponseBody": {
265
+ "description": "The response body for resuming a subscription",
266
+ "type": "object",
267
+ "properties": {
268
+ "subscription": {
269
+ "type": "object",
270
+ "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]"
271
+ }
272
+ }
273
+ },
274
+ "APIKeyResponse": {
275
+ "description": "The general view for API key in response",
276
+ "type": "object",
277
+ "properties": {
278
+ "apiKey": {
279
+ "type": "string",
201
280
  "description": "The API key",
202
- "content": {
203
- "application/json": {
204
- "schema": {
205
- "$ref": "#/components/schemas/APIKeyGetResponseBody"
206
- }
207
- }
281
+ "example": "abcdefghijklmnopqrstuvwxyz"
282
+ },
283
+ "createdAt": {
284
+ "type": "string",
285
+ "description": "The creation date of the API key",
286
+ "example": "2000-10-31T01:23:45Z",
287
+ "format": "date-time"
288
+ },
289
+ "name": {
290
+ "type": "string",
291
+ "description": "The name of the API key",
292
+ "example": "My API Key"
293
+ },
294
+ "expiresAt": {
295
+ "type": "string",
296
+ "description": "The expiration date of the API key",
297
+ "example": "2000-10-31T01:23:45Z",
298
+ "format": "date-time"
299
+ },
300
+ "revoked": {
301
+ "type": "boolean",
302
+ "description": "The status of the API key",
303
+ "example": false
304
+ }
305
+ }
306
+ },
307
+ "APIKeyCreateRequestBody": {
308
+ "description": "The request body for creating an API key",
309
+ "type": "object",
310
+ "properties": {
311
+ "expiresAt": {
312
+ "type": "string",
313
+ "description": "The expiration date of the API key",
314
+ "example": "2000-10-31T01:23:45Z",
315
+ "format": "date-time"
316
+ },
317
+ "name": {
318
+ "type": "string",
319
+ "description": "The name of the API key",
320
+ "example": "My API Key"
321
+ }
322
+ },
323
+ "required": [
324
+ "name"
325
+ ]
326
+ },
327
+ "APIKeyCreateResponseBody": {
328
+ "allOf": [
329
+ {
330
+ "$ref": "#/components/schemas/APIKeyResponse"
331
+ },
332
+ {
333
+ "description": "The response body for creating an API key"
334
+ }
335
+ ]
336
+ },
337
+ "APIKeyCreateUnsuccessfulResponseBody": {
338
+ "description": "The response body for an unsuccessful API key creation",
339
+ "type": "object",
340
+ "properties": {
341
+ "error": {
342
+ "type": "string",
343
+ "example": "API key creation unsuccessful"
344
+ }
345
+ }
346
+ },
347
+ "APIKeyUpdateRequestBody": {
348
+ "description": "The request body for updating an API key",
349
+ "type": "object",
350
+ "properties": {
351
+ "apiKey": {
352
+ "type": "string",
353
+ "description": "The API key",
354
+ "example": "abcdefghijklmnopqrstuvwxyz"
355
+ },
356
+ "name": {
357
+ "type": "string",
358
+ "description": "The name of the API key",
359
+ "example": "My API Key"
360
+ },
361
+ "expiresAt": {
362
+ "type": "string",
363
+ "description": "The expiration date of the API key",
364
+ "example": "2000-10-31T01:23:45Z",
365
+ "format": "date-time"
366
+ },
367
+ "revoked": {
368
+ "type": "boolean",
369
+ "description": "The status of the API key",
370
+ "example": false,
371
+ "default": false
372
+ }
373
+ },
374
+ "required": [
375
+ "apiKey"
376
+ ]
377
+ },
378
+ "APIKeyUpdateResponseBody": {
379
+ "allOf": [
380
+ {
381
+ "$ref": "#/components/schemas/APIKeyResponse"
382
+ },
383
+ {
384
+ "description": "The response body for an successful API key update"
385
+ }
386
+ ]
387
+ },
388
+ "APIKeyUpdateUnsuccessfulResponseBody": {
389
+ "description": "The response body for an unsuccessful API key update",
390
+ "type": "object",
391
+ "properties": {
392
+ "error": {
393
+ "type": "string",
394
+ "example": "API key update unsuccessful"
395
+ }
396
+ }
397
+ },
398
+ "APIKeyRevokeRequestBody": {
399
+ "description": "The request body for revoking an API key",
400
+ "type": "object",
401
+ "properties": {
402
+ "apiKey": {
403
+ "type": "string",
404
+ "description": "The API key",
405
+ "example": "abcdefghijklmnopqrstuvwxyz"
406
+ }
407
+ },
408
+ "required": [
409
+ "apiKey"
410
+ ]
411
+ },
412
+ "APIKeyRevokeResponseBody": {
413
+ "description": "The response body for revoking an API key",
414
+ "type": "object",
415
+ "properties": {
416
+ "apiKey": {
417
+ "type": "string",
418
+ "description": "The API key",
419
+ "example": "abcdefghijklmnopqrstuvwxyz"
420
+ },
421
+ "revoked": {
422
+ "type": "boolean",
423
+ "description": "The status of the API key",
424
+ "example": true
425
+ }
426
+ },
427
+ "required": [
428
+ "apiKey"
429
+ ]
430
+ },
431
+ "APIKeyRevokeUnsuccessfulResponseBody": {
432
+ "description": "The response body for an unsuccessful API key revocation",
433
+ "type": "object",
434
+ "properties": {
435
+ "error": {
436
+ "type": "string",
437
+ "example": "API key revocation unsuccessful"
438
+ }
439
+ }
440
+ },
441
+ "APIKeyListResponseBody": {
442
+ "description": "The response body for listing API keys",
443
+ "type": "object",
444
+ "properties": {
445
+ "apiKeys": {
446
+ "type": "array",
447
+ "items": {
448
+ "$ref": "#/components/schemas/APIKeyResponse"
208
449
  }
450
+ }
451
+ }
452
+ },
453
+ "APIKeyGetRequestBody": {
454
+ "description": "The request body for getting an API key",
455
+ "type": "object",
456
+ "properties": {
457
+ "apiKey": {
458
+ "type": "string",
459
+ "description": "The API key",
460
+ "example": "abcdefghijklmnopqrstuvwxyz"
461
+ }
462
+ },
463
+ "required": [
464
+ "apiKey"
465
+ ]
466
+ },
467
+ "APIKeyGetResponseBody": {
468
+ "allOf": [
469
+ {
470
+ "$ref": "#/components/schemas/APIKeyResponse"
209
471
  },
210
- "400": {
211
- "$ref": "#/components/schemas/InvalidRequest"
472
+ {
473
+ "description": "The response body for getting an API key"
474
+ }
475
+ ]
476
+ },
477
+ "OrganisationResponseBody": {
478
+ "description": "The response body for an organisation",
479
+ "type": "object",
480
+ "properties": {
481
+ "name": {
482
+ "type": "string",
483
+ "description": "The name of the organisation",
484
+ "example": "Cheqd"
212
485
  },
213
- "401": {
214
- "$ref": "#/components/schemas/UnauthorizedError"
486
+ "email": {
487
+ "type": "string",
488
+ "description": "The email of the organisation",
489
+ "example": "cheqd@example.com",
490
+ "format": "email",
491
+ "nullable": true,
492
+ "default": null
215
493
  },
216
- "404": {
217
- "$ref": "#/components/schemas/NotFoundError"
494
+ "description": {
495
+ "type": "string",
496
+ "description": "The description of the organisation",
497
+ "example": "Cheqd organisation",
498
+ "nullable": true,
499
+ "default": null
218
500
  },
219
- "500": {
220
- "$ref": "#/components/schemas/InternalError"
501
+ "cosmosAddress": {
502
+ "type": "string",
503
+ "description": "The cosmos address of the organisation",
504
+ "example": "cheqd1hwzvac94udsk8x4mf6htt544lev4jltkwgxp7u"
505
+ }
506
+ }
507
+ },
508
+ "NotFoundError": {
509
+ "description": "The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.",
510
+ "type": "object",
511
+ "properties": {
512
+ "error": {
513
+ "type": "string",
514
+ "example": "Not Found Error"
221
515
  }
222
516
  }
223
517
  }
224
- },
225
- "/admin/organisation/update": {
518
+ }
519
+ },
520
+ "security": [
521
+ {
522
+ "ApiKeyAuth": []
523
+ }
524
+ ],
525
+ "paths": {
526
+ "/admin/api-key/create": {
226
527
  "post": {
227
- "summary": "Update an organisation",
228
- "description": "Update an organisation",
229
- "tags": [
230
- "Organisation"
231
- ],
232
- "requestBody": {
233
- "required": true,
234
- "content": {
235
- "application/json": {
236
- "schema": {
237
- "type": "object",
238
- "properties": {
239
- "name": {
240
- "type": "string",
241
- "example": "Cheqd"
242
- },
243
- "email": {
244
- "type": "string",
245
- "example": "cheqd@example.com",
246
- "format": "email"
247
- },
248
- "description": {
249
- "type": "string",
250
- "example": "Cheqd organisation"
251
- }
252
- }
528
+ "summary": "Create a new API key",
529
+ "description": "Create a new API key",
530
+ "tags": [
531
+ "API Key"
532
+ ],
533
+ "requestBody": {
534
+ "content": {
535
+ "application/json": {
536
+ "schema": {
537
+ "$ref": "#/components/schemas/APIKeyCreateRequestBody"
253
538
  }
254
539
  }
255
540
  }
256
541
  },
257
542
  "responses": {
258
- "200": {
259
- "description": "A successful response",
543
+ "201": {
544
+ "description": "A new API key has been created",
260
545
  "content": {
261
546
  "application/json": {
262
547
  "schema": {
263
- "$ref": "#/components/schemas/OrganisationResponseBody"
548
+ "$ref": "#/components/schemas/APIKeyResponse"
264
549
  }
265
550
  }
266
551
  }
267
552
  },
268
553
  "400": {
269
- "$ref": "#/components/schemas/InvalidRequest"
554
+ "$ref": "#/components/schemas/APIKeyCreateUnsuccessfulResponseBody"
270
555
  },
271
556
  "401": {
272
557
  "$ref": "#/components/schemas/UnauthorizedError"
273
558
  },
274
- "404": {
275
- "$ref": "#/components/schemas/NotFoundError"
276
- },
277
559
  "500": {
278
560
  "$ref": "#/components/schemas/InternalError"
279
561
  }
280
562
  }
281
563
  }
282
564
  },
283
- "/admin/organisation/get": {
284
- "get": {
285
- "summary": "Get an organisation",
286
- "description": "Get an organisation",
565
+ "/admin/api-key/update": {
566
+ "post": {
567
+ "summary": "Update an existing API key",
568
+ "description": "Update an existing API key",
287
569
  "tags": [
288
- "Organisation"
570
+ "API Key"
289
571
  ],
572
+ "requestBody": {
573
+ "content": {
574
+ "application/json": {
575
+ "schema": {
576
+ "$ref": "#/components/schemas/APIKeyUpdateRequestBody"
577
+ }
578
+ }
579
+ }
580
+ },
290
581
  "responses": {
291
582
  "200": {
292
- "description": "A successful response",
583
+ "description": "The API key has been updated",
293
584
  "content": {
294
585
  "application/json": {
295
586
  "schema": {
296
- "$ref": "#/components/schemas/OrganisationResponseBody"
587
+ "$ref": "#/components/schemas/APIKeyUpdateResponseBody"
297
588
  }
298
589
  }
299
590
  }
300
591
  },
301
592
  "400": {
302
- "$ref": "#/components/schemas/InvalidRequest"
593
+ "$ref": "#/components/schemas/APIKeyUpdateUnsuccessfulResponseBody"
303
594
  },
304
595
  "401": {
305
596
  "$ref": "#/components/schemas/UnauthorizedError"
306
597
  },
307
- "404": {
308
- "$ref": "#/components/schemas/NotFoundError"
309
- },
310
598
  "500": {
311
599
  "$ref": "#/components/schemas/InternalError"
312
600
  }
313
601
  }
314
602
  }
315
603
  },
316
- "/admin/price/list": {
317
- "get": {
318
- "summary": "Get a list of prices",
319
- "description": "Get a list of prices",
604
+ "/admin/api-key/revoke": {
605
+ "post": {
606
+ "summary": "Revoke an existing API key",
607
+ "description": "Revoke an existing API key",
320
608
  "tags": [
321
- "Price"
609
+ "API Key"
322
610
  ],
323
- "parameters": [
324
- {
325
- "in": "query",
326
- "name": "productId",
327
- "schema": {
328
- "type": "string",
329
- "description": "The product id. If passed - returns filtered by this product list of prices.",
330
- "required": false
611
+ "requestBody": {
612
+ "content": {
613
+ "application/json": {
614
+ "schema": {
615
+ "$ref": "#/components/schemas/APIKeyRevokeRequestBody"
616
+ }
331
617
  }
332
618
  }
333
- ],
619
+ },
334
620
  "responses": {
335
621
  "200": {
336
- "description": "A list of prices",
622
+ "description": "The API key has been revoked",
337
623
  "content": {
338
624
  "application/json": {
339
625
  "schema": {
340
- "$ref": "#/components/schemas/PriceListResponseBody"
626
+ "$ref": "#/components/schemas/APIKeyRevokeResponseBody"
341
627
  }
342
628
  }
343
629
  }
344
630
  },
345
631
  "400": {
346
- "$ref": "#/components/schemas/InvalidRequest"
632
+ "$ref": "#/components/schemas/APIKeyRevokeUnsuccessfulResponseBody"
347
633
  },
348
634
  "401": {
349
635
  "$ref": "#/components/schemas/UnauthorizedError"
350
636
  },
351
- "404": {
352
- "$ref": "#/components/schemas/NotFoundError"
353
- },
354
637
  "500": {
355
638
  "$ref": "#/components/schemas/InternalError"
356
639
  }
357
640
  }
358
641
  }
359
642
  },
360
- "/admin/product/list": {
643
+ "/admin/api-key/list": {
361
644
  "get": {
362
- "summary": "Get a list of products",
363
- "description": "Get a list of products which are on a Stripe side",
645
+ "summary": "List all API keys",
646
+ "description": "List all API keys",
364
647
  "tags": [
365
- "Product"
366
- ],
367
- "parameters": [
368
- {
369
- "in": "query",
370
- "name": "prices",
371
- "schema": {
372
- "type": "boolean",
373
- "description": "If setup to true - returns the list of products with prices inside. Default - true",
374
- "required": false
375
- }
376
- },
377
- {
378
- "in": "query",
379
- "name": "limit",
380
- "schema": {
381
- "type": "integer",
382
- "minimum": 1,
383
- "maximum": 100,
384
- "description": "Restrict the response to only include items from 1 to 100. Default - 10",
385
- "required": false
386
- }
387
- },
388
- {
389
- "in": "query",
390
- "name": "cursor",
391
- "schema": {
392
- "type": "string",
393
- "description": "Cursor for pagination, this only goes forward, i.e., Stripe's equivalent of 'starting_after'",
394
- "required": false
395
- }
396
- }
648
+ "API Key"
397
649
  ],
398
650
  "responses": {
399
651
  "200": {
400
- "description": "A list of products",
652
+ "description": "A list of API keys",
401
653
  "content": {
402
654
  "application/json": {
403
655
  "schema": {
404
- "$ref": "#/components/schemas/ProductListResponseBody"
656
+ "$ref": "#/components/schemas/APIKeyListResponseBody"
405
657
  }
406
658
  }
407
659
  }
@@ -421,40 +673,30 @@
421
673
  }
422
674
  }
423
675
  },
424
- "/admin/product/get/{productId}": {
676
+ "/admin/api-key/get": {
425
677
  "get": {
426
- "summary": "Get a product",
427
- "description": "Get a product by id",
678
+ "summary": "Get an API key",
679
+ "description": "Get an API key. If the API key is not provided, the latest not revoked API key it returns.",
428
680
  "tags": [
429
- "Product"
681
+ "API Key"
430
682
  ],
431
683
  "parameters": [
432
684
  {
433
- "in": "path",
434
- "name": "productId",
435
- "schema": {
436
- "type": "string",
437
- "description": "The product id which identifies the product in Stripe"
438
- },
439
- "required": true
440
- },
441
- {
685
+ "name": "apiKey",
442
686
  "in": "query",
443
- "name": "prices",
687
+ "required": false,
444
688
  "schema": {
445
- "type": "boolean",
446
- "description": "If setup to true - returns the product with prices inside. Default - true",
447
- "required": false
689
+ "type": "string"
448
690
  }
449
691
  }
450
692
  ],
451
693
  "responses": {
452
694
  "200": {
453
- "description": "A product",
695
+ "description": "The API key",
454
696
  "content": {
455
697
  "application/json": {
456
698
  "schema": {
457
- "$ref": "#/components/schemas/ProductGetResponseBody"
699
+ "$ref": "#/components/schemas/APIKeyGetResponseBody"
458
700
  }
459
701
  }
460
702
  }
@@ -474,108 +716,45 @@
474
716
  }
475
717
  }
476
718
  },
477
- "/admin/subscription/create": {
719
+ "/admin/organisation/update": {
478
720
  "post": {
479
- "summary": "Create a subscription",
480
- "description": "Creates a new subscription for an existing customer",
721
+ "summary": "Update an organisation",
722
+ "description": "Update an organisation",
481
723
  "tags": [
482
- "Subscription"
724
+ "Organisation"
483
725
  ],
484
726
  "requestBody": {
727
+ "required": true,
485
728
  "content": {
486
729
  "application/json": {
487
730
  "schema": {
488
- "$ref": "#/components/schemas/SubscriptionCreateRequestBody"
489
- }
490
- }
491
- }
492
- },
493
- "responses": {
494
- "201": {
495
- "description": "The request was successful.",
496
- "content": {
497
- "application/json": {
498
- "schema": {
499
- "$ref": "#/components/schemas/SubscriptionCreateResponseBody"
731
+ "type": "object",
732
+ "properties": {
733
+ "name": {
734
+ "type": "string",
735
+ "example": "Cheqd"
736
+ },
737
+ "email": {
738
+ "type": "string",
739
+ "example": "cheqd@example.com",
740
+ "format": "email"
741
+ },
742
+ "description": {
743
+ "type": "string",
744
+ "example": "Cheqd organisation"
745
+ }
500
746
  }
501
747
  }
502
748
  }
503
- },
504
- "400": {
505
- "$ref": "#/components/schemas/InvalidRequest"
506
- },
507
- "401": {
508
- "$ref": "#/components/schemas/UnauthorizedError"
509
- },
510
- "500": {
511
- "$ref": "#/components/schemas/InternalError"
512
- }
513
- }
514
- }
515
- },
516
- "/admin/subscription/update": {
517
- "post": {
518
- "summary": "Update a subscription",
519
- "description": "Updates an existing subscription",
520
- "tags": [
521
- "Subscription"
522
- ],
523
- "requestBody": {
524
- "content": {
525
- "application/json": {
526
- "schema": {
527
- "$ref": "#/components/schemas/SubscriptionUpdateRequestBody"
528
- }
529
- }
530
749
  }
531
750
  },
532
751
  "responses": {
533
752
  "200": {
534
- "description": "The request was successful.",
535
- "content": {
536
- "application/json": {
537
- "schema": {
538
- "$ref": "#/components/schemas/SubscriptionUpdateResponseBody"
539
- }
540
- }
541
- }
542
- },
543
- "400": {
544
- "$ref": "#/components/schemas/InvalidRequest"
545
- },
546
- "401": {
547
- "$ref": "#/components/schemas/UnauthorizedError"
548
- },
549
- "500": {
550
- "$ref": "#/components/schemas/InternalError"
551
- }
552
- }
553
- }
554
- },
555
- "/admin/subscription/list": {
556
- "get": {
557
- "summary": "Get a list of subscriptions",
558
- "description": "Get a list of subscriptions",
559
- "tags": [
560
- "Subscription"
561
- ],
562
- "parameters": [
563
- {
564
- "in": "query",
565
- "name": "paymentProviderId",
566
- "schema": {
567
- "type": "string",
568
- "description": "The customer id. If passed - returns filtered by this customer list of subscriptions."
569
- }
570
- }
571
- ],
572
- "responses": {
573
- "200": {
574
- "description": "A list of subscriptions",
753
+ "description": "A successful response",
575
754
  "content": {
576
755
  "application/json": {
577
756
  "schema": {
578
- "$ref": "#/components/schemas/SubscriptionListResponseBody"
757
+ "$ref": "#/components/schemas/OrganisationResponseBody"
579
758
  }
580
759
  }
581
760
  }
@@ -595,20 +774,20 @@
595
774
  }
596
775
  }
597
776
  },
598
- "/admin/subscription/get": {
599
- "get": {
600
- "summary": "Get a subscription",
601
- "description": "Get a subscription",
777
+ "/admin/organisation/get": {
778
+ "get": {
779
+ "summary": "Get an organisation",
780
+ "description": "Get an organisation",
602
781
  "tags": [
603
- "Subscription"
782
+ "Organisation"
604
783
  ],
605
784
  "responses": {
606
785
  "200": {
607
- "description": "The request was successful.",
786
+ "description": "A successful response",
608
787
  "content": {
609
788
  "application/json": {
610
789
  "schema": {
611
- "$ref": "#/components/schemas/SubscriptionGetResponseBody"
790
+ "$ref": "#/components/schemas/OrganisationResponseBody"
612
791
  }
613
792
  }
614
793
  }
@@ -628,29 +807,30 @@
628
807
  }
629
808
  }
630
809
  },
631
- "/admin/subscription/cancel": {
632
- "post": {
633
- "summary": "Cancel a subscription",
634
- "description": "Cancels an existing subscription",
810
+ "/admin/price/list": {
811
+ "get": {
812
+ "summary": "Get a list of prices",
813
+ "description": "Get a list of prices",
635
814
  "tags": [
636
- "Subscription"
815
+ "Price"
637
816
  ],
638
- "requestBody": {
639
- "content": {
640
- "application/json": {
641
- "schema": {
642
- "$ref": "#/components/schemas/SubscriptionCancelRequestBody"
643
- }
817
+ "parameters": [
818
+ {
819
+ "in": "query",
820
+ "name": "productId",
821
+ "schema": {
822
+ "type": "string",
823
+ "description": "The product id. If passed - returns filtered by this product list of prices."
644
824
  }
645
825
  }
646
- },
826
+ ],
647
827
  "responses": {
648
828
  "200": {
649
- "description": "The request was successful.",
829
+ "description": "A list of prices",
650
830
  "content": {
651
831
  "application/json": {
652
832
  "schema": {
653
- "$ref": "#/components/schemas/SubscriptionCancelResponseBody"
833
+ "$ref": "#/components/schemas/PriceListResponseBody"
654
834
  }
655
835
  }
656
836
  }
@@ -670,519 +850,353 @@
670
850
  }
671
851
  }
672
852
  },
673
- "/admin/subscription/resume": {},
674
- "post": {
675
- "summary": "Resume a subscription",
676
- "description": "Resumes an existing subscription",
677
- "tags": [
678
- "Subscription"
679
- ],
680
- "requestBody": {
681
- "content": {
682
- "application/json": {
853
+ "/admin/product/list": {
854
+ "get": {
855
+ "summary": "Get a list of products",
856
+ "description": "Get a list of products which are on a Stripe side",
857
+ "tags": [
858
+ "Product"
859
+ ],
860
+ "parameters": [
861
+ {
862
+ "in": "query",
863
+ "name": "prices",
683
864
  "schema": {
684
- "$ref": "#/components/schemas/SubscriptionResumeRequestBody"
685
- }
686
- }
687
- }
688
- },
689
- "responses": {
690
- "200": {
691
- "description": "The request was successful.",
692
- "content": {
693
- "application/json": {
694
- "schema": {
695
- "$ref": "#/components/schemas/SubscriptionResumeResponseBody"
696
- }
697
- }
698
- }
699
- },
700
- "400": {
701
- "$ref": "#/components/schemas/InvalidRequest"
702
- },
703
- "401": {
704
- "$ref": "#/components/schemas/UnauthorizedError"
705
- },
706
- "404": {
707
- "$ref": "#/components/schemas/NotFoundError"
708
- },
709
- "500": {
710
- "$ref": "#/components/schemas/InternalError"
711
- }
712
- }
713
- }
714
- },
715
- "components": {
716
- "schemas": {
717
- "PriceListResponseBody": {
718
- "description": "A list of active prcies from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/list)",
719
- "type": "object",
720
- "properties": {
721
- "prices": {
722
- "type": "array",
723
- "items": {
724
- "type": "object",
725
- "description": "A price object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/object)"
726
- }
727
- }
728
- }
729
- },
730
- "ProductListResponseBody": {
731
- "type": "object",
732
- "properties": {
733
- "products": {
734
- "type": "array",
735
- "items": {
736
- "type": "object",
737
- "description": "A product object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/object)"
865
+ "type": "boolean",
866
+ "description": "If setup to true - returns the list of products with prices inside. Default - true"
738
867
  }
739
- }
740
- }
741
- },
742
- "ProductGetResponseBody": {
743
- "description": "A product with or without prices inside. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/retrieve)",
744
- "type": "object"
745
- },
746
- "InvalidRequest": {
747
- "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.",
748
- "type": "object",
749
- "properties": {
750
- "error": {
751
- "type": "string",
752
- "example": "InvalidRequest"
753
- }
754
- }
755
- },
756
- "InternalError": {
757
- "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.",
758
- "type": "object",
759
- "properties": {
760
- "error": {
761
- "type": "string",
762
- "example": "Internal Error"
763
- }
764
- }
765
- },
766
- "UnauthorizedError": {
767
- "description": "Access token is missing or invalid",
768
- "type": "object",
769
- "properties": {
770
- "error": {
771
- "type": "string",
772
- "example": "Unauthorized Error"
773
- }
774
- }
775
- },
776
- "SubscriptionCreateRequestBody": {
777
- "description": "The request body for creating a subscription",
778
- "type": "object",
779
- "properties": {
780
- "price": {
781
- "type": "string",
782
- "description": "The price id",
783
- "example": "price_1234567890"
784
- },
785
- "successURL": {
786
- "type": "string",
787
- "description": "The URL to redirect to after the customer sucessfully completes the checkout",
788
- "example": "https://example.com/success"
789
- },
790
- "cancelURL": {
791
- "type": "string",
792
- "description": "The URL to redirect to after the customer cancels the checkout",
793
- "example": "https://example.com/cancel"
794
- },
795
- "quantity": {
796
- "type": "number",
797
- "description": "The quantity of the product",
798
- "example": 1
799
- },
800
- "trialPeriodDays": {
801
- "type": "number",
802
- "description": "The number of days the customer has to pay for the product",
803
- "example": 7
804
868
  },
805
- "idempotencyKey": {
806
- "type": "string",
807
- "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.",
808
- "example": "abcdefghijklmnopqrstuvwxyz"
809
- }
810
- }
811
- },
812
- "SubscriptionCreateResponseBody": {
813
- "description": "The response body for creating a subscription",
814
- "type": "object",
815
- "properties": {
816
- "subscription": {
817
- "type": "object",
818
- "description": "An object with link to checkout session. For more information see the [Stripe API documentation](https://docs.stripe.com/api/checkout/sessions/object)",
819
- "properties": {
820
- "sessionURL": {
821
- "type": "string",
822
- "description": "URL which user should follow to manage subscription"
823
- }
869
+ {
870
+ "in": "query",
871
+ "name": "limit",
872
+ "schema": {
873
+ "type": "integer",
874
+ "minimum": 1,
875
+ "maximum": 100,
876
+ "description": "Restrict the response to only include items from 1 to 100. Default - 10"
824
877
  }
825
- }
826
- }
827
- },
828
- "SubscriptionUpdateRequestBody": {
829
- "description": "The request body for updating a subscription",
830
- "type": "object",
831
- "properties": {
832
- "returnURL": {
833
- "type": "string",
834
- "description": "URL which is used to redirect to the page with ability to update the subscription"
835
- }
836
- }
837
- },
838
- "SubscriptionUpdateResponseBody": {
839
- "description": "The response body for updating a subscription",
840
- "type": "object",
841
- "properties": {
842
- "subscription": {
843
- "type": "object",
844
- "description": "Object with redirect url inside",
845
- "properties": {
846
- "sessionURL": {
847
- "type": "string",
848
- "description": "URL with session URL rediect to"
849
- }
878
+ },
879
+ {
880
+ "in": "query",
881
+ "name": "cursor",
882
+ "schema": {
883
+ "type": "string",
884
+ "description": "Cursor for pagination, this only goes forward, i.e., Stripe's equivalent of 'starting_after'"
850
885
  }
851
886
  }
852
- }
853
- },
854
- "SubscriptionGetRequestBody": {
855
- "description": "The request body for getting a subscription",
856
- "type": "object",
857
- "properties": {
858
- "subscriptionId": {
859
- "type": "string",
860
- "description": "The subscription id",
861
- "example": "sub_1234567890"
862
- }
863
- }
864
- },
865
- "SubscriptionGetResponseBody": {
866
- "description": "The response body for getting a subscription",
867
- "type": "object",
868
- "properties": {
869
- "subscription": {
870
- "type": "object",
871
- "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object)"
872
- }
873
- }
874
- },
875
- "SubscriptionListRequestBody": {
876
- "description": "The request body for listing subscriptions",
877
- "type": "object",
878
- "properties": {
879
- "customerId": {
880
- "type": "string",
881
- "description": "The Stripe customer id",
882
- "example": "cus_1234567890"
883
- }
884
- }
885
- },
886
- "SubscriptionListResponseBody": {
887
- "description": "The response body for listing subscriptions",
888
- "type": "object",
889
- "properties": {
890
- "subscriptions": {
891
- "type": "array",
892
- "items": {
893
- "type": "object",
894
- "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]"
887
+ ],
888
+ "responses": {
889
+ "200": {
890
+ "description": "A list of products",
891
+ "content": {
892
+ "application/json": {
893
+ "schema": {
894
+ "$ref": "#/components/schemas/ProductListResponseBody"
895
+ }
896
+ }
895
897
  }
898
+ },
899
+ "400": {
900
+ "$ref": "#/components/schemas/InvalidRequest"
901
+ },
902
+ "401": {
903
+ "$ref": "#/components/schemas/UnauthorizedError"
904
+ },
905
+ "404": {
906
+ "$ref": "#/components/schemas/NotFoundError"
907
+ },
908
+ "500": {
909
+ "$ref": "#/components/schemas/InternalError"
896
910
  }
897
911
  }
898
- },
899
- "SubscriptionCancelRequestBody": {
900
- "description": "The request body for canceling a subscription",
901
- "type": "object",
902
- "properties": {
903
- "subscriptionId": {
904
- "type": "string",
905
- "description": "The subscription id",
906
- "example": "sub_1234567890"
907
- }
908
- }
909
- },
910
- "SubscriptionCancelResponseBody": {
911
- "description": "The response body for canceling a subscription",
912
- "type": "object",
913
- "properties": {
914
- "subscription": {
915
- "type": "object",
916
- "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]"
912
+ }
913
+ },
914
+ "/admin/product/get/{productId}": {
915
+ "get": {
916
+ "summary": "Get a product",
917
+ "description": "Get a product by id",
918
+ "tags": [
919
+ "Product"
920
+ ],
921
+ "parameters": [
922
+ {
923
+ "in": "path",
924
+ "name": "productId",
925
+ "schema": {
926
+ "type": "string",
927
+ "description": "The product id which identifies the product in Stripe"
928
+ },
929
+ "required": true
917
930
  },
918
- "idempotencyKey": {
919
- "type": "string",
920
- "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.",
921
- "example": "abcdefghijklmnopqrstuvwxyz"
931
+ {
932
+ "in": "query",
933
+ "name": "prices",
934
+ "schema": {
935
+ "type": "boolean",
936
+ "description": "If setup to true - returns the product with prices inside. Default - true"
937
+ }
922
938
  }
923
- }
924
- },
925
- "SubscriptionResumeRequestBody": {
926
- "description": "The request body for resuming a subscription",
927
- "type": "object",
928
- "properties": {
929
- "subscriptionId": {
930
- "type": "string",
931
- "description": "The subscription id",
932
- "example": "sub_1234567890"
939
+ ],
940
+ "responses": {
941
+ "200": {
942
+ "description": "A product",
943
+ "content": {
944
+ "application/json": {
945
+ "schema": {
946
+ "$ref": "#/components/schemas/ProductGetResponseBody"
947
+ }
948
+ }
949
+ }
933
950
  },
934
- "idempotencyKey": {
935
- "type": "string",
936
- "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.",
937
- "example": "abcdefghijklmnopqrstuvwxyz"
951
+ "400": {
952
+ "$ref": "#/components/schemas/InvalidRequest"
953
+ },
954
+ "401": {
955
+ "$ref": "#/components/schemas/UnauthorizedError"
956
+ },
957
+ "404": {
958
+ "$ref": "#/components/schemas/NotFoundError"
959
+ },
960
+ "500": {
961
+ "$ref": "#/components/schemas/InternalError"
938
962
  }
939
963
  }
940
- },
941
- "SubscriptionResumeResponseBody": {
942
- "description": "The response body for resuming a subscription",
943
- "type": "object",
944
- "properties": {
945
- "subscription": {
946
- "type": "object",
947
- "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]"
964
+ }
965
+ },
966
+ "/admin/subscription/create": {
967
+ "post": {
968
+ "summary": "Create a subscription",
969
+ "description": "Creates a new subscription for an existing customer",
970
+ "tags": [
971
+ "Subscription"
972
+ ],
973
+ "requestBody": {
974
+ "content": {
975
+ "application/json": {
976
+ "schema": {
977
+ "$ref": "#/components/schemas/SubscriptionCreateRequestBody"
978
+ }
979
+ }
948
980
  }
949
- }
950
- },
951
- "APIKeyResponse": {
952
- "description": "The general view for API key in response",
953
- "type": "object",
954
- "properties": {
955
- "apiKey": {
956
- "type": "string",
957
- "description": "The API key",
958
- "example": "abcdefghijklmnopqrstuvwxyz"
959
- },
960
- "createdAt": {
961
- "type": "string",
962
- "description": "The creation date of the API key",
963
- "example": "2000-10-31T01:23:45Z",
964
- "format": "date-time"
981
+ },
982
+ "responses": {
983
+ "201": {
984
+ "description": "The request was successful.",
985
+ "content": {
986
+ "application/json": {
987
+ "schema": {
988
+ "$ref": "#/components/schemas/SubscriptionCreateResponseBody"
989
+ }
990
+ }
991
+ }
965
992
  },
966
- "name": {
967
- "type": "string",
968
- "description": "The name of the API key",
969
- "example": "My API Key"
993
+ "400": {
994
+ "$ref": "#/components/schemas/InvalidRequest"
970
995
  },
971
- "expiresAt": {
972
- "type": "string",
973
- "description": "The expiration date of the API key",
974
- "example": "2000-10-31T01:23:45Z",
975
- "format": "date-time"
996
+ "401": {
997
+ "$ref": "#/components/schemas/UnauthorizedError"
976
998
  },
977
- "revoked": {
978
- "type": "boolean",
979
- "description": "The status of the API key",
980
- "example": false
999
+ "500": {
1000
+ "$ref": "#/components/schemas/InternalError"
981
1001
  }
982
1002
  }
983
- },
984
- "APIKeyCreateRequestBody": {
985
- "description": "The request body for creating an API key",
986
- "type": "object",
987
- "properties": {
988
- "expiresAt": {
989
- "type": "string",
990
- "description": "The expiration date of the API key",
991
- "example": "2000-10-31T01:23:45Z",
992
- "format": "date-time"
993
- },
994
- "name": {
995
- "type": "string",
996
- "description": "The name of the API key",
997
- "example": "My API Key"
1003
+ }
1004
+ },
1005
+ "/admin/subscription/update": {
1006
+ "post": {
1007
+ "summary": "Update a subscription",
1008
+ "description": "Updates an existing subscription",
1009
+ "tags": [
1010
+ "Subscription"
1011
+ ],
1012
+ "requestBody": {
1013
+ "content": {
1014
+ "application/json": {
1015
+ "schema": {
1016
+ "$ref": "#/components/schemas/SubscriptionUpdateRequestBody"
1017
+ }
1018
+ }
998
1019
  }
999
1020
  },
1000
- "required": [
1001
- "name"
1002
- ]
1003
- },
1004
- "APIKeyCreateResponseBody": {
1005
- "description": "The response body for creating an API key",
1006
- "type": "object",
1007
- "schema": {
1008
- "ref": "#/components/schemas/APIKeyResponse"
1021
+ "responses": {
1022
+ "200": {
1023
+ "description": "The request was successful.",
1024
+ "content": {
1025
+ "application/json": {
1026
+ "schema": {
1027
+ "$ref": "#/components/schemas/SubscriptionUpdateResponseBody"
1028
+ }
1029
+ }
1030
+ }
1031
+ },
1032
+ "400": {
1033
+ "$ref": "#/components/schemas/InvalidRequest"
1034
+ },
1035
+ "401": {
1036
+ "$ref": "#/components/schemas/UnauthorizedError"
1037
+ },
1038
+ "500": {
1039
+ "$ref": "#/components/schemas/InternalError"
1040
+ }
1009
1041
  }
1010
- },
1011
- "APIKeyCreateUnsuccessfulResponseBody": {
1012
- "description": "The response body for an unsuccessful API key creation",
1013
- "type": "object",
1014
- "properties": {
1015
- "error": {
1016
- "type": "string",
1017
- "example": "API key creation unsuccessful"
1042
+ }
1043
+ },
1044
+ "/admin/subscription/list": {
1045
+ "get": {
1046
+ "summary": "Get a list of subscriptions",
1047
+ "description": "Get a list of subscriptions",
1048
+ "tags": [
1049
+ "Subscription"
1050
+ ],
1051
+ "parameters": [
1052
+ {
1053
+ "in": "query",
1054
+ "name": "paymentProviderId",
1055
+ "schema": {
1056
+ "type": "string",
1057
+ "description": "The customer id. If passed - returns filtered by this customer list of subscriptions."
1058
+ }
1018
1059
  }
1019
- }
1020
- },
1021
- "APIKeyUpdateRequestBody": {
1022
- "description": "The request body for updating an API key",
1023
- "type": "object",
1024
- "properties": {
1025
- "apiKey": {
1026
- "type": "string",
1027
- "description": "The API key",
1028
- "example": "abcdefghijklmnopqrstuvwxyz"
1060
+ ],
1061
+ "responses": {
1062
+ "200": {
1063
+ "description": "A list of subscriptions",
1064
+ "content": {
1065
+ "application/json": {
1066
+ "schema": {
1067
+ "$ref": "#/components/schemas/SubscriptionListResponseBody"
1068
+ }
1069
+ }
1070
+ }
1029
1071
  },
1030
- "name": {
1031
- "type": "string",
1032
- "description": "The name of the API key",
1033
- "example": "My API Key"
1072
+ "400": {
1073
+ "$ref": "#/components/schemas/InvalidRequest"
1034
1074
  },
1035
- "expiresAt": {
1036
- "type": "string",
1037
- "description": "The expiration date of the API key",
1038
- "example": "2000-10-31T01:23:45Z",
1039
- "format": "date-time"
1075
+ "401": {
1076
+ "$ref": "#/components/schemas/UnauthorizedError"
1040
1077
  },
1041
- "revoked": {
1042
- "type": "boolean",
1043
- "description": "The status of the API key",
1044
- "example": false,
1045
- "default": false
1078
+ "404": {
1079
+ "$ref": "#/components/schemas/NotFoundError"
1080
+ },
1081
+ "500": {
1082
+ "$ref": "#/components/schemas/InternalError"
1046
1083
  }
1047
- },
1048
- "required": [
1049
- "apiKey"
1050
- ]
1051
- },
1052
- "APIKeyUpdateResponseBody": {
1053
- "description": "The response body for an unsuccessful API key update",
1054
- "type": "object",
1055
- "schema": {
1056
- "ref": "#/components/schemas/APIKeyResponse"
1057
1084
  }
1058
- },
1059
- "APIKeyUpdateUnsuccessfulResponseBody": {
1060
- "description": "The response body for an unsuccessful API key update",
1061
- "type": "object",
1062
- "properties": {
1063
- "error": {
1064
- "type": "string",
1065
- "example": "API key update unsuccessful"
1085
+ }
1086
+ },
1087
+ "/admin/subscription/get": {
1088
+ "get": {
1089
+ "summary": "Get a subscription",
1090
+ "description": "Get a subscription",
1091
+ "tags": [
1092
+ "Subscription"
1093
+ ],
1094
+ "responses": {
1095
+ "200": {
1096
+ "description": "The request was successful.",
1097
+ "content": {
1098
+ "application/json": {
1099
+ "schema": {
1100
+ "$ref": "#/components/schemas/SubscriptionGetResponseBody"
1101
+ }
1102
+ }
1103
+ }
1104
+ },
1105
+ "400": {
1106
+ "$ref": "#/components/schemas/InvalidRequest"
1107
+ },
1108
+ "401": {
1109
+ "$ref": "#/components/schemas/UnauthorizedError"
1110
+ },
1111
+ "404": {
1112
+ "$ref": "#/components/schemas/NotFoundError"
1113
+ },
1114
+ "500": {
1115
+ "$ref": "#/components/schemas/InternalError"
1066
1116
  }
1067
1117
  }
1068
- },
1069
- "APIKeyRevokeRequestBody": {
1070
- "description": "The request body for revoking an API key",
1071
- "type": "object",
1072
- "properties": {
1073
- "apiKey": {
1074
- "type": "string",
1075
- "description": "The API key",
1076
- "example": "abcdefghijklmnopqrstuvwxyz"
1118
+ }
1119
+ },
1120
+ "/admin/subscription/cancel": {
1121
+ "post": {
1122
+ "summary": "Cancel a subscription",
1123
+ "description": "Cancels an existing subscription",
1124
+ "tags": [
1125
+ "Subscription"
1126
+ ],
1127
+ "requestBody": {
1128
+ "content": {
1129
+ "application/json": {
1130
+ "schema": {
1131
+ "$ref": "#/components/schemas/SubscriptionCancelRequestBody"
1132
+ }
1133
+ }
1077
1134
  }
1078
1135
  },
1079
- "required": [
1080
- "apiKey"
1081
- ]
1082
- },
1083
- "APIKeyRevokeResponseBody": {
1084
- "description": "The response body for revoking an API key",
1085
- "type": "object",
1086
- "properties": {
1087
- "apiKey": {
1088
- "type": "string",
1089
- "description": "The API key",
1090
- "example": "abcdefghijklmnopqrstuvwxyz"
1136
+ "responses": {
1137
+ "200": {
1138
+ "description": "The request was successful.",
1139
+ "content": {
1140
+ "application/json": {
1141
+ "schema": {
1142
+ "$ref": "#/components/schemas/SubscriptionCancelResponseBody"
1143
+ }
1144
+ }
1145
+ }
1091
1146
  },
1092
- "revoked": {
1093
- "type": "boolean",
1094
- "description": "The status of the API key",
1095
- "example": true
1096
- }
1097
- },
1098
- "required": [
1099
- "apiKey"
1100
- ]
1101
- },
1102
- "APIKeyRevokeUnsuccessfulResponseBody": {
1103
- "description": "The response body for an unsuccessful API key revocation",
1104
- "type": "object",
1105
- "properties": {
1106
- "error": {
1107
- "type": "string",
1108
- "example": "API key revocation unsuccessful"
1147
+ "400": {
1148
+ "$ref": "#/components/schemas/InvalidRequest"
1149
+ },
1150
+ "401": {
1151
+ "$ref": "#/components/schemas/UnauthorizedError"
1152
+ },
1153
+ "404": {
1154
+ "$ref": "#/components/schemas/NotFoundError"
1155
+ },
1156
+ "500": {
1157
+ "$ref": "#/components/schemas/InternalError"
1109
1158
  }
1110
1159
  }
1111
- },
1112
- "APIKeyListResponseBody": {
1113
- "description": "The response body for listing API keys",
1114
- "type": "object",
1115
- "properties": {
1116
- "apiKeys": {
1117
- "type": "array",
1118
- "items": {
1119
- "type": "object",
1160
+ }
1161
+ },
1162
+ "/admin/subscription/resume": {
1163
+ "post": {
1164
+ "summary": "Resume a subscription",
1165
+ "description": "Resumes an existing subscription",
1166
+ "tags": [
1167
+ "Subscription"
1168
+ ],
1169
+ "requestBody": {
1170
+ "content": {
1171
+ "application/json": {
1120
1172
  "schema": {
1121
- "ref": "#/components/schemas/APIKeyResponse"
1173
+ "$ref": "#/components/schemas/SubscriptionResumeRequestBody"
1122
1174
  }
1123
1175
  }
1124
1176
  }
1125
- }
1126
- },
1127
- "APIKeyGetRequestBody": {
1128
- "description": "The request body for getting an API key",
1129
- "type": "object",
1130
- "properties": {
1131
- "apiKey": {
1132
- "type": "string",
1133
- "description": "The API key",
1134
- "example": "abcdefghijklmnopqrstuvwxyz"
1135
- }
1136
1177
  },
1137
- "required": [
1138
- "apiKey"
1139
- ]
1140
- },
1141
- "APIKeyGetResponseBody": {
1142
- "description": "The response body for getting an API key",
1143
- "type": "object",
1144
- "schema": {
1145
- "ref": "#/components/schemas/APIKeyResponse"
1146
- }
1147
- },
1148
- "OrganisationResponseBody": {
1149
- "description": "The response body for an organisation",
1150
- "type": "object",
1151
- "properties": {
1152
- "name": {
1153
- "type": "string",
1154
- "description": "The name of the organisation",
1155
- "example": "Cheqd"
1178
+ "responses": {
1179
+ "200": {
1180
+ "description": "The request was successful.",
1181
+ "content": {
1182
+ "application/json": {
1183
+ "schema": {
1184
+ "$ref": "#/components/schemas/SubscriptionResumeResponseBody"
1185
+ }
1186
+ }
1187
+ }
1156
1188
  },
1157
- "email": {
1158
- "type": "string",
1159
- "description": "The email of the organisation",
1160
- "example": "cheqd@example.com",
1161
- "format": "email",
1162
- "nullable": true,
1163
- "default": null
1189
+ "400": {
1190
+ "$ref": "#/components/schemas/InvalidRequest"
1164
1191
  },
1165
- "description": {
1166
- "type": "string",
1167
- "description": "The description of the organisation",
1168
- "example": "Cheqd organisation",
1169
- "nullable": true,
1170
- "default": null
1192
+ "401": {
1193
+ "$ref": "#/components/schemas/UnauthorizedError"
1171
1194
  },
1172
- "cosmosAddress": {
1173
- "type": "string",
1174
- "description": "The cosmos address of the organisation",
1175
- "example": "cheqd1hwzvac94udsk8x4mf6htt544lev4jltkwgxp7u"
1176
- }
1177
- }
1178
- },
1179
- "NotFoundError": {
1180
- "description": "The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.",
1181
- "type": "object",
1182
- "properties": {
1183
- "error": {
1184
- "type": "string",
1185
- "example": "Not Found Error"
1195
+ "404": {
1196
+ "$ref": "#/components/schemas/NotFoundError"
1197
+ },
1198
+ "500": {
1199
+ "$ref": "#/components/schemas/InternalError"
1186
1200
  }
1187
1201
  }
1188
1202
  }