50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Uwaa.Pleroma.Test;
|
|
|
|
static class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
MainInline().Wait();
|
|
}
|
|
|
|
static async Task MainInline()
|
|
{
|
|
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);
|
|
}
|
|
|
|
Pleroma client = new Pleroma("localhost", "Bearer abcdefghijklmnopqrstuvwxyz");
|
|
Account account = await client.GetAccount();
|
|
Status[] statuses = await client.GetTimeline();
|
|
|
|
Console.WriteLine($"Account: {account} ({account.ID})");
|
|
Console.WriteLine("Public statuses:");
|
|
foreach (Status status in statuses)
|
|
PrintStatus(status);
|
|
|
|
Console.WriteLine();
|
|
|
|
SearchResults search = await client.Search("bepis", type: SearchType.Statuses, limit: 10);
|
|
if (search.Statuses == null || search.Statuses.Length == 0)
|
|
{
|
|
Console.WriteLine("No search results");
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Search results for \"bepis\":");
|
|
foreach (Status status in search.Statuses)
|
|
PrintStatus(status);
|
|
}
|
|
|
|
Console.ReadKey();
|
|
}
|
|
}
|