catchup feed

This commit is contained in:
Adam R Grey 2023-04-04 13:12:08 -04:00
parent 6d63d51a57
commit 5d2a4e28fa

View File

@ -545,10 +545,40 @@ namespace ttrss_co_client.ttrss
} }
} }
public enum CATCHUPMODE { All, OneDay, OneWeek, TwoWeeks } public enum CATCHUPMODE { All, OneDay, OneWeek, TwoWeeks }
public async Task CatchupFeed(int feed_id, bool is_cat, CATCHUPMODE mode = CATCHUPMODE.All) ///<summary>Tries to catchup (e.g. mark as read) specified feed.</summary>
public async Task<bool> CatchupFeed(int feed_id, bool is_cat, CATCHUPMODE mode = CATCHUPMODE.All)
{ {
assertInitialized(); assertInitialized();
throw new NotImplementedException();
var modestring = "all";
if(mode != CATCHUPMODE.All)
{
assertApiLevel(15);
switch (mode)
{
case CATCHUPMODE.OneDay:
modestring = "1day";
break;
case CATCHUPMODE.OneWeek:
modestring = "1week";
break;
case CATCHUPMODE.TwoWeeks:
modestring = "2week";
break;
}
}
var json = JsonContent.Create(new
{
op = "catchupFeed",
sid = this.SessionId,
feed_id = feed_id,
is_cat = is_cat,
mode = modestring
});
var apiResponse = await get<Dictionary<string, string>>(json);
return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok";
} }
public async Task GetLabels(int? article_id) public async Task GetLabels(int? article_id)
{ {