Add greader folder creation/update/deletion requests (creation request doesn't work though)

This commit is contained in:
Shinokuni 2019-08-21 13:51:00 +02:00
parent 49e9d22082
commit c26e7cff47
3 changed files with 35 additions and 3 deletions

View File

@ -122,17 +122,25 @@ public class FreshRSSRepository extends ARepository {
@Override
public Completable addFolder(Folder folder) {
return null;
FreshRSSAPI api = new FreshRSSAPI(account.toCredentials());
return api.createFolder(account.getWriteToken(), folder.getName());
}
@Override
public Completable updateFolder(Folder folder) {
return null;
FreshRSSAPI api = new FreshRSSAPI(account.toCredentials());
return api.updateFolder(account.getWriteToken(), folder.getRemoteId(), folder.getName())
.andThen(super.updateFolder(folder));
}
@Override
public Completable deleteFolder(Folder folder) {
return null;
FreshRSSAPI api = new FreshRSSAPI(account.toCredentials());
return api.deleteFolder(account.getWriteToken(), folder.getRemoteId())
.andThen(super.deleteFolder(folder));
}
@Override

View File

@ -116,6 +116,18 @@ public class FreshRSSAPI extends API<FreshRSSService> {
return api.updateFeed(token, "feed/" + feedUrl, title, folderId, "edit");
}
public Completable createFolder(String token, String tagName) {
return api.createFolder(token, "user/-/label/" + tagName);
}
public Completable updateFolder(String token, String folderId, String name) {
return api.updateFolder(token, folderId, "user/-/label/" + name);
}
public Completable deleteFolder(String token, String folderId) {
return api.deleteFolder(token, folderId);
}
public enum EXCLUDE_ITEMS {
EXCLUDE_READ_ITEMS("user/-/state/com.google/read");

View File

@ -49,4 +49,16 @@ public interface FreshRSSService {
@FormUrlEncoded
@POST("reader/api/0/subscription/edit")
Completable updateFeed(@Field("T") String token, @Field("s") String feedUrl, @Field("t") String title, @Field("a") String folderId, @Field("ac") String action);
@FormUrlEncoded
@POST("reader/api/0/edit-tag")
Completable createFolder(@Field("T") String token, @Field("a") String tagName);
@FormUrlEncoded
@POST("reader/api/0/rename-tag")
Completable updateFolder(@Field("T") String token, @Field("s") String folderId, @Field("dest") String newFolderId);
@FormUrlEncoded
@POST("reader/api/0/disable-tag")
Completable deleteFolder(@Field("T") String token, @Field("s") String folderId);
}