ScummVM API documentation
googledrivestorage.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_GOOGLEDRIVE_GOOGLEDRIVESTORAGE_H
23#define BACKENDS_CLOUD_GOOGLEDRIVE_GOOGLEDRIVESTORAGE_H
24
25#include "backends/cloud/id/idstorage.h"
26#include "backends/networking/http/httpjsonrequest.h"
27
28namespace Cloud {
29namespace GoogleDrive {
30
33 GoogleDriveStorage(const Common::String &token, const Common::String &refreshToken, bool enabled);
34
36 void infoInnerCallback(StorageInfoCallback outerCallback, const Networking::JsonResponse &json);
37
39 void createDirectoryInnerCallback(BoolCallback outerCallback, const Networking::JsonResponse &json);
40
41 void printInfo(const StorageInfoResponse &response);
42
43protected:
48
52 uint32 storageIndex() override;
53
54 bool needsRefreshToken() override;
55
56 bool canReuseRefreshToken() override;
57
58public:
61
64
65 ~GoogleDriveStorage() override;
66
78 void saveConfig(const Common::String &keyPrefix) override;
79
84 Common::String name() const override;
85
90
93
96
98 Networking::Request *createDirectoryWithParentId(const Common::String &parentId, const Common::String &directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback) override;
99
102
105
111
115 static void removeFromConfig(const Common::String &keyPrefix);
116
117 Common::String getRootDirectoryId() override;
118
119 Common::String accessToken() const { return _token; }
120};
121
122} // End of namespace GoogleDrive
123} // End of namespace Cloud
124
125#endif
Common::String _token
Definition: basestorage.h:33
Definition: googledrivestorage.h:31
Networking::Request * upload(const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) override
void saveConfig(const Common::String &keyPrefix) override
Common::String cloudProvider() override
Networking::Request * createDirectoryWithParentId(const Common::String &parentId, const Common::String &directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback) override
GoogleDriveStorage(const Networking::JsonResponse &codeFlowJson, Networking::ErrorCallback cb)
static GoogleDriveStorage * loadFromConfig(const Common::String &keyPrefix)
Networking::Request * listDirectoryById(const Common::String &id, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback) override
Common::String name() const override
static void removeFromConfig(const Common::String &keyPrefix)
Common::String savesDirectoryPath() override
GoogleDriveStorage(const Common::String &code, Networking::ErrorCallback cb)
Networking::Request * streamFileById(const Common::String &id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback) override
Networking::Request * info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) override
Definition: idstorage.h:45
Definition: stream.h:745
Definition: str.h:59
Definition: request.h:119
Definition: request.h:47