An Unofficial Asynchronous Java API Wrapper for MyWaifuList
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
dependabot[bot] 8e83e89072
Bump mockito-core from 4.11.0 to 5.2.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 4.11.0 to 5.2.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v4.11.0...v5.2.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
.github chore: update dependabot 2 years ago
src Remove public access from APIWrapper.java 3 years ago
.gitignore Add .gitignore 3 years ago
LICENSE Initial commit 3 years ago
README.md docs: update README.md 2 years ago
pom.xml Bump mockito-core from 4.11.0 to 5.2.0 2 years ago

README.md

maven-central build-status codecov

MyWaifuWrapper

An Unofficial Asynchronous Java API Wrapper for MyWaifuList

Summary

This is an Unofficial Asynchronous API Wrapper for MyWaifuList

Disclaimer

Given that MyWaifuList is a primarily user-driven website and this API is currently in an Alpha state, the data returned may not be fully complete and at its best quality

Configuration

There are 2 ways to create and configure the MyWaifuClient

  • createDefault(apiKey)
  • build()

createDefault()

createDefault(apiKey) will provide a default implementation and return a MyWaifuClient ready to be used. Only the apiKey is required to instantiate MyWaifuClient.

public class Main {
    private static void main(String[] args) {
        MyWaifuClient myWaifuClient = MyWaifuClient.createDefault("apiKey");
    }
}

build()

build() is used to build the object from the ground up, allowing for the fine-tuning of properties within the MyWaifuClient. Not all the additional properties need to specified within the builder. However, the bare minimum would be the apiKey within the Builder constructor and then .build()

import me.goudham.MyWaifuClient;

import java.net.http.HttpClient;
import java.time.Duration;

public class Main {
    private static void main(String[] args) {
        // Bare Minimum Config 
        // (Would recommend using createDefault())
        MyWaifuClient myWaifuClient = new MyWaifuClient.Builder("apiKey").build();
        
        // Creation Through Builder
        MyWaifuClient myWaifuClient = new MyWaifuClient.Builder("apiKey")
                .withVersion(HttpClient.Version.HTTP_2)
                .withConnectTimeout(Duration.ofMinutes(10))
                .build();
    }
}

Usage

Once MyWaifuClient has been configured properly, many methods are available for you to get the data that you wish. Each method links up to an endpoint that is listed within the MyWaifuList API Docs

With every method executed from the MyWaifuClient, a Response object will be returned. The object will house the type of entity, response status code, and the response body. This allows for extreme flexibility as the raw response and marshalled entity are available to the user.

The documentation for each method provides clear and detailed information on what arguments to pass in, please do also refer to that.

Shown below are some examples of how you can retrieve data:

public class Main {
    public static void main(String[] args) throws APIMapperException, APIResponseException {
        // ... myWaifuClient has been instantiated
        
        // getWaifu(Integer id) 
        Response<Waifu> waifuResponse = myWaifuClient.getWaifu(7);
        Integer waifuResponseCode = waifuResponse.getStatusCode();
        String waifuResponseBody = waifuResponse.getBody();
        Waifu waifu = waifuResponse.getModel();
        
        // getRandomWaifu()
        Response<FilteredWaifu> randomWaifuResponse = myWaifuClient.getRandomWaifu();
        Integer randomWaifuResponseCode = randomWaifuResponse.getStatusCode();
        String randomWaifuResponseBody = randomWaifuResponse.getBody();
        FilteredWaifu randomWaifu = randomWaifuResponse.getModel();
        
        // getSeasonalAnime()
        Response<List<FilteredSeries>> seasonalAnimeResponse = myWaifuClient.getSeasonalAnime();
        Integer seasonalAnimeResponseStatusCode = seasonalAnimeResponse.getStatusCode();
        String seasonalAnimeResponseBody = seasonalAnimeResponse.getBody();
        List<FilteredSeries> seasonalAnime = seasonalAnimeResponse.getModel();
    
        // getUserWaifus(Integer id, WaifuListType waifuListType, Integer pageNum)
        Response<PaginationData<FilteredWaifu>> userWaifusLikedResponse = myWaifuClient.getUserWaifus(1, WaifuListType.LIKED, 1);
        Integer userWaifusLikedResponseStatusCode = userWaifusLikedResponse.getStatusCode();
        String userWaifusLikedResponseBody = userWaifusLikedResponse.getBody();
        PaginationData<FilteredWaifu> userWaifusLiked = userWaifusLikedResponse.getModel();
    }
}

Installation

Latest Stable Version: maven-central

Be sure to replace the VERSION key below with the one of the versions shown above!

Maven

<!-- https://mvnrepository.com/artifact/me.goudham/MyWaifuWrapper -->
<dependency>
    <groupId>me.goudham</groupId>
    <artifactId>MyWaifuWrapper</artifactId>
    <version>VERSION</version>
</dependency>

Gradle

repositories {
    mavenCentral()
}

dependencies {
    // https://mvnrepository.com/artifact/me.goudham/MyWaifuWrapper
    implementation group: 'me.goudham', name: 'MyWaifuWrapper', version: 'VERSION'
}

License

FOSSA Status