mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
more api doc
This commit is contained in:
@@ -6,14 +6,25 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import com.wordnik.swagger.annotations.ApiClass;
|
||||||
|
import com.wordnik.swagger.annotations.ApiProperty;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@ApiClass("User settings")
|
||||||
public class Settings implements Serializable {
|
public class Settings implements Serializable {
|
||||||
|
|
||||||
|
@ApiProperty(value = "user reads all entries or unread entries only", allowableValues = "all,unread", required = true)
|
||||||
private String readingMode;
|
private String readingMode;
|
||||||
|
|
||||||
|
@ApiProperty(value = "user reads entries in ascending or descending order", allowableValues = "asc,desc", required = true)
|
||||||
private String readingOrder;
|
private String readingOrder;
|
||||||
|
|
||||||
|
@ApiProperty(value = "user wants category and feeds with no unread entries shown", required = true)
|
||||||
private boolean showRead;
|
private boolean showRead;
|
||||||
|
|
||||||
|
@ApiProperty(value = "user's custom css for the website")
|
||||||
private String customCss;
|
private String customCss;
|
||||||
|
|
||||||
public String getReadingMode() {
|
public String getReadingMode() {
|
||||||
|
|||||||
@@ -11,12 +11,17 @@ import com.commafeed.backend.model.UserSettings.ReadingMode;
|
|||||||
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
||||||
import com.commafeed.frontend.model.Settings;
|
import com.commafeed.frontend.model.Settings;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.wordnik.swagger.annotations.Api;
|
||||||
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
|
import com.wordnik.swagger.annotations.ApiParam;
|
||||||
|
|
||||||
@Path("settings")
|
@Path("/settings")
|
||||||
|
@Api(value = "/settings", description = "Operations about user settings")
|
||||||
public class SettingsREST extends AbstractREST {
|
public class SettingsREST extends AbstractREST {
|
||||||
|
|
||||||
@Path("get")
|
@Path("/get")
|
||||||
@GET
|
@GET
|
||||||
|
@ApiOperation(value = "Retrieve user settings", notes = "Retrieve user settings", responseClass = "com.commafeed.frontend.model.Settings")
|
||||||
public Settings get() {
|
public Settings get() {
|
||||||
Settings s = new Settings();
|
Settings s = new Settings();
|
||||||
UserSettings settings = userSettingsDAO.findByUser(getUser());
|
UserSettings settings = userSettingsDAO.findByUser(getUser());
|
||||||
@@ -33,9 +38,10 @@ public class SettingsREST extends AbstractREST {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("save")
|
@Path("/save")
|
||||||
@POST
|
@POST
|
||||||
public Response save(Settings settings) {
|
@ApiOperation(value = "Save user settings", notes = "Save user settings")
|
||||||
|
public Response save(@ApiParam Settings settings) {
|
||||||
Preconditions.checkNotNull(settings);
|
Preconditions.checkNotNull(settings);
|
||||||
|
|
||||||
UserSettings s = userSettingsDAO.findByUser(getUser());
|
UserSettings s = userSettingsDAO.findByUser(getUser());
|
||||||
|
|||||||
Reference in New Issue
Block a user