Documentation for OpenFLUID 2.2.0
openfluid::utils::HTTPClient Class Reference

#include <utils/HTTPClient.hpp>

Classes

struct  KeyValueList
 
struct  Request
 
struct  Response
 

Public Member Functions

 CPPCLASS_DEFAULT_FIVE (HTTPClient)
 
 HTTPClient (const std::string &BaseURL)
 
std::string getBaseURL () const
 
void setBaseURL (const std::string &BaseURL)
 
KeyValueListdefaultHeaders ()
 
void setAllowedRedirections (int MaxRedir)
 
void disallowRedirections ()
 
void setCertificateVerify (bool Verify)
 
Response getResource (const Request &Req) const
 
Response postResource (const Request &Req) const
 
Response putResource (const Request &Req) const
 
Response patchResource (const Request &Req) const
 
Response deleteResource (const Request &Req) const
 

Static Public Member Functions

static bool downloadToString (const std::string &URL, std::string &Content)
 
static bool downloadToFile (const std::string &URL, const std::string &FilePath)
 

Constructor & Destructor Documentation

◆ HTTPClient()

openfluid::utils::HTTPClient::HTTPClient ( const std::string &  BaseURL)

Constructs an HTTP client with the given base URL

Parameters
[in]BaseURLthe base URL used by the client that will prefix requests paths

Member Function Documentation

◆ CPPCLASS_DEFAULT_FIVE()

openfluid::utils::HTTPClient::CPPCLASS_DEFAULT_FIVE ( HTTPClient  )

◆ defaultHeaders()

KeyValueList& openfluid::utils::HTTPClient::defaultHeaders ( )
inline

The default headers added to the headers of any request

Returns
a reference to the default headers

◆ deleteResource()

Response openfluid::utils::HTTPClient::deleteResource ( const Request Req) const

Performs a DELETE request

Parameters
[in]Reqthe request data
Returns
the response to the request
Warning
not implemented

◆ disallowRedirections()

void openfluid::utils::HTTPClient::disallowRedirections ( )
inline

Disallows redirections (sets allowed redirections to -1)

◆ downloadToFile()

static bool openfluid::utils::HTTPClient::downloadToFile ( const std::string &  URL,
const std::string &  FilePath 
)
static

Downloads URL contents to file

Parameters
[in]URLThe URL for the download
[out]FilePathThe path of the file to store the downloaded contents

◆ downloadToString()

static bool openfluid::utils::HTTPClient::downloadToString ( const std::string &  URL,
std::string &  Content 
)
static

Downloads URL contents to string

Parameters
[in]URLThe URL for the download
[out]ContentThe string containing the downloaded contents

◆ getBaseURL()

std::string openfluid::utils::HTTPClient::getBaseURL ( ) const
inline

Returns the base URL of the client

Returns
the base URL used by the client that will prefix requests paths

◆ getResource()

Response openfluid::utils::HTTPClient::getResource ( const Request Req) const

Performs a GET request

Parameters
[in]Reqthe request data
Returns
the response to the request

◆ patchResource()

Response openfluid::utils::HTTPClient::patchResource ( const Request Req) const

Performs a PATCH request

Parameters
[in]Reqthe request data
Returns
the response to the request
Warning
not implemented

◆ postResource()

Response openfluid::utils::HTTPClient::postResource ( const Request Req) const

Performs a POST request

Parameters
[in]Reqthe request data
Returns
the response to the request

◆ putResource()

Response openfluid::utils::HTTPClient::putResource ( const Request Req) const

Performs a PUT request

Parameters
[in]Reqthe request data
Returns
the response to the request
Warning
not implemented

◆ setAllowedRedirections()

void openfluid::utils::HTTPClient::setAllowedRedirections ( int  MaxRedir)

Sets maximum allowed redirections

Parameters
[in]MaxRedirmaximum allowed redirections

◆ setBaseURL()

void openfluid::utils::HTTPClient::setBaseURL ( const std::string &  BaseURL)
inline

Sets the base URL of the client

Parameters
[in]BaseURLthe base URL used by the client that will prefix requests paths

◆ setCertificateVerify()

void openfluid::utils::HTTPClient::setCertificateVerify ( bool  Verify)

Enables or disables SSL certicates verification

Parameters
[in]Verifyenable or disable verification

The documentation for this class was generated from the following file: