Skip to content

Commit

Permalink
adjust syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed May 24, 2023
1 parent 9bda566 commit feb6630
Show file tree
Hide file tree
Showing 62 changed files with 347 additions and 306 deletions.
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Changelog

## 3.1.0

### New Features

* Add character support [#381](https://github.com/KatsuteDev/Mal4J/pull/381) ([@Katsute](https://github.com/Katsute))
This is an undocumented feature, you must use `MyAnimeList.enableExperimentalFeature(ExperimentalFeature.CHARACTERS)` to enable it.

Retrieve characters using `MyAnimeList.getCharacter(id)`.

Character information currently includes:

* Name
* Alternative names
* Picture
* Biography
* Animeography
* Add ability to retrieve characters from Anime [#385](https://github.com/KatsuteDev/Mal4J/pull/385) ([@Katsute](https://github.com/Katsute))
This is an undocumented feature, you must use `MyAnimeList.enableExperimentalFeature(ExperimentalFeature.CHARACTERS)` to enable it.

Retrieve characters using `MyAnimeList.getAnimeCharacters(anime id)` or `Anime.getCharacters()`.

Character information currently includes:

* Name
* Alternative names
* Picture
* Biography
* Animeography

### Fixes

* Fix incomplete Anime/Manga listings [#386](https://github.com/KatsuteDev/Mal4J/pull/386) ([@Katsute](https://github.com/Katsute))
* Anime/Manga recommendation
* Related Anime/Manga

### Dependencies

* Bump junit-jupiter from 5.9.2 to 5.9.3 [#377](https://github.com/KatsuteDev/Mal4J/pull/377) ([@mashiro-san](https://github.com/mashiro-san))
* Bump maven-surefire-plugin from 3.0.0 to 3.1.0 [#378](https://github.com/KatsuteDev/Mal4J/pull/378) ([@dependabot](https://github.com/dependabot))
* Bump maven-gpg-plugin from 3.0.1 to 3.1.0 [#379](https://github.com/KatsuteDev/Mal4J/pull/379) ([@dependabot](https://github.com/dependabot))
* Bump maven-source-plugin from 3.2.1 to 3.3.0 [#383](https://github.com/KatsuteDev/Mal4J/pull/383) ([@dependabot](https://github.com/dependabot))

**Full Changelog**: [`3.0.3...3.1.0`](https://github.com/KatsuteDev/Mal4J/compare/3.0.3...3.1.0)

## 3.0.3

### 📘 Dependencies
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.katsute</groupId>
<artifactId>mal4j</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.1.0</version>

<profiles>
<profile>
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/dev/katsute/mal4j/APIStruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
import java.lang.annotation.Target;
import java.lang.reflect.Method;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

/**
* Annotations used to structure API calls.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/dev/katsute/mal4j/Fields.java
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ private Character(){}

public static final String biography = "biography";

@SuppressWarnings("SpellCheckingInspection")
public static final String animeography = "animeography";

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package dev.katsute.mal4j;

import static dev.katsute.mal4j.APIStruct.*;
import static dev.katsute.mal4j.Json.JsonObject;
import static dev.katsute.mal4j.Json.*;

/**
* Represents the HTTP requests for authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.function.Consumer;
import java.util.zip.GZIPOutputStream;

import static dev.katsute.mal4j.Json.JsonObject;
import static dev.katsute.mal4j.Json.*;

/**
* <b>Documentation:</b> <a href="https://myanimelist.net/apiconfig/references/authorization">https://myanimelist.net/apiconfig/references/authorization</a> <br>
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/dev/katsute/mal4j/MyAnimeListImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
import java.util.function.Function;
import java.util.regex.Pattern;

import static dev.katsute.mal4j.Json.JsonObject;
import static dev.katsute.mal4j.Json.*;
import static dev.katsute.mal4j.MyAnimeListSchema_Anime.*;
import static dev.katsute.mal4j.MyAnimeListSchema_Character.asCharacter;
import static dev.katsute.mal4j.MyAnimeListSchema_Character.*;
import static dev.katsute.mal4j.MyAnimeListSchema_Forum.*;
import static dev.katsute.mal4j.MyAnimeListSchema_Manga.*;
import static dev.katsute.mal4j.MyAnimeListSchema_User.asUser;
import static dev.katsute.mal4j.MyAnimeListSchema_User.*;

final class MyAnimeListImpl extends MyAnimeList {

Expand Down Expand Up @@ -104,7 +104,7 @@ public synchronized final void refreshToken(){
private final List<ExperimentalFeature> enabledFeatures = new ArrayList<>();

@SuppressWarnings("SameParameterValue")
final void checkExperimentalFeatureEnabled(final ExperimentalFeature feature) {
final void checkExperimentalFeatureEnabled(final ExperimentalFeature feature){
if(nativeFeatures.contains(feature) || enabledFeatures.contains(feature) || enabledFeatures.contains(ExperimentalFeature.ALL))
return;

Expand All @@ -127,7 +127,7 @@ final void clearExperimentalFeatures(){

@Override
public final AnimeSearchQuery getAnime(){
return new AnimeSearchQuery() {
return new AnimeSearchQuery(){

@Override
public final List<Anime> search(){
Expand Down Expand Up @@ -195,7 +195,7 @@ final JsonObject getAnimeSchema(final long id, final String... fields){
@Override
public final AnimeCharacterQuery getAnimeCharacters(final long id){
checkExperimentalFeatureEnabled(ExperimentalFeature.CHARACTERS);
return new AnimeCharacterQuery() {
return new AnimeCharacterQuery(){

@Override
public final List<Character> search(){
Expand Down Expand Up @@ -245,7 +245,7 @@ public final AnimeRankingQuery getAnimeRanking(final AnimeRankingType rankingTyp

@Override
public final AnimeRankingQuery getAnimeRanking(final String rankingType){
return new AnimeRankingQuery(Objects.requireNonNull(rankingType, "Ranking type cannot be null")) {
return new AnimeRankingQuery(Objects.requireNonNull(rankingType, "Ranking type cannot be null")){

@Override
public final List<AnimeRanking> search(){
Expand Down Expand Up @@ -291,7 +291,7 @@ public final PaginatedIterator<AnimeRanking> searchAll(){

@Override
public final AnimeSeasonQuery getAnimeSeason(final int year, final Season season){
return new AnimeSeasonQuery(year, Objects.requireNonNull(season, "Season cannot be null")) {
return new AnimeSeasonQuery(year, Objects.requireNonNull(season, "Season cannot be null")){

@Override
public final List<Anime> search(){
Expand Down Expand Up @@ -342,7 +342,7 @@ public final PaginatedIterator<Anime> searchAll(){

@Override
public final AnimeSuggestionQuery getAnimeSuggestions(){
return new AnimeSuggestionQuery() {
return new AnimeSuggestionQuery(){

@Override
public final List<Anime> search(){
Expand Down Expand Up @@ -385,7 +385,7 @@ public final PaginatedIterator<Anime> searchAll(){

@Override
public final AnimeListUpdate updateAnimeListing(final long id){
return new AnimeListUpdate(id) {
return new AnimeListUpdate(id){

@Override
public synchronized final AnimeListStatus update(){
Expand Down Expand Up @@ -436,7 +436,7 @@ public final UserAnimeListQuery getUserAnimeListing(){

@Override
public final UserAnimeListQuery getUserAnimeListing(final String username){
return new UserAnimeListQuery(Objects.requireNonNull(username, "Username cannot be null" )) {
return new UserAnimeListQuery(Objects.requireNonNull(username, "Username cannot be null" )){

@Override
public final List<AnimeListStatus> search(){
Expand Down Expand Up @@ -551,7 +551,7 @@ public final ForumTopicDetail getForumTopicDetail(final long id, final Integer l

@Override
public final ForumTopicDetailPostQuery getForumTopicDetailPostQuery(final long id){
return new ForumTopicDetailPostQuery() {
return new ForumTopicDetailPostQuery(){

@Override
public final List<Post> search(){
Expand Down Expand Up @@ -594,7 +594,7 @@ public final PaginatedIterator<Post> searchAll(){

@Override
public final ForumSearchQuery getForumTopics(){
return new ForumSearchQuery() {
return new ForumSearchQuery(){

@Override
public final List<ForumTopic> search(){
Expand Down Expand Up @@ -647,7 +647,7 @@ public final PaginatedIterator<ForumTopic> searchAll(){

@Override
public final MangaSearchQuery getManga(){
return new MangaSearchQuery() {
return new MangaSearchQuery(){

@Override
public final List<Manga> search(){
Expand Down Expand Up @@ -720,7 +720,7 @@ public final MangaRankingQuery getMangaRanking(final MangaRankingType rankingTyp

@Override
public final MangaRankingQuery getMangaRanking(final String rankingType){
return new MangaRankingQuery(Objects.requireNonNull(rankingType, "Ranking type cannot be null")) {
return new MangaRankingQuery(Objects.requireNonNull(rankingType, "Ranking type cannot be null")){

@Override
public final List<MangaRanking> search(){
Expand Down Expand Up @@ -767,7 +767,7 @@ public final PaginatedIterator<MangaRanking> searchAll(){

@Override
public final MangaListUpdate updateMangaListing(final long id){
return new MangaListUpdate(id) {
return new MangaListUpdate(id){

@Override
public synchronized final MangaListStatus update(){
Expand Down Expand Up @@ -819,7 +819,7 @@ public final UserMangaListQuery getUserMangaListing(){

@Override
public final UserMangaListQuery getUserMangaListing(final String username){
return new UserMangaListQuery(Objects.requireNonNull(username, "Username cannot be null")) {
return new UserMangaListQuery(Objects.requireNonNull(username, "Username cannot be null")){

@Override
public final List<MangaListStatus> search(){
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/dev/katsute/mal4j/MyAnimeListSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected static NullableDate parseNullableDate(final String date){
return null;
}

return new NullableDate() {
return new NullableDate(){

private final Long time = t;

Expand Down Expand Up @@ -153,35 +153,35 @@ protected static Time asTime(final String time){
final int h = Integer.parseInt(hhmm[0]);
final int m = Integer.parseInt(hhmm[1]);

return new Time() {
return new Time(){

private final Integer hour = h;
private final Integer hour12 = h > 12 ? h - 12 : h == 0 ? 12 : h;
private final Boolean am = hour <= 12;
private final Integer minute = m;

@Override
public final Integer getHour() {
public final Integer getHour(){
return hour;
}

@Override
public final Integer get12Hour() {
public final Integer get12Hour(){
return hour12;
}

@Override
public final Boolean isAM() {
public final Boolean isAM(){
return am;
}

@Override
public final Boolean isPM() {
public final Boolean isPM(){
return !am;
}

@Override
public final Integer getMinute() {
public final Integer getMinute(){
return minute;
}

Expand Down
Loading

0 comments on commit feb6630

Please sign in to comment.