olp-cpp-sdk  1.18.1
Classes | Typedefs | Enumerations | Functions
olp::http Namespace Reference

Provides a platform specific network abstraction layer. More...

Classes

struct  CertificateSettings
 Settings for custom network certificate. More...
 
class  HttpStatusCode
 HTTP status codes, as specified in RFC7231. More...
 
class  Network
 An HTTP client abstraction. More...
 
struct  NetworkInitializationSettings
 Settings for network initialization. More...
 
class  NetworkProxySettings
 Contains a proxy configuration for the network interface that is applied per request. More...
 
class  NetworkRequest
 A network request abstraction for an HTTP request. More...
 
class  NetworkResponse
 A network response abstraction for the HTTP request. More...
 
class  NetworkSettings
 Contains a configuration for the network. More...
 
class  SendOutcome
 Rrepresents the outcome of a network request. More...
 
class  NetworkUtils
 Network internal utilities. More...
 

Typedefs

using RequestId = std::uint64_t
 A unique request ID. More...
 
using Header = std::pair< std::string, std::string >
 An alias for the HTTP header.
 
using Headers = std::vector< Header >
 An alias for a vector of the HTTP headers.
 

Enumerations

enum class  RequestIdConstants : RequestId { RequestIdInvalid = std::numeric_limits<RequestId>::min() , RequestIdMin = std::numeric_limits<RequestId>::min() + 1 , RequestIdMax = std::numeric_limits<RequestId>::max() }
 The list of special values for NetworkRequestId. More...
 
enum class  ErrorCode {
  SUCCESS = 0 , IO_ERROR = -1 , AUTHORIZATION_ERROR = -2 , INVALID_URL_ERROR = -3 ,
  OFFLINE_ERROR = -4 , CANCELLED_ERROR = -5 , AUTHENTICATION_ERROR = -6 , TIMEOUT_ERROR = -7 ,
  NETWORK_OVERLOAD_ERROR = -8 , UNKNOWN_ERROR = -9
}
 The common Network error codes. More...
 

Functions

OLP_SDK_DEPRECATED("Will be removed by 05.2024, use " "CreateDefaultNetwork(NetworkInitializationSettings) instead") CORE_API std CORE_API std::shared_ptr< NetworkCreateDefaultNetwork (NetworkInitializationSettings settings)
 Creates a default Network implementation. More...
 
CORE_API std::string ErrorCodeToString (ErrorCode code)
 The helper function that converts an error code to a human readable string.
 
CORE_API std::string HttpErrorToString (int http_status)
 Converts the HTTP error status code to string. More...
 

Detailed Description

Provides a platform specific network abstraction layer.

Typedef Documentation

◆ RequestId

using olp::http::RequestId = typedef std::uint64_t

A unique request ID.

Values of this type mark a unique request all the way until the request completion. This value is returned by Network::Send and used by Network::Cancel and NetworkResponse so that the user can track the request until its completion.

Enumeration Type Documentation

◆ ErrorCode

enum olp::http::ErrorCode
strong

The common Network error codes.

Enumerator
TIMEOUT_ERROR 

The timeout interval of the request expired before request was completed.

NETWORK_OVERLOAD_ERROR 

Reached maximum limit of active requests that network can process.

UNKNOWN_ERROR 

Internal error that can't be interpreted.

◆ RequestIdConstants

The list of special values for NetworkRequestId.

Enumerator
RequestIdInvalid 

The value that indicates the invalid request ID.

RequestIdMin 

The minimum value of the valid request ID.

RequestIdMax 

The maximum value of the valid request ID.

Function Documentation

◆ CreateDefaultNetwork()

OLP_SDK_DEPRECATED ( "Will be removed by 05.2024, use " "CreateDefaultNetwork(NetworkInitializationSettings) instead") CORE_API std CORE_API std::shared_ptr<Network> olp::http::CreateDefaultNetwork ( NetworkInitializationSettings  settings)

Creates a default Network implementation.

Creates a default Network implementation.

◆ HttpErrorToString()

CORE_API std::string olp::http::HttpErrorToString ( int  http_status)

Converts the HTTP error status code to string.

Parameters
http_statusThe HTTP status.
Returns
The readable string representation of http code.