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

Media (C compatible)

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

modioAddModLogo

void modioAddModLogo(void* object, u32 mod_id, char* logo_path, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modioaddmodlogo

API endpoint used: Add Mod Media

Adds a new logo image to a corresponding mod.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
logo_path char* Image's local path to be uploaded.
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 onAddModLogo(void* object, ModioResponse response)
{
  if(response.code == 201)
  {
    //Logo added successfully
  }
}

[...]

modioAddModLogo(NULL, mod_id, (char*)"ModExample/logo.png", &onAddModLogo);

modioAddModImages

void modioAddModImages(void* object, u32 mod_id, char** image_paths_array, u32 image_paths_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modioaddmodimages

API endpoint used: Add Mod Media

Adds a new logo image to a corresponding mod.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
image_paths_array char** Array containing the images paths to be added.
image_paths_array_size u32 Images array size.
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 onAddModImages(void* object, ModioResponse response)
{
  if(response.code == 201)
  {
    //Images added successfully
  }
}

[...]

char **images_array = (char **)malloc(1);
images_array[0] = (char *)malloc(100);
strcpy(images_array[0], "../ModExample/logo.png\0");

modioAddModImages(NULL, mod_id, images_array, 1, &onAddModImages);

modioAddModYoutubeLinks

void modioAddModYoutubeLinks(void* object, u32 mod_id, char** youtube_links_array, u32 youtube_links_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modioaddmodyoutubelinks

API endpoint used: Add Mod Media

Adds a list of youtube links to a corresponding mod's gallery.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
youtube_links_array char** Array containing the youtube links to be added.
youtube_links_array_size u32 Youtube links array size.
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 onAddModYoutubeLinks(void* object, ModioResponse response)
{
  if(response.code == 201)
  {
    //Youtube links added successfully
  }
}

[...]

char **youtube_links_array = (char **)malloc(1);
youtube_links_array[0] = (char *)malloc(100);
strcpy(youtube_links_array[0], "https://www.youtube.com/watch?v=dQw4w9WgXcQ\0");

modioAddModYoutubeLinks(NULL, mod_id, youtube_links_array, 1, &onAddModYoutubeLinks);

modioAddModSketchfabLinks

void modioAddModSketchfabLinks(void* object, u32 mod_id, char** sketchfab_links_array, u32 sketchfab_links_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modioaddmodsketchfablinks

API endpoint used: Add Mod Media

Adds a list of sketchfab links to a corresponding mod.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
youtube_links_array char** Array containing the youtube links to be added.
youtube_links_array_size u32 Youtube links array size.
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 onAddModSketchfabLinks(void* object, ModioResponse response)
{
  if(response.code == 201)
  {
    //Sketchfab links added successfully
  }
}

[...]

char **sketchfab_links_array = (char **)malloc(1);
sketchfab_links_array[0] = (char *)malloc(100);
strcpy(sketchfab_links_array[0], "https://sketchfab.com/models/7793b895f27841f4930e6b71f75a8d74\0");

modioAddModSketchfabLinks(NULL, mod_id, sketchfab_links_array, 1, &onAddModSketchfabLinks);

modioDeleteModImages

void modioDeleteModImages(void* object, u32 mod_id, char** image_paths_array, u32 image_paths_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modiodeletemodimages

API endpoint used: Add Mod Media

Adds a list of sketchfab links to a corresponding mod.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
image_paths_array char** Array containing the images paths to be added.
image_paths_array_size u32 Images array size.
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 onDeleteModImages(void* object, ModioResponse response)
{
  if(response.code == 204)
  {
    //Images deleted successfully
  }
}

[...]# modioDeleteModImages

```c++
void modioDeleteModImages(void* object, u32 mod_id, char** image_paths_array, u32 image_paths_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modiodeletemodimages

API endpoint used: Add Mod Media

Deletes a list of images from a corresponding mod's gallery.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
image_paths_array char** Array containing the images paths to be added.
image_paths_array_size u32 Images array size.
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 onDeleteModImages(void* object, ModioResponse response)
{
  if(response.code == 204)
  {
    //Images deleted successfully
  }
}

[...]

char **images_array = (char **)malloc(1);
images_array[0] = (char *)malloc(100);
strcpy(images_array[0], "Screenshot1.png\0");

modioDeleteModImages(NULL, mod_id, images_array, 1, &onDeleteModImages);

char **images_array = (char **)malloc(1); images_array[0] = (char *)malloc(100); strcpy(images_array[0], "Screenshot1.png\0");

modioDeleteModImages(NULL, mod_id, images_array, 1, &onDeleteModImages);


# modioDeleteModYoutubeLinks

```c++
void modioDeleteModYoutubeLinks(void* object, u32 mod_id, char** youtube_links_array, u32 youtube_links_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modiodeletemodyoutubelinks

API endpoint used: Add Mod Media

Deletes a list of youtube links from a corresponding mod.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
youtube_links_array char** Array containing the images paths to be added.
youtube_links_array_size u32 Images array size.
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 onDeleteModYoutubeLinks(void* object, ModioResponse response)
{
  if(response.code == 204)
  {
    //Images deleted successfully
  }
}

[...]

char **youtube_links_array = (char **)malloc(1);
youtube_links_array[0] = (char *)malloc(100);
strcpy(youtube_links_array[0], "https://www.youtube.com/watch?v=dQw4w9WgXcQ\0");

modioDeleteModYoutubeLinks(NULL, mod_id, youtube_links_array, 1, &onDeleteModYoutubeLinks);

modioDeleteModSketchfabLinks

void modioDeleteModSketchfabLinks(void* object, u32 mod_id, char** sketchfab_links_array, u32 sketchfab_links_array_size, void (*callback)(void* object, ModioResponse response));

Wrapped by: Media#modiodeletemodsketchfablinks

API endpoint used: Add Mod Media

Deletes a list of sketchfab links from a corresponding mod.

Function parameters

Name Type Description
object void* Context parameter.
mod_id u32 Mod's unique identifier.
sketchfab_links_array char** Array containing the images paths to be added.
sketchfab_links_array_size u32 Images array size.
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 onDeleteModSketchfabLinks(void* object, ModioResponse response)
{
  if(response.code == 204)
  {
    //Sketchfab links deleted successfully
  }
}

[...]

char **sketchrab_links_array = (char **)malloc(1);
sketchrab_links_array[0] = (char *)malloc(100);
strcpy(sketchrab_links_array[0], "https://sketchfab.com/models/7793b895f27841f4930e6b71f75a8d74\0");

modioDeleteModSketchfabLinks(NULL, mod_id, sketchrab_links_array, 1, &onDeleteModSketchfabLinks);

modioDownloadImage

void MODIO_DLL modioDownloadImage(void* object, char* image_url, char* path, void (*callback)(void* object, ModioResponse response, char* path));

Wrapped by: Media#modiodownloadimage

Downloads an image to a desired path given the image url.

Function parameters

Name Type Description
object void* Context parameter.
image_url char* Image url.
path char* Path where the image will be downloaded.
callback void (*callback)(void* object, ModioResponse response, char* path) 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.
path char* Path where the image was downloaded.

Example

void onImageDownloaded(void* object, ModioResponse response)
{
  if(response.code == 200)
  {
    //Image downloaded successfully
  }
}

[...]

modioDownloadImage(NULL, mod.logo.original, (char*)"mods_dir/full.png", &onImageDownloaded);

Contents

Clone this wiki locally