重新组织项目结构
This commit is contained in:
1 parent
28206cd50e
commit
4d7dde104d
15 files changed
+59
-83
No files matched your search
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_ACCOUNT_INFO_HPP
|
||||
#define SEADISK_ACCOUNT_INFO_HPP
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace seafile
|
||||
{
|
||||
/**
|
||||
* @brief Seafile user profile information.
|
||||
*/
|
||||
struct AccountInfo final
|
||||
{
|
||||
/// Space usage percentage.
|
||||
std::string space_usage;
|
||||
|
||||
/// User avatar URL.
|
||||
std::string avatar_url;
|
||||
|
||||
/// Login email address.
|
||||
std::string email;
|
||||
|
||||
/// Display name.
|
||||
std::string name;
|
||||
|
||||
/// Total available storage space in bytes.
|
||||
std::uint64_t total{};
|
||||
|
||||
/// Used storage space in bytes.
|
||||
std::uint64_t usage{};
|
||||
|
||||
/// Login identifier.
|
||||
std::string login_id;
|
||||
|
||||
/// User department.
|
||||
std::string department;
|
||||
|
||||
/// Contact email address.
|
||||
std::string contact_email;
|
||||
|
||||
/// Institution or organization name.
|
||||
std::string institution;
|
||||
|
||||
/// Indicates whether the user is a staff member.
|
||||
bool is_staff{};
|
||||
|
||||
/// File update notification interval.
|
||||
int file_updates_email_interval{};
|
||||
|
||||
/// Collaboration notification interval.
|
||||
int collaborate_email_interval{};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(
|
||||
AccountInfo,
|
||||
space_usage,
|
||||
avatar_url,
|
||||
email,
|
||||
name,
|
||||
total,
|
||||
usage,
|
||||
login_id,
|
||||
department,
|
||||
contact_email,
|
||||
institution,
|
||||
is_staff,
|
||||
file_updates_email_interval,
|
||||
collaborate_email_interval)
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SEADISK_ACCOUNT_INFO_HPP
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Created by Shell on 2026/6/18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_AUTH_TOKEN_HPP
|
||||
#define SEADISK_AUTH_TOKEN_HPP
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace seafile {
|
||||
struct AuthToken final {
|
||||
std::string token;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(AuthToken, token);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SEADISK_AUTH_TOKEN_HPP
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_DEFAULT_REPO_HPP
|
||||
#define SEADISK_DEFAULT_REPO_HPP
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace seafile
|
||||
{
|
||||
/**
|
||||
* default repo response
|
||||
*/
|
||||
struct DefaultRepo final
|
||||
{
|
||||
/**
|
||||
* indicates if default repo exists
|
||||
*/
|
||||
bool exists = false;
|
||||
|
||||
/**
|
||||
* default repo id
|
||||
*/
|
||||
std::optional<std::string> repo_id;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(DefaultRepo, exists, repo_id);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SEADISK_DEFAULT_REPO_HPP
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_DIR_INFO_HPP
|
||||
#define SEADISK_DIR_INFO_HPP
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
namespace seafile
|
||||
{
|
||||
/**
|
||||
* @brief Repository directory information.
|
||||
*/
|
||||
struct DirInfo final
|
||||
{
|
||||
/// Repository identifier.
|
||||
std::string repo_id;
|
||||
|
||||
/// Full directory path within the repository.
|
||||
std::string path;
|
||||
|
||||
/// Directory name.
|
||||
std::string name;
|
||||
|
||||
/// Last modification time in ISO 8601 format.
|
||||
std::string mtime;
|
||||
|
||||
/// Current user's permission (e.g. "r", "rw").
|
||||
std::string permission;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(
|
||||
DirInfo,
|
||||
repo_id,
|
||||
path,
|
||||
name,
|
||||
mtime,
|
||||
permission)
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_DIR_INFO_HPP
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Created by Shell on 2026/6/17.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_EXCEPTION_HPP
|
||||
#define SEADISK_EXCEPTION_HPP
|
||||
#include <stdexcept>
|
||||
|
||||
namespace seafile {
|
||||
class SeafileException : public std::runtime_error {
|
||||
public:
|
||||
explicit SeafileException(const std::string &msg)
|
||||
: std::runtime_error(msg) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SEADISK_EXCEPTION_HPP
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_FILE_INFO_HPP
|
||||
#define SEADISK_FILE_INFO_HPP
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace seafile
|
||||
{
|
||||
/**
|
||||
* @brief Detailed file metadata.
|
||||
*/
|
||||
struct FileInfo final
|
||||
{
|
||||
/// Object type, usually "file".
|
||||
std::string type;
|
||||
|
||||
/// File object identifier.
|
||||
std::string id;
|
||||
|
||||
/// File name.
|
||||
std::string name;
|
||||
|
||||
/// Current user's permission (e.g. "r", "rw").
|
||||
std::string permission;
|
||||
|
||||
/// Last modification time (Unix timestamp, seconds).
|
||||
std::int64_t mtime{};
|
||||
|
||||
/// Last modification time in ISO 8601 format.
|
||||
std::string last_modified;
|
||||
|
||||
/// Internal email address of the last modifier.
|
||||
std::string last_modifier_email;
|
||||
|
||||
/// Display name of the last modifier.
|
||||
std::string last_modifier_name;
|
||||
|
||||
/// Contact email address of the last modifier.
|
||||
std::string last_modifier_contact_email;
|
||||
|
||||
/// File size in bytes.
|
||||
std::uint64_t size{};
|
||||
|
||||
/// Whether the file is starred by the current user.
|
||||
bool starred{};
|
||||
|
||||
/// Total number of comments.
|
||||
std::uint32_t comment_total{};
|
||||
|
||||
/// Whether the current user can edit the file.
|
||||
bool can_edit{};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(
|
||||
FileInfo,
|
||||
type,
|
||||
id,
|
||||
name,
|
||||
permission,
|
||||
mtime,
|
||||
last_modified,
|
||||
last_modifier_email,
|
||||
last_modifier_name,
|
||||
last_modifier_contact_email,
|
||||
size,
|
||||
starred,
|
||||
comment_total,
|
||||
can_edit)
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_FILE_INFO_HPP
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_REPO_ENTRY_HPP
|
||||
#define SEADISK_REPO_ENTRY_HPP
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace seafile
|
||||
{
|
||||
/**
|
||||
* @brief File or directory entry metadata.
|
||||
*/
|
||||
struct RepoEntry final
|
||||
{
|
||||
/// Entry type ("file" or "dir").
|
||||
std::string type;
|
||||
|
||||
/// File or directory name.
|
||||
std::string name;
|
||||
|
||||
/// Object identifier.
|
||||
std::string id;
|
||||
|
||||
/// Last modification time (Unix timestamp, seconds).
|
||||
std::int64_t mtime{};
|
||||
|
||||
/// Internal email address of the last modifier.
|
||||
std::optional<std::string> modifier_email;
|
||||
|
||||
/// File size in bytes. For directories this may be 0.
|
||||
std::optional<std::uint64_t> size{};
|
||||
|
||||
/// Whether the file is currently locked.
|
||||
std::optional<bool> is_locked{};
|
||||
|
||||
/// Lock owner email or identifier. Null if unlocked.
|
||||
std::optional<std::string> lock_owner;
|
||||
|
||||
/// Lock timestamp (Unix timestamp, seconds).
|
||||
std::optional<std::int64_t> lock_time{};
|
||||
|
||||
/// Whether the current user owns the lock.
|
||||
std::optional<bool> locked_by_me{};
|
||||
|
||||
/// Current user's permission (e.g. "r", "rw").
|
||||
std::optional<std::string> permission;
|
||||
|
||||
/// Contact email address of the last modifier.
|
||||
std::optional<std::string> modifier_contact_email;
|
||||
|
||||
/// Display name of the last modifier.
|
||||
std::optional<std::string> modifier_name;
|
||||
|
||||
/// Whether the entry is starred by the current user.
|
||||
std::optional<bool> starred{};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(
|
||||
RepoEntry,
|
||||
modifier_email,
|
||||
size,
|
||||
is_locked,
|
||||
lock_owner,
|
||||
lock_time,
|
||||
locked_by_me,
|
||||
type,
|
||||
name,
|
||||
id,
|
||||
mtime,
|
||||
permission,
|
||||
modifier_contact_email,
|
||||
modifier_name,
|
||||
starred);
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_REPO_ENTRY_HPP
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_REPO_INFO_HPP
|
||||
#define SEADISK_REPO_INFO_HPP
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace seafile
|
||||
{
|
||||
/**
|
||||
*@brief Seafile repository metadata.
|
||||
*/
|
||||
struct RepoInfo final
|
||||
{
|
||||
/// Object type, usually "repo".
|
||||
std::string type;
|
||||
|
||||
/// Repository UUID.
|
||||
std::string id;
|
||||
|
||||
/// Repository owner identifier.
|
||||
std::string owner;
|
||||
|
||||
/// Repository name.
|
||||
std::string name;
|
||||
|
||||
/// Last modification time (Unix timestamp, seconds).
|
||||
std::int64_t mtime{};
|
||||
|
||||
/// Repository size in bytes.
|
||||
std::uint64_t size{};
|
||||
|
||||
/// Indicates whether the repository is encrypted.
|
||||
bool encrypted{};
|
||||
|
||||
/// Root directory object ID.
|
||||
std::string root;
|
||||
|
||||
/// Current user's permission (e.g. "r", "rw").
|
||||
std::string permission;
|
||||
|
||||
/// Internal email address of the last modifier.
|
||||
std::string modifier_email;
|
||||
|
||||
/// Contact email address of the last modifier.
|
||||
std::string modifier_contact_email;
|
||||
|
||||
/// Display name of the last modifier.
|
||||
std::string modifier_name;
|
||||
|
||||
/// Total number of files in the repository.
|
||||
std::uint64_t file_count{};
|
||||
|
||||
/// Head commit identifier.
|
||||
std::string head_commit_id;
|
||||
|
||||
/// Repository encryption version.
|
||||
int enc_version{};
|
||||
|
||||
/// Encryption salt.
|
||||
std::string salt;
|
||||
|
||||
/// Encryption magic value.
|
||||
std::string magic;
|
||||
|
||||
/// Repository random key.
|
||||
std::string random_key;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(
|
||||
RepoInfo,
|
||||
type,
|
||||
id,
|
||||
owner,
|
||||
name,
|
||||
mtime,
|
||||
size,
|
||||
encrypted,
|
||||
root,
|
||||
permission,
|
||||
modifier_email,
|
||||
modifier_contact_email,
|
||||
modifier_name,
|
||||
file_count,
|
||||
head_commit_id,
|
||||
enc_version,
|
||||
salt,
|
||||
magic,
|
||||
random_key)
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_REPO_INFO_HPP
|
||||
@@ -0,0 +1,273 @@
|
||||
//
|
||||
// Created by Shell on 2026/6/17.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_SEAFILE_API_HPP
|
||||
#define SEADISK_SEAFILE_API_HPP
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "exception.hpp"
|
||||
#include <tl/expected.hpp>
|
||||
#include <ada.h>
|
||||
#include <cpr/cpr.h>
|
||||
|
||||
#include "account_info.hpp"
|
||||
#include "auth_token.hpp"
|
||||
#include "default_repo.hpp"
|
||||
#include "dir_info.hpp"
|
||||
#include "file_info.hpp"
|
||||
#include "repo_entry.hpp"
|
||||
#include "repo_info.hpp"
|
||||
#include "server_info.hpp"
|
||||
#include "token_type.hpp"
|
||||
|
||||
namespace seafile {
|
||||
class SeaFileApi final {
|
||||
//base url of the seafile api server
|
||||
std::string base_url;
|
||||
|
||||
/**
|
||||
* @brief make a url string from given path
|
||||
* @param path url path
|
||||
* @return the whole url string
|
||||
*/
|
||||
[[nodiscard]] std::string makeUrl(const std::string &path) const {
|
||||
auto url = ada::parse(this->base_url);
|
||||
url->set_pathname(path);
|
||||
return std::string(url->get_href());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static tl::expected<T, SeafileException>
|
||||
parseResponse(const cpr::Response &response) {
|
||||
if (response.error) {
|
||||
return tl::make_unexpected(
|
||||
SeafileException(
|
||||
response.error.message));
|
||||
}
|
||||
|
||||
if (response.status_code != 200 && response.status_code != 206) {
|
||||
return tl::make_unexpected(
|
||||
SeafileException(
|
||||
std::format("Http Error: {}",
|
||||
response.status_code)));
|
||||
}
|
||||
|
||||
try {
|
||||
return nlohmann::json::parse(response.text)
|
||||
.get<T>();
|
||||
} catch (const std::exception &e) {
|
||||
return tl::make_unexpected(
|
||||
SeafileException(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
static std::string makeAuthToken(const std::string &token, const TokenType &token_type) {
|
||||
return token_type == TokenType::BEARER
|
||||
? std::format("Bearer {}", token)
|
||||
: std::format("Token {}", token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief post body and fetch result
|
||||
* @tparam T return type
|
||||
* @param path target url path
|
||||
* @param body post body data
|
||||
* @return T if success else SeafileException
|
||||
*/
|
||||
template<typename T>
|
||||
tl::expected<T, SeafileException> post(const std::string &path, const nlohmann::json &body) {
|
||||
const auto url = makeUrl(path);
|
||||
const auto response = cpr::Post(
|
||||
cpr::Url{url},
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"content-type", "application/json"}
|
||||
}, cpr::Body{body.dump()});
|
||||
return parseResponse<T>(response);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief primary constructor
|
||||
* @param base_url base url of seafile server
|
||||
*/
|
||||
explicit SeaFileApi(std::string base_url) : base_url(std::move(base_url)) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Obtain account token
|
||||
* @param username username
|
||||
* @param password password
|
||||
* @return token when success else SeafileException
|
||||
*/
|
||||
tl::expected<AuthToken, SeafileException>
|
||||
authToken(const std::string &username, const std::string &password) {
|
||||
const nlohmann::json body = {
|
||||
{"username", username},
|
||||
{"password", password}
|
||||
};
|
||||
return this->post<AuthToken>("/api2/auth-token/", body);
|
||||
}
|
||||
|
||||
tl::expected<ServerInfo, SeafileException>
|
||||
serverInfo() const {
|
||||
const auto response = cpr::Get(
|
||||
cpr::Url{makeUrl("/api2/server-info/")},
|
||||
cpr::Header{
|
||||
{"accept", "application/json"}
|
||||
});
|
||||
|
||||
return parseResponse<ServerInfo>(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the default repo of user
|
||||
* @param token token
|
||||
* @param token_type token type
|
||||
* @return default repo info
|
||||
*/
|
||||
tl::expected<DefaultRepo, SeafileException>
|
||||
defaultRepo(const std::string &token, const TokenType token_type) const {
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
const auto url = makeUrl("/api2/default-repo/");
|
||||
const auto response = cpr::Get(cpr::Url{url},
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
});
|
||||
return parseResponse<DefaultRepo>(response);
|
||||
}
|
||||
|
||||
tl::expected<RepoInfo, SeafileException>
|
||||
repoInfo(const std::string &repo_id, const std::string &token, const TokenType token_type) const {
|
||||
const auto url = makeUrl(std::format("/api2/repos/{}/", repo_id));
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
|
||||
const auto response = cpr::Get(cpr::Url{url},
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
});
|
||||
return parseResponse<RepoInfo>(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lists all the items information in the directory
|
||||
* @param repo_id repo id
|
||||
* @param path path to query
|
||||
* @param token token
|
||||
* @param token_type token type
|
||||
* @return repo entries
|
||||
*/
|
||||
tl::expected<std::vector<RepoEntry>, SeafileException>
|
||||
repoDir(const std::string &repo_id, const std::string &path, const std::string &token,
|
||||
const TokenType token_type) const {
|
||||
const auto url = cpr::Url{makeUrl(std::format("/api2/repos/{}/dir/", repo_id))};
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
|
||||
const auto response = cpr::Get(url,
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
},
|
||||
cpr::Parameters{
|
||||
{"p", path}
|
||||
});
|
||||
return parseResponse<std::vector<RepoEntry> >(response);
|
||||
}
|
||||
|
||||
tl::expected<AccountInfo, SeafileException>
|
||||
accountInfo(const std::string &token,
|
||||
const TokenType token_type) const {
|
||||
const auto url = cpr::Url{makeUrl("/api2/account/info/")};
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
|
||||
const auto response = cpr::Get(url,
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
});
|
||||
return parseResponse<AccountInfo>(response);
|
||||
}
|
||||
|
||||
tl::expected<FileInfo, SeafileException>
|
||||
fileDetail(const std::string &repo_id, const std::string &path, const std::string &token,
|
||||
const TokenType token_type) const {
|
||||
const auto url = cpr::Url{makeUrl(std::format("/api2/repos/{}/file/detail/", repo_id))};
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
|
||||
const auto response = cpr::Get(url,
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
}, cpr::Parameters{
|
||||
{"p", path}
|
||||
});
|
||||
return parseResponse<FileInfo>(response);
|
||||
}
|
||||
|
||||
tl::expected<std::string, SeafileException>
|
||||
downloadFileUrl(const std::string &repo_id, const std::string &path, const std::string &token,
|
||||
const TokenType token_type) const {
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
const auto url = cpr::Url{makeUrl(std::format("/api2/repos/{}/file/", repo_id))};
|
||||
const auto response = cpr::Get(url,
|
||||
cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
}, cpr::Parameters{
|
||||
{"p", path}
|
||||
});
|
||||
return parseResponse<std::string>(response);
|
||||
}
|
||||
|
||||
|
||||
tl::expected<std::string, SeafileException>
|
||||
downloadFile(const std::string &repo_id,
|
||||
const std::string &path,
|
||||
const std::optional<size_t> start,
|
||||
const std::optional<size_t> end,
|
||||
const std::string &token,
|
||||
const TokenType token_type) const {
|
||||
if (auto download_url = downloadFileUrl(repo_id, path, token, token_type); download_url.has_value()) {
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
const auto url = cpr::Url{download_url.value()};
|
||||
auto header = cpr::Header{
|
||||
{"authorization", auth}
|
||||
};
|
||||
const auto range = std::format(
|
||||
"bytes={}-{}",
|
||||
start ? std::to_string(*start) : "",
|
||||
end ? std::to_string(*end) : "");
|
||||
header.emplace("range", range);
|
||||
if (const auto &response = cpr::Get(url, header);
|
||||
response.error || (response.status_code != 200 && response.status_code != 206)) {
|
||||
return tl::make_unexpected(SeafileException{std::format("HTTP Error:{}", response.status_code)});
|
||||
} else {
|
||||
return response.text;
|
||||
}
|
||||
} else {
|
||||
return download_url;
|
||||
}
|
||||
}
|
||||
|
||||
tl::expected<DirInfo, SeafileException> dirDetail(const std::string &repo_id, const std::string &path,
|
||||
const std::string &token, const TokenType token_type) const {
|
||||
const auto auth = makeAuthToken(token, token_type);
|
||||
const auto url = cpr::Url{makeUrl(std::format("/api/v2.1/repos/{}/dir/detail/", repo_id))};
|
||||
const auto response = cpr::Get(url, cpr::Header{
|
||||
{"accept", "application/json"},
|
||||
{"authorization", auth}
|
||||
}, cpr::Parameters{
|
||||
{"path", path}
|
||||
});
|
||||
|
||||
return parseResponse<DirInfo>(response);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SEADISK_SEAFILE_API_HPP
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Shell on 2026/6/17.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_SERVER_INFO_HPP
|
||||
#define SEADISK_SERVER_INFO_HPP
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace seafile {
|
||||
/**
|
||||
* seafile server info
|
||||
*/
|
||||
struct ServerInfo final {
|
||||
/**
|
||||
* server version
|
||||
*/
|
||||
std::string version;
|
||||
/**
|
||||
* encrypted library version
|
||||
*/
|
||||
int encrypted_library_version = 0;
|
||||
/**
|
||||
* supported features
|
||||
*/
|
||||
std::vector<std::string> features;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(ServerInfo, version, encrypted_library_version, features);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SEADISK_SERVER_INFO_HPP
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by Shell on 2026-06-18.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_TOKEN_TYPE_HPP
|
||||
#define SEADISK_TOKEN_TYPE_HPP
|
||||
namespace seafile
|
||||
{
|
||||
enum class TokenType
|
||||
{
|
||||
TOKEN,
|
||||
BEARER
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_TOKEN_TYPE_HPP
|
||||
Reference in new issue
Block a user