Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
Mads::HttpsClient Class Reference

Portable HTTPS GET client with zero external dependencies. More...

#include <https_client.hpp>

Classes

struct  Response
 Result of an HTTPS GET request. More...
 

Public Member Functions

 HttpsClient ()
 
 ~HttpsClient ()
 
 HttpsClient (const HttpsClient &)=delete
 
HttpsClientoperator= (const HttpsClient &)=delete
 
void set_hostname (const std::string &hostname)
 Set the remote hostname (without https:// prefix)
 
void set_path (const std::string &path)
 Set the API path on the remote server.
 
void set_user_agent (const std::string &user_agent)
 Set the User-Agent header.
 
void add_query_pair (const std::string &k, const std::string &v)
 Add a query pair.
 
std::string query_string ()
 
Response get ()
 Perform HTTPS GET request to configured endpoint.
 

Detailed Description

Portable HTTPS GET client with zero external dependencies.

Uses platform-native APIs:

  • macOS: Foundation framework (CFNetwork)
  • Linux: OpenSSL (system library)
  • Android: not currently implemented
  • Windows: WinHTTP

Definition at line 18 of file https_client.hpp.

Constructor & Destructor Documentation

◆ HttpsClient() [1/2]

Mads::HttpsClient::HttpsClient ( )

◆ ~HttpsClient()

Mads::HttpsClient::~HttpsClient ( )

◆ HttpsClient() [2/2]

Mads::HttpsClient::HttpsClient ( const HttpsClient )
delete

Member Function Documentation

◆ add_query_pair()

void Mads::HttpsClient::add_query_pair ( const std::string &  k,
const std::string &  v 
)

Add a query pair.

Parameters
key
value

◆ get()

Response Mads::HttpsClient::get ( )

Perform HTTPS GET request to configured endpoint.

Returns
Response containing status code, message, and body
Exceptions
std::runtime_erroron network or system errors

◆ operator=()

HttpsClient & Mads::HttpsClient::operator= ( const HttpsClient )
delete

◆ query_string()

std::string Mads::HttpsClient::query_string ( )

◆ set_hostname()

void Mads::HttpsClient::set_hostname ( const std::string &  hostname)

Set the remote hostname (without https:// prefix)

Parameters
hostnamee.g., "api.example.com"

◆ set_path()

void Mads::HttpsClient::set_path ( const std::string &  path)

Set the API path on the remote server.

Parameters
pathe.g., "/v1/status" or "/api/data"

◆ set_user_agent()

void Mads::HttpsClient::set_user_agent ( const std::string &  user_agent)

Set the User-Agent header.

Parameters
user_agente.g., "MyApp/1.0"

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