Model/ApiError.ps1
# # SMServer V6 # Syncplify Server! REST API # Version: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION No description available. .PARAMETER ErrorType No description available. .PARAMETER VarData No description available. .PARAMETER Reason No description available. .PARAMETER CausedBy No description available. .PARAMETER HumanReadable No description available. .OUTPUTS ApiError<PSCustomObject> #> function Initialize-SS6ApiError { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${ErrorType}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${VarData}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${Reason}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${CausedBy}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [String] ${HumanReadable} ) Process { 'Creating PSCustomObject: SS6AdminModule => SS6ApiError' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "errorType" = ${ErrorType} "data" = ${VarData} "reason" = ${Reason} "causedBy" = ${CausedBy} "humanReadable" = ${HumanReadable} } return $PSO } } <# .SYNOPSIS Convert from JSON to ApiError<PSCustomObject> .DESCRIPTION Convert from JSON to ApiError<PSCustomObject> .PARAMETER Json Json object .OUTPUTS ApiError<PSCustomObject> #> function ConvertFrom-SS6JsonToApiError { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: SS6AdminModule => SS6ApiError' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SS6ApiError $AllProperties = ("errorType", "data", "reason", "causedBy", "humanReadable") 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 "errorType"))) { #optional property not found $ErrorType = $null } else { $ErrorType = $JsonParameters.PSobject.Properties["errorType"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "data"))) { #optional property not found $VarData = $null } else { $VarData = $JsonParameters.PSobject.Properties["data"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "reason"))) { #optional property not found $Reason = $null } else { $Reason = $JsonParameters.PSobject.Properties["reason"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "causedBy"))) { #optional property not found $CausedBy = $null } else { $CausedBy = $JsonParameters.PSobject.Properties["causedBy"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "humanReadable"))) { #optional property not found $HumanReadable = $null } else { $HumanReadable = $JsonParameters.PSobject.Properties["humanReadable"].value } $PSO = [PSCustomObject]@{ "errorType" = ${ErrorType} "data" = ${VarData} "reason" = ${Reason} "causedBy" = ${CausedBy} "humanReadable" = ${HumanReadable} } return $PSO } } |