diff --git a/ttrss/ApiClient.cs b/ttrss/ApiClient.cs index c7d1a7b..fa8fae1 100644 --- a/ttrss/ApiClient.cs +++ b/ttrss/ApiClient.cs @@ -647,7 +647,7 @@ namespace ttrss_co_client.ttrss } public async Task ShareToPublished(string title, Uri url, string content, bool sanitize = true) { - if(url == null) + if (url == null) { throw new ArgumentNullException("url"); } @@ -661,7 +661,7 @@ namespace ttrss_co_client.ttrss { op = "shareToPublished", sid = this.SessionId, - title =title, + title = title, url = url.ToString(), content = content, sanitize = sanitize @@ -675,7 +675,7 @@ namespace ttrss_co_client.ttrss ///probably if the feed requires basic HTTP auth; the login? (decidedly not self-explanatory, gdi) ///probably if the feed requires basic HTTP auth; the password? (decidedly not self-explanatory, gdi) ///¯\_(ツ)_/¯ - code 1 = success, I think? - the documentation says "See subscribe_to_feed() in functions.php for details" - that function doesn't exist (as of 2023-04-04). - public async Task SubscribeToFeed(Uri feed_url, int category_id =0, string login=null, string password=null) + public async Task SubscribeToFeed(Uri feed_url, int category_id = 0, string login = null, string password = null) { assertInitialized(); assertApiLevel(5); @@ -708,11 +708,20 @@ namespace ttrss_co_client.ttrss return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok"; } - public async Task GetFeedTree() + ///(almost) the whole shebang, for a user + public async Task GetFeedTree(bool include_empty = false) { assertInitialized(); assertApiLevel(5); - throw new NotImplementedException(); + + var json = JsonContent.Create(new + { + op = "getFeedTree", + sid = this.SessionId, + include_empty = include_empty + }); + + return await get(json); } private void assertInitialized() { diff --git a/ttrss/datastructures/Tree.cs b/ttrss/datastructures/Tree.cs new file mode 100644 index 0000000..c08d53c --- /dev/null +++ b/ttrss/datastructures/Tree.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace ttrss_co_client.ttrss.datastructures +{ + public class Tree + { + public ItemCollection categories { get; set; } + + public class ItemCollection + { + public string identifier { get; set; } + public string label { get; set; } + public IEnumerable items { get; set; } + public class Item + { + public string id { get; set; } + public int? bare_id { get; set; } + public int? auxcounter { get; set; } + public string name { get; set; } + public IEnumerable items { get; set; } + public bool? checkbox { get; set; } + public string type { get; set; } + public int? unread { get; set; } + public int? child_unread { get; set; } + public string param { get; set; } + public string fg_color { get; set; } + public string bg_color { get; set; } + public int? updates_disabled { get; set; } + } + } + } +} \ No newline at end of file