Model/NodeSession.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 Id
No description available.
.PARAMETER NodeId
No description available.
.PARAMETER UserId
No description available.
.PARAMETER Protocol
No description available.
.PARAMETER StartTime
No description available.
.PARAMETER LastActivity
No description available.
.PARAMETER ClientVersion
No description available.
.PARAMETER RemoteAddr
No description available.
.PARAMETER LastCommand
No description available.
.PARAMETER LastCommandTime
No description available.
.PARAMETER LastError
No description available.
.PARAMETER LastErrorTime
No description available.
.OUTPUTS

NodeSession<PSCustomObject>
#>


function Initialize-SS6NodeSession {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NodeId},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${UserId},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Protocol},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${StartTime},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${LastActivity},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ClientVersion},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RemoteAddr},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LastCommand},
        [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${LastCommandTime},
        [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LastError},
        [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${LastErrorTime}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "nodeId" = ${NodeId}
            "userId" = ${UserId}
            "protocol" = ${Protocol}
            "startTime" = ${StartTime}
            "lastActivity" = ${LastActivity}
            "clientVersion" = ${ClientVersion}
            "remoteAddr" = ${RemoteAddr}
            "lastCommand" = ${LastCommand}
            "LastCommandTime" = ${LastCommandTime}
            "LastError" = ${LastError}
            "LastErrorTime" = ${LastErrorTime}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to NodeSession<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodeSession<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodeSession<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6NodeSession
        $AllProperties = ("id", "nodeId", "userId", "protocol", "startTime", "lastActivity", "clientVersion", "remoteAddr", "lastCommand", "LastCommandTime", "LastError", "LastErrorTime")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "nodeId" = ${NodeId}
            "userId" = ${UserId}
            "protocol" = ${Protocol}
            "startTime" = ${StartTime}
            "lastActivity" = ${LastActivity}
            "clientVersion" = ${ClientVersion}
            "remoteAddr" = ${RemoteAddr}
            "lastCommand" = ${LastCommand}
            "LastCommandTime" = ${LastCommandTime}
            "LastError" = ${LastError}
            "LastErrorTime" = ${LastErrorTime}
        }

        return $PSO
    }

}