[frontend/api] Add EmojiControllerModel
This commit is contained in:
parent
12e74f2f05
commit
c9b282a90e
2 changed files with 31 additions and 10 deletions
|
@ -0,0 +1,20 @@
|
||||||
|
using Iceshrimp.Frontend.Core.Services;
|
||||||
|
using Iceshrimp.Shared.Schemas;
|
||||||
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
|
|
||||||
|
namespace Iceshrimp.Frontend.Core.ControllerModels;
|
||||||
|
|
||||||
|
internal class EmojiControllerModel(ApiClient api)
|
||||||
|
{
|
||||||
|
public Task<List<EmojiResponse>> GetAllEmoji() =>
|
||||||
|
api.Call<List<EmojiResponse>>(HttpMethod.Get, "/emoji");
|
||||||
|
|
||||||
|
public Task<EmojiResponse> UploadEmoji(IBrowserFile file) =>
|
||||||
|
api.Call<EmojiResponse>(HttpMethod.Post, "/emoji", data: file);
|
||||||
|
|
||||||
|
public Task<EmojiResponse?> UpdateEmoji(string id, EmojiResponse emoji) =>
|
||||||
|
api.CallNullable<EmojiResponse>(HttpMethod.Patch, $"/emoji/{id}", data: emoji);
|
||||||
|
|
||||||
|
public Task<EmojiResponse?> GetEmoji(string id) =>
|
||||||
|
api.CallNullable<EmojiResponse>(HttpMethod.Get, $"/emoji/{id}");
|
||||||
|
}
|
|
@ -4,15 +4,16 @@ namespace Iceshrimp.Frontend.Core.Services;
|
||||||
|
|
||||||
internal class ApiService(ApiClient client)
|
internal class ApiService(ApiClient client)
|
||||||
{
|
{
|
||||||
public readonly NoteControllerModel Notes = new(client);
|
public readonly NoteControllerModel Notes = new(client);
|
||||||
public readonly UserControllerModel Users = new(client);
|
public readonly UserControllerModel Users = new(client);
|
||||||
public readonly AuthControllerModel Auth = new(client);
|
public readonly AuthControllerModel Auth = new(client);
|
||||||
public readonly DriveControllerModel Drive = new(client);
|
public readonly DriveControllerModel Drive = new(client);
|
||||||
public readonly AdminControllerModel Admin = new(client);
|
public readonly AdminControllerModel Admin = new(client);
|
||||||
public readonly SearchControllerModel Search = new(client);
|
public readonly SearchControllerModel Search = new(client);
|
||||||
public readonly SettingsControllerModel Settings = new(client);
|
public readonly SettingsControllerModel Settings = new(client);
|
||||||
public readonly TimelineControllerModel Timelines = new(client);
|
public readonly TimelineControllerModel Timelines = new(client);
|
||||||
public readonly NotificationControllerModel Notifications = new(client);
|
public readonly NotificationControllerModel Notifications = new(client);
|
||||||
|
public readonly EmojiControllerModel Emoji = new(client);
|
||||||
|
|
||||||
public void SetBearerToken(string token) => client.SetToken(token);
|
public void SetBearerToken(string token) => client.SetToken(token);
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue