Model/ApiResponse.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 Describes the result of uploading an image resource .PARAMETER Code No description available. .PARAMETER Type No description available. .PARAMETER Message No description available. .OUTPUTS ApiResponse<PSCustomObject> #> function Initialize-ApiResponse { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Code}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${Type}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${Message} ) Process { 'Creating PSCustomObject: PSOpenAPITools => ApiResponse' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "code" = ${Code} "type" = ${Type} "message" = ${Message} } return $PSO } } <# .SYNOPSIS Convert from JSON to ApiResponse<PSCustomObject> .DESCRIPTION Convert from JSON to ApiResponse<PSCustomObject> .PARAMETER Json Json object .OUTPUTS ApiResponse<PSCustomObject> #> function ConvertFrom-JsonToApiResponse { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: PSOpenAPITools => ApiResponse' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in ApiResponse $AllProperties = ("code", "type", "message") 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 "code"))) { #optional property not found $Code = $null } else { $Code = $JsonParameters.PSobject.Properties["code"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "type"))) { #optional property not found $Type = $null } else { $Type = $JsonParameters.PSobject.Properties["type"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "message"))) { #optional property not found $Message = $null } else { $Message = $JsonParameters.PSobject.Properties["message"].value } $PSO = [PSCustomObject]@{ "code" = ${Code} "type" = ${Type} "message" = ${Message} } return $PSO } } |