Compare commits

...

37 Commits

Author SHA1 Message Date
8059ad679e remove nuspec 2025-08-12 13:16:51 +02:00
Developer 02
137579bbcc chore: WindreamHub.Legacy.Client Paketversion auf 1.1.0 erhöht
- Paketversion von 1.0.0 auf 1.1.0 aktualisiert, um die neuen Änderungen widerzuspiegeln.
2024-09-13 15:39:56 +02:00
Developer 02
4aa696410c refactor: Generische Methoden für Rückgabetypen in DocumentsRouteService hinzugefügt
- Refaktorierte CreateAsync-, UploadAsync-, UpdateAsync-, DownloadAsync- und DeleteAsync-Methoden, um generische TData- und TError-Typen zu unterstützen.
- Dynamische Overloads für Create-, Upload-, Update-, Download- und Delete-Methoden hinzugefügt für flexible Anwendungsfälle.
- Methoden-Signaturen aktualisiert, um bessere Typinferenz und Handhabung verschiedener Rückgabetypen zu ermöglichen.
2024-09-13 14:38:09 +02:00
Developer 02
3be920c06a feat: Deserialize- und DeserializeList-Methoden zu ModelExtensions hinzufügen
- Hinzugefügt: Deserialize<T>- und Deserialize-Methoden für JSON-Deserialisierung.
- Hinzugefügt: DeserializeList-Methode zum Deserialisieren von JSON in eine IEnumerable<dynamic>.
2024-09-13 13:48:35 +02:00
Developer 02
4aa4a0add5 feat: DeleteAsync-Methode hinzufügen und Methodennamen mit 'Async'-Suffix refaktorisieren
- Hinzugefügt: DeleteAsync-Methode zur Handhabung der Dokumentenlöschung.
- Bestehende Methoden umbenannt, um 'Async'-Suffix für Konsistenz zu enthalten.
2024-09-13 13:46:17 +02:00
Developer 02
650f2c58d3 refactor: HTTP-Methoden umbenennen, um das Suffix 'Async' für asynchrone Operationen hinzuzufügen 2024-09-13 13:23:14 +02:00
Developer 02
8e367e89c4 feat: Fehler-Modelle für den Dokumentenlöschvorgang hinzugefügt 2024-09-13 13:15:58 +02:00
Developer 02
193c2c41cd chore: Projektdatei aktualisiert, um DeleteItem- und DocDeleteBody-Modelle einzuschließen 2024-09-13 12:08:31 +02:00
Developer 02
6ee87f8b02 feat: DeleteItem- und DocDeleteBody-Modelle für Dokumentenlöschanforderung erstellt 2024-09-13 12:06:57 +02:00
Developer 02
8249c99132 feat: Neue Update- und Download-Methoden zu DocumentsRouteService hinzugefügt 2024-09-13 12:04:35 +02:00
Developer 02
b1834c3417 refactor: DocCreateBody in DocBody umbenannt
- `DocCreateBody` in `DocBody` umbenannt, um den Code einfacher und klarer zu gestalten.
2024-09-13 11:27:27 +02:00
Developer 02
dc0cfd6010 refactor: Dokumenterstellungs-Modelle in den Request-Ordner verschoben
- Modelle von `Models/Documents/Create/Request` nach `Models/Documents/Request` verschoben, um eine bessere Organisation und Konsistenz zu gewährleisten.
2024-09-13 11:25:29 +02:00
Developer 02
18b3a7dfff feat: Flag-Enum für Dokumentoperationen eingeführt
- Ein `Flag`-Enum erstellt, um dokumentbezogene Operationen zu repräsentieren (z.B. `CreateObject`, `CheckIn` usw.).
- Die Verwendung von Integer-Flags in `DocumentsRouteService` durch das neue Enum ersetzt, um die Lesbarkeit und Wartbarkeit des Codes zu verbessern.
- Die `Upload`-Methode aktualisiert, um Flags als Array von `Flag`-Enum-Werten zu verarbeiten.
2024-09-13 11:18:24 +02:00
Developer 02
d9784115ce refactor: Bool-Typen in den Modellen auf bool? geändert 2024-09-13 09:44:20 +02:00
Developer 02
d0ae6c4541 feat: Methode "Upload" zur Dateiübertragung mit Abfrageparametern hinzugefügt
- Methode "Upload" für das Hochladen von Dateien hinzugefügt.
- Unterstützung für Abfrageparameter wie item_id, item_location, item_name, flags und stream_identity hinzugefügt.
- Methode auf MultipartFormDataContent für die Dateiverarbeitung aktualisiert.
2024-09-13 01:28:16 +02:00
Developer 02
e8cffa5fa0 refactor: Dokumenterstellungs-Modelle in den Create-Ordner verschoben 2024-09-13 00:55:06 +02:00
Developer 02
39e78821cf feat: Dokumenterstellungs-Methoden zu DocumentsRouteService hinzugefügt und Modelle aktualisiert
- Zwei `Create`-Methoden in `DocumentsRouteService` hinzugefügt, um die Dokumentenerstellung über HTTP-POST-Anfragen zu ermöglichen.
- `int`-Felder im `DocCreateBody`-Modell in `int?` umgewandelt, um mögliche Nullwerte vom Server zu berücksichtigen.
- Die neue Dokumenterstellungsfunktion in WindreamClientService integriert.
2024-09-13 00:40:06 +02:00
Developer 02
152b4f7cff feat: Modelle für die Antwort auf die Dokumentenerstellung in DocumentsRouteService hinzugefügt 2024-09-12 22:05:59 +02:00
Developer 02
987cecba4c feat: Modelle für Dokumentenerstellungsanfragen in DocumentsRouteService hinzugefügt
- `Attribute`, `DocumentCreationBody`, `Item` und `ObjectType` Modelle für die Dokumentenerstellungsanfrage hinzugefügt.
- Diese Modelle werden zur Erstellung von Dokumentenanfragen mit spezifischen Attributen und Details verwendet.
2024-09-12 21:38:41 +02:00
Developer 02
dcaf510bd3 refactor: SystemDetails-Response-Modelle in den SystemDetails-Ordner verschoben 2024-09-12 21:08:45 +02:00
Developer 02
71f0919bce 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`.
2024-09-12 20:59:55 +02:00
Developer 02
5062930d5b feat: Benutzer-Authentifizierungsmethoden und Validierungslogik hinzugefügt
- `IsValidUser`-Methode in `AuthenticationRouteService` hinzugefügt, um Benutzer über die `/IsValidUser`-Route zu validieren.
- Drei neue `AuthenticateAsync`-Methoden in `WindreamClientService` implementiert, um verschiedene Benutzerauthentifizierungen zu unterstützen (ICredential, Domain/Name/Passwort und Base64-Authorization-Header).
- HttpClient aktualisiert, um Authorization-Header für die Authentifizierung hinzuzufügen.
2024-09-12 20:20:49 +02:00
Developer 02
c233ab0ed7 feat: AuthenticationRouteService zum WindreamHub-Client hinzugefügt
- `AuthenticationRouteService`-Klasse zur Verwaltung von Authentifizierungsrouten erstellt.
- `AuthenticationRouteService` im DI-Container mit `AddSingleton<AuthenticationRouteService>()` registriert.
- `AuthenticationRouteService` zum `WindreamClientService` hinzugefügt, um die Authentifizierung im Hauptdienst zu verwalten.
2024-09-12 02:09:13 +02:00
Developer 02
0346af5b29 feat: Füge UserCredential-Klasse für die Windream-API-Integration hinzu
- UserCredential-Klasse erstellt, um Benutzerdaten für die Windream-API zu verwalten.
- Konstruktor implementiert, um Domain, Name und Passwort zu initialisieren.
- ConvertToBase64-Methode hinzugefügt, um Anmeldeinformationen für den Autorisierungsheader zu kodieren.
2024-09-11 16:43:57 +02:00
Developer 02
8eabf99616 chore: für NuGet-Paket konfiguriert 2024-07-31 09:55:00 +02:00
Developer 02
8c1ae0e373 refactor: CreateFetchAsyncAction in CreateFetchAction umbenannt 2024-07-30 11:46:58 +02:00
Developer 02
ccf76a72c1 refactor: Fehler-Action-Parameter in der FetchAsync-Methode optional machen 2024-07-30 11:31:42 +02:00
Developer 02
bcf0db1d5a refactor: Methoden von 'Subscribe' auf 'Fetch' umbenannt 2024-07-30 11:22:51 +02:00
Developer 02
82ce7996d1 feat: Erweiterung der ModelExtensions um zusätzliche Subscribe-Methoden
- Hinzugefügt: `SubscribeAsync` Methode für asynchrone Verarbeitung mit Abbruch-Token.
- Hinzugefügt: Überlastung von `Subscribe` Methode für sofortige Ausführung und wiederholte Ausführung mit Delay.
- Hinzugefügt: Methoden zur Erstellung von `Subscribe`-Aktionen mit Unterstützung für Abbruch-Token.
2024-07-30 11:12:31 +02:00
Developer 02
353088a6b2 feat: Integration von SimplifiedResponse und seiner Erweiterung abgeschlossen
- Methode ähnlich zu Angular's Subscribe für verbesserte asynchrone Verarbeitung implementiert.
- Modelle erstellt und Methoden für den GetSystemDetails-Endpunkt hinzugefügt.
2024-07-29 17:41:43 +02:00
Developer 02
31ac95ab24 chore: .gitignore aktualisiert 2024-07-29 17:00:58 +02:00
Developer 02
d1ac521e8d feat: Legacy-Version des Client Services erstellt und bestehende Services und Routen integriert 2024-07-29 15:46:12 +02:00
Developer 02
966b96f315 chore: ConsoleApp-Referenz aus den Lösungen entfernt 2024-07-29 11:03:18 +02:00
Developer 02
4939396f71 Konfigurierte .csproj-Dateien für die Paketierung von WindreamHub.Client und WindreamHub.Abstractions als NuGet-Pakete. 2024-06-28 03:15:48 +02:00
Developer 02
ce3a9f90db Initialer Commit: Projekteinrichtung und erste Implementierung
- Erstellte Lösungsstruktur und Projektdateien
- Hinzugefügte grundlegende Abstraktionen und Client-Services
- Implementierte anfängliche Antwortverarbeitungsklassen
- Einrichtung von Dependency Injection und Konfigurationsoptionen
2024-06-28 02:42:38 +02:00
Developer 02
5cd343216a Gitignore aktualisieren 2024-06-28 02:42:23 +02:00
Developer 02
7c0f8b56e8 Neue Lösung und Klassenbibliotheksprojekt erstellt und das Projekt zur Lösung hinzugefügt. 2024-06-27 13:51:30 +02:00
55 changed files with 1200 additions and 0 deletions

3
.gitignore vendored
View File

@@ -412,3 +412,6 @@ FodyWeavers.xsd
# Built Visual Studio Code Extensions # Built Visual Studio Code Extensions
*.vsix *.vsix
/src/WindreamHub.ConsoleApp/WindreamHub.ConsoleApp.csproj
/src/WindreamHub.ConsoleApp
/src/WindreamHub.Legacy.ConsoleApp

51
WindreamHub.sln Normal file
View File

@@ -0,0 +1,51 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7BFFBEF2-6639-41F6-B6C2-D231FF719F57}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindreamHub.Abstractions", "src\WindreamHub.Abstractions\WindreamHub.Abstractions.csproj", "{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindreamHub.Client", "src\WindreamHub.Client\WindreamHub.Client.csproj", "{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindreamHub.Legacy.Client", "src\WindreamHub.Legacy.Client\WindreamHub.Legacy.Client.csproj", "{67E6A3A1-F863-417E-9619-DC9B6A710512}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WindreamHub.Legacy.ConsoleApp", "src\WindreamHub.Legacy.ConsoleApp\WindreamHub.Legacy.ConsoleApp.vbproj", "{DE6A7FB2-87D6-471E-8019-DF6E196FA471}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270}.Debug|Any CPU.Build.0 = Release|Any CPU
{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270}.Release|Any CPU.Build.0 = Release|Any CPU
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Debug|Any CPU.Build.0 = Release|Any CPU
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Release|Any CPU.Build.0 = Release|Any CPU
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Debug|Any CPU.Build.0 = Release|Any CPU
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Release|Any CPU.Build.0 = Release|Any CPU
{DE6A7FB2-87D6-471E-8019-DF6E196FA471}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE6A7FB2-87D6-471E-8019-DF6E196FA471}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE6A7FB2-87D6-471E-8019-DF6E196FA471}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE6A7FB2-87D6-471E-8019-DF6E196FA471}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
{67E6A3A1-F863-417E-9619-DC9B6A710512} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
{DE6A7FB2-87D6-471E-8019-DF6E196FA471} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C2C9327F-0E3C-40B5-B878-DA59F03CF150}
EndGlobalSection
EndGlobal

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,14 @@
namespace WindreamHub.Abstractions.Client
{
public record BaseEndpoint(string Route);
public record SystemDetails(string Route) : BaseEndpoint(Route)
{
public required Func<Task<SimplifiedResponse<dynamic, dynamic>>> GetAsync { get; init; }
}
public record Subscriptions(string Route) : BaseEndpoint(Route)
{
public required Func<Task<SimplifiedResponse<dynamic, dynamic>>> GetEventsAsync { get; init; }
}
}

View File

@@ -0,0 +1,12 @@
using DigitalData.Core.Abstractions.Client;
using System.ComponentModel.Design;
namespace WindreamHub.Abstractions.Client
{
public interface IWindreamClientService : IBaseHttpClientService
{
public Subscriptions Subscriptions { get; }
public SystemDetails SystemDetails { get; }
}
}

View File

@@ -0,0 +1,6 @@
using System.Net;
namespace WindreamHub.Abstractions.Client
{
public record SimplifiedResponse<TData, TError>(bool Ok, HttpStatusCode Status, TData Data, TError Error);
}

View File

@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>WindreamHub.Abstractions</PackageId>
<Version>1.0.0</Version>
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>WindreamHub.Abstractions</Product>
<Description>This package contains interfaces for the WindreamHub solution. It provides abstractions for making HTTP requests and includes interfaces for proxy server interactions, promoting modularity and ease of integration within the Windream ecosystem.</Description>
<Copyright>Copyright 2024</Copyright>
<PackageProjectUrl></PackageProjectUrl>
<PackageIcon>Assets\icon.png</PackageIcon>
<RepositoryUrl>http://git.dd:3000/tekh/WindreamHub.git</RepositoryUrl>
<PackageTags>digital data core abstractions http proxy windream</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.1.1" />
</ItemGroup>
<ItemGroup>
<None Update="Assets\icon.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,24 @@
using DigitalData.Core.Client;
using Microsoft.Extensions.DependencyInjection;
using WindreamHub.Abstractions.Client;
namespace WindreamHub.Client
{
public static class DIExtensions
{
public static IServiceCollection AddWindreamClientService(this IServiceCollection services, string uri, bool useAbstract = true)
{
services.AddHttpClientService<WindreamClientOptions>(opt =>
{
opt.Uri = uri;
});
if (useAbstract)
services.AddSingleton<IWindreamClientService, WindreamClientService>();
else
services.AddSingleton<WindreamClientService>();
return services;
}
}
}

View File

@@ -0,0 +1,24 @@
using DigitalData.Core.Client;
using WindreamHub.Abstractions.Client;
namespace WindreamHub.Client
{
public static class ResponseExtensions
{
public static async Task<SimplifiedResponse<dynamic, dynamic>> SimplifyDynamic(this HttpResponseMessage message)
{
dynamic data = message.IsSuccessStatusCode ? await message.Json() : new { };
dynamic err = message.IsSuccessStatusCode ? await message.Json() : new { };
return new (Ok: message.IsSuccessStatusCode,Status: message.StatusCode, Data: data, Error: err);
}
public static async Task<SimplifiedResponse<IEnumerable<dynamic>, dynamic>> SimplifyDynamicList(this HttpResponseMessage message)
{
dynamic data = message.IsSuccessStatusCode ? await message.JsonList() : new { };
dynamic err = message.IsSuccessStatusCode ? await message.Json() : new { };
return new(Ok: message.IsSuccessStatusCode, Status: message.StatusCode, Data: data, Error: err);
}
}
}

View File

@@ -0,0 +1,8 @@
using DigitalData.Core.Client;
namespace WindreamHub.Client
{
public class WindreamClientOptions : HttpClientOptions
{
}
}

View File

@@ -0,0 +1,33 @@
using DigitalData.Core.Abstractions.Client;
using DigitalData.Core.Client;
using Microsoft.Extensions.Options;
using System.Net;
using WindreamHub.Abstractions.Client;
namespace WindreamHub.Client
{
public class WindreamClientService :
HttpClientService<WindreamClientOptions>,
IWindreamClientService,
IHttpClientService<WindreamClientOptions>
{
public WindreamClientService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) : base(client, cookieContainer, clientOptions)
{
Subscriptions = new(Route: "subscriptions")
{
GetEventsAsync = async () => await FetchAsync($"/{Subscriptions!.Route}/GetSubscriptionEvents")
.ThenAsync(res => res.SimplifyDynamic())
};
SystemDetails = new(Route: "systemDetails")
{
GetAsync = async () => await FetchAsync($"/{SystemDetails!.Route}/GetSystemDetails")
.ThenAsync(res => res.SimplifyDynamic())
};
}
public Subscriptions Subscriptions { get; }
public SystemDetails SystemDetails { get; }
}
}

View File

@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>WindreamHub.Client</PackageId>
<Version>1.0.0</Version>
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>Digital Data GmbH</Product>
<Description>This package provides the client library for the Windream. It includes functionality for making HTTP requests to the Windream Webservice API, facilitating integration and communication with Windream document management systems.</Description>
<Copyright>Copyright 2024</Copyright>
<PackageIcon>Assets\icon.png</PackageIcon>
<RepositoryUrl>http://git.dd:3000/tekh/WindreamHub.git</RepositoryUrl>
<PackageTags>digital data core http windream</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.1.1" />
<PackageReference Include="DigitalData.Core.Client" Version="1.0.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WindreamHub.Abstractions\WindreamHub.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Assets\icon.png">
<PackagePath>\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>True</Pack>
</None>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,26 @@
using DigitalData.Core.Legacy.Client;
using Microsoft.Extensions.DependencyInjection;
using WindreamHub.Legacy.Client.Route;
using WindreamHub.Legacy.Client.Routes;
namespace WindreamHub.Legacy.Client
{
public static class DIExtensions
{
public static IServiceCollection AddWindreamClientService(this IServiceCollection services, string uri)
{
services
.AddHttpClientService<WindreamClientOptions>(opt =>
{
opt.Uri = uri;
})
.AddSingleton<WindreamClientService>()
.AddSingleton<SubscriptionsRouteService>()
.AddSingleton<SystemDetailsRouteService>()
.AddSingleton<AuthenticationRouteService>()
.AddSingleton<DocumentsRouteService>();
return services;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace WindreamHub.Legacy.Client.Models.Authentication
{
public class Base64Credential : ICredential
{
public Base64Credential(string authorizationHeader) => AuthorizationHeader = authorizationHeader;
public string AuthorizationHeader { get; }
}
}

View File

@@ -0,0 +1,11 @@
using WindreamHub.Legacy.Client.Models.Shared;
namespace WindreamHub.Legacy.Client.Models.Authentication
{
public class ErrorDetails
{
public ErrorItem Item { get; set; }
public string Message { get; set; }
public int? ErrorCode { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace WindreamHub.Legacy.Client.Models.Authentication
{
public interface ICredential
{
string AuthorizationHeader { get; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Text;
using WindreamHub.Legacy.Client.Models.Authentication;
namespace WindreamHub.Legacy.Client.Models
{
public class UserCredential : ICredential
{
public readonly string Domain;
public readonly string Name;
public string AuthorizationHeader { get; }
public UserCredential(string domain, string name, string password)
{
Domain = domain;
Name = name;
AuthorizationHeader = ConvertToBase64(domain, name, password);
}
private static string ConvertToBase64(string domain, string username, string password)
{
var credentials = $"{domain}\\{username}:{password}";
var base64Credentials = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(credentials));
return base64Credentials;
}
}
}

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client.Models.Authentication
{
public class ValidationResponse
{
public int? UserID { get; set; }
public string UserName { get; set; }
public string FullUserName { get; set; }
public bool? IsValidUser { get; set; }
public ErrorDetails Error { get; set; }
public List<ErrorDetails> Errors { get; set; }
public bool? HasErrors { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace WindreamHub.Legacy.Client.Models.Documents
{
public enum Flag
{
CreateObject = 1,
CheckIn = 2,
CreateNewVersion = 4,
UseDefaultLocation = 8,
ReturnIndexingDetails = 16,
ForceOverwrite = 32,
CreateTree = 64
}
}

View File

@@ -0,0 +1,8 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Request
{
public class Attribute
{
public string Name { get; set; }
public object Value { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Request.Delete
{
public class DeleteItem
{
public int Id { get; set; }
public string Location { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Request.Delete
{
public class DocDeleteBody
{
public DeleteItem Item { get; set; }
public int Flags { get; set; }
public int ResponseDetails { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Request
{
public class DocBody
{
public Item Item { get; set; }
public bool? CreateFolder { get; set; }
public int? ResponseDetails { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client.Models.Documents.Request
{
public class Item
{
public ObjectType ObjectType { get; set; }
public List<Attribute> Attributes { get; set; }
public string Location { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Request
{
public class ObjectType
{
public int? Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class Attribute
{
public string Name { get; set; }
public string DisplayName { get; set; }
public object Value { get; set; }
public int? Type { get; set; }
public int? UnderlyingType { get; set; }
public string Column { get; set; }
public bool? IsSystem { get; set; }
public bool? IsSortable { get; set; }
public VectorDetails VectorDetails { get; set; }
public TypeSpecificDetails TypeSpecificDetails { get; set; }
public int? MaxSize { get; set; }
public bool? AlwaysModifiable { get; set; }
public int? PreDigits { get; set; }
public int? PostDigits { get; set; }
public bool? IsFulltext { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client.Models.Documents.Response.Delete
{
public class DocDelErrorResponse
{
public ErrorDetail Error { get; set; }
public List<Error> Errors { get; set; }
public bool HasErrors { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response.Delete
{
public class ErrorDetail
{
public string Message { get; set; }
public int? ErrorCode { get; set; }
public int? Type { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class DocResponse
{
public Item Item { get; set; }
public IndexingDetails IndexingDetails { get; set; }
public Error Error { get; set; }
public List<Error> Errors { get; set; }
public bool? HasErrors { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using WindreamHub.Legacy.Client.Models.Shared;
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class Error
{
public ErrorItem Item { get; set; }
public string Message { get; set; }
public int? ErrorCode { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class IndexingDetails
{
public bool? IndexEventRequired { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class Item
{
public List<Attribute> Attributes { get; set; }
public ObjectType ObjectType { get; set; }
public ParentWindreamObject ParentWindreamObject { get; set; }
public int? Entity { get; set; }
public string LocationComplete { get; set; }
public int? Id { get; set; }
public string Location { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class ObjectType
{
public int? Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class ParentWindreamObject
{
public string LocationComplete { get; set; }
public int? Id { get; set; }
public string Location { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class TypeSpecificDetails
{
public bool? OnceEditable { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace WindreamHub.Legacy.Client.Models.Documents.Response
{
public class VectorDetails
{
public int? EntriesLimit { get; set; }
}
}

View File

@@ -0,0 +1,110 @@
using DigitalData.Core.Legacy.Client;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Text;
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client.Models
{
public static class ModelExtensions
{
public static async Task<SimplifiedResponse<TData, TError>> Simplify<TData, TError>(this HttpResponseMessage message)
{
TData data = message.IsSuccessStatusCode ? await message.Json<TData>() : default;
TError err = !message.IsSuccessStatusCode ? await message.Json<TError>() : default;
return new SimplifiedResponse<TData, TError>(ok: message.IsSuccessStatusCode, status: message.StatusCode, data: data, error: err);
}
public static async Task FetchAsync<TData, TError>(this Task<SimplifiedResponse<TData, TError>> responseAsync, Action<TData> next, Action<TError> error = null, CancellationToken cancellationToken = default)
{
if (cancellationToken.IsCancellationRequested)
return;
var res = await responseAsync;
if (res.Ok)
next(res.Data);
else
error?.Invoke(res.Error);
}
public static void Fetch<TData, TError>(this Task<SimplifiedResponse<TData, TError>> responseAsync, Action<TData> next, Action<TError> error = null, CancellationToken cancellationToken = default)
{
Task.Run(async () =>
{
if (cancellationToken.IsCancellationRequested)
return;
var res = await responseAsync;
if (res.Ok)
next(res.Data);
else
error?.Invoke(res.Error);
});
}
public static void Fetch<TData, TError>(this Task<SimplifiedResponse<TData, TError>> responseAsync, int millisecondsDelay, Action<TData> next, Action<TError> error = null, CancellationToken cancellationToken = default)
{
Task.Run(async () =>
{
while (!cancellationToken.IsCancellationRequested)
{
var res = await responseAsync;
if (res.Ok)
next(res.Data);
else
error?.Invoke(res.Error);
await Task.Delay(millisecondsDelay, cancellationToken);
}
});
}
public static Func<Task> CreateFetchAsync<TData, TError>(this Task<SimplifiedResponse<TData, TError>> responseAsync, Action<TData> next, Action<TError> error = null, CancellationToken cancellationToken = default)
{
return async () =>
{
if (cancellationToken.IsCancellationRequested)
return;
var res = await responseAsync;
if (res.Ok)
next(res.Data);
else
error?.Invoke(res.Error);
};
}
public static Action CreateFetch<TData, TError>(this Task<SimplifiedResponse<TData, TError>> responseAsync, Action<TData> next, Action<TError> error = null, CancellationToken cancellationToken = default)
{
return () => Task.Run(async () =>
{
if (cancellationToken.IsCancellationRequested)
return;
var res = await responseAsync;
if (res.Ok)
next(res.Data);
else
error?.Invoke(res.Error);
});
}
public static string Serialize(this object model) => JsonConvert.SerializeObject(model);
public static T Deserialize<T>(this string json) => JsonConvert.DeserializeObject<T>(json);
public static dynamic Deserialize(this string json) => JsonConvert.DeserializeObject<dynamic>(json);
public static IEnumerable<dynamic> DeserializeList(this string json) => JsonConvert.DeserializeObject<IEnumerable<dynamic>>(json);
public static HttpContent ToContent(this string json, Encoding encoding = null, string mediaType = "application/json")
=> new StringContent(json, encoding ?? Encoding.UTF8, mediaType);
public static HttpContent Stringify(this object model, Encoding encoding = null, string mediaType = "application/json")
=> model.Serialize().ToContent(encoding ?? Encoding.UTF8, mediaType);
}
}

View File

@@ -0,0 +1,10 @@
namespace WindreamHub.Legacy.Client.Models.Shared
{
public class ErrorItem
{
public int? Entity { get; set; }
public int? Id { get; set; }
public string Location { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using System.Net;
namespace WindreamHub.Legacy.Client.Models
{
public class SimplifiedResponse<TData, TError>
{
public SimplifiedResponse(bool ok, HttpStatusCode status, TData data, TError error)
{
Ok = ok;
Status = status;
Data = data;
Error = error;
}
public bool Ok { get; }
public HttpStatusCode Status { get; }
public TData Data { get; }
public TError Error { get; }
}
}

View File

@@ -0,0 +1,13 @@
namespace WindreamHub.Legacy.Client.Models.SystemDetails
{
public class SystemDetails
{
public string SystemDateTime { get; set; }
public string WebserviceVersion { get; set; }
public string DefaultDomain { get; set; }
public int? AuthenticationModes { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace WindreamHub.Legacy.Client.Models.SystemDetails
{
public class SystemDetailsResponse
{
public SystemDetails SystemDetails { get; set; }
public object Error { get; set; }
public object Errors { get; set; }
public bool? HasErrors { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WindreamHub.Legacy.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Digital Data GmbH")]
[assembly: AssemblyProduct("WindreamHub.Legacy.Client")]
[assembly: AssemblyCopyright("Copyright © Digital Data GmbH 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("67e6a3a1-f863-417e-9619-dc9b6a710512")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,22 @@
using DigitalData.Core.Legacy.Client;
using Microsoft.Extensions.Options;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using WindreamHub.Legacy.Client.Models;
using WindreamHub.Legacy.Client.Models.Authentication;
namespace WindreamHub.Legacy.Client.Routes
{
public class AuthenticationRouteService : BaseRouteService
{
public AuthenticationRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) : base(client, cookieContainer, clientOptions)
{
}
public async Task<SimplifiedResponse<ValidationResponse, object>> IsValidUserAsync()
{
return await FetchAsync(route: "/IsValidUser", HttpMethod.Get).ThenAsync(res => res.Simplify<ValidationResponse, object>());
}
}
}

View File

@@ -0,0 +1,23 @@
using DigitalData.Core.Legacy.Client;
using Microsoft.Extensions.Options;
using System.Net;
using System.Net.Http;
namespace WindreamHub.Legacy.Client.Routes
{
public class BaseRouteService : HttpClientService<WindreamClientOptions>
{
public BaseRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
base(client, cookieContainer, clientOptions)
{
var route_name = this.GetRouteName();
clientOptions.Value.Routes.TryGetValue(route_name, out string route);
if (route is null)
Uri += $"/{route_name.ToLower()}";
Uri += route;
}
}
}

View File

@@ -0,0 +1,122 @@
using Microsoft.Extensions.Options;
using System.Net;
using System.Net.Http;
using DigitalData.Core.Legacy.Client;
using System.Threading.Tasks;
using WindreamHub.Legacy.Client.Models;
using WindreamHub.Legacy.Client.Models.Documents.Response;
using WindreamHub.Legacy.Client.Models.Documents.Request;
using System.IO;
using System.Web;
using WindreamHub.Legacy.Client.Models.Documents;
using System.Linq;
using WindreamHub.Legacy.Client.Models.Documents.Response.Delete;
using WindreamHub.Legacy.Client.Models.Documents.Request.Delete;
namespace WindreamHub.Legacy.Client.Routes
{
public class DocumentsRouteService : BaseRouteService
{
public DocumentsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) : base(client, cookieContainer, clientOptions)
{
}
//Create
public async Task<SimplifiedResponse<TData, TError>> CreateAsync<TData, TError>(DocBody docCreateBody)
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody.Stringify())
.ThenAsync(res => res.Simplify<TData, TError>());
public Task<SimplifiedResponse<dynamic, dynamic>> CreateDynamicAsync(DocBody docCreateBody) => CreateAsync<dynamic, dynamic>(docCreateBody);
public Task<SimplifiedResponse<DocResponse, DocResponse>> CreateAsync(DocBody docCreateBody) => CreateAsync<DocResponse, DocResponse>(docCreateBody);
//Upload
public async Task<SimplifiedResponse<TData, TError>> UploadAsync<TData, TError>(string path, long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
{
using (var fileStream = File.OpenRead(path))
{
var fileContent = new StreamContent(fileStream);
var formData = new MultipartFormDataContent
{
{ fileContent, "file" },
};
var query = HttpUtility.ParseQueryString(string.Empty);
if (item_id != null)
query["parameter.item.id"] = item_id.ToString();
if (item_location != null)
query["parameter.item.location"] = item_location;
if (item_name != null)
query["parameter.item.name"] = item_name;
if (flags != null && flags.Length > 0)
query["parameter.flags"] = string.Join(",", flags.Select(flag => (int)flag));
if (stream_identity != null)
query["parameter.stream.__identity"] = stream_identity.ToString();
return await FetchAsync(route: $"/Upload?{query}", method: HttpMethod.Post, body: fileContent).ThenAsync(res => res.Simplify<TData, TError>());
}
}
public Task<SimplifiedResponse<dynamic, dynamic>> UploadDynamicAsync(string path, long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
=> UploadAsync<dynamic, dynamic>(path: path, item_id: item_id, item_location: item_location, item_name: item_name, stream_identity: stream_identity, flags: flags);
public Task<SimplifiedResponse<DocResponse, DocResponse>> UploadAsync(string path, long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
=> UploadAsync<DocResponse, DocResponse>(path: path, item_id: item_id, item_location: item_location, item_name: item_name, stream_identity: stream_identity, flags: flags);
//Update
public async Task<SimplifiedResponse<TData, TError>> UpdateAsync<TData, TError>(DocBody docUpdateBody)
=> await FetchAsync(route: "/Update", method: HttpMethod.Post, body: docUpdateBody.Stringify())
.ThenAsync(res => res.Simplify<TData, TError>());
public Task<SimplifiedResponse<dynamic, dynamic>> UpdateDynamicAsync(DocBody docUpdateBody)
=> UpdateAsync<dynamic, dynamic>(docUpdateBody);
public Task<SimplifiedResponse<DocResponse, DocResponse>> UpdateAsync(DocBody docUpdateBody)
=> UpdateAsync<DocResponse, DocResponse>(docUpdateBody);
//Download
public async Task<SimplifiedResponse<TData, TError>> DownloadAsync<TData, TError>(long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
{
var query = HttpUtility.ParseQueryString(string.Empty);
if (item_id != null)
query["parameter.item.id"] = item_id.ToString();
if (item_location != null)
query["parameter.item.location"] = item_location;
if (item_name != null)
query["parameter.item.name"] = item_name;
if (flags != null && flags.Length > 0)
query["parameter.flags"] = string.Join(",", flags.Select(flag => (int)flag));
if (stream_identity != null)
query["parameter.stream.__identity"] = stream_identity.ToString();
return await FetchAsync(route: $"/Download?{query}", method: HttpMethod.Get).ThenAsync(res => res.Simplify<TData, TError>());
}
public Task<SimplifiedResponse<dynamic, dynamic>> DownloadDynamicAsync(long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
=> DownloadAsync<dynamic, dynamic>(item_id: item_id, item_location: item_location, item_name: item_name, stream_identity: stream_identity, flags: flags);
public Task<SimplifiedResponse<DocResponse, DocResponse>> DownloadAsync(long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
=> DownloadAsync<DocResponse, DocResponse>(item_id: item_id, item_location: item_location, item_name: item_name, stream_identity: stream_identity, flags: flags);
//Delete
public async Task<SimplifiedResponse<TData, TError>> DeleteAsync<TData, TError>(DocDeleteBody docDeleteBody)
=> await FetchAsync(route: "/Delete", HttpMethod.Post, body: docDeleteBody.Stringify())
.ThenAsync(res => res.Simplify<TData, TError>());
public async Task<SimplifiedResponse<dynamic, dynamic>> DeleteDynamicAsync(DocDeleteBody docDeleteBody)
=> await DeleteAsync<dynamic, dynamic>(docDeleteBody: docDeleteBody);
public async Task<SimplifiedResponse<DocResponse, DocDelErrorResponse>> DeleteAsync(DocDeleteBody docDeleteBody)
=> await DeleteAsync<DocResponse, DocDelErrorResponse>(docDeleteBody: docDeleteBody);
}
}

View File

@@ -0,0 +1,30 @@
using System;
namespace WindreamHub.Legacy.Client.Routes
{
public static class RouteExtensions
{
public static string GetRouteName(this object service)
{
// Get the full class name including namespace
string fullClassName = service.GetType().FullName;
// Extract the class name part by getting the substring after the last dot (.)
string className = fullClassName.Substring(fullClassName.LastIndexOf('.') + 1);
// Remove the "RouteService" part and return the remainder
string suffix = "RouteService";
if (className.EndsWith(suffix))
{
// Remove the "RouteService" part
string prefix = className.Substring(0, className.Length - suffix.Length);
return prefix;
}
else
{
throw new ArgumentException("Class name does not follow the expected format.");
}
}
}
}

View File

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

View File

@@ -0,0 +1,23 @@
using DigitalData.Core.Legacy.Client;
using Microsoft.Extensions.Options;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using WindreamHub.Legacy.Client.Models;
using WindreamHub.Legacy.Client.Models.SystemDetails;
using WindreamHub.Legacy.Client.Routes;
namespace WindreamHub.Legacy.Client.Route
{
public class SystemDetailsRouteService : BaseRouteService
{
public SystemDetailsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
base(client, cookieContainer, clientOptions)
{
}
public async Task<SimplifiedResponse<SystemDetailsResponse, object>> GetSystemDetailsAsync()
=> await FetchAsync(route: "/GetSystemDetails")
.ThenAsync(res => res.Simplify<SystemDetailsResponse, object>());
}
}

View File

@@ -0,0 +1,15 @@
using DigitalData.Core.Legacy.Client;
using System.Collections.Generic;
namespace WindreamHub.Legacy.Client
{
public class WindreamClientOptions : HttpClientOptions
{
public Dictionary<string, string> Routes = new Dictionary<string, string>()
{
{ "Subscriptions", "/subscriptions" },
{ "SystemDetails", "/systemDetails" },
{ "Authentication", "/authentication" }
};
}
}

View File

@@ -0,0 +1,52 @@
using DigitalData.Core.Legacy.Client;
using Microsoft.Extensions.Options;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using WindreamHub.Legacy.Client.Models.Authentication;
using WindreamHub.Legacy.Client.Models;
using WindreamHub.Legacy.Client.Route;
using WindreamHub.Legacy.Client.Routes;
namespace WindreamHub.Legacy.Client
{
public class WindreamClientService : HttpClientService<WindreamClientOptions>
{
public WindreamClientService(SubscriptionsRouteService subscriptions, SystemDetailsRouteService systemDetails, AuthenticationRouteService authentication, DocumentsRouteService documents, HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
base(client, cookieContainer, clientOptions)
{
Subscriptions = subscriptions;
SystemDetails = systemDetails;
Authentication = authentication;
Documents = documents;
}
public SubscriptionsRouteService Subscriptions { get; }
public SystemDetailsRouteService SystemDetails { get; }
public AuthenticationRouteService Authentication { get; }
public DocumentsRouteService Documents { get; }
public async Task<bool> AuthenticateAsync(ICredential credential)
{
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credential.AuthorizationHeader);
var res = await Authentication.IsValidUserAsync();
return res.Ok && (res.Data.IsValidUser ?? false);
}
public async Task<bool> AuthenticateAsync(string domain, string name, string password)
{
var uCredential = new UserCredential(domain, name, password);
return await AuthenticateAsync(uCredential);
}
public async Task<bool> AuthenticateAsync(string authorizationHeader)
{
var uCredential = new Base64Credential(authorizationHeader);
return await AuthenticateAsync(uCredential);
}
}
}

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{67E6A3A1-F863-417E-9619-DC9B6A710512}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindreamHub.Legacy.Client</RootNamespace>
<AssemblyName>WindreamHub.Legacy.Client</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DigitalData.Core.Client.Legacy, Version=1.0.1.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\DigitalData.Core.Client.Legacy.1.0.1.2\lib\net462\DigitalData.Core.Client.Legacy.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Options.8.0.2\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DIExtensions.cs" />
<Compile Include="Models\Authentication\ErrorDetails.cs" />
<Compile Include="Models\Documents\Flag.cs" />
<Compile Include="Models\Documents\Request\Delete\DeleteItem.cs" />
<Compile Include="Models\Documents\Request\Delete\DocDeleteBody.cs" />
<Compile Include="Models\Documents\Response\Delete\DocDelErrorResponse.cs" />
<Compile Include="Models\Documents\Response\Delete\ErrorDetail.cs" />
<Compile Include="Models\Documents\Response\Error.cs" />
<Compile Include="Models\Shared\ErrorItem.cs" />
<Compile Include="Models\Authentication\ICredential.cs" />
<Compile Include="Models\Authentication\ValidationResponse.cs" />
<Compile Include="Models\Authentication\Base64Credential.cs" />
<Compile Include="Models\Documents\Request\Attribute.cs" />
<Compile Include="Models\Documents\Request\Item.cs" />
<Compile Include="Models\Documents\Request\ObjectType.cs" />
<Compile Include="Models\Documents\Request\DocBody.cs" />
<Compile Include="Models\Documents\Response\Attribute.cs" />
<Compile Include="Models\Documents\Response\DocResponse.cs" />
<Compile Include="Models\Documents\Response\IndexingDetails.cs" />
<Compile Include="Models\Documents\Response\Item.cs" />
<Compile Include="Models\Documents\Response\ObjectType.cs" />
<Compile Include="Models\Documents\Response\ParentWindreamObject.cs" />
<Compile Include="Models\Documents\Response\TypeSpecificDetails.cs" />
<Compile Include="Models\Documents\Response\VectorDetails.cs" />
<Compile Include="Models\ModelExtensions.cs" />
<Compile Include="Models\SimplifiedResponse.cs" />
<Compile Include="Models\SystemDetails\SystemDetails.cs" />
<Compile Include="Models\SystemDetails\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" />
<Compile Include="Routes\SystemDetailsRouteService.cs" />
<Compile Include="Routes\SubscriptionsRouteService.cs" />
<Compile Include="WindreamClientOptions.cs" />
<Compile Include="WindreamClientService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DigitalData.Core.Client.Legacy" version="1.0.1.2" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Options" version="8.0.2" targetFramework="net462" />
<package id="Microsoft.Extensions.Primitives" version="8.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="NuGet.CommandLine" version="6.11.0" targetFramework="net462" developmentDependency="true" />
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
<package id="System.Memory" version="4.5.5" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
</packages>