Longbridge OpenAPI C++ SDK
Public Member Functions | Static Public Member Functions | List of all members
longbridge::HttpClient Class Reference

#include <http_client.hpp>

Public Member Functions

 HttpClient ()
 
 HttpClient (HttpClient &)=delete
 
 HttpClient (HttpClient &&) noexcept
 
 ~HttpClient ()
 
void request (const std::string &method, const std::string &path, const std::optional< std::map< std::string, std::string >> &headers, const std::optional< std::string > &body, AsyncCallback< void *, HttpResult > callback)
 

Static Public Member Functions

static HttpClient from_apikey (const std::string &app_key, const std::string &app_secret, const std::string &access_token, const std::optional< std::string > &http_url=std::nullopt)
 
static HttpClient from_apikey_env (Status &status)
 
static HttpClient from_oauth (const OAuth &oauth, const std::optional< std::string > &http_url=std::nullopt)
 

Constructor & Destructor Documentation

◆ HttpClient() [1/3]

longbridge::HttpClient::HttpClient ( )

◆ HttpClient() [2/3]

longbridge::HttpClient::HttpClient ( HttpClient )
delete

◆ HttpClient() [3/3]

longbridge::HttpClient::HttpClient ( HttpClient &&  )
noexcept

◆ ~HttpClient()

longbridge::HttpClient::~HttpClient ( )

Member Function Documentation

◆ from_apikey()

static HttpClient longbridge::HttpClient::from_apikey ( const std::string &  app_key,
const std::string &  app_secret,
const std::string &  access_token,
const std::optional< std::string > &  http_url = std::nullopt 
)
static

Create a new HttpClient for API Key authentication

Parameters
app_keyApp key
app_secretApp secret
access_tokenAccess token
http_urlHTTP endpoint url (default: https://openapi.longbridge.com)

◆ from_apikey_env()

static HttpClient longbridge::HttpClient::from_apikey_env ( Status status)
static

Create a new HttpClient from environment variables (API Key mode)

Parameters
statusOut-param; set to the error if creation fails

◆ from_oauth()

static HttpClient longbridge::HttpClient::from_oauth ( const OAuth oauth,
const std::optional< std::string > &  http_url = std::nullopt 
)
static

Create a new HttpClient from an OAuth 2.0 client

Parameters
oauthOAuth 2.0 client obtained from OAuthBuilder::build
http_urlHTTP endpoint url (default: https://openapi.longbridge.com)

◆ request()

void longbridge::HttpClient::request ( const std::string &  method,
const std::string &  path,
const std::optional< std::map< std::string, std::string >> &  headers,
const std::optional< std::string > &  body,
AsyncCallback< void *, HttpResult callback 
)

Performs a HTTP request


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