AUI Framework
master
Cross-platform base for C++ UI apps
|
Public Member Functions# | |
Builder (AString url) | |
Builder (const Builder &)=delete | |
Builder & | withWriteCallback (WriteCallback callback) |
Called on server -> client data received (download). | |
Builder & | withWriteCallback (WriteCallbackV2 callback) |
Called on server -> client data received (download). | |
Builder & | withMultipart (const AFormMultipart &multipart) |
Add multipart data. | |
Builder & | withBody (ReadCallback callback) |
Called on client -> server data requested (upload). | |
Builder & | withInputStream (_< IInputStream > inputStream) |
Called on client -> server data requested (upload). | |
Builder & | withTimeout (std::chrono::seconds timeout) |
Specifies acceptable response time. | |
Builder & | withBody (std::string contents) |
Like withBody with callback, but wrapped with string. | |
Builder & | withHeaderCallback (HeaderCallback headerCallback) |
Called on header received. | |
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) | |
Builder & | withRanges (size_t begin) |
Sets: Accept-Ranges: begin-end (download part of the file) | |
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. | |
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. | |
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. | |
Builder & | withParams (const AVector< std::pair< AString, AString > > ¶ms) |
Sets HTTP params to the query. | |
Builder & | withParams (AString params) noexcept |
Sets HTTP params to the query. | |
Builder & | withHeaders (AVector< AString > headers) |
_unique< IInputStream > | toInputStream () |
Makes input stream from curl builder. | |
Response | runBlocking () |
Constructs ACurl object and performs curl request in blocking mode. Use toFuture() instead if possible. | |
AFuture< Response > | runAsync () |
Constructs ACurl object and performs curl request in global ACurlMulti. | |
AFuture< Response > | runAsync (ACurlMulti &curlMulti) |
Constructs ACurl object and performs curl request in specified ACurlMulti. | |
AFuture< Response > ACurl::Builder::runAsync | ( | ACurlMulti & | curlMulti | ) |
Response ACurl::Builder::runBlocking | ( | ) |
AIOException |
_unique< IInputStream > ACurl::Builder::toInputStream | ( | ) |
|
inline |
callback | callback to call. |
|
inline |
|
inline |
headerCallback | callback to call. |
|
inline |
inputStream | input stream to get data to upload from. |
Builder & ACurl::Builder::withLowSpeedLimit | ( | size_t | speed | ) |
speed | threshold speed (bytes per second). |
Builder & ACurl::Builder::withLowSpeedTime | ( | std::chrono::seconds | duration | ) |
duration | duration |
|
inlinenoexcept |
GET is by default.
|
inline |
This function implies adding Content-Type: multipart and it's boundaries, setting withBody with multipart data.
In GET, the params are encoded and appended to the url.
In POST, this value is used instead of readCallback (withBody).
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 |
begin | start index of the part |
Builder & ACurl::Builder::withRanges | ( | size_t | begin, |
size_t | end ) |
begin | start index of the part |
end | end index of the part. |
Builder & ACurl::Builder::withTimeout | ( | std::chrono::seconds | timeout | ) |
|
inline |
callback | callback to call. |
|
inline |
callback | callback to call. |