summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/Services/google_service.h
blob: 3bb4466e57d284522f5c2a60637abb66e7fe2a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef _CLOUDFILE_GDRIVE_H_
#define _CLOUDFILE_GDRIVE_H_

class CGDriveService : public CCloudService
{
private:
	static unsigned RequestAccessTokenThread(void *owner, void *param);
	static unsigned __stdcall RevokeAccessTokenThread(void *param);

	void HandleJsonError(JSONNode &node) override;

	void UploadFile(const char *parentId, const char *name, const char *data, size_t size, CMStringA &fileId);
	void CreateUploadSession(const char *parentId, const char *name, CMStringA &uploadUri);
	void UploadFileChunk(const char *uploadUri, const char *chunk, size_t chunkSize, uint64_t offset, uint64_t fileSize, CMStringA &fileId);
	void CreateFolder(const char *path, CMStringA &folderId);
	void CreateSharedLink(const char *itemId, CMStringA &url);

public:
	CGDriveService(const char *protoName, const wchar_t *userName);

	static CGDriveService* Init(const char *szModuleName, const wchar_t *szUserName);
	static int UnInit(CGDriveService*);

	const char* GetModuleName() const override;

	int GetIconId() const override;

	bool IsLoggedIn() override;
	void Login() override;
	void Logout() override;

	UINT Upload(FileTransferParam *ftp) override;
};

#endif //_CLOUDFILE_GDRIVE_H_