using Iceshrimp.Frontend.Core.Miscellaneous; using Iceshrimp.Frontend.Core.Services; using Iceshrimp.Shared.Schemas.Web; namespace Iceshrimp.Frontend.Core.ControllerModels; internal class UserControllerModel(ApiClient api) { public Task GetUserAsync(string id) => api.CallNullableAsync(HttpMethod.Get, $"/users/{id}"); public Task GetUserProfileAsync(string id) => api.CallNullableAsync(HttpMethod.Get, $"/users/{id}/profile"); [LinkPagination(20, 80)] public Task?> GetUserNotesAsync(string id, PaginationQuery pq) => api.CallNullableAsync>(HttpMethod.Get, $"/users/{id}/notes", pq); public Task LookupUserAsync(string username, string? host) { var query = new QueryString(); query = query.Add("username", username); if (host != null) query = query.Add("host", host); return api.CallNullableAsync(HttpMethod.Get, "/users/lookup", query); } public Task BiteUserAsync(string id) => api.CallAsync(HttpMethod.Post, $"/users/{id}/bite"); public Task FollowUserAsync(string id) => api.CallNullableAsync(HttpMethod.Post, $"/users/{id}/follow"); public Task RemoveUserFromFollowersAsync(string id) => api.CallNullableAsync(HttpMethod.Post, $"/users/{id}/remove_from_followers"); public Task UnfollowUserAsync(string id) => api.CallNullableAsync(HttpMethod.Post, $"/users/{id}/unfollow"); }