Octane API Client
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
octane::ApiClient Class Reference

#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, ErrorResponseinit ()
 Run this method at first.(Since no exeptions are allowed in the constructor, we need this method to initailize the system.) More...
 
Result< RoomId, ErrorResponsecreateRoom (std::string_view name)
 Creates a room. More...
 
Result< Response, ErrorResponseconnectRoom (std::uint64_t id, std::string_view name)
 Connects to the room. More...
 
Result< Response, ErrorResponsedisconnectRoom (std::uint64_t id, std::string_view name)
 Disconnects from the room. More...
 
Result< RoomStatus, ErrorResponsegetRoomStatus (std::optional< std::uint64_t > id=std::nullopt)
 Gets the room's status. More...
 
Result< Response, ErrorResponsedeleteRoom (std::optional< std::uint64_t > id=std::nullopt)
 Deletes the room. More...
 
Result< Content, ErrorResponsegetContent ()
 Gets the room's content. More...
 
Result< Response, ErrorResponsedeleteContent ()
 Deletes the room's content. More...
 
Result< Response, ErrorResponseuploadContent (const Content &content)
 Uploads content to the room. More...
 

Constructor & Destructor Documentation

◆ ApiClient()

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.

Parameters
[in]token
[in]originhttp://localhost:3000
[in]baseUrl/api/v1

◆ ~ApiClient()

octane::ApiClient::~ApiClient ( )
noexcept

Destroy the Api Client object.

Here is the call graph for this function:

Member Function Documentation

◆ connectRoom()

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.

  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Parameters
    [in]idRoom id
    [in]nameDevice name
    Returns
    Result<Response, ErrorResponse> On success, it will return Response. On failure, it will return the error respose written above.
Here is the call graph for this function:

◆ createRoom()

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.

  • ERR_JSON_PARSE_FAILED
  • ERR_INVALID_RESPONSE
  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Parameters
    [in]nameRoom name
    Returns
    Result<RoomId, ErrorResponse> On success, it will return RoomId. On failure, it will return the error response written above.
Here is the call graph for this function:

◆ deleteContent()

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.

  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY
  • ERR_ROOM_DISCONNECTED Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Returns
    Result<Response, ErrorResponse> On success, it will return Response. On failure, it will return the error response written above.
Here is the call graph for this function:

◆ deleteRoom()

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.

  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Parameters
    [in]idRoom id
    Returns
    Result<Response, ErrorResponse> On success, it will return Response On failure, it will return the error response written above.
Here is the call graph for this function:

◆ disconnectRoom()

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.

  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Parameters
    [in]idRoom id
    [in]nameDevice name
    Returns
    Result<Response, ErrorResponse> On success, it will return Response. On failure, it will return the error respose written above.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContent()

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.

  • ERR_JSON_PARSE_FAILED
  • ERR_INVALID_RESPONSE
  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY
  • ERR_ROOM_DISCONNECTED Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Returns
    Result<Content, ErrorResponse> On success, it will return Content. On failure, it will return the error response written above.
Here is the call graph for this function:

◆ getRoomStatus()

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.

  • ERR_JSON_PARSE_FAILED
  • ERR_INVALID_RESPONSE
  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY
  • ERR_ROOM_ID_UNDEFINED Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Parameters
    [in]idRoom id
    Returns
    Result<RoomStatus, ErrorResponse> On success, it will return RoomStatus. On failure, it will return the error response written above.
Here is the call graph for this function:

◆ init()

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.

  • ERR_CURL_INITIALIZATION_FAILED
  • ERR_JSON_PARSE_FAILED
  • ERR_INVALID_RESPONSE
  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY Additionaly, when a response other than a 2xx is returned, the error passed from the server in the form of error response is returned.
    Returns
    Result<std::optional<std::string>, ErrorResponse> On success, it will return Response. On failure, it will return the error response written above.
Here is the call graph for this function:

◆ uploadContent()

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.

  • ERR_CURL_CONNECTION_FAILED
  • ERR_SERVER_HEALTH_STATUS_FAULTY
  • ERR_ROOM_DISCONNECTED Additionaly, when a response other than 2xx is returned, the error passed from the server in the form of error response is returned.
    Parameters
    [in]contentContent you want to upload
    Returns
    Result<Response, ErrorResponse> On success, it will return Response. On failure, it will return the error response written above.
Here is the call graph for this function:

The documentation for this class was generated from the following files: