ScummVM API documentation
onedrivestorage.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_ONEDRIVE_ONEDRIVESTORAGE_H
23 #define BACKENDS_CLOUD_ONEDRIVE_ONEDRIVESTORAGE_H
24 
25 #include "backends/cloud/basestorage.h"
26 #include "backends/networking/curl/curljsonrequest.h"
27 
28 namespace Cloud {
29 namespace OneDrive {
30 
33  OneDriveStorage(const Common::String &token, const Common::String &refreshToken, bool enabled);
34 
36  void infoInnerCallback(StorageInfoCallback outerCallback, const Networking::JsonResponse &json);
37 
38  void fileInfoCallback(Networking::NetworkReadStreamCallback outerCallback, const Networking::JsonResponse &response);
39 
40 protected:
44  Common::String cloudProvider() override;
45 
49  uint32 storageIndex() override;
50 
51  bool needsRefreshToken() override;
52 
53  bool canReuseRefreshToken() override;
54 
55 public:
58 
61 
62  ~OneDriveStorage() override;
63 
75  void saveConfig(const Common::String &keyPrefix) override;
76 
81  Common::String name() const override;
82 
86  Networking::Request *listDirectory(const Common::String &path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive = false) override;
87 
89  Networking::Request *upload(const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) override;
90 
93 
95  Networking::Request *createDirectory(const Common::String &path, BoolCallback callback, Networking::ErrorCallback errorCallback) override;
96 
98  Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) override;
99 
102 
107  static OneDriveStorage *loadFromConfig(const Common::String &keyPrefix);
108 
112  static void removeFromConfig(const Common::String &keyPrefix);
113 
114  Common::String accessToken() const { return _token; }
115 };
116 
117 } // End of namespace OneDrive
118 } // End of namespace Cloud
119 
120 #endif
void saveConfig(const Common::String &keyPrefix) override
bool canReuseRefreshToken() override
Definition: str.h:59
Definition: basestorage.h:28
Networking::Request * upload(const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) override
Common::String savesDirectoryPath() override
Definition: request.h:47
Definition: stream.h:745
Common::String cloudProvider() override
static OneDriveStorage * loadFromConfig(const Common::String &keyPrefix)
Definition: onedrivestorage.h:31
Common::String name() const override
static void removeFromConfig(const Common::String &keyPrefix)
Networking::Request * createDirectory(const Common::String &path, BoolCallback callback, Networking::ErrorCallback errorCallback) override
Common::String _token
Definition: basestorage.h:33
Definition: callback.h:49
Networking::Request * listDirectory(const Common::String &path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false) override
Networking::Request * streamFileById(const Common::String &path, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback) override
Networking::Request * info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) override
Definition: basestorage.h:30
Definition: request.h:119