GithubHelp home page GithubHelp logo

nexusmods4j's Introduction

NexusMods4J

NexusMods4J is a wrapper around the nexus mods API.

This Library only utilizes two libraries, OKHTTP3, and JSON parser, GSON (may change in the future).

NexusMods4J uses a fluent design system to enhance the readability of your code. For example a standard method call may be api.getGames() or api.endorse(), these calls don't give you much information on the type of call, or what the call is connected to.
A NexusMods4J method call may be api.get().games().all(), this call tells you three thing straight away, that it is a get request, that it is part of the games section of the api, and that you are requesting ALL the games(with info).

Usage

You will first need to obtain an API key for your application (or use your personal api key for testing), see how to do this here or here.
Future versions may have a built in system for accessing the SSO and obtaining an api key.

Next, create a reference to co.uk.innoxium.nexusmods4j.NexusAPI. It should look like the following:

NexusAPI api = new NexusAPI(<api key>);

You can now use the Fluent api design to access the API to your hearts desire (NexusMods does have rate limiting in place).

Examples

An example of requesting a list of all moddable games can be executed with the following code:

ArrayList<Game> allGames = api.get().games().all();
// You can also request non-verified games, these are games which may have mods available on the page, but are not yet visible.
ArrayList<Game> allGamesWithNonVerified = api.get().games().all(true);

As described above, this code sendes a get request to the games endpoint requesting ALL games

An exmaple of tracking a mod would be

boolean tracked = api.post().mods().track(<game_domain>, <mod_id>);
// You can also untrack by calling:
boolean untracked = api.post().mods.untrack(<game_domain>, <mod_id>); 
// ^ This is actually a Delete request, however as the only one in the Nexus API, I moved it to the post() as it seemed fitting (hell, they made removing an endorsement a post request)
// You can also use a Mod reference due to it containing the "game_domain" and "mod_id" values in the request body.
boolean tracked = api.post().mods().track(modList.getSelectedItem());
// ^ This method assumes you are using a JList<Mod> to get the Mod reference

How to get

We currently are not on Maven Central, so you will need to add our repo to your pom or build.gradle.
Our repo is https://repo.repsy.io/mvn/innoxium/innoxium

For Maven:

<dependency>
  <groupId>uk.co.innoxium.nexusmods4j</groupId>
  <artifactId>nexusmods4j</artifactId>
  <version>1.0</version>
</dependency>

For Gradle:

implementation 'uk.co.innoxium.nexusmods4j:nexusmods4j:1.0'

Or Gradle Kotlin DSL:

implementation("uk.co.innoxium.nexusmods4j:nexusmods4j:1.0")

nexusmods4j's People

Contributors

zpiddock avatar shadowchild avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.