Update API specification

This commit is contained in:
aftermath2
2023-04-01 12:00:00 +00:00
parent 4fd16c5e73
commit cb6a044256

View File

@ -37,6 +37,10 @@ class MakerViewSchema:
400: { 400: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -46,6 +50,10 @@ class MakerViewSchema:
409: { 409: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -138,6 +146,10 @@ class OrderViewSchema:
400: { 400: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -147,6 +159,10 @@ class OrderViewSchema:
403: { 403: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -157,6 +173,10 @@ class OrderViewSchema:
404: { 404: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -168,22 +188,18 @@ class OrderViewSchema:
"examples": [ "examples": [
OpenApiExample( OpenApiExample(
"Order cancelled", "Order cancelled",
value={"bad_request": "This order has been cancelled"}, value={"error_code": 1043, "bad_request": "This order has been cancelled"},
status_codes=[400], status_codes=[400],
), ),
OpenApiExample( OpenApiExample(
"When the order is not public and you neither the taker nor maker", "When the order is not public and you neither the taker nor maker",
value={"bad_request": "This order is not available"}, value={"error_code": 1044, "bad_request": "This order is not available"},
status_codes=[400],
),
OpenApiExample(
"Order cancelled",
value={"bad_request": "This order has been cancelled"},
status_codes=[400], status_codes=[400],
), ),
OpenApiExample( OpenApiExample(
"When maker bond expires (as maker)", "When maker bond expires (as maker)",
value={ value={
"error_code": 1022,
"bad_request": "Invoice expired. You did not confirm publishing the order in time. Make a new order." "bad_request": "Invoice expired. You did not confirm publishing the order in time. Make a new order."
}, },
status_codes=[400], status_codes=[400],
@ -191,6 +207,7 @@ class OrderViewSchema:
OpenApiExample( OpenApiExample(
"When Robosats node is down", "When Robosats node is down",
value={ value={
"error_code": 1023,
"bad_request": "The lightning node is down. Write in the Telegram group to make sure the staff is aware." "bad_request": "The lightning node is down. Write in the Telegram group to make sure the staff is aware."
}, },
status_codes=[400], status_codes=[400],
@ -333,6 +350,10 @@ class OrderViewSchema:
400: { 400: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -344,6 +365,7 @@ class OrderViewSchema:
OpenApiExample( OpenApiExample(
"User not authenticated", "User not authenticated",
value={ value={
"error_code": 1036,
"bad_request": "Woops! It seems you do not have a robot avatar", "bad_request": "Woops! It seems you do not have a robot avatar",
}, },
status_codes=[400], status_codes=[400],
@ -587,6 +609,10 @@ class RewardViewSchema:
"type": "boolean", "type": "boolean",
"default": False, "default": False,
}, },
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "More context for the reason of the failure", "description": "More context for the reason of the failure",
@ -600,6 +626,7 @@ class RewardViewSchema:
OpenApiExample( OpenApiExample(
"User not authenticated", "User not authenticated",
value={ value={
"error_code": 1036,
"bad_request": "Woops! It seems you do not have a robot avatar", "bad_request": "Woops! It seems you do not have a robot avatar",
}, },
status_codes=[400], status_codes=[400],
@ -685,6 +712,7 @@ class TickViewSchema:
OpenApiExample( OpenApiExample(
"Too many ticks", "Too many ticks",
value={ value={
"error_code": 1051,
"bad_request": "More than 5000 market ticks have been found. Try narrowing the date range." "bad_request": "More than 5000 market ticks have been found. Try narrowing the date range."
}, },
status_codes=[400], status_codes=[400],
@ -783,6 +811,10 @@ class StealthViewSchema:
400: { 400: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",
@ -802,6 +834,10 @@ class ReviewViewSchema:
400: { 400: {
"type": "object", "type": "object",
"properties": { "properties": {
"error_code": {
"type": "integer",
"description": "Error code",
},
"bad_request": { "bad_request": {
"type": "string", "type": "string",
"description": "Reason for the failure", "description": "Reason for the failure",