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

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

	void HandleJsonError(JSONNode &node);

	char* UploadFile(const char *data, size_t size, char *path);
	void StartUploadSession(const char *data, size_t size, char *sessionId);
	void AppendToUploadSession(const char *data, size_t size, const char *sessionId, size_t offset);
	char* FinishUploadSession(const char *data, size_t size, const char *sessionId, size_t offset, char *path);
	void CreateFolder(const char *path);
	void CreateSharedLink(const char *path, char *url);

public:
	CDropboxService(HNETLIBUSER hConnection);

	const char* GetModule() const;
	const wchar_t* GetText() const;
	HANDLE GetIcon() const;
	
	bool IsLoggedIn();
	void Login();
	void Logout();

	UINT Upload(FileTransferParam *ftp);
};

#endif //_CLOUDSERVICE_DROPBOX_H_