diff options
| -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[]>())!; + } } |
