summaryrefslogtreecommitdiff
path: root/protocols/CloudFile/src/Services/dropbox_service.h
blob: b6c5a7dfcddbb65bc585bdc38efa26e08a06bce0 (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
36
#ifndef _CLOUDSERVICE_DROPBOX_H_
#define _CLOUDSERVICE_DROPBOX_H_

class CDropboxService : public CCloudService
{
private:
	void __cdecl RequestAccessTokenThread(void *);
	void __cdecl RevokeAccessTokenThread(void *);

	void HandleJsonError(JSONNode &node) override;

	auto UploadFile(const char *data, size_t size, const std::string &path);
	auto CreateUploadSession(const char *chunk, size_t chunkSize);
	void UploadFileChunk(const std::string &sessionId, const char *chunk, size_t chunkSize, size_t offset);
	auto CommitUploadSession(const std::string &sessionId, const char *chunk, size_t chunkSize, size_t offset, const std::string &path);
	void CreateFolder(const std::string &path);
	auto CreateSharedLink(const std::string &path);

	void Upload(FileTransferParam *ftp) override;

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

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

	const char* GetModuleName() const override;

	int GetIconId() const override;

	bool IsLoggedIn() override;
	void Login(HWND owner = nullptr) override;
	void Logout() override;
};

#endif //_CLOUDSERVICE_DROPBOX_H_