ScummVM API documentation
dropboxstorage.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BACKENDS_CLOUD_DROPBOX_STORAGE_H
23 #define BACKENDS_CLOUD_DROPBOX_STORAGE_H
24 
25 #include "backends/cloud/basestorage.h"
26 #include "common/callback.h"
27 #include "backends/networking/curl/curljsonrequest.h"
28 
29 namespace Cloud {
30 namespace Dropbox {
31 
34  DropboxStorage(const Common::String &token, const Common::String &refreshToken, bool enabled);
35 
36 protected:
40  Common::String cloudProvider() override;
41 
45  uint32 storageIndex() override;
46 
47  bool needsRefreshToken() override;
48 
49  bool canReuseRefreshToken() override;
50 
51 public:
54 
57 
58  ~DropboxStorage() override;
59 
71  void saveConfig(const Common::String &keyPrefix) override;
72 
77  Common::String name() const override;
78 
82  Networking::Request *listDirectory(const Common::String &path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive = false) override;
83 
85  Networking::Request *upload(const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) override;
86 
89 
91  Networking::Request *createDirectory(const Common::String &path, BoolCallback callback, Networking::ErrorCallback errorCallback) override;
92 
94  Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) override;
95 
98 
103  static DropboxStorage *loadFromConfig(const Common::String &keyPrefix);
104 
108  static void removeFromConfig(const Common::String &keyPrefix);
109 
110  Common::String accessToken() const { return _token; }
111 };
112 
113 } // End of namespace Dropbox
114 } // End of namespace Cloud
115 
116 #endif
Definition: str.h:59
Definition: basestorage.h:28
static DropboxStorage * loadFromConfig(const Common::String &keyPrefix)
bool needsRefreshToken() override
static void removeFromConfig(const Common::String &keyPrefix)
Networking::Request * streamFileById(const Common::String &path, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback) override
Definition: request.h:47
Definition: stream.h:745
Common::String name() const override
uint32 storageIndex() override
bool canReuseRefreshToken() override
Common::String _token
Definition: basestorage.h:33
Networking::Request * upload(const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) override
Definition: callback.h:49
Networking::Request * listDirectory(const Common::String &path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false) override
Networking::Request * createDirectory(const Common::String &path, BoolCallback callback, Networking::ErrorCallback errorCallback) override
Networking::Request * info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) override
Definition: dropboxstorage.h:32
Definition: basestorage.h:30
Common::String savesDirectoryPath() override
void saveConfig(const Common::String &keyPrefix) override
Common::String cloudProvider() override
Definition: request.h:119