summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/Services/microsoft_service.h
blob: d99341000347fab0a38bc4b09a0a495a02b09b18 (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
#ifndef _CLOUDFILE_ONEDRIVE_H_
#define _CLOUDFILE_ONEDRIVE_H_

class COneDriveService : public CCloudService
{
private:
	void __cdecl RequestAccessTokenThread(void *param);

	void HandleJsonError(JSONNode &node) override;

	auto UploadFile(const std::string &parentId, const std::string &fileName, const char *data, size_t size);
	auto CreateUploadSession(const std::string &parentId, const std::string &fileName);
	auto UploadFileChunk(const std::string &uploadUri, const char *chunk, size_t chunkSize, uint64_t offset, uint64_t fileSize);
	auto CreateFolder(const std::string &name);
	auto CreateSharedLink(const std::string &itemId);

	void Upload(FileTransferParam *ftp) override;

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

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

	const char* GetModuleName() const override;
	
	int GetIconId() const override;

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

#endif //_CLOUDFILE_ONEDRIVE_H_