LongPort OpenAPI C++ SDK
http_client.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 #include <optional>
5 #include <string>
6 
7 #include "async_result.hpp"
8 #include "status.hpp"
9 
10 typedef struct lb_http_client_t lb_http_client_t;
11 
12 namespace longport {
13 
14 struct HttpResult
15 {
16  const char* response_body;
17 
20  {
21  }
22 };
23 
25 {
26 private:
27  lb_http_client_t* http_client_;
28 
29 public:
31  HttpClient(HttpClient&) = delete;
33 
42  HttpClient(const std::string& http_url,
43  const std::string& app_key,
44  const std::string& app_secret,
45  const std::string& access_token);
46 
48 
52  void request(const std::string& method,
53  const std::string& path,
54  const std::optional<std::map<std::string, std::string>>& headers,
55  const std::optional<std::string>& body,
57 };
58 
59 }
Definition: http_client.hpp:25
HttpClient(const std::string &http_url, const std::string &app_key, const std::string &app_secret, const std::string &access_token)
HttpClient(HttpClient &)=delete
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)
Definition: status.hpp:9
struct lb_http_client_t lb_http_client_t
Definition: http_client.hpp:10
Definition: async_result.hpp:7
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:39
Definition: http_client.hpp:15
const char * response_body
Definition: http_client.hpp:16
HttpResult(const char *response_body)
Definition: http_client.hpp:18