Model/PasswordType.ps1

#
# SMServer V6
# Syncplify Server! REST API
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

To set a password 'PassVerType' must be plain and a payload must be provided

.PARAMETER Version
No description available.
.PARAMETER Salt
No description available.
.PARAMETER Payload
No description available.
.PARAMETER MustChange
No description available.
.OUTPUTS

PasswordType<PSCustomObject>
#>


function Initialize-SS6PasswordType {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Version},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Salt},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Payload},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${MustChange}
    )

    Process {
        'Creating PSCustomObject: SS6AdminModule => SS6PasswordType' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "version" = ${Version}
            "salt" = ${Salt}
            "payload" = ${Payload}
            "mustChange" = ${MustChange}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to PasswordType<PSCustomObject>

.DESCRIPTION

Convert from JSON to PasswordType<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PasswordType<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: SS6AdminModule => SS6PasswordType' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

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

        $PSO = [PSCustomObject]@{
            "version" = ${Version}
            "salt" = ${Salt}
            "payload" = ${Payload}
            "mustChange" = ${MustChange}
        }

        return $PSO
    }

}