style API.md

This commit is contained in:
Horhik 2021-04-16 18:46:58 +03:00
parent 40b38517f8
commit 3e83becd39
5 changed files with 203 additions and 69 deletions

View File

@ -164,25 +164,92 @@
<div id="content" class="content"> <div id="content" class="content">
<main> <main>
<h1 id="hole-frontend-api"><a class="header" href="#hole-frontend-api">Hole Frontend API</a></h1> <h1 id="hole-frontend-api"><a class="header" href="#hole-frontend-api">Hole Frontend API</a></h1>
<h2 id="loginning-and-registration"><a class="header" href="#loginning-and-registration">Loginning and Registration</a></h2> <!-- ## Loginning and Registration -->
<h3 id="registration-request"><a class="header" href="#registration-request">Registration request</a></h3> <!-- ### Registration request -->
<p>On base of password will be generted keypair for signing and keypair for encoding.</p> <!-- On base of password will be generted keypair for signing and keypair for encoding. -->
<pre><code class="language-json"> { <!-- ``` json -->
request_type: &quot;registration&quot;, <!-- { -->
username: &quot;user&quot;, <!-- request_type: "registration", -->
password: &quot;passwd123&quot;, <!-- username: "user", -->
} <!-- password: "passwd123", -->
<!-- } -->
<!-- ``` -->
<!-- ### Login request -->
<!-- ```json -->
<!-- { -->
<!-- request_type: login, -->
<!-- username: "name", -->
<!-- decode_key: "key", -->
<!-- sign_key: "key", -->
<!-- } -->
<!-- ``` -->
<!-- ## Adding friends -->
<!-- Each user have :w -->
<hr />
<h1 id="requests"><a class="header" href="#requests">Requests</a></h1>
<pre><code class="language-Rust">pub enum Request {
StartApp,
StopApp,
LoadUsers,
#[serde(rename_all = &quot;camelCase&quot;)]
SendMessage {
user_id: Id,
message: String,
},
#[serde(rename_all = &quot;camelCase&quot;)]
LoadMessages {
user_id: Id,
count: u32,
start_index: u32,
},
#[serde(rename_all = &quot;camelCase&quot;)]
AddUser {
name: String,
sign_key: String,
insert_key: String,
}, // CreateInstance TODO v0.3
}
</code></pre> </code></pre>
<h3 id="login-request"><a class="header" href="#login-request">Login request</a></h3> <h2 id="startapp"><a class="header" href="#startapp"><code>StartApp</code></a></h2>
<pre><code class="language-json"> { <p>Require when when client started.</p>
request_type: login, <pre><code class="language-json">{
username: &quot;name&quot;, type: &quot;startApp&quot;
decode_key: &quot;key&quot;, }
sign_key: &quot;key&quot;, </code></pre>
} <h2 id="stopapp"><a class="header" href="#stopapp"><code>StopApp</code></a></h2>
<pre><code class="language-json">{
type: &quot;stopApp&quot;
}
</code></pre>
<h2 id="loadusers"><a class="header" href="#loadusers"><code>LoadUsers</code></a></h2>
<pre><code class="language-json">{
type: &quot;loadUsers&quot;
}
</code></pre>
<h2 id="sendmessage"><a class="header" href="#sendmessage"><code>SendMessage</code></a></h2>
<pre><code class="language-json">{
type: &quot;sendMessage&quot;,
userId: &quot;UUID_V4...&quot;,
message: &quot;hellow world&quot;
}
</code></pre>
<h2 id="adduser"><a class="header" href="#adduser"><code>AddUser</code></a></h2>
<pre><code class="language-json">{
type: &quot;addUser&quot;,
name: &quot;username&quot;,
signKey: &quot;USK@key...&quot;,
insertKey: &quot;insertkey...&quot;
}
</code></pre>
<h2 id="loadmessages"><a class="header" href="#loadmessages"><code>LoadMessages</code></a></h2>
<p>Requesting <code>count</code> messages from <code>userId</code> started from <code>startIndex</code>'s message</p>
<pre><code class="language-json">{
type: &quot;loadMessages&quot;,
userId: &quot;UUID_V4...&quot;,
count: 10,
startIndex: 30
}
</code></pre> </code></pre>
<h2 id="adding-friends"><a class="header" href="#adding-friends">Adding friends</a></h2>
<p>Each user have :w</p>
</main> </main>

View File

@ -204,25 +204,92 @@ EndMessage
<h2 id="adding-friend"><a class="header" href="#adding-friend">Adding friend</a></h2> <h2 id="adding-friend"><a class="header" href="#adding-friend">Adding friend</a></h2>
<p>Hole generates file, which alice have to send to bob somehow, and bob have to do the same. This file will contain unique ID and two keys</p> <p>Hole generates file, which alice have to send to bob somehow, and bob have to do the same. This file will contain unique ID and two keys</p>
<h1 id="hole-frontend-api"><a class="header" href="#hole-frontend-api">Hole Frontend API</a></h1> <h1 id="hole-frontend-api"><a class="header" href="#hole-frontend-api">Hole Frontend API</a></h1>
<h2 id="loginning-and-registration"><a class="header" href="#loginning-and-registration">Loginning and Registration</a></h2> <!-- ## Loginning and Registration -->
<h3 id="registration-request"><a class="header" href="#registration-request">Registration request</a></h3> <!-- ### Registration request -->
<p>On base of password will be generted keypair for signing and keypair for encoding.</p> <!-- On base of password will be generted keypair for signing and keypair for encoding. -->
<pre><code class="language-json"> { <!-- ``` json -->
request_type: &quot;registration&quot;, <!-- { -->
username: &quot;user&quot;, <!-- request_type: "registration", -->
password: &quot;passwd123&quot;, <!-- username: "user", -->
} <!-- password: "passwd123", -->
<!-- } -->
<!-- ``` -->
<!-- ### Login request -->
<!-- ```json -->
<!-- { -->
<!-- request_type: login, -->
<!-- username: "name", -->
<!-- decode_key: "key", -->
<!-- sign_key: "key", -->
<!-- } -->
<!-- ``` -->
<!-- ## Adding friends -->
<!-- Each user have :w -->
<hr />
<h1 id="requests"><a class="header" href="#requests">Requests</a></h1>
<pre><code class="language-Rust">pub enum Request {
StartApp,
StopApp,
LoadUsers,
#[serde(rename_all = &quot;camelCase&quot;)]
SendMessage {
user_id: Id,
message: String,
},
#[serde(rename_all = &quot;camelCase&quot;)]
LoadMessages {
user_id: Id,
count: u32,
start_index: u32,
},
#[serde(rename_all = &quot;camelCase&quot;)]
AddUser {
name: String,
sign_key: String,
insert_key: String,
}, // CreateInstance TODO v0.3
}
</code></pre> </code></pre>
<h3 id="login-request"><a class="header" href="#login-request">Login request</a></h3> <h2 id="startapp"><a class="header" href="#startapp"><code>StartApp</code></a></h2>
<pre><code class="language-json"> { <p>Require when when client started.</p>
request_type: login, <pre><code class="language-json">{
username: &quot;name&quot;, type: &quot;startApp&quot;
decode_key: &quot;key&quot;, }
sign_key: &quot;key&quot;, </code></pre>
} <h2 id="stopapp"><a class="header" href="#stopapp"><code>StopApp</code></a></h2>
<pre><code class="language-json">{
type: &quot;stopApp&quot;
}
</code></pre>
<h2 id="loadusers"><a class="header" href="#loadusers"><code>LoadUsers</code></a></h2>
<pre><code class="language-json">{
type: &quot;loadUsers&quot;
}
</code></pre>
<h2 id="sendmessage"><a class="header" href="#sendmessage"><code>SendMessage</code></a></h2>
<pre><code class="language-json">{
type: &quot;sendMessage&quot;,
userId: &quot;UUID_V4...&quot;,
message: &quot;hellow world&quot;
}
</code></pre>
<h2 id="adduser"><a class="header" href="#adduser"><code>AddUser</code></a></h2>
<pre><code class="language-json">{
type: &quot;addUser&quot;,
name: &quot;username&quot;,
signKey: &quot;USK@key...&quot;,
insertKey: &quot;insertkey...&quot;
}
</code></pre>
<h2 id="loadmessages"><a class="header" href="#loadmessages"><code>LoadMessages</code></a></h2>
<p>Requesting <code>count</code> messages from <code>userId</code> started from <code>startIndex</code>'s message</p>
<pre><code class="language-json">{
type: &quot;loadMessages&quot;,
userId: &quot;UUID_V4...&quot;,
count: 10,
startIndex: 30
}
</code></pre> </code></pre>
<h2 id="adding-friends"><a class="header" href="#adding-friends">Adding friends</a></h2>
<p>Each user have :w</p>
</main> </main>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,30 +1,30 @@
# Hole Frontend API # Hole Frontend API
## Loginning and Registration <!-- ## Loginning and Registration -->
### Registration request <!-- ### Registration request -->
On base of password will be generted keypair for signing and keypair for encoding. <!-- On base of password will be generted keypair for signing and keypair for encoding. -->
``` json <!-- ``` json -->
{ <!-- { -->
request_type: "registration", <!-- request_type: "registration", -->
username: "user", <!-- username: "user", -->
password: "passwd123", <!-- password: "passwd123", -->
} <!-- } -->
``` <!-- ``` -->
### Login request <!-- ### Login request -->
```json <!-- ```json -->
{ <!-- { -->
request_type: login, <!-- request_type: login, -->
username: "name", <!-- username: "name", -->
decode_key: "key", <!-- decode_key: "key", -->
sign_key: "key", <!-- sign_key: "key", -->
} <!-- } -->
``` <!-- ``` -->
## Adding friends <!-- ## Adding friends -->
Each user have :w <!-- Each user have :w -->
---- ----
@ -56,47 +56,47 @@ pub enum Request {
## `StartApp` ## `StartApp`
Require when when client started. Require when when client started.
``` json ``` json
{ {
type: "startApp" type: "startApp"
} }
``` ```
## `StopApp` ## `StopApp`
``` json ``` json
{ {
type: "stopApp" type: "stopApp"
} }
``` ```
## `LoadUsers` ## `LoadUsers`
``` json ``` json
{ {
type: "loadUsers" type: "loadUsers"
} }
``` ```
## `SendMessage` ## `SendMessage`
``` json ``` json
{ {
type: "sendMessage", type: "sendMessage",
userId: "UUID_V4...", userId: "UUID_V4...",
message: "hellow world" message: "hellow world"
} }
``` ```
## `AddUser` ## `AddUser`
``` json ``` json
{ {
type: "addUser", type: "addUser",
name: "username", name: "username",
signKey: "USK@key...", signKey: "USK@key...",
insertKey: "insertkey..." insertKey: "insertkey..."
} }
``` ```
## `LoadMessages` ## `LoadMessages`
Requesting `count` messages from `userId` started from `startIndex`'s message Requesting `count` messages from `userId` started from `startIndex`'s message
``` json ``` json
{ {
type: "loadMessages", type: "loadMessages",
userId: "UUID_V4...", userId: "UUID_V4...",
count: 10, count: 10,
startIndex: 30 startIndex: 30
} }
``` ```