diff --git a/src/main/java/com/omertron/themoviedbapi/enumeration/TVEpisodeMethod.java b/src/main/java/com/omertron/themoviedbapi/enumeration/TVEpisodeMethod.java new file mode 100644 index 000000000..5f3de57c5 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/enumeration/TVEpisodeMethod.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2004-2015 Stuart Boston + * + * This file is part of TheMovieDB API. + * + * TheMovieDB API is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * TheMovieDB API is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with TheMovieDB API. If not, see . + * + */ +package com.omertron.themoviedbapi.enumeration; + +import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod; +import org.apache.commons.lang3.StringUtils; + +/** + * List of TV methods + * + * @author Stuart + */ +public enum TVEpisodeMethod implements AppendToResponseMethod { + + CREDITS, + EXTERNAL_IDS, + IMAGES, + VIDEOS; + + /** + * Get the string to use in the URL + * + * @return + */ + @Override + public String getPropertyString() { + return this.name().toLowerCase(); + } + + /** + * Convert a string into an Enum type + * + * @param method + * @return + * @throws IllegalArgumentException If type is not recognised + * + */ + public static TVEpisodeMethod fromString(String method) { + if (StringUtils.isNotBlank(method)) { + try { + return TVEpisodeMethod.valueOf(method.trim().toUpperCase()); + } catch (IllegalArgumentException ex) { + throw new IllegalArgumentException("Method " + method + " does not exist.", ex); + } + } + throw new IllegalArgumentException("Method must not be null"); + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/enumeration/TVSeasonMethod.java b/src/main/java/com/omertron/themoviedbapi/enumeration/TVSeasonMethod.java new file mode 100644 index 000000000..130851448 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/enumeration/TVSeasonMethod.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2004-2015 Stuart Boston + * + * This file is part of TheMovieDB API. + * + * TheMovieDB API is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * TheMovieDB API is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with TheMovieDB API. If not, see . + * + */ +package com.omertron.themoviedbapi.enumeration; + +import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod; +import org.apache.commons.lang3.StringUtils; + +/** + * List of TV methods + * + * @author Stuart + */ +public enum TVSeasonMethod implements AppendToResponseMethod { + + CREDITS, + EXTERNAL_IDS, + IMAGES, + VIDEOS; + + /** + * Get the string to use in the URL + * + * @return + */ + @Override + public String getPropertyString() { + return this.name().toLowerCase(); + } + + /** + * Convert a string into an Enum type + * + * @param method + * @return + * @throws IllegalArgumentException If type is not recognised + * + */ + public static TVSeasonMethod fromString(String method) { + if (StringUtils.isNotBlank(method)) { + try { + return TVSeasonMethod.valueOf(method.trim().toUpperCase()); + } catch (IllegalArgumentException ex) { + throw new IllegalArgumentException("Method " + method + " does not exist.", ex); + } + } + throw new IllegalArgumentException("Method must not be null"); + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/model/tv/TVEpisodeInfo.java b/src/main/java/com/omertron/themoviedbapi/model/tv/TVEpisodeInfo.java index 462880cea..c8d3da53d 100644 --- a/src/main/java/com/omertron/themoviedbapi/model/tv/TVEpisodeInfo.java +++ b/src/main/java/com/omertron/themoviedbapi/model/tv/TVEpisodeInfo.java @@ -20,17 +20,29 @@ package com.omertron.themoviedbapi.model.tv; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.omertron.themoviedbapi.enumeration.TVEpisodeMethod; +import com.omertron.themoviedbapi.interfaces.AppendToResponse; +import com.omertron.themoviedbapi.model.artwork.Artwork; import com.omertron.themoviedbapi.model.credits.MediaCreditCast; import com.omertron.themoviedbapi.model.credits.MediaCreditCrew; +import com.omertron.themoviedbapi.model.media.MediaCreditList; +import com.omertron.themoviedbapi.model.media.Video; +import com.omertron.themoviedbapi.model.person.ExternalID; +import com.omertron.themoviedbapi.results.WrapperGenericList; +import com.omertron.themoviedbapi.results.WrapperImages; import java.io.Serializable; +import java.util.Collections; +import java.util.EnumSet; import java.util.List; +import java.util.Set; /** * TV Episode information * * @author stuart.boston */ -public class TVEpisodeInfo extends TVEpisodeBasic implements Serializable { +public class TVEpisodeInfo extends TVEpisodeBasic implements Serializable, AppendToResponse { private static final long serialVersionUID = 4L; @@ -40,7 +52,15 @@ public class TVEpisodeInfo extends TVEpisodeBasic implements Serializable { private List guestStars; @JsonProperty("production_code") private String productionCode; + // AppendToResponse + private final Set methods = EnumSet.noneOf(TVEpisodeMethod.class); + // AppendToResponse Properties + private MediaCreditList credits = new MediaCreditList(); + private ExternalID externalIDs = new ExternalID(); + private List images = Collections.emptyList(); + private List