NAM A2 Sync
This commit is contained in:
+89
-96
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -36,111 +37,103 @@
|
||||
namespace pipedal
|
||||
{
|
||||
|
||||
namespace tone3000
|
||||
class Tone3000FileDownloadRequest;
|
||||
|
||||
using tone3000_time_point = std::string; // Date in ISO 8601 format. (C++ doesn't handle timezones)
|
||||
class Tone3000Model
|
||||
{
|
||||
using tone3000_time_point = std::string; // Date in ISO 8601 format. (C++ doesn't handle timezones)
|
||||
class Tone3000Model
|
||||
{
|
||||
private:
|
||||
int64_t id_ = -1;
|
||||
std::string name_;
|
||||
std::string model_url_;
|
||||
tone3000_time_point created_at_;
|
||||
std::optional<std::string> size_;
|
||||
std::string user_id_;
|
||||
private:
|
||||
int64_t id_ = -1;
|
||||
std::string name_;
|
||||
std::string model_url_;
|
||||
tone3000_time_point created_at_;
|
||||
std::optional<std::string> size_;
|
||||
std::string user_id_;
|
||||
|
||||
public:
|
||||
JSON_GETTER_SETTER(id)
|
||||
JSON_GETTER_SETTER_REF(name)
|
||||
JSON_GETTER_SETTER_REF(model_url)
|
||||
JSON_GETTER_SETTER_REF(created_at)
|
||||
JSON_GETTER_SETTER_REF(size)
|
||||
JSON_GETTER_SETTER_REF(user_id)
|
||||
public:
|
||||
JSON_GETTER_SETTER(id)
|
||||
JSON_GETTER_SETTER_REF(name)
|
||||
JSON_GETTER_SETTER_REF(model_url)
|
||||
JSON_GETTER_SETTER_REF(created_at)
|
||||
JSON_GETTER_SETTER_REF(size)
|
||||
JSON_GETTER_SETTER_REF(user_id)
|
||||
|
||||
DECLARE_JSON_MAP(Tone3000Model);
|
||||
};
|
||||
DECLARE_JSON_MAP(Tone3000Model);
|
||||
};
|
||||
|
||||
class Tone3000User
|
||||
{
|
||||
private:
|
||||
std::string id_;
|
||||
std::optional<std::string> avatar_url_;
|
||||
std::string username_;
|
||||
std::string url_;
|
||||
class Tone3000User
|
||||
{
|
||||
private:
|
||||
std::string id_;
|
||||
std::optional<std::string> avatar_url_;
|
||||
std::string username_;
|
||||
std::string url_;
|
||||
|
||||
public:
|
||||
JSON_GETTER_SETTER_REF(id)
|
||||
JSON_GETTER_SETTER(username)
|
||||
JSON_GETTER_SETTER(url)
|
||||
public:
|
||||
JSON_GETTER_SETTER_REF(id)
|
||||
JSON_GETTER_SETTER(username)
|
||||
JSON_GETTER_SETTER(url)
|
||||
|
||||
DECLARE_JSON_MAP(Tone3000User);
|
||||
};
|
||||
DECLARE_JSON_MAP(Tone3000User);
|
||||
};
|
||||
|
||||
class Tone3000Download
|
||||
{
|
||||
private:
|
||||
int64_t id_ = -1;
|
||||
std::string user_id_;
|
||||
std::string title_;
|
||||
std::string platform_;
|
||||
std::string description_;
|
||||
tone3000_time_point created_at_;
|
||||
tone3000_time_point updated_at_;
|
||||
std::string gear_;
|
||||
std::optional<std::vector<std::string>> images_;
|
||||
bool is_public_ = true;
|
||||
std::vector<std::string> links_;
|
||||
int64_t model_count_ = 0;
|
||||
int64_t favorites_count_ = 0;
|
||||
std::string license_;
|
||||
std::optional<std::vector<std::string>> sizes_;
|
||||
Tone3000User user_;
|
||||
std::vector<Tone3000Model> models_;
|
||||
class Tone3000Download
|
||||
{
|
||||
private:
|
||||
int64_t id_ = -1;
|
||||
std::string user_id_;
|
||||
std::string title_;
|
||||
std::string description_;
|
||||
tone3000_time_point created_at_;
|
||||
tone3000_time_point updated_at_;
|
||||
std::string gear_;
|
||||
std::vector<std::string> images_;
|
||||
bool is_public_ = true;
|
||||
std::vector<std::string> links_;
|
||||
std::string platform_;
|
||||
int64_t models_count_ = 0;
|
||||
int64_t favorites_count_ = 0;
|
||||
int64_t downloads_count_ = 0;
|
||||
std::string license_;
|
||||
std::optional<std::vector<std::string>> sizes_;
|
||||
int64_t a1_models_count_ = 0;
|
||||
int64_t a2_models_count_ =0;
|
||||
int64_t irs_count_ =0;
|
||||
int64_t custom_models_count_ = 0;
|
||||
Tone3000User user_;
|
||||
std::string url_;
|
||||
|
||||
public:
|
||||
JSON_GETTER_SETTER(id)
|
||||
JSON_GETTER_SETTER_REF(user_id)
|
||||
JSON_GETTER_SETTER_REF(title)
|
||||
JSON_GETTER_SETTER_REF(platform)
|
||||
JSON_GETTER_SETTER_REF(description)
|
||||
JSON_GETTER_SETTER_REF(created_at)
|
||||
JSON_GETTER_SETTER_REF(updated_at)
|
||||
JSON_GETTER_SETTER_REF(gear)
|
||||
JSON_GETTER_SETTER_REF(images)
|
||||
JSON_GETTER_SETTER(is_public)
|
||||
JSON_GETTER_SETTER_REF(links)
|
||||
JSON_GETTER_SETTER(model_count)
|
||||
JSON_GETTER_SETTER(favorites_count)
|
||||
JSON_GETTER_SETTER_REF(license)
|
||||
JSON_GETTER_SETTER_REF(sizes)
|
||||
JSON_GETTER_SETTER_REF(user)
|
||||
JSON_GETTER_SETTER_REF(models)
|
||||
std::vector<Tone3000Model> models_;
|
||||
|
||||
DECLARE_JSON_MAP(Tone3000Download);
|
||||
};
|
||||
public:
|
||||
Tone3000Download() = default;
|
||||
Tone3000Download(const std::string&json);
|
||||
|
||||
class Tone3000DownloadResult {
|
||||
private:
|
||||
bool success_;
|
||||
std::string errorMessage_;
|
||||
public:
|
||||
JSON_GETTER_SETTER(success);
|
||||
JSON_GETTER_SETTER_REF(errorMessage);
|
||||
JSON_GETTER_SETTER(id)
|
||||
JSON_GETTER_SETTER_REF(user_id)
|
||||
JSON_GETTER_SETTER_REF(title)
|
||||
JSON_GETTER_SETTER_REF(description)
|
||||
JSON_GETTER_SETTER_REF(created_at)
|
||||
JSON_GETTER_SETTER_REF(updated_at)
|
||||
JSON_GETTER_SETTER_REF(gear)
|
||||
JSON_GETTER_SETTER_REF(images)
|
||||
JSON_GETTER_SETTER(is_public)
|
||||
JSON_GETTER_SETTER_REF(links)
|
||||
JSON_GETTER_SETTER_REF(platform)
|
||||
JSON_GETTER_SETTER(models_count)
|
||||
JSON_GETTER_SETTER(favorites_count)
|
||||
JSON_GETTER_SETTER(downloads_count)
|
||||
JSON_GETTER_SETTER_REF(license)
|
||||
JSON_GETTER_SETTER_REF(sizes)
|
||||
JSON_GETTER_SETTER_REF(a1_models_count)
|
||||
JSON_GETTER_SETTER_REF(a2_models_count)
|
||||
JSON_GETTER_SETTER_REF(irs_count)
|
||||
JSON_GETTER_SETTER_REF(custom_models_count)
|
||||
JSON_GETTER_SETTER_REF(user)
|
||||
JSON_GETTER_SETTER_REF(url)
|
||||
JSON_GETTER_SETTER_REF(models)
|
||||
|
||||
Tone3000DownloadResult();
|
||||
Tone3000DownloadResult(const std::exception &e);
|
||||
DECLARE_JSON_MAP(Tone3000Download);
|
||||
};
|
||||
|
||||
DECLARE_JSON_MAP(Tone3000DownloadResult);
|
||||
};
|
||||
|
||||
extern std::string DownloadTone3000Bundle
|
||||
(
|
||||
const std::filesystem::path&destinationFolder,
|
||||
const std::string &downloadUrl,
|
||||
int64_t downloadHandle,
|
||||
std::function<void(const Tone3000DownloadProgress&progress)> progressCallback,
|
||||
std::function<bool()> isCancelled
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user