Longbridge OpenAPI C++ SDK
oauth.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <functional>
5 #include <string>
6 
7 #include "async_result.hpp"
8 #include "status.hpp"
9 
10 typedef struct lb_oauth_t lb_oauth_t;
11 
12 namespace longbridge {
13 
18 class OAuth
19 {
20 private:
21  lb_oauth_t* oauth_;
22 
23 public:
24  explicit OAuth(lb_oauth_t* oauth);
25  OAuth(const OAuth& other);
26  OAuth(OAuth&& other);
27  OAuth& operator=(const OAuth& other);
28  OAuth& operator=(OAuth&& other);
29  ~OAuth();
30 
31  operator const lb_oauth_t*() const { return oauth_; }
32 };
33 
41 {
42 private:
43  std::string client_id_;
44  uint16_t callback_port_;
45 
46 public:
50  OAuthBuilder(const std::string& client_id, uint16_t callback_port = 0);
51 
56  void build(std::function<void(const std::string&)> open_url,
58 };
59 
60 } // namespace longbridge
Definition: oauth.hpp:41
void build(std::function< void(const std::string &)> open_url, AsyncCallback< void *, OAuth > callback)
OAuthBuilder(const std::string &client_id, uint16_t callback_port=0)
Definition: oauth.hpp:19
OAuth & operator=(const OAuth &other)
OAuth(const OAuth &other)
OAuth(lb_oauth_t *oauth)
OAuth(OAuth &&other)
OAuth & operator=(OAuth &&other)
Definition: async_result.hpp:8
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48
struct lb_oauth_t lb_oauth_t
Definition: oauth.hpp:10