aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api/src/api.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-03 09:24:24 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-03 09:24:24 +0800
commit36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70 (patch)
tree93d3aee8f0381821d175713a8a31fd37899753c2 /packages/sra-api/src/api.ts
parent0390a5ecbfc79dfd435d3f9e911abd610f33d455 (diff)
downloaddexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.tar
dexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.tar.gz
dexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.tar.bz2
dexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.tar.lz
dexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.tar.xz
dexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.tar.zst
dexon-sol-tools-36e7cb16aa086892ace18b2c6f3ed5a6e3b26a70.zip
Add errors and headers
Diffstat (limited to 'packages/sra-api/src/api.ts')
-rw-r--r--packages/sra-api/src/api.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts
index 7d2cc6e08..2a43e3e8e 100644
--- a/packages/sra-api/src/api.ts
+++ b/packages/sra-api/src/api.ts
@@ -37,6 +37,51 @@ const networkdIdParameter = {
},
};
+const headers = {
+ 'X-Rate-Limit-Limit': {
+ description: `The maximum number of requests you're permitted to make per hour.`,
+ schema: {
+ type: 'integer',
+ },
+ },
+ 'X-Rate-Limit-Remaining': {
+ description: 'The number of requests remaining in the current rate limit window.',
+ schema: {
+ type: 'integer',
+ },
+ },
+ 'X-Rate-Limit-Reset': {
+ description: 'The time at which the current rate limit window resets in UTC epoch seconds.',
+ schema: {
+ type: 'integer',
+ },
+ },
+};
+
+const errorResponses = {
+ '400': {
+ description: 'Validation error',
+ content: {
+ 'application/json': {
+ schema: { $ref: '#/components/schemas/relayerApiErrorResponseSchema' },
+ example: examples.validationError,
+ },
+ },
+ },
+ '404': {
+ description: 'Not found',
+ },
+ '429': {
+ description: 'Too many requests - Rate limit exceeded',
+ },
+ '500': {
+ description: 'Internal Server Error',
+ },
+ '501': {
+ description: 'Not implemented.',
+ },
+};
+
export const api: OpenApiSpec = {
openapi: '3.0.0',
info: {
@@ -82,6 +127,8 @@ export const api: OpenApiSpec = {
],
responses: {
'200': {
+ headers,
+ description: 'OK',
content: {
'application/json': {
schema: { $ref: '#/components/schemas/relayerApiAssetDataPairsResponseSchema' },
@@ -89,6 +136,7 @@ export const api: OpenApiSpec = {
},
},
},
+ ...errorResponses,
},
},
},