Esempio n. 1
0
    /// <summary>
    /// Update bridge config
    /// </summary>
    /// <param name="update"></param>
    /// <returns></returns>
    public async Task<HueResults> UpdateBridgeConfigAsync(BridgeConfigUpdate update)
    {
      CheckInitialized();

      string command = JsonConvert.SerializeObject(update, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });

      HttpClient client = new HttpClient();
      var result = await client.PutAsync(new Uri(string.Format("{0}config", ApiBase)), new StringContent(command)).ConfigureAwait(false);

      string jsonResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

      return DeserializeDefaultHueResult(jsonResult);
    }
        /// <summary>
        /// Update bridge config
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        public async Task <HueResults> UpdateBridgeConfigAsync(BridgeConfigUpdate update)
        {
            CheckInitialized();

            string command = JsonConvert.SerializeObject(update, new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            HttpClient client = HueClient.GetHttpClient();
            var        result = await client.PutAsync(new Uri(string.Format("{0}config", ApiBase)), new StringContent(command)).ConfigureAwait(false);

            string jsonResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(DeserializeDefaultHueResult(jsonResult));
        }