Skip to content

Commit 771c7e8

Browse files
committed
Extend the ucp bookmarks api by the new filterAvailable field
1 parent 80e9a10 commit 771c7e8

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

library/src/main/java/me/proxer/library/api/ucp/BookmarksEndpoint.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ public final class BookmarksEndpoint implements PagingLimitEndpoint<List<Bookmar
4141
@Setter(onMethod = @__({@Override}))
4242
private Integer limit;
4343

44+
/**
45+
* Sets if only available or only not available bookmarks should be returned.
46+
* <p>
47+
* This field being null means that all bookmarks are returned.
48+
*/
49+
@Nullable
50+
@Setter
51+
private Boolean filterAvailable;
52+
4453
BookmarksEndpoint(final InternalApi internalApi) {
4554
this.internalApi = internalApi;
4655
}
@@ -50,6 +59,6 @@ public final class BookmarksEndpoint implements PagingLimitEndpoint<List<Bookmar
5059
*/
5160
@Override
5261
public ProxerCall<List<Bookmark>> build() {
53-
return internalApi.bookmarks(category, page, limit);
62+
return internalApi.bookmarks(category, page, limit, filterAvailable);
5463
}
5564
}

library/src/main/java/me/proxer/library/api/ucp/InternalApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ ProxerCall<List<UcpHistoryEntry>> history(@Query("p") Integer page,
3535
@GET("ucp/reminder")
3636
ProxerCall<List<Bookmark>> bookmarks(@Query("kat") Category category,
3737
@Query("p") Integer page,
38-
@Query("limit") Integer limit);
38+
@Query("limit") Integer limit,
39+
@Query("available") Boolean available);
3940

4041
@GET("ucp/topten")
4142
ProxerCall<List<UcpTopTenEntry>> topTen();

library/src/test/java/me/proxer/library/api/ucp/BookmarksEndpointTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ public void testPath() throws ProxerException, IOException, InterruptedException
4040
.category(Category.MANGA)
4141
.page(12)
4242
.limit(1)
43+
.filterAvailable(true)
4344
.build()
4445
.execute();
4546

46-
assertThat(server.takeRequest().getPath()).isEqualTo("/api/v1/ucp/reminder?kat=manga&p=12&limit=1");
47+
assertThat(server.takeRequest().getPath()).isEqualTo("/api/v1/ucp/reminder?kat=manga&p=12" +
48+
"&limit=1&available=true");
4749
}
4850

4951
private Bookmark buildTestBookmark() {

0 commit comments

Comments
 (0)