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 Nov 7, 2017 · 31 revisions

modioAddModfile

void modioAddModfile(int mod_id, ModioModfileHandler* modfile_handler, void (*callback)(ModioResponse* response, ModioModfile* modfile))

API endpoint used: Add Mod File

Uploads a file to a corresponding mod.

Function parameters

Name Type Description
mod_id int Mod's unique identifier
modfile_handler ModioModfileHandler* ModioModfileHandler object containing the data that will be added
callback void (*callback)(ModioResponse* response, ModioModfile* modfile) Function called once the process finished

Callback parameters

Name Type Description
response ModioResponse* ModioResponse object that contains the mod.io response status
modfile ModioModfile* Resulting ModioModfile object

Example:

void onModfileAdded(ModioResponse* response, ModioModfile* modfile)
{
  cout<<"Add Modfile Response: "<<response->code<<endl;
  if(response->code == 201)
  {
    //Modfile successfully added
  }
}

[...]

ModioModfileHandler* modfile_handler = new ModioModfileHandler();
modioInitModfileHandler(modfile_handler);
//Required
modioSetModfilePath(modfile_handler, (char*)"ModExample/modfile/");
modioSetModfileVersion(modfile_handler, (char*)"v1.0.0");
modioSetModfileChangelog(modfile_handler, (char*)"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");
//Optional
modioSetModfileActive(modfile_handler, true);

modioAddModfile(mod_id, modfile_handler, &onModfileAdded);

modioEditModfile

void modioEditModfile(int mod_id, int modfile_id, ModioModfileHandler* modfile_handler, void (*callback)(ModioResponse* response, int modfile_id))

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

int mod_id, int modfile_id, ModioModfileHandler* modfile_handler, void (callback)(ModioResponse response, int modfile_id)

Name Type Description
mod_id int Mod's uinique identifier
modfile_id int Modfile's unique identifier
modfile_handler ModioModfileHandler* ModioModfileHandler object containing the data that will be edited
callback void (*callback)(ModioResponse* response, int modfile_id) Function called once the process finished

Callback parameters

Name Type Description
response ModioResponse* ModioResponse object that contains the mod.io response status
modfile_id int Resulting ModioModfile object

Example

void onModfileEdited(ModioResponse* response, int modfile_id)
{
  if(response->code == 200)
  {
    //Modfile successfully edited
  }
}

[...]

ModioModfileHandler* modfile_handler = new ModioModfileHandler;
modioInitModfileHandler(modfile_handler);
modioSetModfileActive(modfile_handler,false);
modioSetModfileChangelog(modfile_handler,(char*)"Stuff was changed on this mod via the examples.");

modioEditModfile(mod_id, modfile_id, modfile_handler, &onModfileEdited);

Contents

Clone this wiki locally