Octane API Client
Loading...
Searching...
No Matches
Namespaces | Classes | Enumerations | Functions | Variables
octane Namespace Reference

Namespaces

namespace  internal
 

Classes

struct  _
 Structure representing that it returns nothing. More...
 
class  ApiClient
 
struct  Content
 Structure used as result for getContent, has data and ContentStatus and inherits Response. More...
 
struct  ContentStatus
 Structure used in Content, has the status of Content. More...
 
struct  Device
 Structure used in RoomStatus's devices, has the information of each device connected to the room. More...
 
class  error_t
 Utility class that can be used when we only want to specify quasi-normal state types. More...
 
struct  ErrorResponse
 General stucture to represent the error. More...
 
struct  FileInfo
 
struct  HealthResult
 Structure used as result for health, has the server's status and message. More...
 
class  ok_t
 Utility class that can be used when we only want to specify normal state types. More...
 
struct  Response
 Structure used/inherited in various methods of ApiClient, has the server's status. More...
 
class  Result
 Wrapper class that bifurcates the values indicated by normal and quasi-normal states. More...
 
struct  RoomId
 Structure used as result for createRoom, has the room id and inherits Response. More...
 
struct  RoomStatus
 Structure used as result for getRoomStatus, has the status of the room and inherits Response. More...
 

Enumerations

enum struct  Health { Healthy , Degraded , Faulty }
 Enum used in HealthResult, represents the server's status. More...
 
enum struct  ContentType { File , Clipboard , MultiFile }
 Enum used in ContentStatus, represents the type of Content. More...
 

Functions

bool operator== (const HealthResult &a, const HealthResult &b)
 
std::ostream & operator<< (std::ostream &stream, const HealthResult &healthResult)
 
bool operator== (const RoomId &a, const RoomId &b)
 
std::ostream & operator<< (std::ostream &stream, const RoomId &roomId)
 
bool operator== (const RoomStatus &a, const RoomStatus &b)
 
std::ostream & operator<< (std::ostream &stream, const RoomStatus &roomStatus)
 
bool operator== (const ContentStatus &a, const ContentStatus &b)
 
std::ostream & operator<< (std::ostream &stream, const ContentStatus &contentStatus)
 
error_t< ErrorResponsemakeError (std::string_view code, std::string_view reason)
 Utility function to create error response. More...
 
bool operator== (const ErrorResponse &a, const ErrorResponse &b)
 
std::ostream & operator<< (std::ostream &stream, const ErrorResponse &err)
 
template<typename T_OK >
decltype(auto) ok (const T_OK &ok)
 Utility function used to construct normal state values. More...
 
template<typename T_OK >
decltype(auto) ok (T_OK &&ok)
 Utility function used to construct normal state values. More...
 
template<typename T_OK = _>
ok_t< _ok ()
 Utitlity function used when the normal state type is _. More...
 
template<typename T_Error , size_t N>
decltype(auto) error (const T_Error(&error)[N])
 Utility function used to construct quasi-normal state values. More...
 
template<typename T_Error >
decltype(auto) error (const T_Error &error)
 Utility function to construct quasi-normal state values. More...
 
template<typename T_Error >
decltype(auto) err (T_Error &&error)
 Utility function to construct quasi-normal state values. More...
 

Variables

constexpr auto LIBRARY_NAME = "Octane API Client"
 
constexpr auto LIBRARY_VERSION = "v0.1.0"
 Library version. More...
 
constexpr auto DEFAULT_API_TOKEN = "mock"
 Default API token. More...
 
constexpr auto DEFAULT_API_ORIGIN = "http://localhost:3000"
 Default API origin. More...
 
constexpr auto DEFAULT_API_BASE_URL = "/api/v1"
 Default base URL. More...
 
constexpr auto ERR_API_CLIENT_INITIALIZATION_FAILED = "ERR_API_CLIENT_INITIALIZATION_FAILED"
 Used when ApiClient initialization failed. More...
 
