1.1.3-c • Published 11 months ago

modio.js v1.1.3-c

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

modio.js

This is currently a very unfinished library. Docs are still very basic, and most API features you'll get using libraries for other languages (python, cli) are not here. Made this because there were no other libraries for using the mod.io API for nodejs, and I decided to publish it because other people might be looking for a module to use mod.io API too.

Usage

Setting API key
const modio = require('modio.js');

modio.setAPIKey('your-api-key'); // Get an API key at mod.io/apikey
Setting OAuth key
const modio = require('modio.js');

modio.setOAuthKey('your-oauth-key'); // Get an OAuth key at mod.io/apikey
Using Email Exchange
// Api key is needed.
const message = await modio.emailRequest('someperson@someservice.com');

// The user has to input the security code, so use whatever you use for getting user input.
const code = (await inquirer.prompt({type: 'input', name: 'oauth', message: 'Input the OAuth key you got.'})).oauth;

// Returns an Access Token class.
const accesstoken = await modio.emailExchange(code);
Downloading a mod
await modio.downloadMod('@game', '@mod', 'platform', 'outputpath'); //  Uses ID's like'@bonelab', '@m60'. File id's are not supported yet, but will be in a future update.
Getting all games
const games = await modio.getGames();
Getting a specific game
const game = await modio.getGame(id); // ID is same as shown in the mod download example ('@bonelab')
Getting all mods for a game
const mods = await modio.getMods(game); // Game is just @game, ex. '@bonelab'
Getting a specific mod
const mod = await modio.getMod(game, mod); // Game: @game (ex. '@bonelab'), mod: @mod (ex. '@m60')
Getting a mod's files
const modfiles = await modio.getModfiles(game, mod); // Extra arg: customErrorHandler. This arg is a function that handles mod request and modfile request errors. It gets the gameid, modid, res json, modfile res json and firstCall bool sent in. firstCall is an internal arg, which is passed in as false. Pass this in as the 4th argument to getModfiles if you decide to re-call getModfiles.
Getting a specific platform's mod files
const modfile = await modio.getModfile(game, mod, platform); // Game: @game (ex. '@bonelab'), mod: @mod (ex. '@m60'), platform: 'platform', ex. 'windows'
Getting comments on a mod
const comments = await modio.getModComments(game ,mod);
Getting a mod's dependencies
const dependencies = await modio.getModDependencies(game, mod);

OAuth is needed for the following functions.

Getting all subscribed mods
const mods = await modio.getSubscriptions();
Subscribing and unsubscribing from a mod
const subscribed = await modio.subscribeTo('@game', '@mod');
const unsubscribed = await modio.unsubscribeFrom('@game', '@mod');
Adding a rating to a mod
const message = await modio.addRating('@game', '@mod', rating) // Rating can be -1, 0 or 1. -1 is negative, 0 removes previous rating and 1 is positive.
Parsing a URL into game and mod
const parsedUrl = modio.parseUrl('https://mod.io/g/bonelab/m/m60'); // Parses url into an object containing game and mod. These are the game and mod params you need for most other functions.
const game = parsedUrl.game; // bonelab
const mod = parsedUrl.mod; // m60

Exposed variables

Exposed variables are: exposedInfo

exposedInfo contains booleans for whether or not both types of keys have been set.

Extra info

You'll likely be able to see newer versions on Github, as it's easier for me to update singular files there.

Changelog

Fix emailExchange checking the wrong variable

1.1.3-c

11 months ago

1.1.3-b

12 months ago

1.1.3-a

12 months ago

1.1.2-a

12 months ago

1.1.1-b

1 year ago

1.1.1-a

1 year ago

1.1.0-d

1 year ago

1.1.0-c

1 year ago

1.1.0-b

1 year ago

1.1.0-a

1 year ago

1.0.10-a

1 year ago

1.0.9-e

1 year ago

1.0.9-d

1 year ago

1.0.9-c

1 year ago

1.0.9-b

1 year ago

1.0.9-a

1 year ago

1.0.8-b

1 year ago

1.0.8-a

1 year ago

1.0.7-g

1 year ago

1.0.7-f

1 year ago

1.0.7-e

1 year ago

1.0.7-d

1 year ago

1.0.7-c

1 year ago

1.0.7-b

1 year ago

1.0.7-a

1 year ago

1.0.6-e

1 year ago

1.0.6-d

1 year ago

1.0.6-c

1 year ago

1.0.6-b

1 year ago

1.0.6-a

1 year ago

1.0.5-c

1 year ago

1.0.5-b

1 year ago

1.0.5-a

1 year ago

1.0.4-a

1 year ago

1.0.2-d

1 year ago

1.0.2-c

1 year ago

1.0.2-b

1 year ago

1.0.2-a

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago