Esempio n. 1
0
        /// <summary>
        /// A client for the API documented at https://support.lightwaverf.com/hc/en-us/articles/360020665652
        /// </summary>
        /// <param name="options"></param>
        public LightwaveRfLinkPlusClient(LightwaveRfLinkPlusClientOptions options)
        {
            _httpClientHandler = new LightwaveRfLinkPlusClientHttpClientHandler(options ?? throw new ArgumentNullException(nameof(options)));
            _httpClient        = new HttpClient(_httpClientHandler)
            {
                BaseAddress = new Uri("https://publicapi.lightwaverf.com/v1")
            };

            var refitSettings = new RefitSettings
            {
                ContentSerializer = new JsonContentSerializer(
                    new JsonSerializerSettings
                {
                    NullValueHandling = NullValueHandling.Ignore
                })
            };

            Devices    = RestService.For <IDevices>(_httpClient, refitSettings);
            Hierarchy  = RestService.For <IHierarchy>(_httpClient, refitSettings);
            LinkPlus   = RestService.For <ILinkPlus>(_httpClient, refitSettings);
            Rooms      = RestService.For <IRooms>(_httpClient, refitSettings);
            Structures = RestService.For <IStructures>(_httpClient, refitSettings);
            Users      = RestService.For <IUsers>(_httpClient, refitSettings);
            Zones      = RestService.For <IZones>(_httpClient, refitSettings);
        }
Esempio n. 2
0
 public LightwaveRfLinkPlusClientHttpClientHandler(LightwaveRfLinkPlusClientOptions options)
 {
     _options = options;
     _logger  = options.LoggerFactory?.CreateLogger <LightwaveRfLinkPlusClient>();
 }