Add new endpoint - getDailyWaifu()

pull/9/head
Hammy 4 years ago
parent 61c1c0e7b0
commit 59508153ed

@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.databind.type.TypeFactory;
import org.goudham.me.api.entity.series.FilteredSeries; import org.goudham.me.api.entity.series.FilteredSeries;
import org.goudham.me.api.entity.series.Series; import org.goudham.me.api.entity.series.Series;
import org.goudham.me.api.entity.waifu.FilteredWaifu;
import org.goudham.me.api.entity.waifu.Waifu; import org.goudham.me.api.entity.waifu.Waifu;
import org.goudham.me.exception.APIMapperException; import org.goudham.me.exception.APIMapperException;
import org.goudham.me.exception.APIResponseException; import org.goudham.me.exception.APIResponseException;
@ -95,6 +96,11 @@ public class APIWrapper {
return apiMapper.deserialize(waifuResult, Waifu.class); return apiMapper.deserialize(waifuResult, Waifu.class);
} }
Response<FilteredWaifu> getDailyWaifu() throws APIResponseException, APIMapperException {
Result waifuResult = sendRequest(httpClient, "meta/daily");
return apiMapper.deserialize(waifuResult, FilteredWaifu.class);
}
Response<Series> getSeries(String param) throws APIResponseException, APIMapperException { Response<Series> getSeries(String param) throws APIResponseException, APIMapperException {
Result seriesResult = sendRequest(httpClient, "series/" + param); Result seriesResult = sendRequest(httpClient, "series/" + param);
return apiMapper.deserialize(seriesResult, Series.class); return apiMapper.deserialize(seriesResult, Series.class);

@ -2,6 +2,7 @@ package org.goudham.me;
import org.goudham.me.api.entity.series.FilteredSeries; import org.goudham.me.api.entity.series.FilteredSeries;
import org.goudham.me.api.entity.series.Series; import org.goudham.me.api.entity.series.Series;
import org.goudham.me.api.entity.waifu.FilteredWaifu;
import org.goudham.me.api.entity.waifu.Waifu; import org.goudham.me.api.entity.waifu.Waifu;
import org.goudham.me.exception.APIMapperException; import org.goudham.me.exception.APIMapperException;
import org.goudham.me.exception.APIResponseException; import org.goudham.me.exception.APIResponseException;
@ -62,6 +63,10 @@ public class MyWaifuClient {
return APIWrapper.getWaifu(String.valueOf(id)); return APIWrapper.getWaifu(String.valueOf(id));
} }
public Response<FilteredWaifu> getDailyWaifu() throws APIResponseException, APIMapperException {
return APIWrapper.getDailyWaifu();
}
public Response<Series> getSeries(@NotNull Integer id) throws APIMapperException, APIResponseException { public Response<Series> getSeries(@NotNull Integer id) throws APIMapperException, APIResponseException {
return APIWrapper.getSeries(String.valueOf(id)); return APIWrapper.getSeries(String.valueOf(id));
} }

@ -1,16 +1,12 @@
package org.goudham.me.api.entity.waifu; package org.goudham.me.api.entity.waifu;
import com.fasterxml.jackson.annotation.*;
import org.goudham.me.api.entity.series.FilteredSeries; import org.goudham.me.api.entity.series.FilteredSeries;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.annotation.processing.Generated; import javax.annotation.processing.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** /**
* Filtered Waifu * Filtered Waifu
@ -52,6 +48,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"id" "id"
}) })
@Generated("jsonschema2pojo") @Generated("jsonschema2pojo")
@JsonIgnoreProperties(ignoreUnknown = true)
public class FilteredWaifu { public class FilteredWaifu {
/** /**
* Used to generate readable URL's for the {@link FilteredWaifu} * Used to generate readable URL's for the {@link FilteredWaifu}

Loading…
Cancel
Save