Connection object for advanced usage.
More...
#include <connection.h>
|
struct | Info |
| holds some diagnostics information about the connection object it came from More...
|
|
struct | RequestInfo |
| holds some diagnostics information about a request More...
|
|
Connection object for advanced usage.
RestClient::Connection::Connection |
( |
const std::string & |
baseUrl | ) |
|
|
explicit |
constructor for the Connection object
- Parameters
-
baseUrl | - base URL for the connection to use |
void RestClient::Connection::AppendHeader |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
append a header to the internal map
- Parameters
-
key | for the header field |
value | for the header field |
HTTP DELETE method.
- Parameters
-
- Returns
- response struct
we want HTTP DELETE
set HTTP DELETE METHOD
void RestClient::Connection::FollowRedirects |
( |
bool |
follow | ) |
|
configure whether to follow redirects on this connection
- Parameters
-
follow | - boolean whether to follow redirects |
HTTP GET method.
- Parameters
-
- Returns
- response struct
std::string RestClient::Connection::GetUserAgent |
( |
| ) |
|
get the user agent to add to the request
- Returns
- user agent as std::string
HTTP HEAD method.
- Parameters
-
- Returns
- response struct
we want HTTP HEAD
set HTTP HEAD METHOD
RestClient::Response RestClient::Connection::post |
( |
const std::string & |
url, |
|
|
const std::string & |
data |
|
) |
| |
HTTP POST method.
- Parameters
-
url | to query |
data | HTTP POST body |
- Returns
- response struct
Now specify we want to POST data
set post fields
RestClient::Response RestClient::Connection::put |
( |
const std::string & |
url, |
|
|
const std::string & |
data |
|
) |
| |
HTTP PUT method.
- Parameters
-
url | to query |
data | HTTP PUT body |
- Returns
- response struct
initialize upload object
Now specify we want to PUT data
set read callback function
set data object to pass to callback function
set data size
void RestClient::Connection::SetBasicAuth |
( |
const std::string & |
username, |
|
|
const std::string & |
password |
|
) |
| |
set username and password for basic auth
- Parameters
-
void RestClient::Connection::SetCAInfoFilePath |
( |
const std::string & |
caInfoFilePath | ) |
|
set custom Certificate Authority (CA) path
- Parameters
-
caInfoFilePath | - The path to a file holding the certificates used to verify the peer with. See CURLOPT_CAINFO |
set the custom headers map. This will replace the currently configured headers with the provided ones. If you want to add additional headers, use AppendHeader()
- Parameters
-
void RestClient::Connection::SetTimeout |
( |
int |
seconds | ) |
|
set timeout for connection
- Parameters
-
seconds | - timeout in seconds |
void RestClient::Connection::SetUserAgent |
( |
const std::string & |
userAgent | ) |
|
set custom user agent for connection. This gets prepended to the default restclient-cpp/RESTCLIENT_VERSION string
- Parameters
-
userAgent | - custom userAgent prefix |
The documentation for this class was generated from the following files: