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

Mods (C compatible)

Ahmed Castro edited this page Dec 20, 2017 · 20 revisions

modioGetMods

void modioGetMods(void* object, ModioFilterHandler* filter, void (*callback)(void* object, ModioResponse response, ModioMod* mods, int mods_size));

Wrapped by: Mods#modiogetmods

API endpoint used: Get All Mods

Browse mods on mod.io, can be filtered using the FilterHandler handle.

Function parameters

Name Type Description
object void* Context parameter.
filter ModioFilterHandler* ModioFilterHandler object to be customized.
callback void (*callback)(void* object, ModioResponse response, ModioMod* mods, int mods_size) Function called once the process finished.

Callback parameters

ModioResponse* response, ModioMod* mods, int mods_size)

Name Type Description
object void* Context parameter.
response ModioResponse ModioResponse object that contains the mod.io response status.
mods ModioMod* ModioMod array containing the returned mods.
mods_size int Mod array size.

Example

void onModsGet(void* object, ModioResponse response, ModioMod* mods, int mods_size)
{
  if(response.code == 200)
  {
    //Mods successfully retrieved
  }
}

[...]

ModioFilterHandler filter;
modioInitFilter(&filter);
modioSetFilterLimit(&filter,3);

modioGetMods(NULL,filter, &onModsGet);

modioAddMod

void MODIO_DLL modioAddMod(void* object, ModioModHandler* mod_handler, void (*callback)(void* object, ModioResponse response, ModioMod* mod));

Wrapped by: Mods#modioaddmod

API endpoint used: Add Mod

Adds a new Mod to mod.io. Use the ModioModHandler to set the mods fields before uploading.

Function parameters

Name Type Description
object void* Context parameter.
mod_handler ModioModHandler* ModioModHandler object containing the data that will be added.
callback void (*callback)(void* object, ModioResponse response, ModioMod* mod) Function called once the process finished.

Calback parameters

Name Type Description
object void* Context parameter.
response ModioResponse ModioResponse object that contains the mod.io response status.
mod ModioMod* Resulting ModioMod object.

Example

void onModAdded(void* object, ModioResponse response, ModioMod mod)
{
  if(response.code == 201)
  {
    //Mod successfully added
  }
}

[..]

ModioModHandler mod_handler;
modioInitModHandler(&mod_handler);
modioSetLogoPath(&mod_handler, (char*)"ModExample/logo.png");
modioSetName(&mod_handler, (char*)"Example Mod Test");
modioSetHomepage(&mod_handler, (char*)"http://www.webpage.com");
modioSetSummary(&mod_handler, (char*)"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.");
modioAddTag(&mod_handler, (char*)"Easy");
modioAddTag(&mod_handler, (char*)"Medium");
modioSetPrice(&mod_handler, 1.99);
modioSetStock(&mod_handler, 25);
modioSetDescription(&mod_handler, (char*)"This mod description was added via the SDK examples. This mod description was added via the SDK examples.");
modioSetMetadata(&mod_handler, (char*)"Optional metadata");

modioAddMod(NULL, mod_handler, &onModAdded);

modioEditMod

void MODIO_DLL modioEditMod(void* object, int mod_id, ModioModHandler* mod_handler, void (*callback)(void* object, ModioResponse response, ModioMod* mod));

Wrapped by: Mods#modioeditmod

API endpoint used: Edit Mod

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

Function parameters

Name Type Description
object void* Context paramter.
mod_id int Mod's unique identifier.
mod_handler ModioModHandler* ModioModHandler object containing the data that will be edited.
callback void (*callback)(void* object, ModioResponse response, ModioMod* mod) Function called once the process finished.

Callback parameters

Name Type Description
object void* Context paramter.
response ModioResponse ModioResponse object that contains the mod.io response status.
mod ModioMod* Resulting ModioMod object.

Example

void onModEdited(void* object, ModioResponse response, ModioMod mod)
{
  if(response.code == 200)
  {
    //Mod successfully edited
  }
}

[...]

ModioModHandler mod_handler;
modioInitModHandler(&mod_handler);
modioSetLogoPath(&mod_handler, (char*)"ModExample/logo.png");
modioSetName(&mod_handler, (char*)"Update Example");
modioSetHomepage(&mod_handler, (char*)"http://www.updated.com");
modioSetSummary(&mod_handler, (char*)"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.");
modioAddTag(&mod_handler, (char*)"Easy");
modioSetPrice(&mod_handler, 2.99);
modioSetDescription(&mod_handler, (char*)"This mod description was updated via the SDK examples. This mod description was updated via the SDK examples.");
modioSetMetadata(&mod_handler, (char*)"Optional updated metadata");

modioEditMod(NULL, mod.id, mod_handler, &onModEdited);

modioDeleteMod

void MODIO_DLL modioDeleteMod(void* object, int mod_id, void (*callback)(void* object, ModioResponse response, int mod_id));

Wrapped by: Mods#modiodeletemod

API endpoint used: Delete Mod

Deletes a mod profile.

Function parameters

Name Type Description
object void* Context parameter.
mod_id int Mod's unique identifier.
callback void (*callback)(void* object, ModioResponse response, int mod_id) Function called once the process finished.

Callback parameters

Name Type Description
object void* Context parameter.
response ModioResponse ModioResponse object that contains the mod.io response status.
mod int Deleted mod id.

Example

void onModDeleted(void* object, ModioResponse response, int mod_id)
{
  if(response.code == 204)
  {
    //Mod successfully deleted
  }
}

[...]

modioDeleteMod(NULL, mod.id, &onModDeleted);

Contents

Clone this wiki locally