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 GetUser(string id) => api.CallNullable(HttpMethod.Get, $"/users/{id}"); public Task GetUserProfile(string id) => api.CallNullable(HttpMethod.Get, $"/users/{id}/profile"); [LinkPagination(20, 80)] public Task?> GetUserNotes(string id, PaginationQuery pq) => api.CallNullable>(HttpMethod.Get, $"/users/{id}/notes", pq); public Task LookupUser(string username, string? host) { var query = new QueryString(); query = query.Add("username", username); if (host != null) query = query.Add("host", host); return api.CallNullable(HttpMethod.Get, "/users/lookup", query); } public Task BiteUser(string id) => api.Call(HttpMethod.Post, $"/users/{id}/bite"); public Task FollowUser(string id) => api.CallNullable(HttpMethod.Post, $"/users/{id}/follow"); public Task UnfollowUser(string id) => api.CallNullable(HttpMethod.Post, $"/users/{id}/unfollow"); }