Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Modfiles

Ahmed Castro edited this page Sep 28, 2018 · 31 revisions

getAllModfiles

void getAllModfiles(u32 mod_id, modio::FilterCreator& filter, const std::function<void(const modio::Response& response, const std::vector<modio::Modfile> & modfiles)>& callback);

API endpoint used: Get All Modfiles

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

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.
filter_creator modio::FilterCreator& modio::FilterCreator object to be customized.
callback const std::function<void(const modio::Response& response, const std::vector<modio::Modfile> & modfiles)>& 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::Modfile> Vector containing the returned [Modfile] objects.

Example

modio::FilterCreator filter_creator;
filter_creator.setFilterLimit(3);

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

getModfile

void getModfile(u32 mod_id, u32 modfile_id, const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& callback);

API endpoint used: Get Mod File

Get a file.

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.
modfile_id u32 Modfiles's unique identifier.
callback const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& Function called once the process finished.

Callback parameters

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

Example:

modio_instance.getModfile(mod_id, modfile_id, [&](const modio::Response& response, const modio::Modfile& modfile)
{
  if(response.code == 200)
  {
    //Modfile successfully retrieved
  }
});

addModfile

void Instance::addModfile(u32 mod_id, modio::ModfileCreator& modfile_creator)

API endpoint used: Add Mod File

Uploads a file to a corresponding mod.

Function parameters

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

Example:

modio::ModfileCreator modfile_creator;
modfile_creator.setModfilePath("ModExample/modfile/");
modfile_creator.setModfileVersion("v1.1.0");
modfile_creator.setModfileChangelog("This is a change log, this is a changelog , this is a changelog , this is a changelog , this is a changelog , this is a changelog, this is a changelog , this is a changelog , this is a changelog");

modio_instance.addModfile(requested_mod.id, modfile_creator);

editModfile

void Instance::editModfile(u32 mod_id, u32 modfile_id, modio::ModfileEditor& modfile_editor, const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& callback)

API endpoint used: Edit Mod File

Updates the details of a corresponding modfile. Only the changelog and active fields are editable. If you want to update another field, you should add a new modfile instead.

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.
modfile_id u32 Modfile's unique identifier.
modfile_editor modio::ModfileEditor& modio::ModfileEditor object containing the data that will be edited.
callback const std::function<void(const modio::Response& response, const modio::Modfile& modfile)>& 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.
modfile const modio::Modfile& Resulting modio::Modfile object.

Example

modio::ModfileEditor modfile_editor;
modfile_editor.setModfileActive(true);
modfile_editor.setModfileChangelog("Stuff was changed on this mod via the examples.");

mod.editModfile(requested_mod.id, requested_mod.modfile.id, modfile_editor, [&](const modio::Response& response, const modio::Modfile& modfile)
{
  if(response.code == 200)
  {
    //Modfile successfully edited
  }
});

deleteModfile

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

API endpoint used: Delete Mod File

Delete a modfile.

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.
modfile_id u32 Modfile'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

mod.deleteModfile(requested_mod.id, requested_mod.modfile.id, [&](const modio::Response& response)
{
  if(response.code == 204)
  {
    //Modfile successfully deleted
  }
});

Contents

Clone this wiki locally