pleroma: add more endpoints
This commit is contained in:
parent
75255633e0
commit
4c0b3a9327
3 changed files with 60 additions and 1 deletions
31
Pleroma/Models/ModerationLogEntry.cs
Normal file
31
Pleroma/Models/ModerationLogEntry.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Uwaa.Pleroma;
|
||||
|
||||
public class ModerationLog
|
||||
{
|
||||
[JsonPropertyName("items")]
|
||||
public ModerationLogEntry[] Items { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("total")]
|
||||
public int Total { get; set; }
|
||||
}
|
||||
|
||||
public class ModerationLogEntry
|
||||
{
|
||||
[JsonPropertyName("data")]
|
||||
public JsonObject Data { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public int ID { get; set; }
|
||||
|
||||
[JsonPropertyName("message")]
|
||||
public string Message { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("time")]
|
||||
public int Time { get; set; }
|
||||
|
||||
public string Action => (string)Data["action"]!;
|
||||
|
||||
public override string ToString() => Message;
|
||||
}
|
|
@ -9,7 +9,7 @@ public class Page
|
|||
public int PageSize { get; set; }
|
||||
}
|
||||
|
||||
public class UsersPage
|
||||
public class UsersPage : Page
|
||||
{
|
||||
[JsonPropertyName("users")]
|
||||
public AccountInfo[] Users { get; set; } = null!;
|
||||
|
|
|
@ -403,6 +403,26 @@ public class Pleroma
|
|||
}))!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Feature one of your own public statuses at the top of your profile
|
||||
/// </summary>
|
||||
/// <param name="status">The status to pin.</param>
|
||||
/// <returns>The pinned status, if it exists.</returns>
|
||||
public Task<Status?> Pin(StatusID status)
|
||||
{
|
||||
return Retry<Status?>(() => new HttpRequestMessage(HttpMethod.Post, $"/api/v1/statuses/{WebUtility.UrlEncode(status.ID)}/pin"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unfeature a status from the top of your profile
|
||||
/// </summary>
|
||||
/// <param name="status">The status to unpin.</param>
|
||||
/// <returns>The unpinned status, if it exists.</returns>
|
||||
public Task<Status?> Unpin(StatusID status)
|
||||
{
|
||||
return Retry<Status?>(() => new HttpRequestMessage(HttpMethod.Post, $"/api/v1/statuses/{WebUtility.UrlEncode(status.ID)}/unpin"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reposts/boosts/shares a status.
|
||||
/// </summary>
|
||||
|
@ -849,6 +869,14 @@ public class PleromaAdmin : Pleroma
|
|||
return req;
|
||||
})!;
|
||||
}
|
||||
|
||||
public Task<ModerationLog> GetModerationLog(int page = 1)
|
||||
{
|
||||
return Retry<ModerationLog>(() => new HttpRequestMessage(HttpMethod.Get, $"/api/v1/pleroma/admin/moderation_log" + CreateQuery(addPair =>
|
||||
{
|
||||
addPair("page", page.ToString());
|
||||
})))!;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(EnumLowerCaseConverter<ActorType>))]
|
||||
|
|
Loading…
Reference in a new issue