This commit is contained in:
Adam R Grey 2023-04-04 17:31:51 -04:00
parent c53752d305
commit 3936850913
2 changed files with 46 additions and 5 deletions

View File

@ -647,7 +647,7 @@ namespace ttrss_co_client.ttrss
} }
public async Task<bool> ShareToPublished(string title, Uri url, string content, bool sanitize = true) public async Task<bool> ShareToPublished(string title, Uri url, string content, bool sanitize = true)
{ {
if(url == null) if (url == null)
{ {
throw new ArgumentNullException("url"); throw new ArgumentNullException("url");
} }
@ -661,7 +661,7 @@ namespace ttrss_co_client.ttrss
{ {
op = "shareToPublished", op = "shareToPublished",
sid = this.SessionId, sid = this.SessionId,
title =title, title = title,
url = url.ToString(), url = url.ToString(),
content = content, content = content,
sanitize = sanitize sanitize = sanitize
@ -675,7 +675,7 @@ namespace ttrss_co_client.ttrss
///<param name="login">probably if the feed requires basic HTTP auth; the login? (decidedly not self-explanatory, gdi)</param> ///<param name="login">probably if the feed requires basic HTTP auth; the login? (decidedly not self-explanatory, gdi)</param>
///<param name="password">probably if the feed requires basic HTTP auth; the password? (decidedly not self-explanatory, gdi)</param> ///<param name="password">probably if the feed requires basic HTTP auth; the password? (decidedly not self-explanatory, gdi)</param>
///<returns>¯\_(ツ)_/¯ - 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).</returns> ///<returns>¯\_(ツ)_/¯ - 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).</returns>
public async Task<int> SubscribeToFeed(Uri feed_url, int category_id =0, string login=null, string password=null) public async Task<int> SubscribeToFeed(Uri feed_url, int category_id = 0, string login = null, string password = null)
{ {
assertInitialized(); assertInitialized();
assertApiLevel(5); assertApiLevel(5);
@ -708,11 +708,20 @@ namespace ttrss_co_client.ttrss
return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok"; return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok";
} }
public async Task GetFeedTree() ///<returns>(almost) the whole shebang, for a user</returns>
public async Task<Tree> GetFeedTree(bool include_empty = false)
{ {
assertInitialized(); assertInitialized();
assertApiLevel(5); assertApiLevel(5);
throw new NotImplementedException();
var json = JsonContent.Create(new
{
op = "getFeedTree",
sid = this.SessionId,
include_empty = include_empty
});
return await get<Tree>(json);
} }
private void assertInitialized() private void assertInitialized()
{ {

View File

@ -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<Item> 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<Item> 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; }
}
}
}
}