diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:32:49 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:32:49 +1000 |
| commit | bc05caed482d70284f6af14ff15e6cad2afd1985 (patch) | |
| tree | 1ef302adec52abb887ed18317330d4422aba6b5e | |
| parent | 0ef438a7404117aad37e92b39ab8950c18522843 (diff) | |
| -rw-r--r-- | ApiClient.csproj | 4 | ||||
| -rw-r--r-- | HyperBooru.cs | 20 | ||||
| -rw-r--r-- | Statistics.cs | 14 |
3 files changed, 27 insertions, 11 deletions
diff --git a/ApiClient.csproj b/ApiClient.csproj index 8622f7a..e3b991c 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.17.0.0</AssemblyVersion> + <AssemblyVersion>0.18.0.0</AssemblyVersion> <FileVersion>$(AssemblyVersion)</FileVersion> - <Version>0.17-alpha</Version> + <Version>0.18-alpha</Version> </PropertyGroup> <ItemGroup> diff --git a/HyperBooru.cs b/HyperBooru.cs index b07351d..4ee1256 100644 --- a/HyperBooru.cs +++ b/HyperBooru.cs @@ -5,11 +5,12 @@ using System.Net.Http.Json; namespace HyperBooru.ApiClient; public sealed class HBSession : IDisposable { - public Media Media { get; private init; } - public Tag Tag { get; private init; } - public Feed Feed { get; private init; } - public User User { get; private init; } - public Uri BaseUri { get; private init; } + public Media Media { get; private init; } + public Tag Tag { get; private init; } + public Feed Feed { get; private init; } + public User User { get; private init; } + public Statistics Statistics { get; private init; } + public Uri BaseUri { get; private init; } internal HttpClient HttpClient { get; private init; } @@ -35,10 +36,11 @@ public sealed class HBSession : IDisposable { BaseAddress = BaseUri }; - Media = new(this); - Tag = new(this); - Feed = new(this); - User = new(this); + Media = new(this); + Tag = new(this); + Feed = new(this); + User = new(this); + Statistics = new(this); } public async Task LoginAsync(string username, string password) { diff --git a/Statistics.cs b/Statistics.cs new file mode 100644 index 0000000..74871f2 --- /dev/null +++ b/Statistics.cs @@ -0,0 +1,14 @@ +using HyperBooru.ApiModels; +using System.Net.Http.Json; + +namespace HyperBooru.ApiClient; + +public class Statistics { + private HBSession session; + + internal Statistics(HBSession session) => + this.session = session; + + public async Task<IngestStatistics> GetIngestStatisticsAsync() => + (await session.HttpClient.GetFromJsonAsync<IngestStatistics>("/api/stats/ingest"))!; +} |
