Arbiter  0.0.0
dropbox.hpp
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <vector>
6 
7 #ifndef ARBITER_IS_AMALGAMATION
8 #include <arbiter/drivers/http.hpp>
9 #endif
10 
11 #ifdef ARBITER_CUSTOM_NAMESPACE
12 namespace ARBITER_CUSTOM_NAMESPACE
13 {
14 #endif
15 
16 namespace arbiter
17 {
18 
19 namespace drivers
20 {
21 
23 class Dropbox : public Http
24 {
25 public:
26  class Auth;
27  Dropbox(http::Pool& pool, const Auth& auth);
28 
32  static std::unique_ptr<Dropbox> create(
33  http::Pool& pool,
34  const Json::Value& json);
35 
36  virtual std::string type() const override { return "dropbox"; }
37  virtual void put(
38  std::string path,
39  const std::vector<char>& data,
40  http::Headers headers,
41  http::Query query = http::Query()) const override;
42 
44  class Auth
45  {
46  public:
47  explicit Auth(std::string token) : m_token(token) { }
48  const std::string& token() const { return m_token; }
49 
50  private:
51  std::string m_token;
52  };
53 
54 private:
55  virtual bool get(
56  std::string path,
57  std::vector<char>& data,
58  http::Headers headers,
59  http::Query query) const override;
60 
61  virtual std::unique_ptr<std::size_t> tryGetSize(
62  std::string path) const override;
63 
64  virtual std::vector<std::string> glob(
65  std::string path,
66  bool verbose) const override;
67 
68  std::string continueFileInfo(std::string cursor) const;
69 
70  http::Headers httpGetHeaders() const;
71  http::Headers httpPostHeaders() const;
72 
73  Auth m_auth;
74 };
75 
76 } // namespace drivers
77 } // namespace arbiter
78 
79 #ifdef ARBITER_CUSTOM_NAMESPACE
80 }
81 #endif
82 
Dropbox driver.
Definition: dropbox.hpp:23
virtual std::string type() const override
Definition: dropbox.hpp:36
HTTP driver. Intended as both a standalone driver as well as a base for derived drivers build atop HT...
Definition: http.hpp:29
Dropbox authentication information.
Definition: dropbox.hpp:44
Definition: arbiter.cpp:16