Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify testing utilities #176

Merged
merged 12 commits into from
Mar 9, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TmdbConfiguration extends AbstractTmdbApi {
* @return The configuration details
* @throws TmdbException If there was an error making the request or mapping the response.
*/
public Configuration getConfig() throws TmdbException {
public Configuration getDetails() throws TmdbException {
ApiUrl apiUrl = new ApiUrl(TMDB_METHOD_CONFIGURATION);
return mapJsonResult(apiUrl, Configuration.class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/info/movito/themoviedbapi/TmdbMovies.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public ProviderResults getWatchProviders(int movieId) throws TmdbException {
* @param movieId The TMDb id of the movie.
* @param guestSessionId optional - The guest session id of the user.
* @param sessionId optional - The session id of the user.
* @param rating The rating of the movie. Must be: 0 < rating <= 10.
* @param rating The rating of the movie. Must be: 0 &lt; rating &lE; 10.
* @return The response status.
* @throws TmdbException If there was an error making the request or mapping the response.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ReleaseDate extends AbstractJsonMapping {
private String certification;

@JsonProperty("descriptors")
private List<String> descriptors;
private List<Object> descriptors;

@JsonProperty("iso_639_1")
private String language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.HashMap;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = false)
public class Avatar extends AbstractJsonMapping {
@JsonProperty("gravatar")
private HashMap<String, String> gravatar;
private Map<String, String> gravatar;

@JsonProperty("tmdb")
private HashMap<String, String> tmdb;
private Map<String, String> tmdb;

public String getGravatarHash() {
return gravatar.get("hash");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class ImageConfig extends AbstractJsonMapping {
@JsonProperty("logo_sizes")
private List<String> logoSizes;

@JsonProperty("still_sizes")
private List<String> stillSizes;

/**
* Check that the poster size is valid.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package info.movito.themoviedbapi.model.core;

public class MovieResultsPage extends ResultsPage<Movie> { }
public class MovieResultsPage extends ResultsPage<Movie> {

}
77 changes: 16 additions & 61 deletions src/main/java/info/movito/themoviedbapi/model/movies/MovieDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Optional;

@Data
@EqualsAndHashCode(callSuper = true)
Expand Down Expand Up @@ -94,111 +93,67 @@ public class MovieDb extends IdElement implements Multi {
private Integer voteCount;

/* append to responses */

/** Can be null if not appended to the request (append to response). */
@JsonProperty("account_states")
private AccountStates accountStates;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("alternative_titles")
private AlternativeTitles alternativeTitles;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("credits")
private Credits credits;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("changes")
private ChangeResults changes;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("external_ids")
private ExternalIds externalIds;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("images")
private Images images;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("keywords")
private KeywordResults keywords;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("recommendations")
private MovieResultsPage recommendations;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("release_dates")
private ReleaseDateResults releaseDates;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("lists")
private MovieListResultsPage lists;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("reviews")
private ReviewResultsPage reviews;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("similar")
private MovieResultsPage similar;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("translations")
private Translations translations;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("videos")
private VideoResults videos;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("watch/providers")
private ProviderResults watchProviders;

public Optional<AccountStates> getAccountStates() {
return Optional.ofNullable(accountStates);
}

public Optional<AlternativeTitles> getAlternativeTitles() {
return Optional.ofNullable(alternativeTitles);
}

public Optional<Credits> getCredits() {
return Optional.ofNullable(credits);
}

public Optional<ChangeResults> getChanges() {
return Optional.ofNullable(changes);
}

public Optional<ExternalIds> getExternalIds() {
return Optional.ofNullable(externalIds);
}

public Optional<Images> getImages() {
return Optional.ofNullable(images);
}

public Optional<KeywordResults> getKeywords() {
return Optional.ofNullable(keywords);
}

public Optional<MovieResultsPage> getRecommendations() {
return Optional.ofNullable(recommendations);
}

public Optional<ReleaseDateResults> getReleaseDates() {
return Optional.ofNullable(releaseDates);
}

public Optional<MovieListResultsPage> getLists() {
return Optional.ofNullable(lists);
}

public Optional<ReviewResultsPage> getReviews() {
return Optional.ofNullable(reviews);
}

public Optional<MovieResultsPage> getSimilar() {
return Optional.ofNullable(similar);
}

public Optional<Translations> getTranslations() {
return Optional.ofNullable(translations);
}

public Optional<VideoResults> getVideos() {
return Optional.ofNullable(videos);
}

public Optional<ProviderResults> getWatchProviders() {
return Optional.ofNullable(watchProviders);
}

@Override
public MediaType getMediaType() {
return MediaType.MOVIE;
Expand Down
37 changes: 8 additions & 29 deletions src/main/java/info/movito/themoviedbapi/model/people/PersonDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Optional;

@Data
@EqualsAndHashCode(callSuper = true)
Expand Down Expand Up @@ -55,55 +54,35 @@ public class PersonDb extends NamedIdElement implements Multi {
private String profilePath;

/* append to responses */

/** Can be null if not appended to the request (append to response). */
@JsonProperty("combined_credits")
private CombinedPersonCredits combinedCredits;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("changes")
private ChangeResults changes;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("external_ids")
private ExternalIds externalIds;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("images")
private PersonImages images;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("movie_credits")
private MovieCredits movieCredits;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("tv_credits")
private TvCredits tvCredits;

/** Can be null if not appended to the request (append to response). */
@JsonProperty("translations")
private Translations translations;

public Optional<CombinedPersonCredits> getCombinedCredits() {
return Optional.ofNullable(combinedCredits);
}

public Optional<ChangeResults> getChanges() {
return Optional.ofNullable(changes);
}

public Optional<ExternalIds> getExternalIds() {
return Optional.ofNullable(externalIds);
}

public Optional<PersonImages> getImages() {
return Optional.ofNullable(images);
}

public Optional<MovieCredits> getMovieCredits() {
return Optional.ofNullable(movieCredits);
}

public Optional<TvCredits> getTvCredits() {
return Optional.ofNullable(tvCredits);
}

public Optional<Translations> getTranslations() {
return Optional.ofNullable(translations);
}

@Override
public MediaType getMediaType() {
return MediaType.PERSON;
Expand Down
Loading
Loading