constexpr auto ERR_SERVER_HEALTH_STATUS_FAULTY = "ERR_SERVER_HEALTH_STATUS_FAULTY"
 Used when the server has incidents and is currently not available. More...
 
constexpr auto ERR_CURL_INITIALIZATION_FAILED = "ERR_CURL_INITIALIZATION_FAILED"
 Used when cURL initialization failed, such as inoctane::internal::HttpClientMore...
 
constexpr auto ERR_INCORRECT_HTTP_METHOD = "ERR_INCORRECT_HTTP_METHOD"
 Used when an unexpected http method was issued. More...
 
constexpr auto ERR_CURL_CONNECTION_FAILED = "ERR_CURL_CONNECTION_FAILED"
 Used when cURL failed to connect. More...
 
constexpr auto ERR_JSON_PARSE_FAILED = "ERR_JSON_PARSE_FAILED"
 Used when JSON parse failed. More...
 
constexpr auto ERR_INVALID_RESPONSE = "ERR_INVALID_RESPONSE"
 Used when there was an unexpected response from the server. More...
 
constexpr auto ERR_INVALID_REQUEST = "ERR_INVALID_REQUEST"
 Used when an unexpected request was issued. More...
 
constexpr auto ERR_ROOM_ID_UNDEFINED = "ERR_ROOM_ID_UNDEFINED"
 Used when you are not connected to a room but getRoomStatus() and deleteRoom() was passed nothing. More...
 
constexpr auto ERR_ROOM_DISCONNECTED = "ERR_ROOM_DISCONNECTED"
 
constexpr auto ERR_DUP_DEVICE = "ERR_DUP_DEVICE"
 
constexpr auto ERR_CONTENT_HASH_MISMATCH = "ERR_CONTENT_HASH_MISMATCH"
 
constexpr auto ERR_CONTENT_TYPE_DATA_MISMATCH = "ERR_CONTENT_TYPE_DATA_MISMATCH"
 

Enumeration Type Documentation

◆ ContentType

enum struct octane::ContentType
strong

Enum used in ContentStatus, represents the type of Content.

Enumerator
File 

Type of Content is file.

Clipboard 

Type of Content is clipboard.

MultiFile 

Type of Content is multi-file.

◆ Health

enum struct octane::Health
strong

Enum used in HealthResult, represents the server's status.

Enumerator
Healthy 

The server is working.

Degraded 

There are incidents happening in the server.

Faulty 

The server is dead.

Function Documentation

◆ err()

template<typename T_Error >
decltype(auto) octane::err ( T_Error &&  error)

Utility function to construct quasi-normal state values.

例えばResultを返す関数で以下のように使用する。 Use it as following in a function that returns Result.

SomeError someError;
return error(std::move(someError));
decltype(auto) error(const T_Error(&error)[N])
Utility function used to construct quasi-normal state values.
Definition: result.h:350
Template Parameters
T_ErrorType of quasi-normal state.
Parameters
[in]errorValue of quasi-normal state.
Returns
decltype(auto) Object indicating the constructed quasi-normal state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ error() [1/2]

template<typename T_Error >
decltype(auto) octane::error ( const T_Error &  error)

Utility function to construct quasi-normal state values.

例えばResultを返す関数で以下のように使用する。 Use it as following in a function that returns Result.

SomeError someError;
return error(someError);
Template Parameters
T_ErrorType of quasi-normal state.
Parameters
[in]errorValue of quasi-normal state.
Returns
decltype(auto) Object indicating the constructed quasi-normal state.
Here is the call graph for this function:

◆ error() [2/2]

template<typename T_Error , size_t N>
decltype(auto) octane::error ( const T_Error(&)  error[N])

Utility function used to construct quasi-normal state values.

このオーバーロードは正常系が固定長配列のときに使用される。 例えばResultを返す関数で以下のように使用する。 This overload is used when the normal state is a fixed length array. Use it as following in a function that returns Result.

