Rename package

pull/9/head
Hammy 4 years ago
parent 33fe920dae
commit c8ec37a1f5

@ -1,11 +1,12 @@
package me.goudham; package me.goudham;
import me.goudham.domain.user.UserList;
import me.goudham.util.Season; import me.goudham.util.Season;
import me.goudham.api.entity.series.FilteredSeries; import me.goudham.domain.series.FilteredSeries;
import me.goudham.api.entity.series.Series; import me.goudham.domain.series.Series;
import me.goudham.api.entity.user.User; import me.goudham.domain.user.User;
import me.goudham.api.entity.waifu.FilteredWaifu; import me.goudham.domain.waifu.FilteredWaifu;
import me.goudham.api.entity.waifu.Waifu; import me.goudham.domain.waifu.Waifu;
import me.goudham.exception.APIMapperException; import me.goudham.exception.APIMapperException;
import me.goudham.exception.APIResponseException; import me.goudham.exception.APIResponseException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -57,10 +58,28 @@ public class MyWaifuClient {
return new MyWaifuClient(apiKey, httpClient); return new MyWaifuClient(apiKey, httpClient);
} }
/**
* Retrieves information about the {@link Waifu} specified by the given slug
*
* @param slug The slug of the {@link Waifu}
* @return {@link Response}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*
*/
public Response<Waifu> getWaifu(@NotNull String slug) throws APIResponseException, APIMapperException { public Response<Waifu> getWaifu(@NotNull String slug) throws APIResponseException, APIMapperException {
return APIWrapper.getWaifu(slug); return APIWrapper.getWaifu(slug);
} }
/**
* Retrieves information about the {@link Waifu} specified by the given id
*
* @param id The id of the {@link Waifu}
* @return {@link Response}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*
*/
public Response<Waifu> getWaifu(@NotNull Integer id) throws APIResponseException, APIMapperException { public Response<Waifu> getWaifu(@NotNull Integer id) throws APIResponseException, APIMapperException {
return APIWrapper.getWaifu(String.valueOf(id)); return APIWrapper.getWaifu(String.valueOf(id));
} }
@ -73,8 +92,8 @@ public class MyWaifuClient {
return APIWrapper.getRandomWaifu(); return APIWrapper.getRandomWaifu();
} }
public Response<Series> getSeries(@NotNull String param) throws APIMapperException, APIResponseException { public Response<Series> getSeries(@NotNull String slug) throws APIMapperException, APIResponseException {
return APIWrapper.getSeries(param); return APIWrapper.getSeries(slug);
} }
public Response<Series> getSeries(@NotNull Integer id) throws APIMapperException, APIResponseException { public Response<Series> getSeries(@NotNull Integer id) throws APIMapperException, APIResponseException {
@ -113,6 +132,14 @@ public class MyWaifuClient {
return APIWrapper.getUserProfile(String.valueOf(id)); return APIWrapper.getUserProfile(String.valueOf(id));
} }
public Response<List<UserList>> getUserLists(@NotNull Integer id) throws APIMapperException, APIResponseException {
return APIWrapper.getUserLists(String.valueOf(id));
}
public Response<UserList> getUserList(@NotNull Integer userId, @NotNull Integer listId) throws APIMapperException, APIResponseException {
return APIWrapper.getUserList(String.valueOf(userId), String.valueOf(listId));
}
/** /**
* Builder for {@link MyWaifuClient} * Builder for {@link MyWaifuClient}
* *

@ -1,34 +1,34 @@
package me.goudham; package me.goudham;
import me.goudham.api.entity.series.Series; import me.goudham.domain.series.Series;
import me.goudham.api.entity.waifu.Waifu; import me.goudham.domain.waifu.Waifu;
/** /**
* This is returned to the User when called by methods in {@link MyWaifuClient}. * This is returned to the User when called by methods in {@link MyWaifuClient}.
* E.g {@link MyWaifuClient#getWaifu(Integer)} * E.g {@link MyWaifuClient#getWaifu(Integer)}
* <br> * <br>
* Given a successful response, {@link #entity} will be populated with the requested entity. * Given a successful response, {@link #model} will be populated with the requested model.
* <br> * <br>
* No matter successful or unsuccessful response, {@link #statusCode} and {@link #body} * No matter successful or unsuccessful response, {@link #statusCode} and {@link #body}
* will be populated to ensure the user has all the information for debugging or extra information within * will be populated to ensure the user has all the information for debugging or extra information within
* the {@link #body} * the {@link #body}
* *
* @param <T> The type of entity to be returned. E.g {@link Waifu} or {@link Series} * @param <T> The type of model to be returned. E.g {@link Waifu} or {@link Series}
* *
*/ */
public class Response<T> { public class Response<T> {
private final T entity; private final T model;
private final Integer statusCode; private final Integer statusCode;
private final String body; private final String body;
Response(Integer statusCode, String body, T entity) { Response(Integer statusCode, String body, T model) {
this.statusCode = statusCode; this.statusCode = statusCode;
this.body = body; this.body = body;
this.entity = entity; this.model = model;
} }
public T getEntity() { public T getModel() {
return entity; return model;
} }
public Integer getStatusCode() { public Integer getStatusCode() {

@ -1,4 +1,4 @@
package me.goudham.api.entity; package me.goudham.domain;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;

@ -1,4 +1,4 @@
package me.goudham.api.entity; package me.goudham.domain;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;

@ -1,11 +1,10 @@
package me.goudham.api.entity.series; package me.goudham.domain.series;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import javax.annotation.processing.Generated;
import java.util.Objects; import java.util.Objects;
/** /**

@ -1,8 +1,8 @@
package me.goudham.api.entity.series; package me.goudham.domain.series;
import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.*;
import me.goudham.api.entity.Studio; import me.goudham.domain.Studio;
import me.goudham.api.entity.waifu.Waifu; import me.goudham.domain.waifu.Waifu;
import java.util.Objects; import java.util.Objects;

@ -1,10 +1,10 @@
package me.goudham.api.entity.user; package me.goudham.domain.user;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import me.goudham.api.entity.waifu.Waifu; import me.goudham.domain.waifu.Waifu;
import java.util.Objects; import java.util.Objects;

@ -1,11 +1,11 @@
package me.goudham.api.entity.user; package me.goudham.domain.user;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import me.goudham.api.entity.series.Series; import me.goudham.domain.series.Series;
import java.util.Objects; import java.util.Objects;

@ -1,7 +1,7 @@
package me.goudham.api.entity.user; package me.goudham.domain.user;
import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.*;
import me.goudham.api.entity.waifu.Waifu; import me.goudham.domain.waifu.Waifu;
import java.util.Objects; import java.util.Objects;

@ -1,7 +1,7 @@
package me.goudham.api.entity.user; package me.goudham.domain.user;
import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.*;
import me.goudham.api.entity.waifu.Waifu; import me.goudham.domain.waifu.Waifu;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;

@ -1,7 +1,7 @@
package me.goudham.api.entity.waifu; package me.goudham.domain.waifu;
import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.*;
import me.goudham.api.entity.series.FilteredSeries; import me.goudham.domain.series.FilteredSeries;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;

@ -1,8 +1,8 @@
package me.goudham.api.entity.waifu; package me.goudham.domain.waifu;
import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.*;
import me.goudham.api.entity.series.Series; import me.goudham.domain.series.Series;
import me.goudham.api.entity.user.Creator; import me.goudham.domain.user.Creator;
import javax.annotation.processing.Generated; import javax.annotation.processing.Generated;
import java.util.HashMap; import java.util.HashMap;

@ -1,4 +1,4 @@
package me.goudham.api.entity.waifu; package me.goudham.domain.waifu;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
Loading…
Cancel
Save