olp-cpp-sdk
1.21.0
|
A network request abstraction for an HTTP request. More...
#include <NetworkRequest.h>
Public Types | |
enum class | HttpVerb { GET = 0 , POST = 1 , HEAD = 2 , PUT = 3 , DEL = 4 , PATCH = 5 , OPTIONS = 6 } |
The HTTP method, as specified at https://tools.ietf.org/html/rfc2616. More... | |
using | RequestBodyType = std::shared_ptr< const std::vector< std::uint8_t > > |
An alias for the HTTP request body. | |
Public Member Functions | |
NetworkRequest (std::string url) | |
Creates the NetworkRequest instance. More... | |
const Headers & | GetHeaders () const |
Gets all HTTP headers. More... | |
Headers & | GetMutableHeaders () |
Gets the mutable reference to the HTTP headers. More... | |
NetworkRequest & | WithHeader (std::string name, std::string value) |
Adds an extra HTTP header. More... | |
const std::string & | GetUrl () const |
Gets the request URL. More... | |
NetworkRequest & | WithUrl (std::string url) |
Sets the request URL. More... | |
HttpVerb | GetVerb () const |
Gets the HTTP method. More... | |
NetworkRequest & | WithVerb (HttpVerb verb) |
Sets the HTTP method. More... | |
RequestBodyType | GetBody () const |
Gets the request body. More... | |
NetworkRequest & | WithBody (RequestBodyType body) |
Sets the request body. More... | |
const NetworkSettings & | GetSettings () const |
Gets the network settings for this request. More... | |
NetworkRequest & | WithSettings (NetworkSettings settings) |
Sets network settings for this request. More... | |
A network request abstraction for an HTTP request.
|
strong |
The HTTP method, as specified at https://tools.ietf.org/html/rfc2616.
|
explicit |
Creates the NetworkRequest
instance.
[in] | url | The URL of the HTTP request. |
RequestBodyType olp::http::NetworkRequest::GetBody | ( | ) | const |
Gets the request body.
const Headers& olp::http::NetworkRequest::GetHeaders | ( | ) | const |
Gets all HTTP headers.
Headers& olp::http::NetworkRequest::GetMutableHeaders | ( | ) |
Gets the mutable reference to the HTTP headers.
const NetworkSettings& olp::http::NetworkRequest::GetSettings | ( | ) | const |
Gets the network settings for this request.
NetworkSettings
object. const std::string& olp::http::NetworkRequest::GetUrl | ( | ) | const |
Gets the request URL.
HttpVerb olp::http::NetworkRequest::GetVerb | ( | ) | const |
Gets the HTTP method.
NetworkRequest& olp::http::NetworkRequest::WithBody | ( | RequestBodyType | body | ) |
Sets the request body.
[in] | body | The shared pointer to the vector that contains the request body. |
NetworkRequest& olp::http::NetworkRequest::WithHeader | ( | std::string | name, |
std::string | value | ||
) |
Adds an extra HTTP header.
[in] | name | The header name. |
[in] | value | The header value. |
NetworkRequest& olp::http::NetworkRequest::WithSettings | ( | NetworkSettings | settings | ) |
Sets network settings for this request.
[in] | settings | The NetworkRequest instance. |
NetworkRequest& olp::http::NetworkRequest::WithUrl | ( | std::string | url | ) |
Sets the request URL.
[in] | url | The request URL. |
NetworkRequest& olp::http::NetworkRequest::WithVerb | ( | HttpVerb | verb | ) |
Sets the HTTP method.
[in] | verb | The HTTP method. |