Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
Ahmed Castro edited this page Jan 16, 2019 · 50 revisions

getAllMods

void Instance::getAllMods(modio::FilterCreator& filter_creator, const std::function<void(const modio::Response& response, const std::vector<modio::Mod> & mods)>& callback);

API endpoint used: Get All Mods

Browse mods on mod.io, can be filtered using the modio::FilterCreator.

Function parameters

Name Type Description
filter_creator modio::FilterCreator& modio::FilterCreator object to be customized.
callback const std::function<void(const modio::Response& response, const std::vector<modio::Mod> & mods)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.
mods const std::vector<modio::Mod>& Vector containing the returned mods.

Example

modio::FilterCreator filter_creator;
filter_creator.setLimit(3);
filter_creator.addLikeField("name", "Example Mod");
filter_creator.addLikeField("description", "This mod description was added via the SDK examples. This mod description was added via the SDK examples.");

modio_instance.getAllMods(filter_creator, [&](const modio::Response& response, const std::vector<modio::Mod> & mods)
{
  if(response.code == 200)
  {
    //Mod data successfully retrieved
  }
});

getMod

void Instance::getMod(u32 mod_id, const std::function<void(const modio::Response& response, const modio::Mod& mod)>& callback);

API endpoint used: Get Mod

Get a mod by providing its id.

Function parameters

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.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.
mod const modio::Mod& Returned mod.

Example

modio_instance.getMod(mod_id, [&](const modio::Response& response, const modio::Mod& mod)
{
  if(response.code == 200)
  {
    //Mod successfully retrieved
  }
});

addMod

void Instance::addMod(modio::ModCreator& mod_creator, const std::function<void(const modio::Response& response, const modio::Mod& mod)>& callback)

API endpoint used: Add Mod

Adds a new Mod to mod.io. Use the modio::ModCreator to set the mods fields before uploading.

Function parameters

Name Type Description
mod_creator modio::ModCreator& modio::ModCreator object containing the data that will be added.
callback const std::function<void(const modio::Response& response, const modio::Mod& mod)>& Function called once the process finished.

Calback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.
mod const modio::Mod& Resulting modio::Mod object.

Example

modio::ModCreator mod_creator;
mod_creator.setLogoPath("ModExample/logo.png");
mod_creator.setName("Example Mod Test30");
mod_creator.setHomepage("http://www.webpage.com");
mod_creator.setSummary("Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples.");
mod_creator.addTag("Easy");
mod_creator.addTag("Medium");

modio_instance.addMod(mod_creator, [&](const modio::Response& response, const modio::Mod& mod)
{
  if(response.code == 201)
  {
    //Mod successfully added
  }
});

editMod

void Instance::editMod(u32 mod_id, modio::ModEditor& mod_editor, const std::function<void(const modio::Response& response, const modio::Mod& mod)>& callback)

API endpoint used: Edit Mod

Updates the details of a corresponding mod. TODO explain the media functions

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.
mod_editor modio::ModEditor& modio::ModEditor object containing the data that will be edited.
callback const std::function<void(const modio::Response& response, const modio::Mod& mod)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.
mod const modio::Mod& Resulting modio::Mod object.

Example

modio::ModEditor mod_editor;
mod_editor.setLogoPath("ModExample/logo.png");
mod_editor.setName("Update Example");
mod_editor.setHomepage("http://www.updated.com");
mod_editor.setSummary("Mod updated via the SDK examples. Mod updated via the SDK examples. Mod updated via the SDK examples. Mod updated via the SDK examples. Mod updated via the SDK examples. Mod updated via the SDK examples.");
mod_editor.addTag("Easy");
modio_instance.editMod(requested_mod.id, mod_editor, [&](const modio::Response& response, const modio::Mod& mod)
{
  if(response.code == 200)
  {
    //Mod edited successfully
  }
});

deleteMod

void Instance::deleteMod(u32 mod_id, const std::function<void(const modio::Response& response)>& callback)

API endpoint used: Delete Mod

Deletes a mod profile.

Function parameters

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.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.

Example

modio_instance.deleteMod(requested_mod.id, [&](const modio::Response& response)
{
  if(response.code == 204)
  {
    //Mod deleted successfully
  }
});

Contents

Clone this wiki locally