mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Blog Client with Factory and Validator
This implements a simple initial blog client that covers the basic blog actions, but no deletion/removal of blogs, yet. Classes for Blogs and Blog Post Headers have been introduced along with the associated factories. A `BlogPostValidator` has been added that validates incoming blog posts. Closes #402 Closes #404
This commit is contained in:
48
briar-api/src/org/briarproject/api/blogs/BlogManager.java
Normal file
48
briar-api/src/org/briarproject/api/blogs/BlogManager.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package org.briarproject.api.blogs;
|
||||
|
||||
import org.briarproject.api.FormatException;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.identity.LocalAuthor;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface BlogManager {
|
||||
|
||||
/** Returns the unique ID of the blog client. */
|
||||
ClientId getClientId();
|
||||
|
||||
/** Creates a new Blog. */
|
||||
Blog addBlog(LocalAuthor localAuthor, String name, String description)
|
||||
throws DbException;
|
||||
|
||||
/** Stores a local blog post. */
|
||||
void addLocalPost(BlogPost p) throws DbException;
|
||||
|
||||
/** Returns the blog with the given ID. */
|
||||
Blog getBlog(GroupId g) throws DbException;
|
||||
|
||||
/** Returns the blog with the given ID. */
|
||||
Blog getBlog(Transaction txn, GroupId g) throws DbException;
|
||||
|
||||
/** Returns all blogs to which the localAuthor created. */
|
||||
Collection<Blog> getBlogs(LocalAuthor localAuthor) throws DbException;
|
||||
|
||||
/** Returns all blogs to which the user subscribes. */
|
||||
Collection<Blog> getBlogs() throws DbException;
|
||||
|
||||
/** Returns the body of the blog post with the given ID. */
|
||||
@Nullable
|
||||
byte[] getPostBody(MessageId m) throws DbException;
|
||||
|
||||
/** Returns the headers of all posts in the given blog. */
|
||||
Collection<BlogPostHeader> getPostHeaders(GroupId g) throws DbException;
|
||||
|
||||
/** Marks a blog post as read or unread. */
|
||||
void setReadFlag(MessageId m, boolean read) throws DbException;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user