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

Metadata KVP

Ahmed Castro edited this page Sep 3, 2018 · 1 revision

getAllMetadataKVP

void Instance::getAllMetadataKVP(u32 mod_id, const std::function<void(const modio::Response& response, std::vector<modio::MetadataKVP> metadata_kvp)>& callback);

API endpoint used: Get All Mod KVP Metadata

Returns a vector containing all corresponding mod's modio::MetadataKVP objects.

Function parameters

Name Type Description
mod_id u32 Id of the corresponding mod.
callback std::function<void(const modio::Response& response, std::vector<modio::MetadataKVP> metadata_kvp)>& 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.
metadata_kvp std::vector<modio::MetadataKVP> Vector containing the returned modio::MetadataKVP objects.

Example

modio_instance.getAllMetadataKVP(mod_id, [&](const modio::Response &response, std::vector<modio::MetadataKVP> metadata_kvp) {
  if(response.code == 200)
  {
    //Metadata KVP successfully retrieved
  }
});

addMetadataKVP

void Instance::addMetadataKVP(u32 mod_id, std::map<std::string, std::string> metadata_kvp, const std::function<void(const modio::Response &response)> &callback);

API endpoint used: Add Mod KVP Metadata

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

Function parameters

Name Type Description
mod_id u32 Id of the corresponding mod.
metadata_kvp std::map<std::string, std::string> Metadata key value pairs to be added
callback std::map<std::string, std::string> metadata_kvp, 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

std::map<std::string, std::string> metadata_kvp;
metadata_kvp["pistol-dmg"] = "800";

modio_instance.addMetadataKVP(mod_id, metadata_kvp, [&](const modio::Response &response) {
  if(response.code == 201)
  {
    //Metadata KVP successfully added
  }
});

deleteMetadataKVP

void Instance::deleteMetadataKVP(u32 mod_id, std::map<std::string, std::string> metadata_kvp, const std::function<void(const modio::Response &response)> &callback);

API endpoint used: Delete Mod KVP Metadata

Deletes metadata key value pairs from to the corresponding mod.

Function parameters

Name Type Description
mod_id u32 Id of the corresponding mod.
metadata_kvp std::map<std::string, std::string> Metadata key value pairs to be deleted
callback std::map<std::string, std::string> metadata_kvp, 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

std::map<std::string, std::string> metadata_kvp;
metadata_kvp["pistol-dmg"] = "800";

modio_instance.deleteMetadataKVP(mod_id, metadata_kvp, [&](const modio::Response &response) {
  if(response.code == 204)
  {
    //Metadata KVP successfully deleted
  }
});

Contents

Clone this wiki locally