/SpigotResourcesAPI

Java wrapper for the Spigot REST API

Primary LanguageJavaMIT LicenseMIT

SpigotResourcesAPI

a Java wrapper of the Spigot resources REST API (XenforoResourceManagerAPI)

SpigotResourcesAPI aims to be simple, thread-safe and efficient.

Release

Javadoc

See on SpigotMC

How to use

Clone the repository, install the artifact locally (using mvn install, for example) and use the artifact information that is in the pom.xml file as a dependency. Alternatively, you can use JitPack:

Maven

Add JitPack as a repository

<repositories>
  <!--   it is recommended to specify JitPack after all other repositories   -->
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

Add SpigotResourcesAPI as a dependency

<dependencies>
  <dependency>
    <groupId>com.github.robertlit</groupId>
    <artifactId>SpigotResourcesAPI</artifactId>
    <version>VERSION</version>
  </dependency>
</dependencies>

Gradle

Add JitPack as a repository

repositories {
    maven { url 'https://jitpack.io' }
}

Add SpigotResourcesAPI as a dependency

dependencies {
    implementation 'com.github.robertlit:SpigotResourcesAPI:1.3'
}

Code exmaples

// Construct an API and specify how long should data be cached for
SpigotResourcesAPI api = new SpigotResourcesAPI(1, TimeUnit.HOURS);

// Get Author by id
CompletableFuture<Author> future = api.getAuthor(740512);
future.thenAccept(author -> {
  // ...
});

// Get Resources by Author id
CompletableFuture<Collection<Resource>> future = api.getResourcesByAuthor(740512);
future.thenAccept(resources -> {
  // ...
});

// Get Resource by id
CompletableFuture<Resource> future = api.getResource(72343);
future.thenAccept(resource -> {
  // ...
});