19#ifndef CORE_NET_HTTP_CLIENT_H_
20#define CORE_NET_HTTP_CLIENT_H_
64 typedef std::chrono::duration<double>
Seconds;
105 virtual std::string
url_escape(
const std::string& s)
const = 0;
bool operator==(const Client &) const =delete
virtual std::shared_ptr< Request > post(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< Request > put(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::string uri_to_string(const core::net::Uri &uri) const
virtual std::shared_ptr< Request > head(const Request::Configuration &configuration)=0
head is a convenience method for issueing a HEAD request for the given URI.
virtual std::string base64_decode(const std::string &s) const =0
Base64-decodes the given string.
virtual ~Client()=default
virtual Timings timings()=0
Queries timing statistics over all requests that have been executed by this client.
Client(const Client &)=delete
virtual std::string base64_encode(const std::string &s) const =0
Base64-encodes the given string.
std::shared_ptr< Request > 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.
Client & operator=(const Client &)=delete
virtual std::string url_escape(const std::string &s) const =0
Percent-encodes the given string.
std::shared_ptr< Request > del(const Request::Configuration &configuration)
del is a convenience method for issueing a DELETE request for the given URI.
virtual void run()=0
Execute the client and any impl-specific thread-pool or runtime.
virtual std::shared_ptr< Request > get(const Request::Configuration &configuration)=0
get is a convenience method for issueing a GET request for the given URI.
virtual std::shared_ptr< Request > post_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 payl...
virtual void stop()=0
Stop the client and any impl-specific thread-pool or runtime.
The Request class encapsulates a request for a web resource.
CORE_NET_DLL_PUBLIC std::shared_ptr< Client > make_client()
Dispatches to the default implementation and returns a client instance.
The Uri class encapsulates the components of a URI.
HttpMethodNotSupported is thrown if the underlying impl. does not support the requested HTTP method.
HttpMethodNotSupported(Method method, const core::Location &)
Summarizes error conditions.
Summarizes timing information about completed requests.
std::chrono::duration< double > Seconds
Collection of known content types.
The Configuration struct encapsulates all options for creating requests.
#define CORE_NET_DLL_PUBLIC