mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
migrate from swagger to openapi3
This commit is contained in:
1654
commafeed-client/package-lock.json
generated
1654
commafeed-client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -45,7 +45,7 @@
|
|||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
"react-router-dom": "^6.11.2",
|
"react-router-dom": "^6.11.2",
|
||||||
"react-swipeable": "^7.0.0",
|
"react-swipeable": "^7.0.0",
|
||||||
"swagger-ui-react": "^4.18.3",
|
"swagger-ui-react": "^5.10.5",
|
||||||
"throttle-debounce": "^5.0.0",
|
"throttle-debounce": "^5.0.0",
|
||||||
"tinycon": "^0.6.8",
|
"tinycon": "^0.6.8",
|
||||||
"use-local-storage": "^3.0.0",
|
"use-local-storage": "^3.0.0",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ function ApiDocumentationPage() {
|
|||||||
return (
|
return (
|
||||||
// force white background because swagger is unreadable with dark theme
|
// force white background because swagger is unreadable with dark theme
|
||||||
<Box style={{ backgroundColor: "#fff" }}>
|
<Box style={{ backgroundColor: "#fff" }}>
|
||||||
<SwaggerUI url="swagger/swagger.json" />
|
<SwaggerUI url="openapi/openapi.json" />
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default defineConfig({
|
|||||||
"/rest": "http://localhost:8083",
|
"/rest": "http://localhost:8083",
|
||||||
"/next": "http://localhost:8083",
|
"/next": "http://localhost:8083",
|
||||||
"/ws": "ws://localhost:8083",
|
"/ws": "ws://localhost:8083",
|
||||||
"/swagger": "http://localhost:8083",
|
"/openapi": "http://localhost:8083",
|
||||||
"/custom_css.css": "http://localhost:8083",
|
"/custom_css.css": "http://localhost:8083",
|
||||||
"/custom_js.js": "http://localhost:8083",
|
"/custom_js.js": "http://localhost:8083",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -124,41 +124,25 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.kongchen</groupId>
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
<artifactId>swagger-maven-plugin</artifactId>
|
<artifactId>swagger-maven-plugin</artifactId>
|
||||||
<version>3.1.7</version>
|
<version>2.2.19</version>
|
||||||
<?m2e ignore?>
|
<?m2e ignore?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<apiSources>
|
<outputPath>${project.build.directory}/classes/assets/openapi</outputPath>
|
||||||
<apiSource>
|
<outputFormat>JSONANDYAML</outputFormat>
|
||||||
<locations>
|
<resourcePackages>
|
||||||
<location>com.commafeed.frontend.resource</location>
|
<package>com.commafeed.frontend.resource</package>
|
||||||
<location>com.commafeed.frontend.model</location>
|
<package>com.commafeed.frontend.model</package>
|
||||||
<location>com.commafeed.frontend.model.request</location>
|
<package>com.commafeed.frontend.model.request</package>
|
||||||
</locations>
|
</resourcePackages>
|
||||||
<swaggerDirectory>${project.build.directory}/classes/assets/swagger</swaggerDirectory>
|
<prettyPrint>true</prettyPrint>
|
||||||
<basePath>/rest</basePath>
|
|
||||||
<info>
|
|
||||||
<title>CommaFeed</title>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</info>
|
|
||||||
<securityDefinitions>
|
|
||||||
<securityDefinition>
|
|
||||||
<name>basicAuth</name>
|
|
||||||
<type>basic</type>
|
|
||||||
</securityDefinition>
|
|
||||||
</securityDefinitions>
|
|
||||||
<typesToSkip>
|
|
||||||
<typeToSkip>com.commafeed.backend.model.User</typeToSkip>
|
|
||||||
</typesToSkip>
|
|
||||||
</apiSource>
|
|
||||||
</apiSources>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>compile</phase>
|
<phase>compile</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>generate</goal>
|
<goal>resolve</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
@@ -307,9 +291,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>1.5.22</version>
|
<version>2.2.19</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -4,36 +4,36 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Entry details")
|
@Schema(description = "Entry details")
|
||||||
@Data
|
@Data
|
||||||
public class Category implements Serializable {
|
public class Category implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "category id", required = true)
|
@Schema(description = "category id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "parent category id")
|
@Schema(description = "parent category id")
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "parent category name")
|
@Schema(description = "parent category name")
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "category id", required = true)
|
@Schema(description = "category id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "category children categories", required = true)
|
@Schema(description = "category children categories", requiredMode = RequiredMode.REQUIRED)
|
||||||
private List<Category> children = new ArrayList<>();
|
private List<Category> children = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty(value = "category feeds", required = true)
|
@Schema(description = "category feeds", requiredMode = RequiredMode.REQUIRED)
|
||||||
private List<Subscription> feeds = new ArrayList<>();
|
private List<Subscription> feeds = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty(value = "whether the category is expanded or collapsed", required = true)
|
@Schema(description = "whether the category is expanded or collapsed", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean expanded;
|
private boolean expanded;
|
||||||
|
|
||||||
@ApiModelProperty(value = "position of the category in the list", required = true)
|
@Schema(description = "position of the category in the list", requiredMode = RequiredMode.REQUIRED)
|
||||||
private int position;
|
private int position;
|
||||||
}
|
}
|
||||||
@@ -4,45 +4,45 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "List of entries with some metadata")
|
@Schema(description = "List of entries with some metadata")
|
||||||
@Data
|
@Data
|
||||||
public class Entries implements Serializable {
|
public class Entries implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "name of the feed or the category requested", required = true)
|
@Schema(description = "name of the feed or the category requested", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "error or warning message")
|
@Schema(description = "error or warning message")
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
@ApiModelProperty(value = "times the server tried to refresh the feed and failed", required = true)
|
@Schema(description = "times the server tried to refresh the feed and failed", requiredMode = RequiredMode.REQUIRED)
|
||||||
private int errorCount;
|
private int errorCount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "URL of the website, extracted from the feed, only filled if querying for feed entries, not category entries")
|
@Schema(description = "URL of the website, extracted from the feed, only filled if querying for feed entries, not category entries")
|
||||||
private String feedLink;
|
private String feedLink;
|
||||||
|
|
||||||
@ApiModelProperty(value = "list generation timestamp", required = true)
|
@Schema(description = "list generation timestamp", requiredMode = RequiredMode.REQUIRED)
|
||||||
private long timestamp;
|
private long timestamp;
|
||||||
|
|
||||||
@ApiModelProperty(value = "if the query has more elements", required = true)
|
@Schema(description = "if the query has more elements", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean hasMore;
|
private boolean hasMore;
|
||||||
|
|
||||||
@ApiModelProperty(value = "the requested offset")
|
@Schema(description = "the requested offset")
|
||||||
private int offset;
|
private int offset;
|
||||||
|
|
||||||
@ApiModelProperty(value = "the requested limit")
|
@Schema(description = "the requested limit")
|
||||||
private int limit;
|
private int limit;
|
||||||
|
|
||||||
@ApiModelProperty(value = "list of entries", required = true)
|
@Schema(description = "list of entries", requiredMode = RequiredMode.REQUIRED)
|
||||||
private List<Entry> entries = new ArrayList<>();
|
private List<Entry> entries = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty(
|
@Schema(
|
||||||
value = "if true, the unread flag was ignored in the request, all entries are returned regardless of their read status",
|
description = "if true, the unread flag was ignored in the request, all entries are returned regardless of their read status",
|
||||||
required = true)
|
requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean ignoredReadStatus;
|
private boolean ignoredReadStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,88 +21,88 @@ import com.rometools.rome.feed.synd.SyndEnclosureImpl;
|
|||||||
import com.rometools.rome.feed.synd.SyndEntry;
|
import com.rometools.rome.feed.synd.SyndEntry;
|
||||||
import com.rometools.rome.feed.synd.SyndEntryImpl;
|
import com.rometools.rome.feed.synd.SyndEntryImpl;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Entry details")
|
@Schema(description = "Entry details")
|
||||||
@Data
|
@Data
|
||||||
public class Entry implements Serializable {
|
public class Entry implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry id", required = true)
|
@Schema(description = "entry id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry guid", required = true)
|
@Schema(description = "entry guid", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String guid;
|
private String guid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry title", required = true)
|
@Schema(description = "entry title", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry content", required = true)
|
@Schema(description = "entry content", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@ApiModelProperty(value = "comma-separated list of categories")
|
@Schema(description = "comma-separated list of categories")
|
||||||
private String categories;
|
private String categories;
|
||||||
|
|
||||||
@ApiModelProperty(value = "whether entry content and title are rtl", required = true)
|
@Schema(description = "whether entry content and title are rtl", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean rtl;
|
private boolean rtl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry author")
|
@Schema(description = "entry author")
|
||||||
private String author;
|
private String author;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry enclosure url, if any")
|
@Schema(description = "entry enclosure url, if any")
|
||||||
private String enclosureUrl;
|
private String enclosureUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry enclosure mime type, if any")
|
@Schema(description = "entry enclosure mime type, if any")
|
||||||
private String enclosureType;
|
private String enclosureType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry media description, if any")
|
@Schema(description = "entry media description, if any")
|
||||||
private String mediaDescription;
|
private String mediaDescription;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry media thumbnail url, if any")
|
@Schema(description = "entry media thumbnail url, if any")
|
||||||
private String mediaThumbnailUrl;
|
private String mediaThumbnailUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry media thumbnail width, if any")
|
@Schema(description = "entry media thumbnail width, if any")
|
||||||
private Integer mediaThumbnailWidth;
|
private Integer mediaThumbnailWidth;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry media thumbnail height, if any")
|
@Schema(description = "entry media thumbnail height, if any")
|
||||||
private Integer mediaThumbnailHeight;
|
private Integer mediaThumbnailHeight;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry publication date", dataType = "number", required = true)
|
@Schema(description = "entry publication date", type = "number", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Date date;
|
private Date date;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry insertion date in the database", dataType = "number", required = true)
|
@Schema(description = "entry insertion date in the database", type = "number", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Date insertedDate;
|
private Date insertedDate;
|
||||||
|
|
||||||
@ApiModelProperty(value = "feed id", required = true)
|
@Schema(description = "feed id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String feedId;
|
private String feedId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "feed name", required = true)
|
@Schema(description = "feed name", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String feedName;
|
private String feedName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "this entry's feed url", required = true)
|
@Schema(description = "this entry's feed url", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String feedUrl;
|
private String feedUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "this entry's website url", required = true)
|
@Schema(description = "this entry's website url", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String feedLink;
|
private String feedLink;
|
||||||
|
|
||||||
@ApiModelProperty(value = "The favicon url to use for this feed", required = true)
|
@Schema(description = "The favicon url to use for this feed", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String iconUrl;
|
private String iconUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry url", required = true)
|
@Schema(description = "entry url", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@ApiModelProperty(value = "read status", required = true)
|
@Schema(description = "read status", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean read;
|
private boolean read;
|
||||||
|
|
||||||
@ApiModelProperty(value = "starred status", required = true)
|
@Schema(description = "starred status", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean starred;
|
private boolean starred;
|
||||||
|
|
||||||
@ApiModelProperty(value = "whether the entry is still markable (old entry statuses are discarded)", required = true)
|
@Schema(description = "whether the entry is still markable (old entry statuses are discarded)", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean markable;
|
private boolean markable;
|
||||||
|
|
||||||
@ApiModelProperty(value = "tags", required = true)
|
@Schema(description = "tags", requiredMode = RequiredMode.REQUIRED)
|
||||||
private List<String> tags;
|
private List<String> tags;
|
||||||
|
|
||||||
public static Entry build(FeedEntryStatus status, boolean proxyImages) {
|
public static Entry build(FeedEntryStatus status, boolean proxyImages) {
|
||||||
|
|||||||
@@ -2,19 +2,19 @@ package com.commafeed.frontend.model;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Feed details")
|
@Schema(description = "Feed details")
|
||||||
@Data
|
@Data
|
||||||
public class FeedInfo implements Serializable {
|
public class FeedInfo implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "url", required = true)
|
@Schema(description = "url", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@ApiModelProperty(value = "title", required = true)
|
@Schema(description = "title", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,34 +2,34 @@ package com.commafeed.frontend.model;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Server infos")
|
@Schema(description = "Server infos")
|
||||||
@Data
|
@Data
|
||||||
public class ServerInfo implements Serializable {
|
public class ServerInfo implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty
|
@Schema
|
||||||
private String announcement;
|
private String announcement;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private String gitCommit;
|
private String gitCommit;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean allowRegistrations;
|
private boolean allowRegistrations;
|
||||||
|
|
||||||
@ApiModelProperty
|
@Schema
|
||||||
private String googleAnalyticsCode;
|
private String googleAnalyticsCode;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean smtpEnabled;
|
private boolean smtpEnabled;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean demoAccountEnabled;
|
private boolean demoAccountEnabled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,76 +2,84 @@ package com.commafeed.frontend.model;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "User settings")
|
@Schema(description = "User settings")
|
||||||
@Data
|
@Data
|
||||||
public class Settings implements Serializable {
|
public class Settings implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "user's preferred language, english if none", required = true)
|
@Schema(description = "user's preferred language, english if none", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String language;
|
private String language;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user reads all entries or unread entries only", allowableValues = "all,unread", required = true)
|
@Schema(
|
||||||
|
description = "user reads all entries or unread entries only",
|
||||||
|
allowableValues = "all,unread",
|
||||||
|
requiredMode = RequiredMode.REQUIRED)
|
||||||
private String readingMode;
|
private String readingMode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user reads entries in ascending or descending order", allowableValues = "asc,desc", required = true)
|
@Schema(
|
||||||
|
description = "user reads entries in ascending or descending order",
|
||||||
|
allowableValues = "asc,desc",
|
||||||
|
requiredMode = RequiredMode.REQUIRED)
|
||||||
private String readingOrder;
|
private String readingOrder;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user wants category and feeds with no unread entries shown", required = true)
|
@Schema(description = "user wants category and feeds with no unread entries shown", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean showRead;
|
private boolean showRead;
|
||||||
|
|
||||||
@ApiModelProperty(value = "In expanded view, scroll through entries mark them as read", required = true)
|
@Schema(description = "In expanded view, scroll through entries mark them as read", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean scrollMarks;
|
private boolean scrollMarks;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user's custom css for the website")
|
@Schema(description = "user's custom css for the website")
|
||||||
private String customCss;
|
private String customCss;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user's custom js for the website")
|
@Schema(description = "user's custom js for the website")
|
||||||
private String customJs;
|
private String customJs;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user's preferred scroll speed when navigating between entries", required = true)
|
@Schema(description = "user's preferred scroll speed when navigating between entries", requiredMode = RequiredMode.REQUIRED)
|
||||||
private int scrollSpeed;
|
private int scrollSpeed;
|
||||||
|
|
||||||
@ApiModelProperty(value = "always scroll selected entry to the top of the page, even if it fits entirely on screen", required = true)
|
@Schema(
|
||||||
|
description = "always scroll selected entry to the top of the page, even if it fits entirely on screen",
|
||||||
|
requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean alwaysScrollToEntry;
|
private boolean alwaysScrollToEntry;
|
||||||
|
|
||||||
@ApiModelProperty(value = "ask for confirmation when marking all entries as read", required = true)
|
@Schema(description = "ask for confirmation when marking all entries as read", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean markAllAsReadConfirmation;
|
private boolean markAllAsReadConfirmation;
|
||||||
|
|
||||||
@ApiModelProperty(value = "show commafeed's own context menu on right click", required = true)
|
@Schema(description = "show commafeed's own context menu on right click", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean customContextMenu;
|
private boolean customContextMenu;
|
||||||
|
|
||||||
@ApiModelProperty(value = "sharing settings", required = true)
|
@Schema(description = "sharing settings", requiredMode = RequiredMode.REQUIRED)
|
||||||
private SharingSettings sharingSettings = new SharingSettings();
|
private SharingSettings sharingSettings = new SharingSettings();
|
||||||
|
|
||||||
@ApiModel(description = "User sharing settings")
|
@Schema(description = "User sharing settings")
|
||||||
@Data
|
@Data
|
||||||
public static class SharingSettings implements Serializable {
|
public static class SharingSettings implements Serializable {
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean email;
|
private boolean email;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean gmail;
|
private boolean gmail;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean facebook;
|
private boolean facebook;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean twitter;
|
private boolean twitter;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean tumblr;
|
private boolean tumblr;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean pocket;
|
private boolean pocket;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean instapaper;
|
private boolean instapaper;
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean buffer;
|
private boolean buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,55 +8,55 @@ import com.commafeed.backend.model.Feed;
|
|||||||
import com.commafeed.backend.model.FeedCategory;
|
import com.commafeed.backend.model.FeedCategory;
|
||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "User information")
|
@Schema(description = "User information")
|
||||||
@Data
|
@Data
|
||||||
public class Subscription implements Serializable {
|
public class Subscription implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "subscription id", required = true)
|
@Schema(description = "subscription id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "subscription name", required = true)
|
@Schema(description = "subscription name", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "error message while fetching the feed")
|
@Schema(description = "error message while fetching the feed")
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
@ApiModelProperty(value = "error count", required = true)
|
@Schema(description = "error count", requiredMode = RequiredMode.REQUIRED)
|
||||||
private int errorCount;
|
private int errorCount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "last time the feed was refreshed", dataType = "number")
|
@Schema(description = "last time the feed was refreshed", type = "number")
|
||||||
private Date lastRefresh;
|
private Date lastRefresh;
|
||||||
|
|
||||||
@ApiModelProperty(value = "next time the feed refresh is planned, null if refresh is already queued", dataType = "number")
|
@Schema(description = "next time the feed refresh is planned, null if refresh is already queued", type = "number")
|
||||||
private Date nextRefresh;
|
private Date nextRefresh;
|
||||||
|
|
||||||
@ApiModelProperty(value = "this subscription's feed url", required = true)
|
@Schema(description = "this subscription's feed url", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String feedUrl;
|
private String feedUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "this subscription's website url", required = true)
|
@Schema(description = "this subscription's website url", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String feedLink;
|
private String feedLink;
|
||||||
|
|
||||||
@ApiModelProperty(value = "The favicon url to use for this feed", required = true)
|
@Schema(description = "The favicon url to use for this feed", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String iconUrl;
|
private String iconUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "unread count", required = true)
|
@Schema(description = "unread count", requiredMode = RequiredMode.REQUIRED)
|
||||||
private long unread;
|
private long unread;
|
||||||
|
|
||||||
@ApiModelProperty(value = "category id")
|
@Schema(description = "category id")
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
@ApiModelProperty("position of the subscription's in the list")
|
@Schema(description = "position of the subscription's in the list")
|
||||||
private int position;
|
private int position;
|
||||||
|
|
||||||
@ApiModelProperty(value = "date of the newest item", dataType = "number")
|
@Schema(description = "date of the newest item", type = "number")
|
||||||
private Date newestItemTime;
|
private Date newestItemTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
@Schema(description = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
||||||
private String filter;
|
private String filter;
|
||||||
|
|
||||||
public static Subscription build(FeedSubscription subscription, UnreadCount unreadCount) {
|
public static Subscription build(FeedSubscription subscription, UnreadCount unreadCount) {
|
||||||
|
|||||||
@@ -3,22 +3,21 @@ package com.commafeed.frontend.model;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Unread count")
|
@Schema(description = "Unread count")
|
||||||
@Data
|
@Data
|
||||||
public class UnreadCount implements Serializable {
|
public class UnreadCount implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty
|
@Schema
|
||||||
private long feedId;
|
private long feedId;
|
||||||
|
|
||||||
@ApiModelProperty
|
@Schema
|
||||||
private long unreadCount;
|
private long unreadCount;
|
||||||
|
|
||||||
@ApiModelProperty(dataType = "number")
|
@Schema(type = "number")
|
||||||
private Date newestItemTime;
|
private Date newestItemTime;
|
||||||
|
|
||||||
public UnreadCount() {
|
public UnreadCount() {
|
||||||
|
|||||||
@@ -3,40 +3,40 @@ package com.commafeed.frontend.model;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "User information")
|
@Schema(description = "User information")
|
||||||
@Data
|
@Data
|
||||||
public class UserModel implements Serializable {
|
public class UserModel implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "user id", required = true)
|
@Schema(description = "user id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user name", required = true)
|
@Schema(description = "user name", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("user email, if any")
|
@Schema(description = "user email, if any")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ApiModelProperty("api key")
|
@Schema(description = "api key")
|
||||||
private String apiKey;
|
private String apiKey;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user password, never returned by the api")
|
@Schema(description = "user password, never returned by the api")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@ApiModelProperty(value = "account status", required = true)
|
@Schema(description = "account status", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
@ApiModelProperty(value = "account creation date", dataType = "number")
|
@Schema(description = "account creation date", type = "number")
|
||||||
private Date created;
|
private Date created;
|
||||||
|
|
||||||
@ApiModelProperty(value = "last login date", dataType = "number")
|
@Schema(description = "last login date", type = "number")
|
||||||
private Date lastLogin;
|
private Date lastLogin;
|
||||||
|
|
||||||
@ApiModelProperty(value = "user is admin", required = true)
|
@Schema(description = "user is admin", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean admin;
|
private boolean admin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,21 +5,21 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Add Category Request")
|
@Schema(description = "Add Category Request")
|
||||||
@Data
|
@Data
|
||||||
public class AddCategoryRequest implements Serializable {
|
public class AddCategoryRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "name", required = true)
|
@Schema(description = "name", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "parent category id, if any")
|
@Schema(description = "parent category id, if any")
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
|
|||||||
@@ -4,27 +4,27 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Category modification request")
|
@Schema(description = "Category modification request")
|
||||||
@Data
|
@Data
|
||||||
public class CategoryModificationRequest implements Serializable {
|
public class CategoryModificationRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
@Schema(description = "id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new name, null if not changed")
|
@Schema(description = "new name, null if not changed")
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new parent category id")
|
@Schema(description = "new parent category id")
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new display position, null if not changed")
|
@Schema(description = "new display position, null if not changed")
|
||||||
private Integer position;
|
private Integer position;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,19 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Mark Request")
|
@Schema(description = "Mark Request")
|
||||||
@Data
|
@Data
|
||||||
public class CollapseRequest implements Serializable {
|
public class CollapseRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "category id", required = true)
|
@Schema(description = "category id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "collapse", required = true)
|
@Schema(description = "collapse", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean collapse;
|
private boolean collapse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Feed information request")
|
@Schema(description = "Feed information request")
|
||||||
@Data
|
@Data
|
||||||
public class FeedInfoRequest implements Serializable {
|
public class FeedInfoRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "feed url", required = true)
|
@Schema(description = "feed url", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 4096)
|
@Size(max = 4096)
|
||||||
private String url;
|
private String url;
|
||||||
|
|||||||
@@ -4,30 +4,30 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Feed modification request")
|
@Schema(description = "Feed modification request")
|
||||||
@Data
|
@Data
|
||||||
public class FeedModificationRequest implements Serializable {
|
public class FeedModificationRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
@Schema(description = "id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new name, null if not changed")
|
@Schema(description = "new name, null if not changed")
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new parent category id")
|
@Schema(description = "new parent category id")
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new display position, null if not changed")
|
@Schema(description = "new display position, null if not changed")
|
||||||
private Integer position;
|
private Integer position;
|
||||||
|
|
||||||
@ApiModelProperty(value = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
@Schema(description = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
||||||
@Size(max = 4096)
|
@Size(max = 4096)
|
||||||
private String filter;
|
private String filter;
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel
|
@Schema
|
||||||
@Data
|
@Data
|
||||||
public class IDRequest implements Serializable {
|
public class IDRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(required = true)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,20 +5,20 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@Data
|
@Data
|
||||||
@ApiModel
|
@Schema
|
||||||
public class LoginRequest implements Serializable {
|
public class LoginRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "username", required = true)
|
@Schema(description = "username", requiredMode = RequiredMode.REQUIRED)
|
||||||
@Size(min = 3, max = 32)
|
@Size(min = 3, max = 32)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "password", required = true)
|
@Schema(description = "password", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String password;
|
private String password;
|
||||||
|
|||||||
@@ -6,33 +6,37 @@ import java.util.List;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Mark Request")
|
@Schema(description = "Mark Request")
|
||||||
@Data
|
@Data
|
||||||
public class MarkRequest implements Serializable {
|
public class MarkRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry id, category id, 'all' or 'starred'", required = true)
|
@Schema(description = "entry id, category id, 'all' or 'starred'", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "mark as read or unread", required = true)
|
@Schema(description = "mark as read or unread", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean read;
|
private boolean read;
|
||||||
|
|
||||||
@ApiModelProperty(
|
@Schema(
|
||||||
value = "only entries older than this, pass the timestamp you got from the entry list to prevent marking an entry that was not retrieved",
|
description = "only entries older than this, pass the timestamp you got from the entry list to prevent marking an entry that was not retrieved",
|
||||||
required = false)
|
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||||
private Long olderThan;
|
private Long olderThan;
|
||||||
|
|
||||||
@ApiModelProperty(value = "only mark read if a feed has these keywords in the title or rss content", required = false)
|
@Schema(
|
||||||
|
description = "only mark read if a feed has these keywords in the title or rss content",
|
||||||
|
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String keywords;
|
private String keywords;
|
||||||
|
|
||||||
@ApiModelProperty(value = "if marking a category or 'all', exclude those subscriptions from the marking", required = false)
|
@Schema(
|
||||||
|
description = "if marking a category or 'all', exclude those subscriptions from the marking",
|
||||||
|
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||||
private List<Long> excludedSubscriptions;
|
private List<Long> excludedSubscriptions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Multiple Mark Request")
|
@Schema(description = "Multiple Mark Request")
|
||||||
@Data
|
@Data
|
||||||
public class MultipleMarkRequest implements Serializable {
|
public class MultipleMarkRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "list of mark requests", required = true)
|
@Schema(description = "list of mark requests", requiredMode = RequiredMode.REQUIRED)
|
||||||
private List<@Valid MarkRequest> requests;
|
private List<@Valid MarkRequest> requests;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ import javax.validation.constraints.Email;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@Data
|
@Data
|
||||||
@ApiModel
|
@Schema
|
||||||
public class PasswordResetRequest implements Serializable {
|
public class PasswordResetRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "email address for password recovery", required = true)
|
@Schema(description = "email address for password recovery", requiredMode = RequiredMode.REQUIRED)
|
||||||
@Email
|
@Email
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 255)
|
@Size(max = 255)
|
||||||
|
|||||||
@@ -7,28 +7,28 @@ import javax.validation.constraints.Size;
|
|||||||
|
|
||||||
import com.commafeed.frontend.auth.ValidPassword;
|
import com.commafeed.frontend.auth.ValidPassword;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Profile modification request")
|
@Schema(description = "Profile modification request")
|
||||||
@Data
|
@Data
|
||||||
public class ProfileModificationRequest implements Serializable {
|
public class ProfileModificationRequest implements Serializable {
|
||||||
@ApiModelProperty(value = "current user password, required to change profile data", required = true)
|
@Schema(description = "current user password, required to change profile data", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String currentPassword;
|
private String currentPassword;
|
||||||
|
|
||||||
@ApiModelProperty(value = "changes email of the user, if specified")
|
@Schema(description = "changes email of the user, if specified")
|
||||||
@Size(max = 255)
|
@Size(max = 255)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ApiModelProperty(value = "changes password of the user, if specified")
|
@Schema(description = "changes password of the user, if specified")
|
||||||
@ValidPassword
|
@ValidPassword
|
||||||
private String newPassword;
|
private String newPassword;
|
||||||
|
|
||||||
@ApiModelProperty(value = "generate a new api key")
|
@Schema(description = "generate a new api key")
|
||||||
private boolean newApiKey;
|
private boolean newApiKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,26 +8,26 @@ import javax.validation.constraints.Size;
|
|||||||
|
|
||||||
import com.commafeed.frontend.auth.ValidPassword;
|
import com.commafeed.frontend.auth.ValidPassword;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@Data
|
@Data
|
||||||
@ApiModel
|
@Schema
|
||||||
public class RegistrationRequest implements Serializable {
|
public class RegistrationRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "username, between 3 and 32 characters", required = true)
|
@Schema(description = "username, between 3 and 32 characters", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(min = 3, max = 32)
|
@Size(min = 3, max = 32)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "password, minimum 6 characters", required = true)
|
@Schema(description = "password, minimum 6 characters", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@ValidPassword
|
@ValidPassword
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@ApiModelProperty(value = "email address for password recovery", required = true)
|
@Schema(description = "email address for password recovery", requiredMode = RequiredMode.REQUIRED)
|
||||||
@Email
|
@Email
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 255)
|
@Size(max = 255)
|
||||||
|
|||||||
@@ -5,24 +5,24 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Star Request")
|
@Schema(description = "Star Request")
|
||||||
@Data
|
@Data
|
||||||
public class StarRequest implements Serializable {
|
public class StarRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
@Schema(description = "id", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "feed id", required = true)
|
@Schema(description = "feed id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long feedId;
|
private Long feedId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "starred or not", required = true)
|
@Schema(description = "starred or not", requiredMode = RequiredMode.REQUIRED)
|
||||||
private boolean starred;
|
private boolean starred;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,26 +5,26 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Subscription request")
|
@Schema(description = "Subscription request")
|
||||||
@Data
|
@Data
|
||||||
public class SubscribeRequest implements Serializable {
|
public class SubscribeRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "url of the feed", required = true)
|
@Schema(description = "url of the feed", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 4096)
|
@Size(max = 4096)
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@ApiModelProperty(value = "name of the feed for the user", required = true)
|
@Schema(description = "name of the feed for the user", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@ApiModelProperty(value = "id of the user category to place the feed in")
|
@Schema(description = "id of the user category to place the feed in")
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
|
|||||||
@@ -3,19 +3,19 @@ package com.commafeed.frontend.model.request;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ApiModel(description = "Tag Request")
|
@Schema(description = "Tag Request")
|
||||||
@Data
|
@Data
|
||||||
public class TagRequest implements Serializable {
|
public class TagRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry id", required = true)
|
@Schema(description = "entry id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private Long entryId;
|
private Long entryId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "tags", required = true)
|
@Schema(description = "tags", requiredMode = RequiredMode.REQUIRED)
|
||||||
private List<String> tags;
|
private List<String> tags;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,15 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@Path("/admin")
|
@Path("/admin")
|
||||||
@Api(value = "/admin")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
||||||
@@ -60,10 +62,12 @@ public class AdminREST {
|
|||||||
@Path("/user/save")
|
@Path("/user/save")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Save or update a user", notes = "Save or update a user. If the id is not specified, a new user will be created")
|
@Operation(
|
||||||
|
summary = "Save or update a user",
|
||||||
|
description = "Save or update a user. If the id is not specified, a new user will be created")
|
||||||
@Timed
|
@Timed
|
||||||
public Response adminSaveUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
public Response adminSaveUser(@Parameter(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||||
@ApiParam(required = true) UserModel userModel) {
|
@Parameter(required = true) UserModel userModel) {
|
||||||
Preconditions.checkNotNull(userModel);
|
Preconditions.checkNotNull(userModel);
|
||||||
Preconditions.checkNotNull(userModel.getName());
|
Preconditions.checkNotNull(userModel.getName());
|
||||||
|
|
||||||
@@ -116,10 +120,13 @@ public class AdminREST {
|
|||||||
@Path("/user/get/{id}")
|
@Path("/user/get/{id}")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get user information", notes = "Get user information", response = UserModel.class)
|
@Operation(
|
||||||
|
summary = "Get user information",
|
||||||
|
description = "Get user information",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = UserModel.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response adminGetUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
public Response adminGetUser(@Parameter(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||||
@ApiParam(value = "user id", required = true) @PathParam("id") Long id) {
|
@Parameter(description = "user id", required = true) @PathParam("id") Long id) {
|
||||||
Preconditions.checkNotNull(id);
|
Preconditions.checkNotNull(id);
|
||||||
User u = userDAO.findById(id);
|
User u = userDAO.findById(id);
|
||||||
UserModel userModel = new UserModel();
|
UserModel userModel = new UserModel();
|
||||||
@@ -134,9 +141,12 @@ public class AdminREST {
|
|||||||
@Path("/user/getAll")
|
@Path("/user/getAll")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get all users", notes = "Get all users", response = UserModel.class, responseContainer = "List")
|
@Operation(
|
||||||
|
summary = "Get all users",
|
||||||
|
description = "Get all users",
|
||||||
|
responses = { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserModel.class)))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response adminGetUsers(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
public Response adminGetUsers(@Parameter(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||||
Map<Long, UserModel> users = new HashMap<>();
|
Map<Long, UserModel> users = new HashMap<>();
|
||||||
for (UserRole role : userRoleDAO.findAll()) {
|
for (UserRole role : userRoleDAO.findAll()) {
|
||||||
User u = role.getUser();
|
User u = role.getUser();
|
||||||
@@ -162,10 +172,10 @@ public class AdminREST {
|
|||||||
@Path("/user/delete")
|
@Path("/user/delete")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Delete a user", notes = "Delete a user, and all his subscriptions")
|
@Operation(summary = "Delete a user", description = "Delete a user, and all his subscriptions")
|
||||||
@Timed
|
@Timed
|
||||||
public Response adminDeleteUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
public Response adminDeleteUser(@Parameter(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||||
@ApiParam(required = true) IDRequest req) {
|
@Parameter(required = true) IDRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -183,18 +193,21 @@ public class AdminREST {
|
|||||||
@Path("/settings")
|
@Path("/settings")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Retrieve application settings", notes = "Retrieve application settings", response = ApplicationSettings.class)
|
@Operation(
|
||||||
|
summary = "Retrieve application settings",
|
||||||
|
description = "Retrieve application settings",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = ApplicationSettings.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getApplicationSettings(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
public Response getApplicationSettings(@Parameter(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||||
return Response.ok(config.getApplicationSettings()).build();
|
return Response.ok(config.getApplicationSettings()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("/metrics")
|
@Path("/metrics")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Retrieve server metrics")
|
@Operation(summary = "Retrieve server metrics")
|
||||||
@Timed
|
@Timed
|
||||||
public Response getMetrics(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
public Response getMetrics(@Parameter(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||||
return Response.ok(metrics).build();
|
return Response.ok(metrics).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,16 @@ import com.rometools.rome.feed.synd.SyndFeedImpl;
|
|||||||
import com.rometools.rome.io.SyndFeedOutput;
|
import com.rometools.rome.io.SyndFeedOutput;
|
||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Path("/category")
|
@Path("/category")
|
||||||
@Api(value = "/category")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@@ -93,24 +95,26 @@ public class CategoryREST {
|
|||||||
@Path("/entries")
|
@Path("/entries")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get category entries", notes = "Get a list of category entries", response = Entries.class)
|
@Operation(
|
||||||
|
summary = "Get category entries",
|
||||||
|
description = "Get a list of category entries",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Entries.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getCategoryEntries(@ApiParam(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
public Response getCategoryEntries(@Parameter(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
||||||
@ApiParam(value = "id of the category, 'all' or 'starred'", required = true) @QueryParam("id") String id,
|
@Parameter(description = "id of the category, 'all' or 'starred'", required = true) @QueryParam("id") String id,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "all entries or only unread ones",
|
description = "all entries or only unread ones",
|
||||||
allowableValues = "all,unread",
|
|
||||||
required = true) @DefaultValue("unread") @QueryParam("readType") ReadingMode readType,
|
required = true) @DefaultValue("unread") @QueryParam("readType") ReadingMode readType,
|
||||||
@ApiParam(value = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
@Parameter(description = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
||||||
@ApiParam(value = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
@Parameter(description = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
||||||
@ApiParam(value = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
@Parameter(description = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
||||||
@ApiParam(value = "ordering", allowableValues = "asc,desc") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
@Parameter(description = "ordering") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
description = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
||||||
@ApiParam(value = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds,
|
@Parameter(description = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "comma-separated list of excluded subscription ids") @QueryParam("excludedSubscriptionIds") String excludedSubscriptionIds,
|
description = "comma-separated list of excluded subscription ids") @QueryParam("excludedSubscriptionIds") String excludedSubscriptionIds,
|
||||||
@ApiParam(value = "keep only entries tagged with this tag") @QueryParam("tag") String tag) {
|
@Parameter(description = "keep only entries tagged with this tag") @QueryParam("tag") String tag) {
|
||||||
|
|
||||||
Preconditions.checkNotNull(readType);
|
Preconditions.checkNotNull(readType);
|
||||||
|
|
||||||
@@ -186,25 +190,24 @@ public class CategoryREST {
|
|||||||
@Path("/entriesAsFeed")
|
@Path("/entriesAsFeed")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get category entries as feed", notes = "Get a feed of category entries")
|
@Operation(summary = "Get category entries as feed", description = "Get a feed of category entries")
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
@Timed
|
@Timed
|
||||||
public Response getCategoryEntriesAsFeed(@ApiParam(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
public Response getCategoryEntriesAsFeed(@Parameter(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
||||||
@ApiParam(value = "id of the category, 'all' or 'starred'", required = true) @QueryParam("id") String id,
|
@Parameter(description = "id of the category, 'all' or 'starred'", required = true) @QueryParam("id") String id,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "all entries or only unread ones",
|
description = "all entries or only unread ones",
|
||||||
allowableValues = "all,unread",
|
|
||||||
required = true) @DefaultValue("all") @QueryParam("readType") ReadingMode readType,
|
required = true) @DefaultValue("all") @QueryParam("readType") ReadingMode readType,
|
||||||
@ApiParam(value = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
@Parameter(description = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
||||||
@ApiParam(value = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
@Parameter(description = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
||||||
@ApiParam(value = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
@Parameter(description = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
||||||
@ApiParam(value = "date ordering", allowableValues = "asc,desc") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
@Parameter(description = "date ordering") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
description = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
||||||
@ApiParam(value = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds,
|
@Parameter(description = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "comma-separated list of excluded subscription ids") @QueryParam("excludedSubscriptionIds") String excludedSubscriptionIds,
|
description = "comma-separated list of excluded subscription ids") @QueryParam("excludedSubscriptionIds") String excludedSubscriptionIds,
|
||||||
@ApiParam(value = "keep only entries tagged with this tag") @QueryParam("tag") String tag) {
|
@Parameter(description = "keep only entries tagged with this tag") @QueryParam("tag") String tag) {
|
||||||
|
|
||||||
Response response = getCategoryEntries(user, id, readType, newerThan, offset, limit, order, keywords, onlyIds,
|
Response response = getCategoryEntries(user, id, readType, newerThan, offset, limit, order, keywords, onlyIds,
|
||||||
excludedSubscriptionIds, tag);
|
excludedSubscriptionIds, tag);
|
||||||
@@ -234,10 +237,10 @@ public class CategoryREST {
|
|||||||
@Path("/mark")
|
@Path("/mark")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Mark category entries", notes = "Mark feed entries of this category as read")
|
@Operation(summary = "Mark category entries", description = "Mark feed entries of this category as read")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markCategoryEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markCategoryEntries(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "category id, or 'all'", required = true) MarkRequest req) {
|
@Valid @Parameter(description = "category id, or 'all'", required = true) MarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -276,10 +279,13 @@ public class CategoryREST {
|
|||||||
@Path("/add")
|
@Path("/add")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Add a category", notes = "Add a new feed category", response = Long.class)
|
@Operation(
|
||||||
|
summary = "Add a category",
|
||||||
|
description = "Add a new feed category",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Long.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response addCategory(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response addCategory(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(required = true) AddCategoryRequest req) {
|
@Valid @Parameter(required = true) AddCategoryRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getName());
|
Preconditions.checkNotNull(req.getName());
|
||||||
|
|
||||||
@@ -301,9 +307,9 @@ public class CategoryREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/delete")
|
@Path("/delete")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Delete a category", notes = "Delete an existing feed category")
|
@Operation(summary = "Delete a category", description = "Delete an existing feed category")
|
||||||
@Timed
|
@Timed
|
||||||
public Response deleteCategory(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) IDRequest req) {
|
public Response deleteCategory(@Parameter(hidden = true) @SecurityCheck User user, @Parameter(required = true) IDRequest req) {
|
||||||
|
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
@@ -334,10 +340,10 @@ public class CategoryREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/modify")
|
@Path("/modify")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Rename a category", notes = "Rename an existing feed category")
|
@Operation(summary = "Rename a category", description = "Rename an existing feed category")
|
||||||
@Timed
|
@Timed
|
||||||
public Response modifyCategory(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response modifyCategory(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(required = true) CategoryModificationRequest req) {
|
@Valid @Parameter(required = true) CategoryModificationRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -390,9 +396,9 @@ public class CategoryREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/collapse")
|
@Path("/collapse")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Collapse a category", notes = "Save collapsed or expanded status for a category")
|
@Operation(summary = "Collapse a category", description = "Save collapsed or expanded status for a category")
|
||||||
@Timed
|
@Timed
|
||||||
public Response collapseCategory(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) CollapseRequest req) {
|
public Response collapseCategory(@Parameter(hidden = true) @SecurityCheck User user, @Parameter(required = true) CollapseRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -409,9 +415,11 @@ public class CategoryREST {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/unreadCount")
|
@Path("/unreadCount")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get unread count for feed subscriptions", response = UnreadCount.class, responseContainer = "List")
|
@Operation(
|
||||||
|
summary = "Get unread count for feed subscriptions",
|
||||||
|
responses = { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = UnreadCount.class)))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getUnreadCount(@ApiParam(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user) {
|
public Response getUnreadCount(@Parameter(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user) {
|
||||||
Map<Long, UnreadCount> unreadCount = feedSubscriptionService.getUnreadCount(user);
|
Map<Long, UnreadCount> unreadCount = feedSubscriptionService.getUnreadCount(user);
|
||||||
return Response.ok(Lists.newArrayList(unreadCount.values())).build();
|
return Response.ok(Lists.newArrayList(unreadCount.values())).build();
|
||||||
}
|
}
|
||||||
@@ -419,9 +427,12 @@ public class CategoryREST {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/get")
|
@Path("/get")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get root category", notes = "Get all categories and subscriptions of the user", response = Category.class)
|
@Operation(
|
||||||
|
summary = "Get root category",
|
||||||
|
description = "Get all categories and subscriptions of the user",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Category.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getRootCategory(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response getRootCategory(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
Category root = cache.getUserRootCategory(user);
|
Category root = cache.getUserRootCategory(user);
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
log.debug("tree cache miss for {}", user.getId());
|
log.debug("tree cache miss for {}", user.getId());
|
||||||
|
|||||||
@@ -26,13 +26,11 @@ import com.commafeed.frontend.model.request.TagRequest;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@Path("/entry")
|
@Path("/entry")
|
||||||
@Api(value = "/entry")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
||||||
@@ -46,10 +44,10 @@ public class EntryREST {
|
|||||||
@Path("/mark")
|
@Path("/mark")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
|
@Operation(summary = "Mark a feed entry", description = "Mark a feed entry as read/unread")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markEntry(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "Mark Request", required = true) MarkRequest req) {
|
@Valid @Parameter(description = "Mark Request", required = true) MarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -60,10 +58,10 @@ public class EntryREST {
|
|||||||
@Path("/markMultiple")
|
@Path("/markMultiple")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Mark multiple feed entries", notes = "Mark feed entries as read/unread")
|
@Operation(summary = "Mark multiple feed entries", description = "Mark feed entries as read/unread")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markEntries(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "Multiple Mark Request", required = true) MultipleMarkRequest req) {
|
@Valid @Parameter(description = "Multiple Mark Request", required = true) MultipleMarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getRequests());
|
Preconditions.checkNotNull(req.getRequests());
|
||||||
|
|
||||||
@@ -77,10 +75,10 @@ public class EntryREST {
|
|||||||
@Path("/star")
|
@Path("/star")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
|
@Operation(summary = "Mark a feed entry", description = "Mark a feed entry as read/unread")
|
||||||
@Timed
|
@Timed
|
||||||
public Response starEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response starEntry(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "Star Request", required = true) StarRequest req) {
|
@Valid @Parameter(description = "Star Request", required = true) StarRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
Preconditions.checkNotNull(req.getFeedId());
|
Preconditions.checkNotNull(req.getFeedId());
|
||||||
@@ -93,9 +91,9 @@ public class EntryREST {
|
|||||||
@Path("/tags")
|
@Path("/tags")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get list of tags for the user", notes = "Get list of tags for the user")
|
@Operation(summary = "Get list of tags for the user", description = "Get list of tags for the user")
|
||||||
@Timed
|
@Timed
|
||||||
public Response getTags(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response getTags(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
List<String> tags = feedEntryTagDAO.findByUser(user);
|
List<String> tags = feedEntryTagDAO.findByUser(user);
|
||||||
return Response.ok(tags).build();
|
return Response.ok(tags).build();
|
||||||
}
|
}
|
||||||
@@ -103,10 +101,10 @@ public class EntryREST {
|
|||||||
@Path("/tag")
|
@Path("/tag")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Set feed entry tags")
|
@Operation(summary = "Set feed entry tags")
|
||||||
@Timed
|
@Timed
|
||||||
public Response tagEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response tagEntry(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "Tag Request", required = true) TagRequest req) {
|
@Valid @Parameter(description = "Tag Request", required = true) TagRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getEntryId());
|
Preconditions.checkNotNull(req.getEntryId());
|
||||||
|
|
||||||
|
|||||||
@@ -84,14 +84,15 @@ import com.rometools.rome.io.SyndFeedOutput;
|
|||||||
import com.rometools.rome.io.WireFeedOutput;
|
import com.rometools.rome.io.WireFeedOutput;
|
||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Path("/feed")
|
@Path("/feed")
|
||||||
@Api(value = "/feed")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@@ -130,21 +131,23 @@ public class FeedREST {
|
|||||||
@Path("/entries")
|
@Path("/entries")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get feed entries", notes = "Get a list of feed entries", response = Entries.class)
|
@Operation(
|
||||||
|
summary = "Get feed entries",
|
||||||
|
description = "Get a list of feed entries",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Entries.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getFeedEntries(@ApiParam(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
public Response getFeedEntries(@Parameter(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
||||||
@ApiParam(value = "id of the feed", required = true) @QueryParam("id") String id,
|
@Parameter(description = "id of the feed", required = true) @QueryParam("id") String id,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "all entries or only unread ones",
|
description = "all entries or only unread ones",
|
||||||
allowableValues = "all,unread",
|
|
||||||
required = true) @DefaultValue("unread") @QueryParam("readType") ReadingMode readType,
|
required = true) @DefaultValue("unread") @QueryParam("readType") ReadingMode readType,
|
||||||
@ApiParam(value = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
@Parameter(description = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
||||||
@ApiParam(value = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
@Parameter(description = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
||||||
@ApiParam(value = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
@Parameter(description = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
||||||
@ApiParam(value = "ordering", allowableValues = "asc,desc") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
@Parameter(description = "ordering") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
description = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
||||||
@ApiParam(value = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds) {
|
@Parameter(description = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds) {
|
||||||
|
|
||||||
Preconditions.checkNotNull(id);
|
Preconditions.checkNotNull(id);
|
||||||
Preconditions.checkNotNull(readType);
|
Preconditions.checkNotNull(readType);
|
||||||
@@ -196,22 +199,21 @@ public class FeedREST {
|
|||||||
@Path("/entriesAsFeed")
|
@Path("/entriesAsFeed")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get feed entries as a feed", notes = "Get a feed of feed entries")
|
@Operation(summary = "Get feed entries as a feed", description = "Get a feed of feed entries")
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
@Timed
|
@Timed
|
||||||
public Response getFeedEntriesAsFeed(@ApiParam(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
public Response getFeedEntriesAsFeed(@Parameter(hidden = true) @SecurityCheck(apiKeyAllowed = true) User user,
|
||||||
@ApiParam(value = "id of the feed", required = true) @QueryParam("id") String id,
|
@Parameter(description = "id of the feed", required = true) @QueryParam("id") String id,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "all entries or only unread ones",
|
description = "all entries or only unread ones",
|
||||||
allowableValues = "all,unread",
|
|
||||||
required = true) @DefaultValue("all") @QueryParam("readType") ReadingMode readType,
|
required = true) @DefaultValue("all") @QueryParam("readType") ReadingMode readType,
|
||||||
@ApiParam(value = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
@Parameter(description = "only entries newer than this") @QueryParam("newerThan") Long newerThan,
|
||||||
@ApiParam(value = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
@Parameter(description = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
||||||
@ApiParam(value = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
@Parameter(description = "limit for paging, default 20, maximum 1000") @DefaultValue("20") @QueryParam("limit") int limit,
|
||||||
@ApiParam(value = "date ordering", allowableValues = "asc,desc") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
@Parameter(description = "date ordering") @QueryParam("order") @DefaultValue("desc") ReadingOrder order,
|
||||||
@ApiParam(
|
@Parameter(
|
||||||
value = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
description = "search for keywords in either the title or the content of the entries, separated by spaces, 3 characters minimum") @QueryParam("keywords") String keywords,
|
||||||
@ApiParam(value = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds) {
|
@Parameter(description = "return only entry ids") @DefaultValue("false") @QueryParam("onlyIds") boolean onlyIds) {
|
||||||
|
|
||||||
Response response = getFeedEntries(user, id, readType, newerThan, offset, limit, order, keywords, onlyIds);
|
Response response = getFeedEntries(user, id, readType, newerThan, offset, limit, order, keywords, onlyIds);
|
||||||
if (response.getStatus() != Status.OK.getStatusCode()) {
|
if (response.getStatus() != Status.OK.getStatusCode()) {
|
||||||
@@ -257,10 +259,13 @@ public class FeedREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/fetch")
|
@Path("/fetch")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Fetch a feed", notes = "Fetch a feed by its url", response = FeedInfo.class)
|
@Operation(
|
||||||
|
summary = "Fetch a feed",
|
||||||
|
description = "Fetch a feed by its url",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = FeedInfo.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response fetchFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response fetchFeed(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "feed url", required = true) FeedInfoRequest req) {
|
@Valid @Parameter(description = "feed url", required = true) FeedInfoRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getUrl());
|
Preconditions.checkNotNull(req.getUrl());
|
||||||
|
|
||||||
@@ -280,9 +285,9 @@ public class FeedREST {
|
|||||||
@Path("/refreshAll")
|
@Path("/refreshAll")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Queue all feeds of the user for refresh", notes = "Manually add all feeds of the user to the refresh queue")
|
@Operation(summary = "Queue all feeds of the user for refresh", description = "Manually add all feeds of the user to the refresh queue")
|
||||||
@Timed
|
@Timed
|
||||||
public Response queueAllForRefresh(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response queueAllForRefresh(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
feedSubscriptionService.refreshAll(user);
|
feedSubscriptionService.refreshAll(user);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
@@ -290,10 +295,10 @@ public class FeedREST {
|
|||||||
@Path("/refresh")
|
@Path("/refresh")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Queue a feed for refresh", notes = "Manually add a feed to the refresh queue")
|
@Operation(summary = "Queue a feed for refresh", description = "Manually add a feed to the refresh queue")
|
||||||
@Timed
|
@Timed
|
||||||
public Response queueForRefresh(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response queueForRefresh(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "Feed id", required = true) IDRequest req) {
|
@Parameter(description = "Feed id", required = true) IDRequest req) {
|
||||||
|
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
@@ -310,10 +315,10 @@ public class FeedREST {
|
|||||||
@Path("/mark")
|
@Path("/mark")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")
|
@Operation(summary = "Mark feed entries", description = "Mark feed entries as read (unread is not supported)")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markFeedEntries(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "Mark request", required = true) MarkRequest req) {
|
@Valid @Parameter(description = "Mark request", required = true) MarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -331,10 +336,12 @@ public class FeedREST {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/get/{id}")
|
@Path("/get/{id}")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "get feed", response = Subscription.class)
|
@Operation(
|
||||||
|
summary = "get feed",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Subscription.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response getFeed(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "user id", required = true) @PathParam("id") Long id) {
|
@Parameter(description = "user id", required = true) @PathParam("id") Long id) {
|
||||||
|
|
||||||
Preconditions.checkNotNull(id);
|
Preconditions.checkNotNull(id);
|
||||||
FeedSubscription sub = feedSubscriptionDAO.findById(user, id);
|
FeedSubscription sub = feedSubscriptionDAO.findById(user, id);
|
||||||
@@ -348,10 +355,10 @@ public class FeedREST {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/favicon/{id}")
|
@Path("/favicon/{id}")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Fetch a feed's icon", notes = "Fetch a feed's icon")
|
@Operation(summary = "Fetch a feed's icon", description = "Fetch a feed's icon")
|
||||||
@Timed
|
@Timed
|
||||||
public Response getFeedFavicon(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response getFeedFavicon(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "subscription id", required = true) @PathParam("id") Long id) {
|
@Parameter(description = "subscription id", required = true) @PathParam("id") Long id) {
|
||||||
|
|
||||||
Preconditions.checkNotNull(id);
|
Preconditions.checkNotNull(id);
|
||||||
FeedSubscription subscription = feedSubscriptionDAO.findById(user, id);
|
FeedSubscription subscription = feedSubscriptionDAO.findById(user, id);
|
||||||
@@ -379,10 +386,13 @@ public class FeedREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/subscribe")
|
@Path("/subscribe")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Subscribe to a feed", notes = "Subscribe to a feed", response = Long.class)
|
@Operation(
|
||||||
|
summary = "Subscribe to a feed",
|
||||||
|
description = "Subscribe to a feed",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Long.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response subscribe(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response subscribe(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "subscription request", required = true) SubscribeRequest req) {
|
@Valid @Parameter(description = "subscription request", required = true) SubscribeRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getTitle());
|
Preconditions.checkNotNull(req.getTitle());
|
||||||
Preconditions.checkNotNull(req.getUrl());
|
Preconditions.checkNotNull(req.getUrl());
|
||||||
@@ -407,10 +417,10 @@ public class FeedREST {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/subscribe")
|
@Path("/subscribe")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Subscribe to a feed", notes = "Subscribe to a feed")
|
@Operation(summary = "Subscribe to a feed", description = "Subscribe to a feed")
|
||||||
@Timed
|
@Timed
|
||||||
public Response subscribeFromUrl(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response subscribeFromUrl(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "feed url", required = true) @QueryParam("url") String url) {
|
@Parameter(description = "feed url", required = true) @QueryParam("url") String url) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Preconditions.checkNotNull(url);
|
Preconditions.checkNotNull(url);
|
||||||
@@ -436,9 +446,9 @@ public class FeedREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/unsubscribe")
|
@Path("/unsubscribe")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Unsubscribe from a feed", notes = "Unsubscribe from a feed")
|
@Operation(summary = "Unsubscribe from a feed", description = "Unsubscribe from a feed")
|
||||||
@Timed
|
@Timed
|
||||||
public Response unsubscribe(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) IDRequest req) {
|
public Response unsubscribe(@Parameter(hidden = true) @SecurityCheck User user, @Parameter(required = true) IDRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -453,10 +463,10 @@ public class FeedREST {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/modify")
|
@Path("/modify")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Modify a subscription", notes = "Modify a feed subscription")
|
@Operation(summary = "Modify a subscription", description = "Modify a feed subscription")
|
||||||
@Timed
|
@Timed
|
||||||
public Response modifyFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response modifyFeed(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(value = "subscription id", required = true) FeedModificationRequest req) {
|
@Valid @Parameter(description = "subscription id", required = true) FeedModificationRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -514,10 +524,10 @@ public class FeedREST {
|
|||||||
@Path("/import")
|
@Path("/import")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||||
@ApiOperation(value = "OPML import", notes = "Import an OPML file, posted as a FORM with the 'file' name")
|
@Operation(summary = "OPML import", description = "Import an OPML file, posted as a FORM with the 'file' name")
|
||||||
@Timed
|
@Timed
|
||||||
public Response importOpml(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response importOpml(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "ompl file", required = true) @FormDataParam("file") InputStream input) {
|
@Parameter(description = "ompl file", required = true) @FormDataParam("file") InputStream input) {
|
||||||
if (CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
if (CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
||||||
return Response.status(Status.FORBIDDEN).entity("Import is disabled for the demo account").build();
|
return Response.status(Status.FORBIDDEN).entity("Import is disabled for the demo account").build();
|
||||||
}
|
}
|
||||||
@@ -535,9 +545,9 @@ public class FeedREST {
|
|||||||
@Path("/export")
|
@Path("/export")
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
@ApiOperation(value = "OPML export", notes = "Export an OPML file of the user's subscriptions")
|
@Operation(summary = "OPML export", description = "Export an OPML file of the user's subscriptions")
|
||||||
@Timed
|
@Timed
|
||||||
public Response exportOpml(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response exportOpml(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
Opml opml = opmlExporter.export(user);
|
Opml opml = opmlExporter.export(user);
|
||||||
WireFeedOutput output = new WireFeedOutput();
|
WireFeedOutput output = new WireFeedOutput();
|
||||||
String opmlString = null;
|
String opmlString = null;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.commafeed.frontend.resource;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
||||||
|
import io.swagger.v3.oas.annotations.info.Info;
|
||||||
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
|
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||||
|
import io.swagger.v3.oas.annotations.servers.Server;
|
||||||
|
|
||||||
|
@OpenAPIDefinition(
|
||||||
|
info = @Info(title = "CommaFeed API"),
|
||||||
|
servers = { @Server(description = "CommaFeed API", url = "../rest") },
|
||||||
|
security = { @SecurityRequirement(name = "basicAuth") })
|
||||||
|
@SecurityScheme(name = "basicAuth", type = SecuritySchemeType.HTTP, scheme = "basic")
|
||||||
|
public class OpenAPI {
|
||||||
|
}
|
||||||
@@ -23,13 +23,14 @@ import com.commafeed.frontend.auth.SecurityCheck;
|
|||||||
import com.commafeed.frontend.model.ServerInfo;
|
import com.commafeed.frontend.model.ServerInfo;
|
||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@Path("/server")
|
@Path("/server")
|
||||||
@Api(value = "/server")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
||||||
@@ -42,7 +43,10 @@ public class ServerREST {
|
|||||||
@Path("/get")
|
@Path("/get")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get server infos", notes = "Get server infos", response = ServerInfo.class)
|
@Operation(
|
||||||
|
summary = "Get server infos",
|
||||||
|
description = "Get server infos",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = ServerInfo.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getServerInfos() {
|
public Response getServerInfos() {
|
||||||
ServerInfo infos = new ServerInfo();
|
ServerInfo infos = new ServerInfo();
|
||||||
@@ -59,11 +63,11 @@ public class ServerREST {
|
|||||||
@Path("/proxy")
|
@Path("/proxy")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "proxy image")
|
@Operation(summary = "proxy image")
|
||||||
@Produces("image/png")
|
@Produces("image/png")
|
||||||
@Timed
|
@Timed
|
||||||
public Response getProxiedImage(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response getProxiedImage(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "image url", required = true) @QueryParam("u") String url) {
|
@Parameter(description = "image url", required = true) @QueryParam("u") String url) {
|
||||||
if (!config.getApplicationSettings().getImageProxyEnabled()) {
|
if (!config.getApplicationSettings().getImageProxyEnabled()) {
|
||||||
return Response.status(Status.FORBIDDEN).build();
|
return Response.status(Status.FORBIDDEN).build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,14 +53,15 @@ import com.commafeed.frontend.session.SessionHelper;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Path("/user")
|
@Path("/user")
|
||||||
@Api(value = "/user")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -79,9 +80,12 @@ public class UserREST {
|
|||||||
@Path("/settings")
|
@Path("/settings")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Retrieve user settings", notes = "Retrieve user settings", response = Settings.class)
|
@Operation(
|
||||||
|
summary = "Retrieve user settings",
|
||||||
|
description = "Retrieve user settings",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = Settings.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getUserSettings(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response getUserSettings(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
Settings s = new Settings();
|
Settings s = new Settings();
|
||||||
UserSettings settings = userSettingsDAO.findByUser(user);
|
UserSettings settings = userSettingsDAO.findByUser(user);
|
||||||
if (settings != null) {
|
if (settings != null) {
|
||||||
@@ -133,9 +137,9 @@ public class UserREST {
|
|||||||
@Path("/settings")
|
@Path("/settings")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Save user settings", notes = "Save user settings")
|
@Operation(summary = "Save user settings", description = "Save user settings")
|
||||||
@Timed
|
@Timed
|
||||||
public Response saveUserSettings(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) Settings settings) {
|
public Response saveUserSettings(@Parameter(hidden = true) @SecurityCheck User user, @Parameter(required = true) Settings settings) {
|
||||||
Preconditions.checkNotNull(settings);
|
Preconditions.checkNotNull(settings);
|
||||||
|
|
||||||
UserSettings s = userSettingsDAO.findByUser(user);
|
UserSettings s = userSettingsDAO.findByUser(user);
|
||||||
@@ -172,9 +176,11 @@ public class UserREST {
|
|||||||
@Path("/profile")
|
@Path("/profile")
|
||||||
@GET
|
@GET
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Retrieve user's profile", response = UserModel.class)
|
@Operation(
|
||||||
|
summary = "Retrieve user's profile",
|
||||||
|
responses = { @ApiResponse(content = @Content(schema = @Schema(implementation = UserModel.class))) })
|
||||||
@Timed
|
@Timed
|
||||||
public Response getUserProfile(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response getUserProfile(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
UserModel userModel = new UserModel();
|
UserModel userModel = new UserModel();
|
||||||
userModel.setId(user.getId());
|
userModel.setId(user.getId());
|
||||||
userModel.setName(user.getName());
|
userModel.setName(user.getName());
|
||||||
@@ -192,10 +198,10 @@ public class UserREST {
|
|||||||
@Path("/profile")
|
@Path("/profile")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Save user's profile")
|
@Operation(summary = "Save user's profile")
|
||||||
@Timed
|
@Timed
|
||||||
public Response saveUserProfile(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response saveUserProfile(@Parameter(hidden = true) @SecurityCheck User user,
|
||||||
@Valid @ApiParam(required = true) ProfileModificationRequest request) {
|
@Valid @Parameter(required = true) ProfileModificationRequest request) {
|
||||||
if (CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
if (CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
||||||
return Response.status(Status.FORBIDDEN).build();
|
return Response.status(Status.FORBIDDEN).build();
|
||||||
}
|
}
|
||||||
@@ -231,10 +237,10 @@ public class UserREST {
|
|||||||
@Path("/register")
|
@Path("/register")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Register a new account")
|
@Operation(summary = "Register a new account")
|
||||||
@Timed
|
@Timed
|
||||||
public Response registerUser(@Valid @ApiParam(required = true) RegistrationRequest req,
|
public Response registerUser(@Valid @Parameter(required = true) RegistrationRequest req,
|
||||||
@Context @ApiParam(hidden = true) SessionHelper sessionHelper) {
|
@Context @Parameter(hidden = true) SessionHelper sessionHelper) {
|
||||||
try {
|
try {
|
||||||
User registeredUser = userService.register(req.getName(), req.getPassword(), req.getEmail(),
|
User registeredUser = userService.register(req.getName(), req.getPassword(), req.getEmail(),
|
||||||
Collections.singletonList(Role.USER));
|
Collections.singletonList(Role.USER));
|
||||||
@@ -249,10 +255,10 @@ public class UserREST {
|
|||||||
@Path("/login")
|
@Path("/login")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Login and create a session")
|
@Operation(summary = "Login and create a session")
|
||||||
@Timed
|
@Timed
|
||||||
public Response login(@Valid @ApiParam(required = true) LoginRequest req,
|
public Response login(@Valid @Parameter(required = true) LoginRequest req,
|
||||||
@ApiParam(hidden = true) @Context SessionHelper sessionHelper) {
|
@Parameter(hidden = true) @Context SessionHelper sessionHelper) {
|
||||||
Optional<User> user = userService.login(req.getName(), req.getPassword());
|
Optional<User> user = userService.login(req.getName(), req.getPassword());
|
||||||
if (user.isPresent()) {
|
if (user.isPresent()) {
|
||||||
sessionHelper.setLoggedInUser(user.get());
|
sessionHelper.setLoggedInUser(user.get());
|
||||||
@@ -265,9 +271,9 @@ public class UserREST {
|
|||||||
@Path("/passwordReset")
|
@Path("/passwordReset")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "send a password reset email")
|
@Operation(summary = "send a password reset email")
|
||||||
@Timed
|
@Timed
|
||||||
public Response sendPasswordReset(@Valid @ApiParam(required = true) PasswordResetRequest req) {
|
public Response sendPasswordReset(@Valid @Parameter(required = true) PasswordResetRequest req) {
|
||||||
User user = userDAO.findByEmail(req.getEmail());
|
User user = userDAO.findByEmail(req.getEmail());
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
@@ -306,8 +312,8 @@ public class UserREST {
|
|||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@Produces(MediaType.TEXT_HTML)
|
@Produces(MediaType.TEXT_HTML)
|
||||||
@Timed
|
@Timed
|
||||||
public Response passwordRecoveryCallback(@ApiParam(required = true) @QueryParam("email") String email,
|
public Response passwordRecoveryCallback(@Parameter(required = true) @QueryParam("email") String email,
|
||||||
@ApiParam(required = true) @QueryParam("token") String token) {
|
@Parameter(required = true) @QueryParam("token") String token) {
|
||||||
Preconditions.checkNotNull(email);
|
Preconditions.checkNotNull(email);
|
||||||
Preconditions.checkNotNull(token);
|
Preconditions.checkNotNull(token);
|
||||||
|
|
||||||
@@ -341,9 +347,9 @@ public class UserREST {
|
|||||||
@Path("/profile/deleteAccount")
|
@Path("/profile/deleteAccount")
|
||||||
@POST
|
@POST
|
||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Delete the user account")
|
@Operation(summary = "Delete the user account")
|
||||||
@Timed
|
@Timed
|
||||||
public Response deleteUser(@ApiParam(hidden = true) @SecurityCheck User user) {
|
public Response deleteUser(@Parameter(hidden = true) @SecurityCheck User user) {
|
||||||
if (CommaFeedApplication.USERNAME_ADMIN.equals(user.getName()) || CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
if (CommaFeedApplication.USERNAME_ADMIN.equals(user.getName()) || CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
||||||
return Response.status(Status.FORBIDDEN).build();
|
return Response.status(Status.FORBIDDEN).build();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user