
org.tinymediamanager.jsonrpc.api.call.Profiles Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kodi-json-rpc Show documentation
Show all versions of kodi-json-rpc Show documentation
This library is the result of freezy's Kodi JSON introspection, merged with dereulenspiegel's adoption
without android, and patched to Kodi 16 Jarvis.
The newest version!
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program 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 2, or (at your option)
* any later version.
*
* This Program 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 XBMC Remote; see the file license. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
package org.tinymediamanager.jsonrpc.api.call;
import java.util.ArrayList;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.node.ArrayNode;
import org.codehaus.jackson.node.ObjectNode;
import org.tinymediamanager.jsonrpc.api.AbstractCall;
import org.tinymediamanager.jsonrpc.api.model.ListModel;
import org.tinymediamanager.jsonrpc.api.model.ProfilesModel;
public final class Profiles {
/**
* Retrieve the current profile.
*
* This class represents the API method Profiles.GetCurrentProfile
*
* This class was generated automatically from XBMC's JSON-RPC introspect.
*/
public static class GetCurrentProfile extends AbstractCall {
public final static String API_TYPE = "Profiles.GetCurrentProfile";
/**
* Retrieve the current profile.
*
* @param properties
* One or more of: thumbnail, lockmode. See constants at {@link ProfilesModel.ProfileFields}.
*/
public GetCurrentProfile(String... properties) {
super();
addParameter("properties", properties);
}
@Override
protected ProfilesModel.ProfileDetail parseOne(JsonNode node) {
return new ProfilesModel.ProfileDetail(node);
}
@Override
public String getName() {
return API_TYPE;
}
@Override
protected boolean returnsList() {
return false;
}
}
/**
* Retrieve all profiles.
*
* This class represents the API method Profiles.GetProfiles
*
* This class was generated automatically from XBMC's JSON-RPC introspect.
*/
public static class GetProfiles extends AbstractCall {
public final static String API_TYPE = "Profiles.GetProfiles";
public final static String RESULT = "profiles";
/**
* Retrieve all profiles.
*
* @param limits
* @param sort
* @param properties
* One or more of: thumbnail, lockmode. See constants at {@link ProfilesModel.ProfileFields}.
*/
public GetProfiles(ListModel.Limits limits, ListModel.Sort sort, String... properties) {
super();
addParameter("limits", limits);
addParameter("sort", sort);
addParameter("properties", properties);
}
/**
* Retrieve all profiles.
*
* @param properties
* One or more of: thumbnail, lockmode. See constants at {@link ProfilesModel.ProfileFields}.
*/
public GetProfiles(String... properties) {
super();
addParameter("properties", properties);
}
/**
* Retrieve all profiles.
*
* @param limits
* @param properties
* One or more of: thumbnail, lockmode. See constants at {@link ProfilesModel.ProfileFields}.
*/
public GetProfiles(ListModel.Limits limits, String... properties) {
super();
addParameter("limits", limits);
addParameter("properties", properties);
}
@Override
protected ArrayList parseMany(JsonNode node) {
final ArrayNode profiles = parseResults(node, RESULT);
if (profiles != null) {
final ArrayList ret = new ArrayList(profiles.size());
for (int i = 0; i < profiles.size(); i++) {
final ObjectNode item = (ObjectNode) profiles.get(i);
ret.add(new ProfilesModel.ProfileDetail(item));
}
return ret;
}
else {
return new ArrayList(0);
}
}
@Override
public String getName() {
return API_TYPE;
}
@Override
protected boolean returnsList() {
return true;
}
}
/**
* Load the specified profile.
*
* This class represents the API method Profiles.LoadProfile
*
* This class was generated automatically from XBMC's JSON-RPC introspect.
*/
public static class LoadProfile extends AbstractCall {
public final static String API_TYPE = "Profiles.LoadProfile";
/**
* Load the specified profile.
*
* @param profile
* Profile name.
* @param prompt
* Prompt for password.
* @param password
*/
public LoadProfile(String profile, Boolean prompt, ProfilesModel.Password password) {
super();
addParameter("profile", profile);
addParameter("prompt", prompt);
addParameter("password", password);
}
/**
* Load the specified profile.
*
* @param profile
* Profile name.
*/
public LoadProfile(String profile) {
super();
addParameter("profile", profile);
}
/**
* Load the specified profile.
*
* @param profile
* Profile name.
* @param prompt
* Prompt for password.
*/
public LoadProfile(String profile, Boolean prompt) {
super();
addParameter("profile", profile);
addParameter("prompt", prompt);
}
/**
* Load the specified profile.
*
* @param profile
* Profile name.
* @param password
*/
public LoadProfile(String profile, ProfilesModel.Password password) {
super();
addParameter("profile", profile);
addParameter("password", password);
}
@Override
protected String parseOne(JsonNode node) {
return node.getTextValue();
}
@Override
public String getName() {
return API_TYPE;
}
@Override
protected boolean returnsList() {
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy