Files
seadisk/include/seafile/api/seafile_api_interface.hpp
T
2026-07-21 22:00:38 +08:00

99 lines
2.3 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>
auth(
const std::string &username,
const std::string &password
) = 0;
virtual tl::expected<ServerInfo, SeafileException>
serverInfo() const = 0;
virtual tl::expected<DefaultRepo, SeafileException>
defaultRepo() const = 0;
virtual tl::expected<RepoInfo, SeafileException>
repoInfo(
const std::string &repo_id
) const = 0;
virtual tl::expected<std::vector<RepoEntry>, SeafileException>
repoDir(
const std::string &repo_id,
const std::string &path
) const = 0;
virtual tl::expected<std::vector<RepoInfo>, SeafileException>
repos(const std::string &type, const std::string &name_contains) const = 0;
virtual tl::expected<AccountInfo, SeafileException>
accountInfo() const = 0;
virtual tl::expected<FileInfo, SeafileException>
fileDetail(
const std::string &repo_id,
const std::string &path
) const = 0;
virtual tl::expected<std::string, SeafileException>
downloadFileUrl(
const std::string &repo_id,
const std::string &path
) 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 = 0;
virtual tl::expected<DirInfo, SeafileException>
dirDetail(
const std::string &repo_id,
const std::string &path
) const = 0;
};
}
#endif //SEADISK_SEAFILE_API_INTERFACE_HPP