mirror of
https://github.com/cadmium-im/cadmium-docs-legacy.git
synced 2024-11-21 18:02:24 +00:00
Slightly fix protocol error specs
This commit is contained in:
parent
09a3a6f502
commit
5ac87b9a2a
@ -53,7 +53,7 @@ This extension is intended for logging into user account on a server by username
|
||||
"from": "cadmium.org",
|
||||
"ok": false,
|
||||
"payload": {
|
||||
"errCode": "invalid_creds",
|
||||
"errID": "invalid_creds",
|
||||
"errText": "Username/password isn't valid"
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ This extension is intended for creating user accounts on a server
|
||||
"from": "cadmium.org",
|
||||
"ok": false,
|
||||
"payload": {
|
||||
"errCode": "id_exists",
|
||||
"errID": "id_exists",
|
||||
"errText": "Username/email/msisdn already taken"
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ None.
|
||||
"from": "cadmium.org",
|
||||
"ok": false,
|
||||
"payload": {
|
||||
"errCode": "ratelimit_exceed",
|
||||
"errID": "ratelimit_exceed",
|
||||
"errText": "Request ratelimit exceed! Please, try again later!",
|
||||
"errPayload": {
|
||||
"retryAfter": 2
|
||||
"retryAfter": 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ None.
|
||||
```typescript
|
||||
interface RatelimitExceedErrorPayload {
|
||||
/**
|
||||
* How long after the client can retry the request (in seconds)
|
||||
* How long after the client can retry the request (in millis)
|
||||
*/
|
||||
retryAfter: number
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
{
|
||||
"definitions": {},
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "urn:cadmium:0",
|
||||
"type": "object",
|
||||
"title": "Base Message Schema",
|
||||
"required": [
|
||||
"id",
|
||||
"type",
|
||||
"from",
|
||||
"to",
|
||||
"payload"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": {
|
||||
"$id": "#/properties/id",
|
||||
"type": "string",
|
||||
"title": "id",
|
||||
"description": "Message identifier (used to track the request-response chain)",
|
||||
"examples": [
|
||||
"abcd"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"$id": "#/properties/type",
|
||||
"type": "string",
|
||||
"title": "type",
|
||||
"description": "Type of message (used to determine which extension this message belongs to)",
|
||||
"examples": [
|
||||
"profile:register",
|
||||
"profile:login",
|
||||
"incorrectMessageType:error"
|
||||
]
|
||||
},
|
||||
"from": {
|
||||
"$id": "#/properties/from",
|
||||
"type": "string",
|
||||
"title": "from",
|
||||
"description": "From which entity this message is send. May be set to \"anonymous\" value, if action doesn't require authorization. This is EntityID",
|
||||
"examples": [
|
||||
"396277b7dcd0f1173f2007baa604de7593529cc3fbf335fb7924851cb25c1fdf",
|
||||
"@juliet@396277b7dcd0f1173f2007baa604de7593529cc3fbf335fb7924851cb25c1fdf",
|
||||
"#chpok@b9966d89028b120145dad38961bed0b3b2eac0a2915c0bb1665ffcc1586f6f59",
|
||||
"anonymous"
|
||||
]
|
||||
},
|
||||
"to": {
|
||||
"$id": "#/properties/to",
|
||||
"type": "string",
|
||||
"title": "to",
|
||||
"description": "Message recipient. This is Entity ID.",
|
||||
"examples": [
|
||||
"@juliet@02a6f23250868e903ff62e99e664a5717e945ca8153bf0ebc4f505cbe3a0860c",
|
||||
"#white_house_garden@8baef2426dc6a92e16d39d79d90ae6d5a0080aaeccc5f02f1e83a959bc4d0be7",
|
||||
"%phone:1234567890@6dfea40d98f71b3191f94c31af887a00eaeef2fe3501226e3fbb302fc5269eec",
|
||||
"@romeo@cadmium.im"
|
||||
]
|
||||
},
|
||||
"payload": {
|
||||
"$id": "#/properties/payload",
|
||||
"type": "object",
|
||||
"title": "payload",
|
||||
"description": "Message payload (used to store extra information in message, list of permissible fields in the payload depends on \"type\" field)"
|
||||
},
|
||||
"ok": {
|
||||
"$id": "#/properties/ok",
|
||||
"type": "boolean",
|
||||
"title": "ok",
|
||||
"description": "Indicating whether request have an error"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
{
|
||||
"definitions": {},
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "urn:cadmium:1",
|
||||
"type": "object",
|
||||
"title": "Protocol Error Schema",
|
||||
"required": [
|
||||
"errCode",
|
||||
"errText"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"errCode": {
|
||||
"$id": "#/properties/errCode",
|
||||
"type": "integer",
|
||||
"title": "Error Code",
|
||||
"description": "Error code (defined in extensions, may be same per extensions)",
|
||||
"examples": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
]
|
||||
},
|
||||
"errText": {
|
||||
"$id": "#/properties/errText",
|
||||
"type": "string",
|
||||
"title": "Error Text",
|
||||
"description": "Explanation of error in human-readable view",
|
||||
"examples": [
|
||||
"Incorrect type of message (type isn't implemented in the server)",
|
||||
"Rate-limit exceed"
|
||||
]
|
||||
},
|
||||
"errPayload": {
|
||||
"$id": "#/properties/errPayload",
|
||||
"type": "object",
|
||||
"title": "Error Payload",
|
||||
"description": "Advanced error information (fields defined in extensions)"
|
||||
}
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ None.
|
||||
"to": "@juliet@cadmium.im",
|
||||
"ok": false,
|
||||
"payload": {
|
||||
"errCode": 0,
|
||||
"errID": "unhandled",
|
||||
"errText": "Incorrect type of message (type isn't implemented in the server)",
|
||||
"errPayload": {}
|
||||
}
|
||||
@ -51,7 +51,7 @@ interface ErrorPayload {
|
||||
/**
|
||||
* Error identifier (defined in extensions, maybe same per extensions)
|
||||
*/
|
||||
errId: string,
|
||||
errID: string,
|
||||
|
||||
/**
|
||||
* Explanation of error in human-readable view
|
||||
|
Loading…
Reference in New Issue
Block a user