83 lines
2.8 KiB
C#
83 lines
2.8 KiB
C#
using Hcs.ClientNet.Api.Request;
|
|
using Hcs.ClientNet.Api.Request.Adapter;
|
|
using Hcs.ClientNet.Api.Request.Exception;
|
|
using Hcs.Service.Async.HouseManagement;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Hcs.Service.Async.HouseManagement
|
|
{
|
|
#pragma warning disable IDE1006
|
|
public partial class getStateResult : IGetStateResultMany { }
|
|
#pragma warning restore IDE1006
|
|
|
|
public partial class HouseManagementPortsTypeAsyncClient : IAsyncClient<RequestHeader>
|
|
{
|
|
public async Task<IGetStateResponse> GetStateAsync(RequestHeader header, IGetStateRequest request)
|
|
{
|
|
return await getStateAsync(header, (getStateRequest)request);
|
|
}
|
|
}
|
|
|
|
#pragma warning disable IDE1006
|
|
public partial class getStateResponse : IGetStateResponse
|
|
#pragma warning restore IDE1006
|
|
{
|
|
public IGetStateResult GetStateResult => getStateResult;
|
|
}
|
|
|
|
public partial class AckRequestAck : IAck { }
|
|
|
|
public partial class ErrorMessageType : IErrorMessage { }
|
|
|
|
#pragma warning disable IDE1006
|
|
public partial class getStateRequest : IGetStateRequest { }
|
|
#pragma warning restore IDE1006
|
|
}
|
|
|
|
namespace Hcs.ClientNet.Api.Request.HouseManagement
|
|
{
|
|
internal class HouseManagementRequestBase(ClientBase client) :
|
|
RequestBase<getStateResult,
|
|
HouseManagementPortsTypeAsyncClient,
|
|
HouseManagementPortsTypeAsync,
|
|
RequestHeader,
|
|
AckRequestAck,
|
|
ErrorMessageType,
|
|
getStateRequest>(client)
|
|
{
|
|
protected override EndPoint EndPoint => EndPoint.HomeManagementAsync;
|
|
|
|
protected override bool EnableMinimalResponseWaitDelay => true;
|
|
|
|
protected override bool CanBeRestarted => true;
|
|
|
|
protected override int RestartTimeoutMinutes => 20;
|
|
|
|
protected getStateResultImportResultCommonResult[] GetCommonResults(IEnumerable<getStateResultImportResult> importResults)
|
|
{
|
|
var result = new List<getStateResultImportResultCommonResult>();
|
|
foreach (var importResult in importResults)
|
|
{
|
|
importResult.Items.OfType<ErrorMessageType>().ToList().ForEach(error =>
|
|
{
|
|
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
|
});
|
|
|
|
var commonResults = importResult.Items.OfType<getStateResultImportResultCommonResult>();
|
|
foreach (var commonResult in commonResults)
|
|
{
|
|
commonResult.Items.OfType<CommonResultTypeError>().ToList().ForEach(error =>
|
|
{
|
|
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
|
});
|
|
}
|
|
|
|
result.AddRange(commonResults);
|
|
}
|
|
return [.. result];
|
|
}
|
|
}
|
|
}
|