Hello
I am building an API wrapper, with 3 simple functions “Get-MyObject”, “New-MyObject” and “Set-MyObject”.
Set-MyObject issues a PUT request to update the object, with approx. 20 fields available to be updated, each represented by an optional parameter. Is there a built-in way to inspect the parameters that the user has supplied, rather than checking each parameter in turn, i.e. I don’t want 20 instances of
if($property1){do something}
In the psuedo-code below, I’m looking for “$supplied_params”:
foreach($param in $supplied_params) { if($param){ $myobject.property1=$param } }
Many thanks in advance.