update API page

This commit is contained in:
Horhik 2021-04-16 18:44:07 +03:00
parent 64c443fdab
commit 40b38517f8
1 changed files with 74 additions and 0 deletions

View File

@ -26,3 +26,77 @@ On base of password will be generted keypair for signing and keypair for encodin
## Adding friends
Each user have :w
----
# Requests
``` Rust
pub enum Request {
StartApp,
StopApp,
LoadUsers,
#[serde(rename_all = "camelCase")]
SendMessage {
user_id: Id,
message: String,
},
#[serde(rename_all = "camelCase")]
LoadMessages {
user_id: Id,
count: u32,
start_index: u32,
},
#[serde(rename_all = "camelCase")]
AddUser {
name: String,
sign_key: String,
insert_key: String,
}, // CreateInstance TODO v0.3
}
```
## `StartApp`
Require when when client started.
``` json
{
type: "startApp"
}
```
## `StopApp`
``` json
{
type: "stopApp"
}
```
## `LoadUsers`
``` json
{
type: "loadUsers"
}
```
## `SendMessage`
``` json
{
type: "sendMessage",
userId: "UUID_V4...",
message: "hellow world"
}
```
## `AddUser`
``` json
{
type: "addUser",
name: "username",
signKey: "USK@key...",
insertKey: "insertkey..."
}
```
## `LoadMessages`
Requesting `count` messages from `userId` started from `startIndex`'s message
``` json
{
type: "loadMessages",
userId: "UUID_V4...",
count: 10,
startIndex: 30
}
```