using System.Text.Json.Nodes; namespace InnovEnergy.Lib.Victron.VictronVRM; /// Settings are *read* as part of the json (Installation class) returned by GetInstallation* /// Settings are *written* using a special request VrmAccount.SettingsRequest public readonly partial record struct Installation { public Task SetNotes (String notes) => SetSettings(new JsonObject { ["notes"] = notes }); public Task SetName (String name) => SetSettings(new JsonObject { ["description"] = name }); public Task SetPhoneNumber(String phoneNb) => SetSettings(new JsonObject { ["phonenumber"] = phoneNb }); private async Task SetSettings(JsonObject settings) { var reply = await VrmAccount.SettingsRequest(IdSite).TryPostJson(settings); var vrmReply = new Reply(reply); return vrmReply.Success; } }