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

Ratings (C compatible)

Ahmed Castro edited this page Oct 21, 2019 · 3 revisions

modioAddModRating

void modioAddModRating(void* object, u32 mod_id, bool vote_up, void (*callback)(void* object, ModioResponse response));

Wrapped by: Ratings#addmodrating

API endpoint used: Add Mod Rating

Submit a positive or negative rating for a mod.

Function parameters

Name Type Description
object void* Context parameter.
vote_up bool true represents a positive vote and false a negative one.
callback void (*callback)(void* object, ModioResponse response) 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.

Example

void onAddModRating(void *object, ModioResponse response)
{
  if (response.code == 201)
  {
    // Mod rating added
  }
}

[...]

modioAddModRating(NULL, mod_id, true, &onAddModRating);

modioGetCurrentUserModRating

u32 modioGetCurrentUserModRating(u32 mod_id);

Wrapped by: Ratings#getcurrentusermodrating

API endpoint used: Get User Ratings

Get a mod rating submitted by the authenticated user by providing the mod id. It returns an u32: -1 means negative rating, 1 positive and 0 no rating.

Function parameters

Name Type Description
mod_id u32 Id of the corresponding mod

Example

int rating_result = getCurrentUserModRating(mod_id);

Contents

Clone this wiki locally