/// <summary> /// Create test client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> public ControllerTestClient(IHttpClient httpClient, ITwinConfig config) { _serviceUri = config?.OpcUaTwinServiceUrl ?? throw new ArgumentNullException(nameof(config)); _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); }
/// <summary> /// Create test client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> public ControllerTestClient(IHttpClient httpClient, ITwinConfig config, ISerializer serializer) { _serviceUri = config?.OpcUaTwinServiceUrl?.TrimEnd('/') ?? throw new ArgumentNullException(nameof(config)); _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); }
public TwinService(string serviceUrl, string resource) { _logger = LogEx.Trace(); _httpClient = new HttpClient(new HttpClientFactory(new HttpHandlerFactory(new List <IHttpHandler> { new HttpBearerAuthentication(new BehalfOfTokenProvider(), _logger) }, _logger), _logger), _logger); _config = new TwinServiceConfig(serviceUrl, resource); _twinServiceHandler = new TwinServiceClient(_httpClient, _config, _logger); }
/// <summary> /// Create service client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> public TwinServiceClient(IHttpClient httpClient, ITwinConfig config) : this(httpClient, config.OpcUaTwinServiceUrl, config.OpcUaTwinServiceResourceId) { }
/// <summary> /// Create service client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> /// <param name="logger"></param> public TwinServiceClient(IHttpClient httpClient, ITwinConfig config, ILogger logger) : this(httpClient, config.OpcUaTwinServiceUrl, config.OpcUaTwinServiceResourceId, logger) { }
/// <summary> /// Create service client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> /// <param name="serializer"></param> public TwinServiceClient(IHttpClient httpClient, ITwinConfig config, ISerializer serializer) : this(httpClient, config?.OpcUaTwinServiceUrl, serializer) { }