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

mod.io SDK Implementation Guide

turupawn edited this page Feb 6, 2019 · 3 revisions

The mod.io SDK provides all the functionality needed to access the mod.io backend. See the Getting Started guide to start integrating the SDK on your project.

Testing Environment

mod.io offers two different environments: testing and live. Testing is located in test.mod.io website it will only be visible for the developers, its meant to be a safe sandbox to prepare before going to the Live environment. The environment is set as a parameter in the Initialization method.

User Authentication

Users need to be authenticated to accomplish certain task such as creating, editing or subscribing to mods. mod.io offers a secure and easy authentication flow through email. You can find more information in User Authentication.

Creating Mods and Uploading Modfiles

Creating a Mod

This are the steps to create a mod profile which can be found in the mod.io API and web. This function creates the mod profile as hidden, to go live you will need to Upload a Modfile.

  1. Initialize a ModCreator, which will have the Mod's data.
  2. Fill the Mod's data using the ModCreator functions.
  3. Call the function addMod by sending ModCreator as a parameter.
  4. The callback Response Code should be 201 CREATED.

Uploading a Modfile

In order for your mod to go live you will need to upload a modfile. Modfiles can't be edited, if you want to make a change upload a new one as a newer version.

  1. Initialize a ModfileCreator, which will have the Modfile's data.
  2. Fill the Modfile's data using the ModfileCreator functions.
  3. Call the function addModfile by sending ModfileCreator as a parameter.
  4. The callback Response Code should be 201 CREATED.

Editing Mods

In case changes are wanted it follows a similar process as creating a mod.

  1. Initialize a ModEditor, which will have the Mod's data.
  2. Fill the Mod's data to be edited using the ModEditor functions.
  3. Call the function editMod by sending ModEditor and the mod's id as a parameters.
  4. The callback Response Code should be 200 OK.

Browsing

You can browse Mod's data and filter the result so you retrieve only the mods you want.

  1. Initialize a FilterCreator to define which would be the query criteria.
  2. Fill the filters data using the FilterCreator function on the request you want to make.
  3. Call getMods by sending the FilterCreator as parameter.
  4. The callback Response Code should be 200 OK and a collection of Mods should be returned.

Additionally you can obtain the autenticated user's Mods using the getUserMods and getUserSubscriptions methods or a specific mod by using the getMod method.

Installing Mods

The mod.io SDK features with a download queue and an installed mod list which gives you a variety of functions to handle local mods. See the Downloads documentation for details.

Automatic Updates

When a mod is updated through any method (web, API, SDK or plugin) it also updates itself locally. This will happen as long as the automatic option is enabled, additionally if a user subscribes to a mod it will be installed automatically.

Deleting

Mods can not be permanently deleted but they can be archived so its only seen by the modder. You can delete a Mod by calling deleteMod by sending the mod ID as parameter.

Examples

Each method in the documentation displays an example but If you want a complete working example you could go to the official examples list.

Errors and Logging

Every callback returns an HTTP Response Code so you can check if there were any errors in your request, you could also review the log placed in .modio/log for details.

mod.io API

The SDK wraps the mod.io API end points. You may achieve the same functionalities by connecting to the API without using the SDK, however it makes the work easier by taking care of automatic tasks and providing an easier interface in C++. See mod.io API Documentation for details.

Going Further

If you want an integration with more features, you could see the complete method list in the Table of Content.

Contents

Clone this wiki locally