Model/SAListItem.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 IpOrNetwork
ip address or cidr network. Both IPv4 and IPv6 are supported
.PARAMETER Notes
No description available.
.OUTPUTS

SAListItem<PSCustomObject>
#>


function Initialize-SS6SAListItem {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IpOrNetwork},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Notes}
    )

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

        if ($IpOrNetwork -eq $null) {
            throw "invalid value for 'IpOrNetwork', 'IpOrNetwork' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "ipOrNetwork" = ${IpOrNetwork}
            "notes" = ${Notes}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SAListItem<PSCustomObject>

.DESCRIPTION

Convert from JSON to SAListItem<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SAListItem<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6SAListItem
        $AllProperties = ("ipOrNetwork", "notes")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'ipOrNetwork' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ipOrNetwork"))) {
            throw "Error! JSON cannot be serialized due to the required property 'ipOrNetwork' missing."
        } else {
            $IpOrNetwork = $JsonParameters.PSobject.Properties["ipOrNetwork"].value
        }

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

        $PSO = [PSCustomObject]@{
            "ipOrNetwork" = ${IpOrNetwork}
            "notes" = ${Notes}
        }

        return $PSO
    }

}