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

Metadata KVP (C compatible)

Ahmed Castro edited this page Sep 3, 2018 · 2 revisions

modioGetAllMetadataKVP

void modioGetAllMetadataKVP(void* object, u32 mod_id, void (*callback)(void* object, ModioResponse response, ModioMetadataKVP* metadata_kvp_array, u32 metadata_kvp_array_size));

Wrapped by: Metadata-KVP#getallmetadatakvp

API endpoint used: Get All Mod KVP Metadata

Returns an array containing all corresponding mod's ModioMetadataKVP objects.

Function parameters

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

Example

void onGetAllMetadataKVP(void *object, ModioResponse response, ModioMetadataKVP *metadata_kvp_array, u32 metadata_kvp_array_size)
{
  if(response.code == 200)
  {
    //Metadata KVP retrieved successfully
  }
}

[...]

modioGetAllMetadataKVP(NULL, mod_id, &onGetAllMetadataKVP);

modioAddMetadataKVP

void modioAddMetadataKVP(void* object, u32 mod_id, char** metadata_kvp_array, u32 metadata_kvp_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Metadata-KVP#addmetadatakvp

API endpoint used: Add Mod KVP Metadata

Adds the metadata key value pairs provided to the corresponding mod.

Function parameters

Name Type Description
object void* Context paramter.
mod_id u32 Mod's unique identifier.
metadata_kvp_array char** Array containing the metadata key value pairs to be added.
metadata_kvp_array_size u32 Metadata key value pairs array size.
callback (*callback)(void* object, ModioResponse response) 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.

Example

void onAddMetadataKVP(void *object, ModioResponse response)
{
  if(response.code == 201)
  {
    //Metadata KVP added successfully
  }
}

[...]

char **metadata_kvp_array = (char **)malloc(1);
metadata_kvp_array[0] = (char *)malloc(100);
strcpy(metadata_kvp_array[0], "pistol-dmg:800\0");

modioAddMetadataKVP(NULL, mod_id, (char **)metadata_kvp_array, 1, &onAddMetadataKVP);

modioDeleteMetadataKVP

void modioDeleteMetadataKVP(void* object, u32 mod_id, char** metadata_kvp_array, u32 metadata_kvp_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Metadata-KVP#deletemetadatakvp

API endpoint used: Delete Mod KVP Metadata

Deletes the metadata key value pairs provided from the corresponding mod.

Function parameters

Name Type Description
object void* Context paramter.
mod_id u32 Mod's unique identifier.
metadata_kvp_array char** Array containing the metadata key value pairs to be deleted.
metadata_kvp_array_size u32 Metadata key value pairs array size.
callback (*callback)(void* object, ModioResponse response) 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.

Example

void onDeleteMetadataKVP(void *object, ModioResponse response)
{
  if(response.code == 204)
  {
    //Metadata KVP deleted successfully
  }
}

[...]

char **metadata_kvp_array = (char **)malloc(1);
metadata_kvp_array[0] = (char *)malloc(100);
strcpy(metadata_kvp_array[0], "pistol-dmg:800\0");

modioDeleteMetadataKVP(NULL, mod_id, (char **)metadata_kvp_array, 1, &onAddMetadataKVP);

Contents

Clone this wiki locally