using System.Net.Http; using System.Net.Http.Json; namespace RGB.NET.Devices.WLED; /// /// Partial implementation of the WLED-JSON-API /// public static class WledAPI { /// /// Gets the data returned by the 'info' endpoint of the WLED-device. /// /// The address of the device to request data from. /// The data returned by the WLED-device. public static WledInfo? Info(string address) { if (string.IsNullOrEmpty(address)) return null; using HttpClient client = new(); try { return client.Send(new HttpRequestMessage(HttpMethod.Get, $"http://{address}/json/info")) .Content .ReadFromJsonAsync() .Result; } catch { return null; } } }