#include <SimpleNetworkStack.h>
◆ Result
◆ ResultFunc
◆ ResultPromise
◆ ErrorType
Enumerator |
---|
PerformError | |
OptUrlError | |
OptFollowLocationError | |
OptWriteFuncError | |
OptWriteDataError | |
OptUseragentError | |
◆ SimpleNetworkStack()
ArcdpsExtension::SimpleNetworkStack::SimpleNetworkStack |
( |
| ) |
|
◆ ~SimpleNetworkStack()
ArcdpsExtension::SimpleNetworkStack::~SimpleNetworkStack |
( |
| ) |
|
|
override |
◆ QueueGet() [1/3]
void ArcdpsExtension::SimpleNetworkStack::QueueGet |
( |
const std::string & |
pUrl, |
|
|
const ResultFunc & |
pFunc, |
|
|
const std::filesystem::path & |
pFilepath = "" |
|
) |
| |
Performs a Get-Request and will call pFunc when the response is gathered. If a filepath is provided, the response will be saved in that file and the Result will have an empty string.
Usage:
if (response) {
std::cout << response.value().Code << " --> " << response.value().Message << std::endl;
}
});
std::expected< Response, Error > Result
Definition SimpleNetworkStack.h:38
- Parameters
-
pUrl | The URL to call |
pFunc | The function that will be called with the response |
pFilepath | Optional filepath to save the response to |
◆ QueueGet() [2/3]
void ArcdpsExtension::SimpleNetworkStack::QueueGet |
( |
const std::string & |
pUrl, |
|
|
const std::filesystem::path & |
pFilepath = "" |
|
) |
| |
Performs a Get-Request.
Usage:
if (response) {
std::cout << response.value().Code << " --> " << response.value().Message << std::endl;
}
});
- Parameters
-
pUrl | The URL to call |
pFilepath | Optional filepath to save the response to |
◆ QueueGet() [3/3]
void ArcdpsExtension::SimpleNetworkStack::QueueGet |
( |
const std::string & |
pUrl, |
|
|
ResultPromise |
pPromise, |
|
|
const std::filesystem::path & |
pFilepath = "" |
|
) |
| |
Performs a Get-Request and will resolve the promise when the response is gathered. If a filepath is provided, the response will be saved in that file and the Result will have an empty string.
Usage:
std::promise<SimpleNetworkStack::Result> promise;
auto future = barrier.get_future();
QueueGet(
"https://example.com/", std::move(promise));
void QueueGet(const std::string &pUrl, const std::filesystem::path &pFilepath="")
Definition SimpleNetworkStack.cpp:103
- Parameters
-
pUrl | The URL to call |
pPromise | Promise that will resolved with the response |
pFilepath | Optional filepath to save the response to |
◆ SetUserAgent()
void ArcdpsExtension::SimpleNetworkStack::SetUserAgent |
( |
const std::string & |
pUserAgent | ) |
|
|
inline |
Set a different user-agent instead of the default "ArcdpsExtension/1.0"
- Parameters
-
◆ UrlEncode()
std::string ArcdpsExtension::SimpleNetworkStack::UrlEncode |
( |
std::string_view |
pStr | ) |
const |
URL encode a string. Wrapper for curl_easy_escape
.
- Parameters
-
- Returns
- encoded string
The documentation for this class was generated from the following files: