Skip to content

Commit

Permalink
Merge pull request #10 from fschiettecatte/json1_1
Browse files Browse the repository at this point in the history
Added support for JSON Feed version 1.1
  • Loading branch information
devilgate authored Nov 3, 2020
2 parents ad6a0ae + 9eba1ec commit b6a04b6
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 168 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
}

sourceCompatibility = 1.8
version = '1.0.5'
version = '1.1.0'

jar {
manifest {
Expand Down
91 changes: 47 additions & 44 deletions src/main/java/software/tinlion/pertwee/Feed.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
*
*
*/
package software.tinlion.pertwee;

Expand All @@ -10,26 +10,26 @@
import software.tinlion.pertwee.feed.DefaultFeed;

/**
* The main interface for the Pertwee JSON Feed parser. See
* The main interface for the Pertwee JSON Feed parser. See
* <a href="https://jsonfeed.org/version/1">the JSON Feed spec</a>.
*
*
* To get an instance use one of the factory methods in {@link DefaultFeed}.
*
* Once you have an instance you can use the various methods to get the
*
* Once you have an instance you can use the various methods to get the
* various elements of the feed.
*
* This implementation makes a fairly strict interpretation of the spec.
* Where an element is marked as "<code>required</code>", such as
* <code>version</code>, for example, a {@code RequiredElementNotPresentException}
* will be thrown. This is a RuntimeException, but methods for handling
*
* This implementation makes a fairly strict interpretation of the spec.
* Where an element is marked as "<code>required</code>", such as
* <code>version</code>, for example, a {@code RequiredElementNotPresentException}
* will be thrown. This is a RuntimeException, but methods for handling
* required elements declare it thrown, to allow client classes to decide
* how to handle it.
*
* Most of the methods here simply return the comparably-named element from
* the provided JSON (for example, <code>feedUrl</code> returns the element called
* "<code>feed_url</code>"). See the spec for detailed explanations of what each
*
* Most of the methods here simply return the comparably-named element from
* the provided JSON (for example, <code>feedUrl</code> returns the element called
* "<code>feed_url</code>"). See the spec for detailed explanations of what each
* element means.
*
*
* @author Martin McCallion ([email protected])
* @version 1.0.1
*
Expand All @@ -38,87 +38,90 @@ public interface Feed {

/**
* The version is required.
*
*
* @return the version as a string
* @throws RequiredElementNotPresentException for obvious reasons
*/
String version() throws RequiredElementNotPresentException;
/**

/**
* Title is required.
*
*
* @return the title
* @throws RequiredElementNotPresentException for obvious reasons
*/
String title() throws RequiredElementNotPresentException;

/**
* This is described as "optional but strongly recommended."
*
*
* @return the URL
*/
String homePageUrl();

/**
* This is described as "optional but strongly recommended."
*
*
* @return the URL
*/
String feedUrl();

String description();


String language();

String userComment();

String nextUrl();

/**
* A convenience method to get the contents of nextUrl as a Feed.
*
*
* @return the next feed
* @throws IOException on problems
*/
Feed nextFeed() throws IOException;

String icon();

String favicon();

/**
* Optional, but if present certain elements within it must be present.
*
*
* @return The author details of the feed; see {@link Author}
* @throws RequiredElementNotPresentException if the contents of the
* @throws RequiredElementNotPresentException if the contents of the
* "<code>author</code>" element do not meet their requirements
*
*
*/
Author author() throws RequiredElementNotPresentException;

List<Author> authors() throws RequiredElementNotPresentException;

boolean hasExpired();

List<Item> items() throws RequiredElementNotPresentException;

/**
* Returns the next {@code Item} from the feed.
*
*
* @return the Item
*/
Item nextItem();

/**
* Tells us whether the feed has another item.
*
*
* @return true if there is a next Item
*/
boolean hasNextItem();

List<Hub> hubs();

boolean hasExtensions();

/**
* Prints the feed;
*
*
* @return the feed as a string
*/
public String print();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/software/tinlion/pertwee/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ public interface Item {
public String dateModified();

public Author author();
List<Author> authors() throws RequiredElementNotPresentException;

public List<String> tags();

public String language();

boolean hasAttachments();

List<Attachment> attachments();
Expand Down
Loading

0 comments on commit b6a04b6

Please sign in to comment.