aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sra-api')
-rw-r--r--packages/sra-api/src/api.ts48
-rw-r--r--packages/sra-api/src/examples/index.ts2
2 files changed, 50 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,
},
},
},
diff --git a/packages/sra-api/src/examples/index.ts b/packages/sra-api/src/examples/index.ts
index 10ecd182c..eeeb353b3 100644
--- a/packages/sra-api/src/examples/index.ts
+++ b/packages/sra-api/src/examples/index.ts
@@ -1,5 +1,7 @@
+import { validationError } from './errors';
import { relayerApiAssetDataPairsResponseSchema } from './relayerApiAssetDataPairsResponseSchema';
export const examples = {
+ validationError,
relayerApiAssetDataPairsResponseSchema,
};