Subscriptions - modio/modio-sdk-legacy GitHub Wiki
void Instance::subscribeToMod(u32 mod_id, const std::function<void(const modio::Response& response, const modio::Mod& mod)>& callback);
API endpoint used: Subscribe to Mod
Subscribe the authenticated user to a corresponding mod. This will automatically download the mod locally.
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
callback | const std::function<void(const modio::Response& response, const modio::Mod& mod)>& |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
response | const modio::Response& |
modio::Response object that contains the mod.io response status. |
mod | const modio::Mod& |
modio::Mod object the user just subscribed to. |
modio_instance.subscribeToMod(mod_id, [&](const modio::Response& response, const modio::Mod& mod)
{
if(response.code == 201)
{
//Subscribed to mod successfully
}
});
void Instance::unsubscribeFromMod(u32 mod_id, const std::function<void(const modio::Response& response)>& callback);
API endpoint used: Unsubscribe from Mod
Unsubscribe the authenticated user from the corresponding mod. This will automatically uninstall the mod locally.
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
callback | const std::function<void(const modio::Response& response)>& |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
response | const modio::Response& |
modio::Response object that contains the mod.io response status. |
modio_instance.unsubscribeFromMod(mod_id, [&](const modio::Response& response)
{
if(response.code == 204)
{
//Unsubscribed from mod successfully
}
});
bool Instance::isCurrentUserSubscribed(u32 mod_id)
Returns true if the authenticated user is subscribed to the corresponding mod.
Name | Type | Description |
---|---|---|
mod_id | u32 |
Id of the corresponding mod |
bool is_subscribed = isCurrentUserSubscribed(mod_id);
const std::vector<u32> getCurrentUserSubscriptions();
Returns a std::vector
of the mod ids that the current user has subscribed.
std::vector<modio::InstalledMod> installed_mods = mod_instance.getCurrentUserSubscriptions();