feat(Api): Add more api endpoints to the scui api (#714)
* feat(Api): Add send message to player database * feat(cpr): Disabling test build * feat(Api): Fix max message length * feat(Api): Download job for creator menu
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
#include "script.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "services/creator_storage/creator_storage_service.hpp"
|
||||
#include "services/api/api_service.hpp"
|
||||
#include "util/scripts.hpp"
|
||||
#include "thread_pool.hpp"
|
||||
|
||||
static bool cached_creator_files = false;
|
||||
static std::vector<std::string> creator_files;
|
||||
@ -72,6 +74,37 @@ namespace big
|
||||
cached_creator_files = false;
|
||||
});
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
static char job_link[69]{};
|
||||
ImGui::InputText("SocialClub Job Link", job_link, sizeof(job_link));
|
||||
|
||||
components::button("Import", []
|
||||
{
|
||||
g_thread_pool->push([]
|
||||
{
|
||||
nlohmann::json job_details;
|
||||
if (g_api_service->get_job_details(job_link, job_details))
|
||||
{
|
||||
std::string img_src = job_details["content"]["imgSrc"];
|
||||
std::string content_part = img_src.substr(53, 27);
|
||||
|
||||
nlohmann::json job_metadata;
|
||||
|
||||
if (g_api_service->download_job_metadata(content_part))
|
||||
{
|
||||
cached_creator_files = false;
|
||||
g_notification_service->push("Job Import", "Job Import successfully done");
|
||||
}
|
||||
else {
|
||||
g_notification_service->push_error("Job Import", "Couldn't download the job metadata");
|
||||
}
|
||||
} else {
|
||||
g_notification_service->push_error("Job Import", "Couldn't get the job details");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
components::sub_title("Launch Creator");
|
||||
|
Reference in New Issue
Block a user