40 lines
856 B
C++
40 lines
856 B
C++
#pragma once
|
|
|
|
#include <json-c/json.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace drive {
|
|
typedef struct {
|
|
std::string name, id, parent;
|
|
bool isDir = false;
|
|
size_t size;
|
|
} gdItem;
|
|
} // namespace drive
|
|
|
|
class alipan {
|
|
public:
|
|
virtual ~alipan() = default;
|
|
|
|
bool checkLogin();
|
|
void getListWithParent(const std::string& _parent, std::vector<drive::gdItem>& _out);
|
|
bool createDir(const std::string& _dirName, const std::string& _parent);
|
|
bool deleteFile(const std::string& _fileID);
|
|
|
|
private:
|
|
std::string deviceId;
|
|
std::string accessToken;
|
|
std::string rToken;
|
|
|
|
std::string driveId;
|
|
std::string userId;
|
|
std::string signature;
|
|
|
|
json_object* request(const std::string& api, const std::string& data);
|
|
|
|
bool getSelfuser();
|
|
bool refreshToken();
|
|
bool createSession();
|
|
bool qrLogin();
|
|
};
|