Reverse engineered client library for Blue Riiots pool API.
var bc = new BlueClientBuilder()
.UseUsernamePassword("user", "pass")
.Build();
var pools = await bc.GetSwimmingPools();
var bc = new BlueClientBuilder()
.UseHttpClientFactory(myFactory)
...
var bc = new BlueClientBuilder()
// Add a special HttpClient to control the proxy
.UseHttpClient(new HttpClient(new SocketsHttpHandler
{
// Set a proxy if available. Suggestion: Fiddler.
Proxy = new WebProxy(new Uri("http://127.0.0.1:8888"))
}))
...
services
// Note: the AddHttpClient() call is not necessary, but it is possibly to again configure the client here
.AddHttpClient("blueriiot")
.AddBlueRiiot((provider, builder) =>
{
IHttpClientFactory httpFactory = provider.GetRequiredService<IHttpClientFactory>();
// Set required options on the BlueClientBuilder
builder
.UseUsernamePassword(config.Username, config.Password)
// Only necessary if a special HttpClientFactory name is needed
.UseHttpClientFactory(httpFactory, "blueriiot");
})
// Usage
var bc = serviceProvider.GetService<BlueClient>();
var pools = await bc.GetSwimmingPools();
The library uses Microsofts logging extensions. It is possible to log all requests (and responses), by enabling Trace logging for MBW.Client.BlueRiiotApi.BlueClient
.
services.AddLogging(builder =>
{
builder.AddFilter("MBW.Client.BlueRiiotApi.BlueClient", LogLevel.Trace);
});