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:
@@ -17,7 +17,8 @@ namespace WindreamHub.Legacy.Client
|
|||||||
.AddSingleton<WindreamClientService>()
|
.AddSingleton<WindreamClientService>()
|
||||||
.AddSingleton<SubscriptionsRouteService>()
|
.AddSingleton<SubscriptionsRouteService>()
|
||||||
.AddSingleton<SystemDetailsRouteService>()
|
.AddSingleton<SystemDetailsRouteService>()
|
||||||
.AddSingleton<AuthenticationRouteService>();
|
.AddSingleton<AuthenticationRouteService>()
|
||||||
|
.AddSingleton<DocumentsRouteService>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using DigitalData.Core.Legacy.Client;
|
using DigitalData.Core.Legacy.Client;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
||||||
@@ -15,8 +14,8 @@ namespace WindreamHub.Legacy.Client.Routes
|
|||||||
|
|
||||||
clientOptions.Value.Routes.TryGetValue(route_name, out string route);
|
clientOptions.Value.Routes.TryGetValue(route_name, out string route);
|
||||||
|
|
||||||
if(route is null)
|
if (route is null)
|
||||||
throw new InvalidOperationException($"Route not found for the route name: {route_name}.");
|
Uri += $"/{route_name.ToLower()}";
|
||||||
|
|
||||||
Uri += route;
|
Uri += route;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,8 @@ namespace WindreamHub.Legacy.Client
|
|||||||
|
|
||||||
public AuthenticationRouteService Authentication { get; }
|
public AuthenticationRouteService Authentication { get; }
|
||||||
|
|
||||||
|
public DocumentsRouteService Documents { get; }
|
||||||
|
|
||||||
public async Task<bool> AuthenticateAsync(ICredential credential)
|
public async Task<bool> AuthenticateAsync(ICredential credential)
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credential.AuthorizationHeader);
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credential.AuthorizationHeader);
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
<Compile Include="Models\SystemDetailsResponse.cs" />
|
<Compile Include="Models\SystemDetailsResponse.cs" />
|
||||||
<Compile Include="Models\Authentication\UserCredential.cs" />
|
<Compile Include="Models\Authentication\UserCredential.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Routes\DocumentsRouteService.cs" />
|
||||||
<Compile Include="Routes\AuthenticationRouteService.cs" />
|
<Compile Include="Routes\AuthenticationRouteService.cs" />
|
||||||
<Compile Include="Routes\BaseRouteService.cs" />
|
<Compile Include="Routes\BaseRouteService.cs" />
|
||||||
<Compile Include="Routes\RouteExtensions.cs" />
|
<Compile Include="Routes\RouteExtensions.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user