Model/SuperAdmin.ps1

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

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

When adding a new super admin the required fields are 'id', 'password', 'email'

.PARAMETER Id
This is the super admin's USERNAME. Only letters and numbers, no spaces, no special characters
.PARAMETER Password
No description available.
.PARAMETER Email
No description available.
.PARAMETER Picture
No description available.
.PARAMETER AllowList
Optional list of allowed sources (IPv4/6 and Networks) that SuperAdmin can log in from
.PARAMETER TourTaken
No description available.
.PARAMETER AuthenticatorSecret
No description available.
.PARAMETER AuthenticatorType
No description available.
.PARAMETER ReceiveEmailNotifications
No description available.
.OUTPUTS

SuperAdmin<PSCustomObject>
#>


function Initialize-SS6SuperAdmin {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Password},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Picture},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${AllowList},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${TourTaken},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AuthenticatorSecret},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AuthenticatorType},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ReceiveEmailNotifications}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "password" = ${Password}
            "email" = ${Email}
            "picture" = ${Picture}
            "allowList" = ${AllowList}
            "tourTaken" = ${TourTaken}
            "authenticatorSecret" = ${AuthenticatorSecret}
            "authenticatorType" = ${AuthenticatorType}
            "receiveEmailNotifications" = ${ReceiveEmailNotifications}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SuperAdmin<PSCustomObject>

.DESCRIPTION

Convert from JSON to SuperAdmin<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SuperAdmin<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6SuperAdmin
        $AllProperties = ("id", "password", "email", "picture", "allowList", "tourTaken", "authenticatorSecret", "authenticatorType", "receiveEmailNotifications")
        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 "password"))) { #optional property not found
            $Password = $null
        } else {
            $Password = $JsonParameters.PSobject.Properties["password"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "password" = ${Password}
            "email" = ${Email}
            "picture" = ${Picture}
            "allowList" = ${AllowList}
            "tourTaken" = ${TourTaken}
            "authenticatorSecret" = ${AuthenticatorSecret}
            "authenticatorType" = ${AuthenticatorType}
            "receiveEmailNotifications" = ${ReceiveEmailNotifications}
        }

        return $PSO
    }

}