net-cpp ..
C++11 library for networking purposes
core::net::http::Client Class Referenceabstract

#include <client.h>

+ Inheritance diagram for core::net::http::Client:
+ Collaboration diagram for core::net::http::Client:

Classes

struct  Errors
 Summarizes error conditions. More...
 
struct  Timings
 Summarizes timing information about completed requests. More...
 

Public Member Functions

 Client (const Client &)=delete
 
virtual ~Client ()=default
 
Clientoperator= (const Client &)=delete
 
bool operator== (const Client &) const =delete
 
virtual std::string uri_to_string (const core::net::Uri &uri) const
 
virtual std::string url_escape (const std::string &s) const =0
 Percent-encodes the given string.
 
virtual std::string base64_encode (const std::string &s) const =0
 Base64-encodes the given string.
 
virtual std::string base64_decode (const std::string &s) const =0
 Base64-decodes the given string.
 
virtual Timings timings ()=0
 Queries timing statistics over all requests that have been executed by this client.
 
virtual void run ()=0
 Execute the client and any impl-specific thread-pool or runtime.
 
virtual void stop ()=0
 Stop the client and any impl-specific thread-pool or runtime.
 
virtual std::shared_ptr< Requestget (const Request::Configuration &configuration)=0
 get is a convenience method for issueing a GET request for the given URI.
 
virtual std::shared_ptr< Requesthead (const Request::Configuration &configuration)=0
 head is a convenience method for issueing a HEAD request for the given URI.
 
virtual std::shared_ptr< Requestput (const Request::Configuration &configuration, std::istream &payload, std::size_t size)=0
 put is a convenience method for issuing a PUT request for the given URI.
 
virtual std::shared_ptr< Requestpost (const Request::Configuration &configuration, const std::string &payload, const std::string &type)=0
 post is a convenience method for issuing a POST request for the given URI.
 
virtual std::shared_ptr< Requestpost_form (const Request::Configuration &configuration, const std::map< std::string, std::string > &values)
 post_form is a convenience method for issuing a POST request for the given URI, with url-encoded payload.
 
std::shared_ptr< Requestpost (const Request::Configuration &configuration, std::istream &payload, std::size_t size)
 post is a convenience method for issuing a POST request for the given URI.
 
std::shared_ptr< Requestdel (const Request::Configuration &configuration)
 del is a convenience method for issueing a DELETE request for the given URI.
 

Protected Member Functions

 Client ()=default
 

Detailed Description

Definition at line 43 of file client.h.

Constructor & Destructor Documentation

◆ Client() [1/2]

core::net::http::Client::Client ( const Client & )
delete

◆ ~Client()

virtual core::net::http::Client::~Client ( )
virtualdefault

◆ Client() [2/2]

core::net::http::Client::Client ( )
protecteddefault

Member Function Documentation

◆ base64_decode()

virtual std::string core::net::http::Client::base64_decode ( const std::string & s) const
pure virtual

Base64-decodes the given string.

◆ base64_encode()

virtual std::string core::net::http::Client::base64_encode ( const std::string & s) const
pure virtual

Base64-encodes the given string.

◆ del()

std::shared_ptr< Request > core::net::http::Client::del ( const Request::Configuration & configuration)

del is a convenience method for issueing a DELETE request for the given URI.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the provided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
Returns
An executable instance of class Request.

◆ get()

virtual std::shared_ptr< Request > core::net::http::Client::get ( const Request::Configuration & configuration)
pure virtual

get is a convenience method for issueing a GET request for the given URI.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the provided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
Returns
An executable instance of class Request.

◆ head()

virtual std::shared_ptr< Request > core::net::http::Client::head ( const Request::Configuration & configuration)
pure virtual

head is a convenience method for issueing a HEAD request for the given URI.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the provided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
Returns
An executable instance of class Request.

◆ operator=()

Client & core::net::http::Client::operator= ( const Client & )
delete

◆ operator==()

bool core::net::http::Client::operator== ( const Client & ) const
delete

◆ post() [1/2]

virtual std::shared_ptr< Request > core::net::http::Client::post ( const Request::Configuration & configuration,
const std::string & payload,
const std::string & type )
pure virtual

post is a convenience method for issuing a POST request for the given URI.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the provided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
payloadThe data to be transmitted as part of the POST request.
typeThe content-type of the data.
Returns
An executable instance of class Request.

◆ post() [2/2]

std::shared_ptr< Request > core::net::http::Client::post ( const Request::Configuration & configuration,
std::istream & payload,
std::size_t size )

post is a convenience method for issuing a POST request for the given URI.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the pro vided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
payloadThe data to be transmitted as part of the POST request.
sizeSize of the payload data in bytes.
Returns
An executable instance of class Request.

◆ post_form()

virtual std::shared_ptr< Request > core::net::http::Client::post_form ( const Request::Configuration & configuration,
const std::map< std::string, std::string > & values )
virtual

post_form is a convenience method for issuing a POST request for the given URI, with url-encoded payload.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the provided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
valuesKey-value pairs to be added to the payload in url-encoded format.
Returns
An executable instance of class Request.

◆ put()

virtual std::shared_ptr< Request > core::net::http::Client::put ( const Request::Configuration & configuration,
std::istream & payload,
std::size_t size )
pure virtual

put is a convenience method for issuing a PUT request for the given URI.

Exceptions
Errors::HttpMethodNotSupportedif the underlying implementation does not support the provided HTTP method.
Parameters
configurationThe configuration to issue a get request for.
payloadThe data to be transmitted as part of the PUT request.
sizeSize of the payload data in bytes.
Returns
An executable instance of class Request.

◆ run()

virtual void core::net::http::Client::run ( )
pure virtual

Execute the client and any impl-specific thread-pool or runtime.

◆ stop()

virtual void core::net::http::Client::stop ( )
pure virtual

Stop the client and any impl-specific thread-pool or runtime.

◆ timings()

virtual Timings core::net::http::Client::timings ( )
pure virtual

Queries timing statistics over all requests that have been executed by this client.

◆ uri_to_string()

virtual std::string core::net::http::Client::uri_to_string ( const core::net::Uri & uri) const
virtual

◆ url_escape()

virtual std::string core::net::http::Client::url_escape ( const std::string & s) const
pure virtual

Percent-encodes the given string.


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