enclave-networks/enclave.sdk.api

Update handling of patch requests to improve usage

Closed this issue · 2 comments

currently to perform a patch request the below structure is used however this is a little verbose and clunky

var builder = new PatchBuilder<EnrolledSystemPatch>().Set(e => e.Description, server.EnvironmentId);
await organisationClient.EnrolledSystems.UpdateAsync(systemId, builder);

the suggestion is to move the set arguments to the end of the updateasync call as described below

await organisationClient.EnrolledSystems.UpdateAsync(systemId).Set(e => e.Description, server.EnvironmentId).Send();

this should make the update experience much nicer while still retaining the structure of the patch models

A couple of thoughts:

  • The Async suffix should only be on the actual asynchronous operation, i.e. Send.
  • It would be nice if it was easy to define an update, then apply it to multiple systems (I can imagine it would be pretty convenient if you wanted to set the same tags on multiple systems (for example).

The Async suffix should only be on the actual asynchronous operation, i.e. Send.

agreed that would make the most sense

It would be nice if it was easy to define an update, then apply it to multiple systems (I can imagine it would be pretty convenient if you wanted to set the same tags on multiple systems (for example).

if that were the case it would probably be best to create an UpdateMany method as this is the easiest way of doing it imo
However they could do that update themselves in a for loop with an UpdateMany method or whatever it ends up looking we'd want to potentially create a new patchmodel with things that aren't needed to be unique for example Dns name etc