ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <googledrivestorage.h>

Inheritance diagram for Cloud::GoogleDrive::GoogleDriveStorage:
Collaboration diagram for Cloud::GoogleDrive::GoogleDriveStorage:

List of all members.

Public Member Functions

 GoogleDriveStorage (Common::String code)
 This constructor uses OAuth code flow to get tokens.
virtual ~GoogleDriveStorage ()
virtual void saveConfig (Common::String keyPrefix)
 Storage methods, which are used by CloudManager to save storage in configuration file.
virtual Common::String name () const
 Return unique storage name.
virtual Networking::RequestlistDirectoryById (Common::String id, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback)
 Public Cloud API comes down there.
virtual Networking::Requestupload (Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback)
 Returns UploadStatus struct with info about uploaded file.
virtual Networking::RequeststreamFileById (Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback)
 Returns pointer to Networking::NetworkReadStream.
virtual Networking::RequestcreateDirectoryWithParentId (Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback)
 Calls the callback when finished.
virtual Networking::Requestinfo (StorageInfoCallback callback, Networking::ErrorCallback errorCallback)
 Returns the StorageInfo struct.
virtual Common::String savesDirectoryPath ()
 Returns storage's saves directory path with the trailing slash.
virtual Common::String getRootDirectoryId ()
void getAccessToken (BoolCallback callback, Networking::ErrorCallback errorCallback=nullptr, Common::String code="")
 Gets new access_token.
Common::String accessToken () const

Static Public Member Functions

static GoogleDriveStorageloadFromConfig (Common::String keyPrefix)
 Load token and user id from configs and return GoogleDriveStorage for those.

Private Member Functions

 GoogleDriveStorage (Common::String token, Common::String refreshToken)
 This private constructor is called from loadFromConfig().
void tokenRefreshed (BoolCallback callback, Networking::JsonResponse response)
void codeFlowComplete (BoolResponse response)
void codeFlowFailed (Networking::ErrorResponse error)
void infoInnerCallback (StorageInfoCallback outerCallback, Networking::JsonResponse json)
 Constructs StorageInfo based on JSON response from cloud.
void createDirectoryInnerCallback (BoolCallback outerCallback, Networking::JsonResponse json)
 Returns bool based on JSON response from cloud.
void printInfo (StorageInfoResponse response)

Static Private Member Functions

static void loadKeyAndSecret ()

Private Attributes

Common::String _token
Common::String _refreshToken

Static Private Attributes

static char * KEY = nullptr
static char * SECRET = nullptr

Detailed Description

Definition at line 32 of file googledrivestorage.h.


Constructor & Destructor Documentation

Cloud::GoogleDrive::GoogleDriveStorage::GoogleDriveStorage ( Common::String  token,
Common::String  refreshToken 
) [private]

This private constructor is called from loadFromConfig().

Definition at line 71 of file googledrivestorage.cpp.

Cloud::GoogleDrive::GoogleDriveStorage::GoogleDriveStorage ( Common::String  code  ) 

This constructor uses OAuth code flow to get tokens.

Definition at line 74 of file googledrivestorage.cpp.

Cloud::GoogleDrive::GoogleDriveStorage::~GoogleDriveStorage (  )  [virtual]

Definition at line 82 of file googledrivestorage.cpp.


Member Function Documentation

Common::String Cloud::GoogleDrive::GoogleDriveStorage::accessToken (  )  const [inline]

Definition at line 112 of file googledrivestorage.h.

void Cloud::GoogleDrive::GoogleDriveStorage::codeFlowComplete ( BoolResponse  response  )  [private]

Definition at line 154 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::codeFlowFailed ( Networking::ErrorResponse  error  )  [private]

Definition at line 166 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::createDirectoryInnerCallback ( BoolCallback  outerCallback,
Networking::JsonResponse  json 
) [private]

Returns bool based on JSON response from cloud.

Definition at line 239 of file googledrivestorage.cpp.

