2022-12-17 17:24:45 +01:00
|
|
|
#pragma once
|
|
|
|
#include "pointers.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2022-12-17 17:24:45 +01:00
|
|
|
#include <cpr/cpr.h>
|
2022-12-22 11:49:34 +01:00
|
|
|
#define AUTHORIZATION_TICKET std::format("SCAUTH val=\"{}\"", get_ticket())
|
2022-12-17 17:24:45 +01:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
class api_service
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
api_service();
|
|
|
|
~api_service();
|
|
|
|
|
|
|
|
// Returns true if an valid profile matching his username has been found
|
|
|
|
bool get_rid_from_username(std::string_view username, uint64_t& result);
|
|
|
|
|
|
|
|
// Returns true if an valid profile matching his rid has been found
|
|
|
|
bool get_username_from_rid(uint64_t rid, std::string& result);
|
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
// Returns true if the message has been successfully sended to the target
|
2022-12-17 17:24:45 +01:00
|
|
|
bool send_socialclub_message(uint64_t rid, std::string_view message);
|
2022-12-22 11:49:34 +01:00
|
|
|
|
|
|
|
// Returns true if the job data query was successfully
|
|
|
|
bool get_job_details(std::string_view job_link, nlohmann::json& result);
|
|
|
|
|
|
|
|
// Returns true if the job metadata was successfully downloaded
|
2023-01-03 11:35:11 +01:00
|
|
|
bool download_job_metadata(std::string_view content_id, int f1, int f0, int lang);
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2022-12-17 17:24:45 +01:00
|
|
|
private:
|
2023-03-01 21:27:15 +00:00
|
|
|
const std::vector<std::string> languages = {"unset", "en", "fr", "de", "it", "es", "pt", "pl", "ru", "es-mx"};
|
2022-12-22 11:49:34 +01:00
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
inline std::string get_ticket()
|
2022-12-17 17:24:45 +01:00
|
|
|
{
|
|
|
|
return g_pointers->m_sc_info->m_ticket;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
inline api_service* g_api_service;
|
|
|
|
}
|