AUI Framework
master
Cross-platform module-based framework for developing C++20 desktop applications
|
Public Member Functions | |
Builder (AString url) | |
Builder (const Builder &)=delete | |
Builder & | withWriteCallback (WriteCallback callback) |
Called on server -> client data received (download). More... | |
Builder & | withMultipart (const AFormMultipart &multipart) |
Add multipart data. More... | |
Builder & | withBody (ReadCallback callback) |
Called on client -> server data requested (upload). More... | |
Builder & | withInputStream (_< IInputStream > inputStream) |
Called on client -> server data requested (upload). More... | |
Builder & | withTimeout (std::chrono::seconds timeout) |
Specifies acceptable response time. More... | |
Builder & | withBody (std::string contents) |
Like withBody with callback, but wrapped with string. | |
Builder & | withHeaderCallback (HeaderCallback headerCallback) |
Called on header received. More... | |
Builder & | withErrorCallback (ErrorCallback callback) |
Builder & | withDestinationBuffer (aui::constraint::avoid_copy< AByteBuffer > dst) |
Builder & | withOutputStream (_< IOutputStream > dst) |
Builder & | throwExceptionOnError (bool throwExceptionOnError) noexcept |
Builder & | withRanges (size_t begin, size_t end) |
Sets: Accept-Ranges: begin-end (download part of the file) More... | |
Builder & | withRanges (size_t begin) |
Sets: Accept-Ranges: begin-end (download part of the file) More... | |
Builder & | withLowSpeedLimit (size_t speed) |
Set the average transfer speed in bytes per that the transfer should be below during 'low speed time' seconds to consider it to be too slow and abort. More... | |
Builder & | withLowSpeedTime (std::chrono::seconds duration) |
Duration that the transfer speed should be below the 'low speed limit' to consider it to be too slow and abort. More... | |
Builder & | withHttpVersion (Http version) |
Builder & | withUpload (bool upload) |
Builder & | withCustomRequest (const AString &v) |
Builder & | withOnSuccess (std::function< void(ACurl &)> onSuccess) |
template<aui::invocable OnSuccess> | |
Builder & | withOnSuccess (OnSuccess &&onSuccess) |
Builder & | withMethod (Method method) noexcept |
Sets HTTP method to the query. More... | |
Builder & | withParams (const AVector< std::pair< AString, AString > > ¶ms) |
Sets HTTP params to the query. More... | |
Builder & | withParams (AString params) noexcept |
Sets HTTP params to the query. More... | |
Builder & | withHeaders (AVector< AString > headers) |
_unique< IInputStream > | toInputStream () |
Makes input stream from curl builder. More... | |
Response | runBlocking () |
Constructs ACurl object and performs curl request in blocking mode. Use toFuture() instead if possible. More... | |
AFuture< Response > | runAsync () |
Constructs ACurl object and performs curl request in global ACurlMulti. More... | |
AFuture< Response > | runAsync (ACurlMulti &curlMulti) |
Constructs ACurl object and performs curl request in specified ACurlMulti. More... | |
Friends | |
class | ACurl |
AFuture< ACurl::Response > ACurl::Builder::runAsync | ( | ) |
Constructs ACurl object and performs curl request in global ACurlMulti.
AFuture< ACurl::Response > ACurl::Builder::runAsync | ( | ACurlMulti & | curlMulti | ) |
Constructs ACurl object and performs curl request in specified ACurlMulti.
ACurl::Response ACurl::Builder::runBlocking | ( | ) |
Constructs ACurl object and performs curl request in blocking mode. Use toFuture() instead if possible.
AIOException |
_unique< IInputStream > ACurl::Builder::toInputStream | ( | ) |
Makes input stream from curl builder.
AIOException |
|
inline |
Called on client -> server data requested (upload).
callback | callback to call. |
|
inline |
|
inline |
Called on header received.
headerCallback | callback to call. |
|
inline |
Called on client -> server data requested (upload).
callback | callback to call. |
ACurl::Builder & ACurl::Builder::withLowSpeedLimit | ( | size_t | speed | ) |
Set the average transfer speed in bytes per that the transfer should be below during 'low speed time' seconds to consider it to be too slow and abort.
speed | threshold speed (bytes per second). |
ACurl::Builder & ACurl::Builder::withLowSpeedTime | ( | std::chrono::seconds | duration | ) |
Duration that the transfer speed should be below the 'low speed limit' to consider it to be too slow and abort.
duration | duration |
|
inlinenoexcept |
Sets HTTP method to the query.
GET is by default.
|
inline |
Add multipart data.
This function implies adding Content-Type: multipart and it's boundaries, setting withBody with multipart data.
Sets HTTP params to the query.
In GET, the params are encoded and appended to the url.
In POST, this value is used instead of readCallback (withBody).
ACurl::Builder & ACurl::Builder::withParams | ( | const AVector< std::pair< AString, AString > > & | params | ) |
Sets HTTP params to the query.
params | params map in key,value pairs. |
In GET, the params are encoded and appended to the url.
In POST, this value is used instead of readCallback (withBody).
|
inline |
Sets: Accept-Ranges: begin-end (download part of the file)
begin | start index of the part |
end | end index of the part. |
ACurl::Builder & ACurl::Builder::withRanges | ( | size_t | begin, |
size_t | end | ||
) |
Sets: Accept-Ranges: begin-end (download part of the file)
begin | start index of the part |
end | end index of the part. |
ACurl::Builder & ACurl::Builder::withTimeout | ( | std::chrono::seconds | timeout | ) |
Specifies acceptable response time.
|
inline |
Called on server -> client data received (download).
callback | callback to call. |