Open lipkau opened 3 years ago
I feel like this entire library should be re-written in C# if it is going to support strong typing. I welcome a PR to support this in Powershell if it's not too complicated. I do like the dynamic nature and simplicity of converting JSON to PSObjects. In my other Poweshell project it has revealed resource inconstancies in the API between various HTTP methods.
I am planning a PR with a similar implementation I am making for JiraPS and (already have for) ConfluncePS: Class definition: https://github.com/AtlassianPS/ConfluencePS/blob/master/ConfluencePS/ConfluencePS.Types.cs Class import: https://github.com/AtlassianPS/ConfluencePS/blob/master/ConfluencePS/ConfluencePS.psm1#L3-L5
(my JiraPS implementation is better, as I am putting more effort into the constructors, so that implicit type conversion is supported for the parameter. Eg: -Space ABC
is implicitly converted to [...Space]
as it has a constructor for this case)
I would love to have custom classes to use proper objects in the commands. eg: having
$space
be of type[Philips.CfApi.Space]
(full namespace makes it unique, is best practice, and keeps it from clashing with types of other modules) so that a function can rely on that object to actually have the properties it expects. (currently Get-Service fails unexpectedly if the$space
provided does not include guid as a nested property of metadata. And guarding such an input is hard) Note: in order to be able to use namespaces as suggested above, you need custom c# code. Powershell classes do not support namespacesLet me know if you are interested in a PR for this.