2024-11-22 09:55:08 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Uwaa.Pleroma.Test;
|
|
|
|
|
|
|
|
|
|
static class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
MainInline().Wait();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static async Task MainInline()
|
|
|
|
|
{
|
2024-12-16 04:50:54 +01:00
|
|
|
|
static void PrintStatus(Status status)
|
|
|
|
|
{
|
|
|
|
|
Console.Write('\t');
|
|
|
|
|
Console.Write(status.CreatedAt.ToShortDateString());
|
|
|
|
|
Console.Write(' ');
|
|
|
|
|
Console.Write(status.CreatedAt.ToLongTimeString());
|
|
|
|
|
Console.Write(' ');
|
|
|
|
|
Console.WriteLine(status);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
Pleroma client = new Pleroma("localhost", "Bearer abcdefghijklmnopqrstuvwxyz");
|
2024-11-22 09:55:08 +01:00
|
|
|
|
Account account = await client.GetAccount();
|
2024-12-18 10:56:02 +01:00
|
|
|
|
Status[] statuses = await client.GetTimeline(Timeline.Bubble);
|
2024-11-22 09:55:08 +01:00
|
|
|
|
|
|
|
|
|
Console.WriteLine($"Account: {account} ({account.ID})");
|
|
|
|
|
Console.WriteLine("Public statuses:");
|
|
|
|
|
foreach (Status status in statuses)
|
2024-12-16 04:50:54 +01:00
|
|
|
|
PrintStatus(status);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
SearchResults search = await client.Search("bepis", type: SearchType.Statuses, limit: 10);
|
|
|
|
|
if (search.Statuses == null || search.Statuses.Length == 0)
|
2024-11-22 09:55:08 +01:00
|
|
|
|
{
|
2024-12-16 04:50:54 +01:00
|
|
|
|
Console.WriteLine("No search results");
|
2024-11-22 09:55:08 +01:00
|
|
|
|
}
|
2024-12-16 04:50:54 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Search results for \"bepis\":");
|
|
|
|
|
foreach (Status status in search.Statuses)
|
|
|
|
|
PrintStatus(status);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-22 09:55:08 +01:00
|
|
|
|
Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
}
|