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.
This commit is contained in:
parent
152b4f7cff
commit
39e78821cf
@ -6,6 +6,6 @@ namespace WindreamHub.Legacy.Client.Models.Authentication
|
|||||||
{
|
{
|
||||||
public ErrorItem Item { get; set; }
|
public ErrorItem Item { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public int ErrorCode { get; set; }
|
public int? ErrorCode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@ namespace WindreamHub.Legacy.Client.Models.Authentication
|
|||||||
{
|
{
|
||||||
public class ValidationResponse
|
public class ValidationResponse
|
||||||
{
|
{
|
||||||
public int UserID { get; set; }
|
public int? UserID { get; set; }
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string FullUserName { get; set; }
|
public string FullUserName { get; set; }
|
||||||
public bool IsValidUser { get; set; }
|
public bool IsValidUser { get; set; }
|
||||||
|
|||||||
@ -4,6 +4,6 @@
|
|||||||
{
|
{
|
||||||
public Item Item { get; set; }
|
public Item Item { get; set; }
|
||||||
public bool CreateFolder { get; set; }
|
public bool CreateFolder { get; set; }
|
||||||
public int ResponseDetails { get; set; }
|
public int? ResponseDetails { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public class ObjectType
|
public class ObjectType
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,17 +5,17 @@
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
public object Value { get; set; }
|
public object Value { get; set; }
|
||||||
public int Type { get; set; }
|
public int? Type { get; set; }
|
||||||
public int UnderlyingType { get; set; }
|
public int? UnderlyingType { get; set; }
|
||||||
public string Column { get; set; }
|
public string Column { get; set; }
|
||||||
public bool IsSystem { get; set; }
|
public bool IsSystem { get; set; }
|
||||||
public bool IsSortable { get; set; }
|
public bool IsSortable { get; set; }
|
||||||
public VectorDetails VectorDetails { get; set; }
|
public VectorDetails VectorDetails { get; set; }
|
||||||
public TypeSpecificDetails TypeSpecificDetails { get; set; }
|
public TypeSpecificDetails TypeSpecificDetails { get; set; }
|
||||||
public int MaxSize { get; set; }
|
public int? MaxSize { get; set; }
|
||||||
public bool AlwaysModifiable { get; set; }
|
public bool AlwaysModifiable { get; set; }
|
||||||
public int PreDigits { get; set; }
|
public int? PreDigits { get; set; }
|
||||||
public int PostDigits { get; set; }
|
public int? PostDigits { get; set; }
|
||||||
public bool IsFulltext { get; set; }
|
public bool IsFulltext { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,6 @@ namespace WindreamHub.Legacy.Client.Models.Documents.Response
|
|||||||
{
|
{
|
||||||
public ErrorItem Item { get; set; }
|
public ErrorItem Item { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public int ErrorCode { get; set; }
|
public int? ErrorCode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,9 +7,9 @@ namespace WindreamHub.Legacy.Client.Models.Documents.Response
|
|||||||
public List<Attribute> Attributes { get; set; }
|
public List<Attribute> Attributes { get; set; }
|
||||||
public ObjectType ObjectType { get; set; }
|
public ObjectType ObjectType { get; set; }
|
||||||
public ParentWindreamObject ParentWindreamObject { get; set; }
|
public ParentWindreamObject ParentWindreamObject { get; set; }
|
||||||
public int Entity { get; set; }
|
public int? Entity { get; set; }
|
||||||
public string LocationComplete { get; set; }
|
public string LocationComplete { get; set; }
|
||||||
public int Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public class ObjectType
|
public class ObjectType
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,7 +3,7 @@
|
|||||||
public class ParentWindreamObject
|
public class ParentWindreamObject
|
||||||
{
|
{
|
||||||
public string LocationComplete { get; set; }
|
public string LocationComplete { get; set; }
|
||||||
public int Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
{
|
{
|
||||||
public class VectorDetails
|
public class VectorDetails
|
||||||
{
|
{
|
||||||
public int EntriesLimit { get; set; }
|
public int? EntriesLimit { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,6 +4,7 @@ using System.Net.Http;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace WindreamHub.Legacy.Client.Models
|
namespace WindreamHub.Legacy.Client.Models
|
||||||
{
|
{
|
||||||
@ -91,6 +92,12 @@ namespace WindreamHub.Legacy.Client.Models
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Stringify(this object model) => JsonConvert.SerializeObject(model);
|
public static string Serialize(this object model) => JsonConvert.SerializeObject(model);
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
public class ErrorItem
|
public class ErrorItem
|
||||||
{
|
{
|
||||||
public int Entity { get; set; }
|
public int? Entity { get; set; }
|
||||||
public int Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,6 @@
|
|||||||
|
|
||||||
public string DefaultDomain { get; set; }
|
public string DefaultDomain { get; set; }
|
||||||
|
|
||||||
public int AuthenticationModes { get; set; }
|
public int? AuthenticationModes { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,6 +1,11 @@
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
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;
|
||||||
|
|
||||||
namespace WindreamHub.Legacy.Client.Routes
|
namespace WindreamHub.Legacy.Client.Routes
|
||||||
{
|
{
|
||||||
@ -9,5 +14,13 @@ namespace WindreamHub.Legacy.Client.Routes
|
|||||||
public DocumentsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) : base(client, cookieContainer, clientOptions)
|
public DocumentsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) : base(client, cookieContainer, clientOptions)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<SimplifiedResponse<DocCreatResponse, object>> Create(HttpContent docCreateBody)
|
||||||
|
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody)
|
||||||
|
.ThenAsync(res => res.Simplify<DocCreatResponse, object>());
|
||||||
|
|
||||||
|
public async Task<SimplifiedResponse<DocCreatResponse, object>> Create(DocCreateBody docCreateBody)
|
||||||
|
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody.Stringify())
|
||||||
|
.ThenAsync(res => res.Simplify<DocCreatResponse, object>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,13 +13,13 @@ namespace WindreamHub.Legacy.Client
|
|||||||
{
|
{
|
||||||
public class WindreamClientService : HttpClientService<WindreamClientOptions>
|
public class WindreamClientService : HttpClientService<WindreamClientOptions>
|
||||||
{
|
{
|
||||||
public WindreamClientService(SubscriptionsRouteService subscriptions, SystemDetailsRouteService systemDetails, AuthenticationRouteService authentication,
|
public WindreamClientService(SubscriptionsRouteService subscriptions, SystemDetailsRouteService systemDetails, AuthenticationRouteService authentication, DocumentsRouteService documents, HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
|
||||||
HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
|
|
||||||
base(client, cookieContainer, clientOptions)
|
base(client, cookieContainer, clientOptions)
|
||||||
{
|
{
|
||||||
Subscriptions = subscriptions;
|
Subscriptions = subscriptions;
|
||||||
SystemDetails = systemDetails;
|
SystemDetails = systemDetails;
|
||||||
Authentication = authentication;
|
Authentication = authentication;
|
||||||
|
Documents = documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubscriptionsRouteService Subscriptions { get; }
|
public SubscriptionsRouteService Subscriptions { get; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user