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

Tags (C compatible)

Ahmed Castro edited this page Aug 24, 2018 · 6 revisions

modioGetModTags

void modioGetModTags(void* object, u32 mod_id, void (*callback)(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size));

Wrapped by: Tags#getmodtags

API endpoint used: Get Mod Tags

Returns all the tags corresponding a mod.

Function parameters

Name Type Description
object void* Context paramter.
mod_id u32 Mod's unique identifier.
callback void (*callback)(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size) 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_id u32 Mod's unique identifier.
tags_array ModioTag* Array containing the ModioTag objects returned.
tags_array_size u32 Tags array size.

Example

void onGetModTags(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size)
{
  if(response.code == 200)
  {
    //Tags retrieved successfully
  }
}

[...]

modioGetModTags(NULL, mod.id, &onGetModTags);

modioAddModTags

void modioAddModTags(void* object, u32 mod_id, char** tags_array, u32 tags_array_size, void (*callback)(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size));

Wrapped by: Tags#addmodtags

API endpoint used: Add Mod Tag

Adds one or more tags to a mod. Tags are supplied as a char* array.

Function parameters

Name Type Description
object void* Context paramter.
mod_id u32 Mod's unique identifier.
tags_array char** Array containing the tags to be added.
tags_array_size u32 Tags array size.
callback void (*callback)(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size) 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_id u32 Mod's unique identifier.
tags_array ModioTag* Array containing the resulting ModioTag objects.
tags_array_size u32 Tags array size.

Example

void onAddModTags(void* object, ModioResponse response, u32 mod_id)
{
  if(response.code == 201)
  {
    //Tags added successfully
  }
}

[...]

char** tags_array = (char**) malloc(1);
tags_array[0] = (char*) malloc(50);
strcpy(tags_array[0], "Hard\0");

modioAddModTags(NULL, mod.id, (char**)tags_array, 1, &onAddModTags);

modioDeleteModTags

void modioDeleteModTags(void* object, u32 mod_id, char** tags_array, u32 tags_array_size, void (*callback)(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size));

Wrapped by: Tags#deletemodtags

API endpoint used: Delete Mod Tag

Deletes one or more tags to a mod. Tags are supplied as a char* array.

Function parameters

Name Type Description
object void* Context paramter.
mod_id u32 Mod's unique identifier.
tags_array char** Array containing the tags to be deleted.
tags_array_size u32 Tags array size.
callback void (*callback)(void* object, ModioResponse response, u32 mod_id, ModioTag* tags_array, u32 tags_array_size) 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_id u32 Mod's unique identifier.
tags_array ModioTag* Array containing the resulting ModioTag objects.
tags_array_size u32 Tags array size.

Example

void onDeleteModTags(void* object, ModioResponse response, u32 mod_id)
{
  if(response.code == 201)
  {
    //Tags deleted successfully
  }
}

[...]

char** tags_array = (char**) malloc(1);
tags_array[0] = (char*) malloc(50);
strcpy(tags_array[0], "Hard\0");

modioDeleteModTags(NULL, mod.id, (char**)tags_array, 1, &onDeleteModTags);

Contents

Clone this wiki locally