return error("Error!");
Template Parameters
T_ErrorType of quasi-normal state.
NSize of array.
Parameters
[in]errorValue of quasi-normal state.
Returns
decltype(auto) Object indicating the constructed quasi-normal state.
Note
このオーバーロードはエラーを文字列リテラルで表現したかったゆえに生まれた。 okの方で実装していない理由は単に正常系で文字列リテラルを返すことがなかったから。 需要があればそちらも作成する。 This overload was created because we wanted to express errors in string literals. The reason it was not implemented in ok was simply because the normal system never returned a string literal. If there is a demand for it, we will create it too.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeError()

error_t< ErrorResponse > octane::makeError ( std::string_view  code,
std::string_view  reason 
)

Utility function to create error response.

Result<T, ErrorResponse>という形式の戻り値をもつ関数で より楽にエラーを返すために作られた。 Created to make it easier to return errors in functions which return Result<T, ErrorResponse>.

// 通常次のように記述しなければならないところ
// Usually, we had to write error response like this,
.code = ERR_SOME_ERROR,
.reason = "Error!!!",
});
// 次のように記述できる
// But now it can be written as following.
return makeError(ERR_SOME_ERROR, "Error!!!");
error_t< ErrorResponse > makeError(std::string_view code, std::string_view reason)
Utility function to create error response.
Definition: error_response.cpp:16
General stucture to represent the error.
Definition: error_response.h:24
std::string code
Error code.
Definition: error_response.h:33
Parameters
[in]codeError code.
[in]reasonReason why the error ocurred.
Returns
error_t<ErrorResponse> Object represesnting error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ok() [1/3]

template<typename T_OK = _>
ok_t< _ > octane::ok ( )

Utitlity function used when the normal state type is _.

例えばResultを返す関数で以下のように使用する。 Use it as following in a function that returns Result.

return ok();
ok_t< _ > ok()
Utitlity function used when the normal state type is _.
Definition: result.h:294
Template Parameters
T_OK_
Returns
ok_t<_> Object indicating the constructed normal state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ok() [2/3]

template<typename T_OK >
decltype(auto) octane::ok ( const T_OK &  ok)

Utility function used to construct normal state values.

例えばResultを返す関数で以下のように使用する。 Use it as following in a function that returns Result.

return ok("OK!");
Template Parameters
T_OKType of normal state.
Parameters
[in]okValue of normal state.
Returns
decltype(auto) Object indicating the constructed normal state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ok() [3/3]

template<typename T_OK >
decltype(auto) octane::ok ( T_OK &&  ok)

Utility function used to construct normal state values.

例えばResultを返す関数で以下のように使用する。 Use it as following in a function that returns Result.

return ok("OK!");
Template Parameters
T_OKType of normal state.
Parameters
[in]okValue of normal state.
Returns
decltype(auto) Object indicating the constructed normal state.
Here is the call graph for this function:

◆ operator<<() [1/5]

std::ostream & octane::operator<< ( std::ostream &  stream,
const ContentStatus contentStatus 
)

◆ operator<<() [2/5]

std::ostream & octane::operator<< ( std::ostream &  stream,
const ErrorResponse err 
)
Here is the call graph for this function:

◆ operator<<() [3/5]

std::ostream & octane::operator<< ( std::ostream &  stream,
const HealthResult healthResult 
)

◆ operator<<() [4/5]

std::ostream & octane::operator<< ( std::ostream &  stream,
const RoomId roomId 
)

◆ operator<<() [5/5]

std::ostream & octane::operator<< ( std::ostream &  stream,
const RoomStatus roomStatus 
)

◆ operator==() [1/5]

bool octane::operator== ( const ContentStatus a,
const ContentStatus b 
)

◆ operator==() [2/5]

bool octane::operator== ( const ErrorResponse a,
const ErrorResponse b 
)

◆ operator==() [3/5]

bool octane::operator== ( const HealthResult a,
const HealthResult b 
)

◆ operator==() [4/5]

bool octane::operator== ( const RoomId a,
const RoomId b 
)

◆ operator==() [5/5]

