40 lines
882 B
C++
40 lines
882 B
C++
#pragma once
|
|
|
|
#include <variant>
|
|
#include <string>
|
|
#include <functional>
|
|
#include <optional>
|
|
|
|
namespace bts {
|
|
namespace utils {
|
|
|
|
struct DownloadSuccess {
|
|
std::string const sftp_file_path;
|
|
std::string const local_file_path;
|
|
};
|
|
struct DownloadFailure {
|
|
std::string const error_msg;
|
|
};
|
|
using DownloadResult = std::variant<DownloadSuccess, DownloadFailure>;
|
|
using FilePicker = std::function<std::optional<std::string>(std::vector<std::string> const&)>;
|
|
|
|
void begin_sftp_download(
|
|
const std::string host,
|
|
uint32_t port,
|
|
const std::string& user,
|
|
const std::string& password,
|
|
uint32_t time_out_secs,
|
|
const FilePicker& picker,
|
|
std::function<void(DownloadResult const &)> const);
|
|
|
|
DownloadResult sftp_download(
|
|
const std::string host,
|
|
uint32_t port,
|
|
const std::string& user,
|
|
const std::string& password,
|
|
const FilePicker& on_choose);
|
|
|
|
|
|
}}//ns
|
|
|