# Hole Frontend API

# Requests

    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.

    {
         type: "startApp"
    }

## `StopApp`

    {
        type: "stopApp"
    }

## `LoadUsers`

    {
        type: "loadUsers"
    }

## `SendMessage`

    {
        type: "sendMessage",
        userId: "UUID_V4...",
        message: "hellow world"
    }

## `AddUser`

    {
        type: "addUser",
        name: "username",
        signKey: "USK@key...",
        insertKey: "insertkey..."
    }

## `LoadMessages`

Requesting `count` messages from `userId` started from `startIndex`'s message

    {
        type: "loadMessages",
        userId: "UUID_V4...",
        count: 10,
        startIndex: 30
    }