diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-05-09 02:58:04 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-05-09 02:58:04 +1000 |
| commit | 477c6c7a4f2ccb2123a89dce1cc51db2dc643833 (patch) | |
| tree | 49b1f17e8d9ddd65942c4c81fa2a74abb3b0c279 | |
| parent | 1c2427084ba610553c49140a2ce604fa63ba37c9 (diff) | |
v0.15av0.15a
| -rw-r--r-- | ApiClient.csproj | 4 | ||||
| -rw-r--r-- | Media.cs | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/ApiClient.csproj b/ApiClient.csproj index db8e34a..b6f9619 100644 --- a/ApiClient.csproj +++ b/ApiClient.csproj @@ -7,9 +7,9 @@ <AssemblyName>HyperBooru.ApiClient</AssemblyName> <AssemblyTitle>HyperBooru.ApiClient</AssemblyTitle> <RootNamespace>HyperBooru.ApiClient</RootNamespace> - <AssemblyVersion>0.14.0.0</AssemblyVersion> + <AssemblyVersion>0.15.0.0</AssemblyVersion> <FileVersion>$(AssemblyVersion)</FileVersion> - <Version>0.14-alpha</Version> + <Version>0.15-alpha</Version> </PropertyGroup> <ItemGroup> @@ -69,4 +69,22 @@ public class Media { return responseContent!; } + + public async Task<TagDefinition[]> GetTagsAsync(Guid mediaId) => + (await session.HttpClient.GetFromJsonAsync<TagDefinition[]>($"/api/media/{mediaId}/tags"))!; + + public async Task<TagDefinition[]> AddTagsAsync(Guid mediaId, Guid[] tagIds) { + var response = await session.HttpClient.PatchAsJsonAsync($"/api/media/{mediaId}/tags", tagIds); + return (await response.Content.ReadFromJsonAsync<TagDefinition[]>())!; + } + + public async Task<TagDefinition[]> ReplaceTagsAsync(Guid mediaId, Guid[] tagIds) { + var response = await session.HttpClient.PutAsJsonAsync($"/api/media/{mediaId}/tags", tagIds); + return (await response.Content.ReadFromJsonAsync<TagDefinition[]>())!; + } + + public async Task<TagDefinition[]> DeleteTagsAsync(Guid mediaId, Guid[] tagIds) { + var response = await session.HttpClient.PatchAsJsonAsync($"/api/media/{mediaId}/tags/delete", tagIds); + return (await response.Content.ReadFromJsonAsync<TagDefinition[]>())!; + } } |
