You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
3.1 KiB
Java
113 lines
3.1 KiB
Java
/*
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
package com.omertron.themoviedbapi.tools;
|
|
|
|
import java.util.EnumSet;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
public enum MethodSub {
|
|
|
|
ADD_ITEM("add_item"),
|
|
ALT_TITLES("alternative_titles"),
|
|
CASTS("casts"),
|
|
CHANGES("changes"),
|
|
CLEAR("clear"),
|
|
COLLECTION("collection"),
|
|
COMBINED_CREDITS("combined_credits"),
|
|
COMPANY("company"),
|
|
CREDITS("credits"),
|
|
EXTERNAL_IDS("external_ids"),
|
|
FAVORITE("favorite"),
|
|
FAVORITE_MOVIES("favorite/movies"),
|
|
FAVORITE_TV("favorite/tv"),
|
|
GUEST_SESSION("guest_session/new"),
|
|
IMAGES("images"),
|
|
ITEM_STATUS("item_status"),
|
|
KEYWORD("keyword"),
|
|
KEYWORDS("keywords"),
|
|
LATEST("latest"),
|
|
LIST("list"),
|
|
LISTS("lists"),
|
|
MOVIE("movie"),
|
|
MOVIES("movies"),
|
|
MOVIE_CREDITS("movie_credits"),
|
|
MOVIE_LIST("movie/list"),
|
|
MULTI("multi"),
|
|
NOW_PLAYING("now-playing"),
|
|
PERSON("person"),
|
|
POPULAR("popular"),
|
|
RATED_MOVIES("rated/movies"),
|
|
RATED_MOVIES_GUEST("rated_movies"),
|
|
RATED_TV("rated/tv"),
|
|
RATING("rating"),
|
|
RELEASES("releases"),
|
|
REMOVE_ITEM("remove_item"),
|
|
REVIEWS("reviews"),
|
|
SESSION_NEW("session/new"),
|
|
SIMILAR_MOVIES("similar_movies"),
|
|
TAGGED_IMAGES("tagged_images"),
|
|
TOKEN_NEW("token/new"),
|
|
TOKEN_VALIDATE("token/validate_with_login"),
|
|
TOP_RATED("top-rated"),
|
|
TRANSLATIONS("translations"),
|
|
TV("tv"),
|
|
TV_CREDITS("tv_credits"),
|
|
TV_LIST("tv/list"),
|
|
UPCOMING("upcoming"),
|
|
VIDEOS("videos"),
|
|
WATCHLIST("watchlist"),
|
|
WATCHLIST_MOVIES("watchlist/movies"),
|
|
WATCHLIST_TV("watchlist/tv");
|
|
|
|
private final String value;
|
|
|
|
private MethodSub(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
/**
|
|
* Get the URL parameter to use
|
|
*
|
|
* @return
|
|
*/
|
|
public String getValue() {
|
|
return this.value;
|
|
}
|
|
|
|
/**
|
|
* Convert a string into an Enum type
|
|
*
|
|
* @param value
|
|
* @return
|
|
*/
|
|
public static MethodSub fromString(String value) {
|
|
if (StringUtils.isNotBlank(value)) {
|
|
for (final MethodSub method : EnumSet.allOf(MethodSub.class)) {
|
|
if (value.equalsIgnoreCase(method.value)) {
|
|
return method;
|
|
}
|
|
}
|
|
}
|
|
|
|
// We've not found the type!
|
|
throw new IllegalArgumentException("Method '" + value + "' not recognised");
|
|
}
|
|
}
|