get lables
This commit is contained in:
parent
5d2a4e28fa
commit
60eb4a61b9
@ -580,14 +580,25 @@ namespace ttrss_co_client.ttrss
|
||||
|
||||
return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok";
|
||||
}
|
||||
public async Task GetLabels(int? article_id)
|
||||
public async Task<IEnumerable<Label>> GetLabels(int? article_id)
|
||||
{
|
||||
assertInitialized();
|
||||
if (article_id != null)
|
||||
|
||||
var json = JsonContent.Create(new
|
||||
{
|
||||
assertApiLevel(5);
|
||||
op = "getLabels",
|
||||
sid = this.SessionId,
|
||||
article_id = article_id
|
||||
});
|
||||
var labels = await get<IEnumerable<Label>>(json);
|
||||
if(this.api_level < 5)
|
||||
{
|
||||
foreach(var l in labels)
|
||||
{
|
||||
l.id = -11 - l.id;
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
public async Task SetArticleLabel(int label_id, bool assign, params int[] article_ids)
|
||||
{
|
||||
|
@ -9,7 +9,8 @@ namespace ttrss_co_client.ttrss.datastructures
|
||||
public string guid { get; set; }
|
||||
public string title;
|
||||
public Uri link;
|
||||
public IEnumerable<Label> labels;
|
||||
//label-like. seems to be id, caption, fg color, bg color.
|
||||
public IEnumerable<IEnumerable<string>> labels;
|
||||
public bool unread;
|
||||
public bool marked;
|
||||
public bool published;
|
||||
|
@ -4,16 +4,17 @@ namespace ttrss_co_client.ttrss.datastructures
|
||||
{
|
||||
public class Label
|
||||
{
|
||||
public Label(string[] fromServer)
|
||||
public void FromArticle(string[] fromServer)
|
||||
{
|
||||
int.TryParse(fromServer[0], out id);
|
||||
Title = fromServer[1];
|
||||
unknown = fromServer[2];
|
||||
Color = System.Drawing.ColorTranslator.FromHtml(fromServer[3]);
|
||||
caption = fromServer[1];
|
||||
fg_color = System.Drawing.ColorTranslator.FromHtml(fromServer[2]);
|
||||
bg_color = System.Drawing.ColorTranslator.FromHtml(fromServer[3]);
|
||||
}
|
||||
public int id;
|
||||
public string Title { get; set; }
|
||||
public string unknown { get; set; }
|
||||
public System.Drawing.Color Color {get; set;}
|
||||
public string caption { get; set; }
|
||||
public System.Drawing.Color fg_color { get; set; }
|
||||
public System.Drawing.Color bg_color { get; set; }
|
||||
public bool @checked { get; set;}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user