udpate feed and get pref

i think. i don't know any prefs to check.
This commit is contained in:
Adam R Grey 2023-04-04 12:46:30 -04:00
parent ff232db4bc
commit 6d63d51a57

View File

@ -505,15 +505,44 @@ namespace ttrss_co_client.ttrss
///<summary> ///<summary>
///tell the feed to update. As opposed to updating our configuration of the feed. ///tell the feed to update. As opposed to updating our configuration of the feed.
///</summary> ///</summary>
public async Task UpdateFeed(int feed_id) public async Task<bool> UpdateFeed(int feed_id)
{ {
assertInitialized(); assertInitialized();
throw new NotImplementedException();
var json = JsonContent.Create(new
{
op = "updateFeed",
sid = this.SessionId,
feed_id = feed_id
});
var apiResponse = await get<Dictionary<string, string>>(json);
return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok";
} }
public async Task<string> GetPref(string key) public async Task<T> GetPref<T>(string pref)
{ {
assertInitialized(); assertInitialized();
throw new NotImplementedException();
var json = JsonContent.Create(new
{
op = "getPref",
sid = this.SessionId,
pref_name = pref
});
var apiResponse = await get<Dictionary<string, string>>(json);
try
{
var converter = TypeDescriptor.GetConverter(typeof(T));
if (converter != null)
{
return (T)converter.ConvertFromString(apiResponse["value"]);
}
return default(T);
}
catch (NotSupportedException)
{
return default(T);
}
} }
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) public async Task CatchupFeed(int feed_id, bool is_cat, CATCHUPMODE mode = CATCHUPMODE.All)