subscribe to feed - seems to work
This commit is contained in:
parent
f224aa8506
commit
bbf090eae9
@ -645,23 +645,52 @@ namespace ttrss_co_client.ttrss
|
|||||||
throw new Exception("update ostensibly ok, but couldn't parse");
|
throw new Exception("update ostensibly ok, but couldn't parse");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async Task 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)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("url");
|
||||||
|
}
|
||||||
assertInitialized();
|
assertInitialized();
|
||||||
assertApiLevel(4);
|
assertApiLevel(4);
|
||||||
if (!sanitize)
|
if (!sanitize)
|
||||||
assertApiLevel(20);
|
assertApiLevel(20);
|
||||||
throw new NotImplementedException();
|
|
||||||
|
|
||||||
|
var json = JsonContent.Create(new
|
||||||
|
{
|
||||||
|
op = "shareToPublished",
|
||||||
|
sid = this.SessionId,
|
||||||
|
title =title,
|
||||||
|
url = url.ToString(),
|
||||||
|
content = content,
|
||||||
|
sanitize = sanitize
|
||||||
|
});
|
||||||
|
|
||||||
|
var apiResponse = await get<Dictionary<string, string>>(json);
|
||||||
|
|
||||||
|
return apiResponse.ContainsKey("status") && apiResponse["status"]?.ToLower() == "ok";
|
||||||
}
|
}
|
||||||
///<summary>
|
///<param name="category_id">0 = uncategorized</param>
|
||||||
///<param name="login"/>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"/>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>
|
||||||
///</summary>
|
///<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 SubscribeToFeed(Uri feed_url, int category_id, string login, string password)
|
public async Task<int> SubscribeToFeed(Uri feed_url, int category_id =0, string login=null, string password=null)
|
||||||
{
|
{
|
||||||
assertInitialized();
|
assertInitialized();
|
||||||
assertApiLevel(5);
|
assertApiLevel(5);
|
||||||
throw new NotImplementedException();
|
|
||||||
|
var json = JsonContent.Create(new
|
||||||
|
{
|
||||||
|
op = "subscribeToFeed",
|
||||||
|
sid = this.SessionId,
|
||||||
|
feed_url = feed_url.ToString(),
|
||||||
|
category_id = category_id,
|
||||||
|
login = login,
|
||||||
|
password = password
|
||||||
|
});
|
||||||
|
var apiResponse = await get<Dictionary<string, Dictionary<string, int>>>(json);
|
||||||
|
return apiResponse["status"]["code"];
|
||||||
}
|
}
|
||||||
public async Task UnsubscribeFeed()
|
public async Task UnsubscribeFeed()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user