init http framework
This commit is contained in:
35
include/drive.h
Normal file
35
include/drive.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
enum drive_type {
|
||||
dt_alipan,
|
||||
dt_filebrowser,
|
||||
};
|
||||
|
||||
/// @brief file entry
|
||||
struct dItem {
|
||||
std::string id;
|
||||
std::string name;
|
||||
bool folder;
|
||||
};
|
||||
|
||||
class drive {
|
||||
public:
|
||||
virtual ~drive() {}
|
||||
typedef std::shared_ptr<drive> ref;
|
||||
typedef void (*fnQrcode)(const std::string&);
|
||||
|
||||
virtual int qrLogin(fnQrcode printQr) = 0;
|
||||
virtual std::vector<dItem> list(const std::string& file_id) = 0;
|
||||
virtual std::string mkdir(const std::string& parent_id, const std::string& name) = 0;
|
||||
virtual std::string upload(const std::string& parent_id, const std::string& file) = 0;
|
||||
};
|
||||
|
||||
/// @brief factory funtion
|
||||
drive::ref new_drive(drive_type type);
|
||||
|
||||
std::string hex_encode(const unsigned char* data, size_t len);
|
||||
|
||||
Reference in New Issue
Block a user