feat: DocumentsRouteService initialisiert und in WindreamClientService integriert

- `DocumentsRouteService`-Klasse hinzugefügt, um dokumentbezogene Routen zu verwalten, basierend auf `BaseRouteService`.
- `DocumentsRouteService` in `WindreamClientService` für Dokumentoperationen integriert.
- `DocumentsRouteService` als Singleton im Service-Container registriert mit `AddSingleton`.
This commit is contained in:
Developer 02 2024-09-12 20:59:55 +02:00
parent 5062930d5b
commit 71f0919bce
5 changed files with 20 additions and 4 deletions

View File

@ -17,7 +17,8 @@ namespace WindreamHub.Legacy.Client
.AddSingleton<WindreamClientService>()
.AddSingleton<SubscriptionsRouteService>()
.AddSingleton<SystemDetailsRouteService>()
.AddSingleton<AuthenticationRouteService>();
.AddSingleton<AuthenticationRouteService>()
.AddSingleton<DocumentsRouteService>();
return services;
}

View File

@ -1,6 +1,5 @@
using DigitalData.Core.Legacy.Client;
using Microsoft.Extensions.Options;
using System;
using System.Net;
using System.Net.Http;
@ -15,8 +14,8 @@ namespace WindreamHub.Legacy.Client.Routes
clientOptions.Value.Routes.TryGetValue(route_name, out string route);
if(route is null)
throw new InvalidOperationException($"Route not found for the route name: {route_name}.");
if (route is null)
Uri += $"/{route_name.ToLower()}";
Uri += route;
}

View File

@ -0,0 +1,13 @@
using Microsoft.Extensions.Options;
using System.Net;
using System.Net.Http;
namespace WindreamHub.Legacy.Client.Routes
{
public class DocumentsRouteService : BaseRouteService
{
public DocumentsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) : base(client, cookieContainer, clientOptions)
{
}
}
}

View File

@ -28,6 +28,8 @@ namespace WindreamHub.Legacy.Client
public AuthenticationRouteService Authentication { get; }
public DocumentsRouteService Documents { get; }
public async Task<bool> AuthenticateAsync(ICredential credential)
{
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credential.AuthorizationHeader);

View File

@ -94,6 +94,7 @@
<Compile Include="Models\SystemDetailsResponse.cs" />
<Compile Include="Models\Authentication\UserCredential.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routes\DocumentsRouteService.cs" />
<Compile Include="Routes\AuthenticationRouteService.cs" />
<Compile Include="Routes\BaseRouteService.cs" />
<Compile Include="Routes\RouteExtensions.cs" />