27 #include "olp/core/CoreApi.h"
28 #include "olp/core/http/NetworkInitializationSettings.h"
29 #include "olp/core/http/NetworkRequest.h"
30 #include "olp/core/http/NetworkResponse.h"
31 #include "olp/core/http/NetworkTypes.h"
45 std::function<void(std::string key, std::string value)>;
49 const std::uint8_t* data, std::uint64_t offset, std::size_t length)>;
52 using Payload = std::shared_ptr<std::ostream>;
57 uint64_t bytes_downloaded{0ull};
60 uint64_t bytes_uploaded{0ull};
63 uint32_t total_requests{0u};
66 uint32_t total_failed{0u};
A network request abstraction for an HTTP request.
Definition: NetworkRequest.h:34
A network response abstraction for the HTTP request.
Definition: NetworkResponse.h:63
An HTTP client abstraction.
Definition: Network.h:38
std::function< void(const std::uint8_t *data, std::uint64_t offset, std::size_t length)> DataCallback
The callback that is called when a chunk of data is received.
Definition: Network.h:49
virtual Statistics GetStatistics(uint8_t bucket_id=0)
Gets the statistics for a bucket.
virtual void Cancel(RequestId id)=0
Cancels the request associated with the given RequestId.
std::shared_ptr< std::ostream > Payload
The request and response payload type.
Definition: Network.h:52
virtual void SetDefaultHeaders(Headers headers)
Sets the default network headers.
std::function< void(std::string key, std::string value)> HeaderCallback
The callback that is called when a header is received.
Definition: Network.h:45
virtual void SetCurrentBucket(uint8_t bucket_id)
Sets the current bucket statistics.
std::function< void(NetworkResponse response)> Callback
The callback that is called when the request is processed or canceled.
Definition: Network.h:41
virtual SendOutcome Send(NetworkRequest request, Payload payload, Callback callback, HeaderCallback header_callback=nullptr, DataCallback data_callback=nullptr)=0
Sends the network request.
Rrepresents the outcome of a network request.
Definition: NetworkTypes.h:76
CORE_API std::shared_ptr< Network > CreateDefaultNetwork(NetworkInitializationSettings settings)
Creates a default Network implementation.
std::uint64_t RequestId
A unique request ID.
Definition: NetworkTypes.h:41
std::vector< Header > Headers
An alias for a vector of the HTTP headers.
Definition: NetworkTypes.h:140
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24
Settings for network initialization.
Definition: NetworkInitializationSettings.h:31
Network statistics for a specific bucket.
Definition: Network.h:55