using Grpc.Net.Client; using MxGateway.Contracts.Proto; namespace MxGateway.Client; /// /// Provides the initial .NET client entry point and raw generated gRPC client. /// public sealed class MxGatewayClient : IAsyncDisposable { private readonly GrpcChannel _channel; private MxGatewayClient(GrpcChannel channel) { _channel = channel; RawClient = new MxAccessGateway.MxAccessGatewayClient(channel); } public MxAccessGateway.MxAccessGatewayClient RawClient { get; } public static MxGatewayClient Create(MxGatewayClientOptions options) { ArgumentNullException.ThrowIfNull(options); options.Validate(); var channel = GrpcChannel.ForAddress( options.Endpoint, new GrpcChannelOptions { LoggerFactory = options.LoggerFactory, }); return new MxGatewayClient(channel); } public ValueTask DisposeAsync() { _channel.Dispose(); return ValueTask.CompletedTask; } }