Model/InlineObject.ps1
# # OpenAPI Petstore # This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # Version: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION No description available. .PARAMETER Name Updated name of the pet .PARAMETER Status Updated status of the pet .OUTPUTS InlineObject<PSCustomObject> #> function Initialize-InlineObject { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${Name}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${Status} ) Process { 'Creating PSCustomObject: PSOpenAPITools => InlineObject' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "name" = ${Name} "status" = ${Status} } return $PSO } } <# .SYNOPSIS Convert from JSON to InlineObject<PSCustomObject> .DESCRIPTION Convert from JSON to InlineObject<PSCustomObject> .PARAMETER Json Json object .OUTPUTS InlineObject<PSCustomObject> #> function ConvertFrom-JsonToInlineObject { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: PSOpenAPITools => InlineObject' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in InlineObject $AllProperties = ("name", "status") foreach ($name in $JsonParameters.PsObject.Properties.Name) { if (!($AllProperties.Contains($name))) { throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" } } if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found $Name = $null } else { $Name = $JsonParameters.PSobject.Properties["name"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "status"))) { #optional property not found $Status = $null } else { $Status = $JsonParameters.PSobject.Properties["status"].value } $PSO = [PSCustomObject]@{ "name" = ${Name} "status" = ${Status} } return $PSO } } |