Model/ApiCommonApiError.ps1

#
# Confide SDK API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 1.0
# Contact: support@avepoint.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
 
No summary available.
 
.DESCRIPTION
 
No description available.
 
.PARAMETER Field
No description available.
.PARAMETER Message
No description available.
.OUTPUTS
 
ApiCommonApiError<PSCustomObject>
#>


function Initialize-ConfideApiCommonApiError {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Field},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Message}
    )

    Process {
        'Creating PSCustomObject: Confide.Client => ConfideApiCommonApiError' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "field" = ${Field}
            "message" = ${Message}
        }

        return $PSO
    }
}

<#
.SYNOPSIS
 
Convert from JSON to ApiCommonApiError<PSCustomObject>
 
.DESCRIPTION
 
Convert from JSON to ApiCommonApiError<PSCustomObject>
 
.PARAMETER Json
 
Json object
 
.OUTPUTS
 
ApiCommonApiError<PSCustomObject>
#>

function ConvertFrom-ConfideJsonToApiCommonApiError {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: Confide.Client => ConfideApiCommonApiError' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ConfideApiCommonApiError
        $AllProperties = ("field", "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 "field"))) { #optional property not found
            $Field = $null
        } else {
            $Field = $JsonParameters.PSobject.Properties["field"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "message"))) { #optional property not found
            $Message = $null
        } else {
            $Message = $JsonParameters.PSobject.Properties["message"].value
        }

        $PSO = [PSCustomObject]@{
            "field" = ${Field}
            "message" = ${Message}
        }

        return $PSO
    }

}