bool octane::operator== ( const RoomStatus a,
const RoomStatus b 
)

Variable Documentation

◆ DEFAULT_API_BASE_URL

constexpr auto octane::DEFAULT_API_BASE_URL = "/api/v1"
constexpr

Default base URL.

◆ DEFAULT_API_ORIGIN

constexpr auto octane::DEFAULT_API_ORIGIN = "http://localhost:3000"
constexpr

Default API origin.

◆ DEFAULT_API_TOKEN

constexpr auto octane::DEFAULT_API_TOKEN = "mock"
constexpr

Default API token.

◆ ERR_API_CLIENT_INITIALIZATION_FAILED

constexpr auto octane::ERR_API_CLIENT_INITIALIZATION_FAILED = "ERR_API_CLIENT_INITIALIZATION_FAILED"
constexpr

Used when ApiClient initialization failed.

◆ ERR_CONTENT_HASH_MISMATCH

constexpr auto octane::ERR_CONTENT_HASH_MISMATCH = "ERR_CONTENT_HASH_MISMATCH"
constexpr

◆ ERR_CONTENT_TYPE_DATA_MISMATCH

constexpr auto octane::ERR_CONTENT_TYPE_DATA_MISMATCH = "ERR_CONTENT_TYPE_DATA_MISMATCH"
constexpr

◆ ERR_CURL_CONNECTION_FAILED

constexpr auto octane::ERR_CURL_CONNECTION_FAILED = "ERR_CURL_CONNECTION_FAILED"
constexpr

Used when cURL failed to connect.

◆ ERR_CURL_INITIALIZATION_FAILED

constexpr auto octane::ERR_CURL_INITIALIZATION_FAILED = "ERR_CURL_INITIALIZATION_FAILED"
constexpr

Used when cURL initialization failed, such as inoctane::internal::HttpClient

◆ ERR_DUP_DEVICE

constexpr auto octane::ERR_DUP_DEVICE = "ERR_DUP_DEVICE"
constexpr

◆ ERR_INCORRECT_HTTP_METHOD

constexpr auto octane::ERR_INCORRECT_HTTP_METHOD = "ERR_INCORRECT_HTTP_METHOD"
constexpr

Used when an unexpected http method was issued.

◆ ERR_INVALID_REQUEST

constexpr auto octane::ERR_INVALID_REQUEST = "ERR_INVALID_REQUEST"
constexpr

Used when an unexpected request was issued.

◆ ERR_INVALID_RESPONSE

constexpr auto octane::ERR_INVALID_RESPONSE = "ERR_INVALID_RESPONSE"
constexpr

Used when there was an unexpected response from the server.

◆ ERR_JSON_PARSE_FAILED

constexpr auto octane::ERR_JSON_PARSE_FAILED = "ERR_JSON_PARSE_FAILED"
constexpr

Used when JSON parse failed.

◆ ERR_ROOM_DISCONNECTED

constexpr auto octane::ERR_ROOM_DISCONNECTED = "ERR_ROOM_DISCONNECTED"
constexpr

◆ ERR_ROOM_ID_UNDEFINED

constexpr auto octane::ERR_ROOM_ID_UNDEFINED = "ERR_ROOM_ID_UNDEFINED"
constexpr

Used when you are not connected to a room but getRoomStatus() and deleteRoom() was passed nothing.

◆ ERR_SERVER_HEALTH_STATUS_FAULTY

constexpr auto octane::ERR_SERVER_HEALTH_STATUS_FAULTY = "ERR_SERVER_HEALTH_STATUS_FAULTY"
constexpr

Used when the server has incidents and is currently not available.

◆ LIBRARY_NAME

constexpr auto octane::LIBRARY_NAME = "Octane API Client"
constexpr

Library name. Octane API Client。

◆ LIBRARY_VERSION

constexpr auto octane::LIBRARY_VERSION = "v0.1.0"
constexpr

Library version.

Naming conventions are v{MAJOR}.{MINOR}.{PATCH}