117 lines
2.5 KiB
C++
117 lines
2.5 KiB
C++
//
|
|
// Created by Shell on 2026-07-14.
|
|
//
|
|
|
|
#ifndef SEADISK_SEAFILE_API_INTERFACE_HPP
|
|
#define SEADISK_SEAFILE_API_INTERFACE_HPP
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <optional>
|
|
#include <tl/expected.hpp>
|
|
|
|
#include "exception.hpp"
|
|
#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::api {
|
|
|
|
class ISeaFileApi {
|
|
public:
|
|
|
|
virtual ~ISeaFileApi() = default;
|
|
|
|
|
|
virtual tl::expected<AuthToken, SeafileException>
|
|
authToken(
|
|
const std::string& username,
|
|
const std::string& password
|
|
) = 0;
|
|
|
|
|
|
virtual tl::expected<ServerInfo, SeafileException>
|
|
serverInfo() const = 0;
|
|
|
|
|
|
virtual tl::expected<DefaultRepo, SeafileException>
|
|
defaultRepo(
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<RepoInfo, SeafileException>
|
|
repoInfo(
|
|
const std::string& repo_id,
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<std::vector<RepoEntry>, SeafileException>
|
|
repoDir(
|
|
const std::string& repo_id,
|
|
const std::string& path,
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<AccountInfo, SeafileException>
|
|
accountInfo(
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<FileInfo, SeafileException>
|
|
fileDetail(
|
|
const std::string& repo_id,
|
|
const std::string& path,
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<std::string, SeafileException>
|
|
downloadFileUrl(
|
|
const std::string& repo_id,
|
|
const std::string& path,
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<std::string, SeafileException>
|
|
downloadFile(
|
|
const std::string& repo_id,
|
|
const std::string& path,
|
|
std::optional<size_t> start,
|
|
std::optional<size_t> end,
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
|
|
virtual tl::expected<DirInfo, SeafileException>
|
|
dirDetail(
|
|
const std::string& repo_id,
|
|
const std::string& path,
|
|
const std::string& token,
|
|
TokenType token_type
|
|
) const = 0;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif //SEADISK_SEAFILE_API_INTERFACE_HPP
|