summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/Services/yandex_service.h
blob: 0fdcdf679a28c11fbf51bbf99c309e10078677c7 (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_YANDEX_H_
#define _CLOUDFILE_YANDEX_H_

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

	void HandleJsonError(JSONNode &node) override;

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

	void Upload(FileTransferParam *ftp) override;

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

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

	const char* GetModuleName() const override;

	int GetIconId() const override;

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

#endif //_CLOUDFILE_YANDEX_H_