Networking::Request * Cloud::GoogleDrive::GoogleDriveStorage::createDirectoryWithParentId ( Common::String  parentId,
Common::String  directoryName,
BoolCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Calls the callback when finished.

Implements Cloud::Id::IdStorage.

Definition at line 292 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::getAccessToken ( BoolCallback  callback,
Networking::ErrorCallback  errorCallback = nullptr,
Common::String  code = "" 
)

Gets new access_token.

If passed is "", refresh_token is used. Use "" in order to refresh token and pass a callback, so you could continue your work when new token is available.

Definition at line 84 of file googledrivestorage.cpp.

Common::String Cloud::GoogleDrive::GoogleDriveStorage::getRootDirectoryId (  )  [virtual]

Implements Cloud::Id::IdStorage.

Definition at line 345 of file googledrivestorage.cpp.

Networking::Request * Cloud::GoogleDrive::GoogleDriveStorage::info ( StorageInfoCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Returns the StorageInfo struct.

Implements Cloud::Storage.

Definition at line 316 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::infoInnerCallback ( StorageInfoCallback  outerCallback,
Networking::JsonResponse  json 
) [private]

Constructs StorageInfo based on JSON response from cloud.

Definition at line 181 of file googledrivestorage.cpp.

Networking::Request * Cloud::GoogleDrive::GoogleDriveStorage::listDirectoryById ( Common::String  id,
ListDirectoryCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Public Cloud API comes down there.

Returns Array<StorageFile> - the list of files.

Implements Cloud::Id::IdStorage.

Definition at line 260 of file googledrivestorage.cpp.

GoogleDriveStorage * Cloud::GoogleDrive::GoogleDriveStorage::loadFromConfig ( Common::String  keyPrefix  )  [static]

Load token and user id from configs and return GoogleDriveStorage for those.

Returns:
pointer to the newly created GoogleDriveStorage or 0 if some problem occured.

Definition at line 327 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::loadKeyAndSecret (  )  [static, private]

Definition at line 54 of file googledrivestorage.cpp.

Common::String Cloud::GoogleDrive::GoogleDriveStorage::name (  )  const [virtual]

Return unique storage name.

Returns:
some unique storage name (for example, "Dropbox (user@example.com)")

Implements Cloud::Storage.

Definition at line 177 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::printInfo ( StorageInfoResponse  response  )  [private]

Definition at line 285 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::saveConfig ( Common::String  keyPrefix  )  [virtual]

Storage methods, which are used by CloudManager to save storage in configuration file.

Save storage data using ConfMan.

Parameters:
keyPrefix all saved keys must start with this prefix.
Note:
every Storage must write keyPrefix + "type" key with common value (e.g. "Dropbox").

Implements Cloud::Storage.

Definition at line 172 of file googledrivestorage.cpp.

Common::String Cloud::GoogleDrive::GoogleDriveStorage::savesDirectoryPath (  )  [virtual]

Returns storage's saves directory path with the trailing slash.

Implements Cloud::Storage.

Definition at line 325 of file googledrivestorage.cpp.

Networking::Request * Cloud::GoogleDrive::GoogleDriveStorage::streamFileById ( Common::String  id,
Networking::NetworkReadStreamCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Returns pointer to Networking::NetworkReadStream.

Implements Cloud::Id::IdStorage.

Definition at line 272 of file googledrivestorage.cpp.

void Cloud::GoogleDrive::GoogleDriveStorage::tokenRefreshed ( BoolCallback  callback,
Networking::JsonResponse  response 
) [private]

Definition at line 116 of file googledrivestorage.cpp.

Networking::Request * Cloud::GoogleDrive::GoogleDriveStorage::upload ( Common::String  path,
Common::SeekableReadStream contents,
UploadCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Returns UploadStatus struct with info about uploaded file.

Implements Cloud::Storage.

Definition at line 268 of file googledrivestorage.cpp.


Member Data Documentation

char * Cloud::GoogleDrive::GoogleDriveStorage::KEY = nullptr [static, private]

Definition at line 33 of file googledrivestorage.h.

char * Cloud::GoogleDrive::GoogleDriveStorage::SECRET = nullptr [static, private]

Definition at line 33 of file googledrivestorage.h.


The documentation for this class was generated from the following files:


Generated on Sat Mar 23 2019 05:06:46 for ResidualVM by doxygen 1.7.1
curved edge   curved edge