|
Octane API Client
|
#include <api_client.h>
Public Member Functions | |
| ApiClient (std::string_view token=DEFAULT_API_TOKEN, std::string_view origin=DEFAULT_API_ORIGIN, std::string_view baseUrl=DEFAULT_API_BASE_URL) | |
| Construct a new Api Client object. More... | |
| ~ApiClient () noexcept | |
| Destroy the Api Client object. More... | |
| Result< Response, ErrorResponse > | init () |
| Run this method at first.(Since no exeptions are allowed in the constructor, we need this method to initailize the system.) More... | |
| Result< RoomId, ErrorResponse > | createRoom (std::string_view name) |
| Creates a room. More... | |
| Result< Response, ErrorResponse > | connectRoom (std::uint64_t id, std::string_view name) |
| Connects to the room. More... | |
| Result< Response, ErrorResponse > | disconnectRoom (std::uint64_t id, std::string_view name) |
| Disconnects from the room. More... | |
| Result< RoomStatus, ErrorResponse > | getRoomStatus (std::optional< std::uint64_t > id=std::nullopt) |
| Gets the room's status. More... | |
| Result< Response, ErrorResponse > | deleteRoom (std::optional< std::uint64_t > id=std::nullopt) |
| Deletes the room. More... | |
| Result< Content, ErrorResponse > | getContent () |
| Gets the room's content. More... | |
| Result< Response, ErrorResponse > | deleteContent () |
| Deletes the room's content. More... | |
| Result< Response, ErrorResponse > | uploadContent (const Content &content) |
| Uploads content to the room. More... | |
| octane::ApiClient::ApiClient | ( | std::string_view | token = DEFAULT_API_TOKEN, |
| std::string_view | origin = DEFAULT_API_ORIGIN, |
||
| std::string_view | baseUrl = DEFAULT_API_BASE_URL |
||
| ) |
Construct a new Api Client object.
| [in] | token | |
| [in] | origin | http://localhost:3000 |
| [in] | baseUrl | /api/v1 |
|
noexcept |
Destroy the Api Client object.

| Result< Response, ErrorResponse > octane::ApiClient::connectRoom | ( | std::uint64_t | id, |
| std::string_view | name | ||
| ) |
Connects to the room.
This method connects to the room when you pass the room id and device name. This method should not be called after you are connected. If it fails, the following error response will be returned.
| [in] | id | Room id |
| [in] | name | Device name |
Response. On failure, it will return the error respose written above. 
| Result< RoomId, ErrorResponse > octane::ApiClient::createRoom | ( | std::string_view | name | ) |
Creates a room.
This method creates a room, and returns RoomId when you pass the room name. If it fails, the following error response will be returned.
| [in] | name | Room name |
RoomId. On failure, it will return the error response written above. 
| Result< Response, ErrorResponse > octane::ApiClient::deleteContent | ( | ) |
Deletes the room's content.
This method deletes the room's Content. If it fails, the following error response will be returned.
Response. On failure, it will return the error response written above. 
| Result< Response, ErrorResponse > octane::ApiClient::deleteRoom | ( | std::optional< std::uint64_t > | id = std::nullopt | ) |
Deletes the room.
This method deletes the room when you pass the room id. If you pass nothing and you are connected to a room, it will delete that room. If it fails, the following error response will be returned.
| [in] | id | Room id |
Response On failure, it will return the error response written above. 
| Result< Response, ErrorResponse > octane::ApiClient::disconnectRoom | ( | std::uint64_t | id, |
| std::string_view | name | ||
| ) |
Disconnects from the room.
This method disconnects from the room when you pass the room id and device name. This method should not be called after you are disconnected. If it fails, the following error response will be returned.
| [in] | id | Room id |
| [in] | name | Device name |
Response. On failure, it will return the error respose written above. 

| Result< Content, ErrorResponse > octane::ApiClient::getContent | ( | ) |
Gets the room's content.
This method returns the room's Content. If it fails, the following error response will be returned.
Content. On failure, it will return the error response written above. 
| Result< RoomStatus, ErrorResponse > octane::ApiClient::getRoomStatus | ( | std::optional< std::uint64_t > | id = std::nullopt | ) |
Gets the room's status.
This method returns RoomStatus when you pass the room id. If you pass nothing and you are connected to a room, it will return the RoomStatus for that room. If it fails, the following error response will be returned.
| [in] | id | Room id |
RoomStatus. On failure, it will return the error response written above. 
| Result< Response, ErrorResponse > octane::ApiClient::init | ( | ) |
Run this method at first.(Since no exeptions are allowed in the constructor, we need this method to initailize the system.)
This method can be called once for each instance, and should be called right after an instance is created. If it fails, the following error response will be returned.
Response. On failure, it will return the error response written above. 
| Result< Response, ErrorResponse > octane::ApiClient::uploadContent | ( | const Content & | content | ) |
Uploads content to the room.
This method uploads the content (file or clipboard) to the room, by passing it Content. If it fails, the following error response will be returned.
| [in] | content | Content you want to upload |
Response. On failure, it will return the error response written above. 