MySQL 9.1.0
Source Code Documentation
RestClient Class Reference

#include <rest_client.h>

Public Types

using Request = http::client::Request
 
using HttpUri = http::base::Uri
 

Public Member Functions

 RestClient (IOContext &io_ctx, const std::string &default_host, uint16_t default_port, const std::string &default_username={}, const std::string &default_password={}, const bool use_http2=false)
 
 RestClient (IOContext &io_ctx, const HttpUri &default_uri=HttpUri{"http://127.0.0.1"}, const bool use_http2=false)
 
 RestClient (IOContext &io_ctx, TlsClientContext &&tls_context, const HttpUri &default_uri=HttpUri{"http://127.0.0.1"}, const bool use_http2=false)
 
Request request_sync (http::base::method::key_type method, const HttpUri &uri, const std::string &request_body={}, const std::string &content_type="application/json")
 
Request request_sync (http::base::method::key_type method, const std::string &path, const std::string &request_body={}, const std::string &content_type="application/json")
 
 operator bool () const
 
std::string error_msg () const
 

Static Private Member Functions

static std::string make_userinfo (const std::string &user, const std::string &password)
 

Private Attributes

net::io_contextio_context_
 
HttpUri uri_ {"/"}
 
std::unique_ptr< http::client::Clienthttp_client_
 
bool use_http2_
 

Member Typedef Documentation

◆ HttpUri

◆ Request

Constructor & Destructor Documentation

◆ RestClient() [1/3]

RestClient::RestClient ( IOContext io_ctx,
const std::string &  default_host,
uint16_t  default_port,
const std::string &  default_username = {},
const std::string &  default_password = {},
const bool  use_http2 = false 
)

◆ RestClient() [2/3]

RestClient::RestClient ( IOContext io_ctx,
const HttpUri default_uri = HttpUri{"http://127.0.0.1"},
const bool  use_http2 = false 
)
inline

◆ RestClient() [3/3]

RestClient::RestClient ( IOContext io_ctx,
TlsClientContext &&  tls_context,
const HttpUri default_uri = HttpUri{"http://127.0.0.1"},
const bool  use_http2 = false 
)
inline

Member Function Documentation

◆ error_msg()

std::string RestClient::error_msg ( ) const
inline

◆ make_userinfo()

static std::string RestClient::make_userinfo ( const std::string &  user,
const std::string &  password 
)
inlinestaticprivate

◆ operator bool()

RestClient::operator bool ( ) const
inline

◆ request_sync() [1/2]

Request RestClient::request_sync ( http::base::method::key_type  method,
const HttpUri uri,
const std::string &  request_body = {},
const std::string &  content_type = "application/json" 
)

◆ request_sync() [2/2]

Request RestClient::request_sync ( http::base::method::key_type  method,
const std::string &  path,
const std::string &  request_body = {},
const std::string &  content_type = "application/json" 
)

Member Data Documentation

◆ http_client_

std::unique_ptr<http::client::Client> RestClient::http_client_
private

◆ io_context_

net::io_context& RestClient::io_context_
private

◆ uri_

HttpUri RestClient::uri_ {"/"}
private

◆ use_http2_

bool RestClient::use_http2_
private

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