olp-cpp-sdk  1.19.0
Public Member Functions | Static Public Attributes | List of all members
olp::http::SendOutcome Class Referencefinal

Rrepresents the outcome of a network request. More...

#include <NetworkTypes.h>

Public Member Functions

 SendOutcome (RequestId request_id)
 Sets a successful request outcome. More...
 
 SendOutcome (ErrorCode error_code)
 Sets an unsuccessful request outcome. More...
 
bool IsSuccessful () const
 Checks if the network request push was successful. More...
 
RequestId GetRequestId () const
 Gets the request ID. More...
 
ErrorCode GetErrorCode () const
 Gets the error code. More...
 

Static Public Attributes

static constexpr RequestId kInvalidRequestId
 The invalid request ID alias. More...
 

Detailed Description

Rrepresents the outcome of a network request.

It contains either a valid request ID or error code if the request trigger failed. The caller must check whether the outcome of the request was a success before attempting to access the result or error.

Constructor & Destructor Documentation

◆ SendOutcome() [1/2]

olp::http::SendOutcome::SendOutcome ( RequestId  request_id)
inlineexplicit

Sets a successful request outcome.

Parameters
request_idThe valid unique request ID.

◆ SendOutcome() [2/2]

olp::http::SendOutcome::SendOutcome ( ErrorCode  error_code)
inlineexplicit

Sets an unsuccessful request outcome.

Parameters
error_codeThe error code that specifies why the request failed.

Member Function Documentation

◆ GetErrorCode()

ErrorCode olp::http::SendOutcome::GetErrorCode ( ) const
inline

Gets the error code.

Returns
ErrorCode::SUCCESS if the request was successful; any other ErrorCode otherwise.

◆ GetRequestId()

RequestId olp::http::SendOutcome::GetRequestId ( ) const
inline

Gets the request ID.

Returns
The valid request ID if the request was successful; RequestIdConstants::RequestIdInvalid otherwise.

◆ IsSuccessful()

bool olp::http::SendOutcome::IsSuccessful ( ) const
inline

Checks if the network request push was successful.

Returns
True if there is no error and the request ID is valid; false otherwise.

Member Data Documentation

◆ kInvalidRequestId

constexpr RequestId olp::http::SendOutcome::kInvalidRequestId
staticconstexpr
Initial value:
=
@ RequestIdInvalid
The value that indicates the invalid request ID.
std::uint64_t RequestId
A unique request ID.
Definition: NetworkTypes.h:41

The invalid request ID alias.


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