Model/ApiModelObjectsModernApiPrivilegedUser.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 IsShareCoordinator
No description available.
.PARAMETER CanShareLink
No description available.
.PARAMETER CanConfigureScan
No description available.
.PARAMETER CanGenerateUploadLink
No description available.
.PARAMETER CanGenerateDownloadLinkInShareCenter
No description available.
.PARAMETER CanGenerateUploadLinkInShareCenter
No description available.
.PARAMETER SendInvitationEmail
No description available.
.PARAMETER Email
No description available.
.OUTPUTS
 
ApiModelObjectsModernApiPrivilegedUser<PSCustomObject>
#>


function Initialize-ConfideApiModelObjectsModernApiPrivilegedUser {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsShareCoordinator},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CanShareLink},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CanConfigureScan},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CanGenerateUploadLink},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CanGenerateDownloadLinkInShareCenter},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${CanGenerateUploadLinkInShareCenter},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${SendInvitationEmail},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email}
    )

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

        if (!$Email) {
            throw "invalid value for 'Email', 'Email' cannot be null."
        }

        if ($Email.length -lt 1) {
            throw "invalid value for 'Email', the character length must be great than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "isShareCoordinator" = ${IsShareCoordinator}
            "canShareLink" = ${CanShareLink}
            "canConfigureScan" = ${CanConfigureScan}
            "canGenerateUploadLink" = ${CanGenerateUploadLink}
            "canGenerateDownloadLinkInShareCenter" = ${CanGenerateDownloadLinkInShareCenter}
            "canGenerateUploadLinkInShareCenter" = ${CanGenerateUploadLinkInShareCenter}
            "sendInvitationEmail" = ${SendInvitationEmail}
            "email" = ${Email}
        }

        return $PSO
    }
}

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

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ConfideApiModelObjectsModernApiPrivilegedUser
        $AllProperties = ("isShareCoordinator", "canShareLink", "canConfigureScan", "canGenerateUploadLink", "canGenerateDownloadLinkInShareCenter", "canGenerateUploadLinkInShareCenter", "sendInvitationEmail", "email")
        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 'email' missing."
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "isShareCoordinator" = ${IsShareCoordinator}
            "canShareLink" = ${CanShareLink}
            "canConfigureScan" = ${CanConfigureScan}
            "canGenerateUploadLink" = ${CanGenerateUploadLink}
            "canGenerateDownloadLinkInShareCenter" = ${CanGenerateDownloadLinkInShareCenter}
            "canGenerateUploadLinkInShareCenter" = ${CanGenerateUploadLinkInShareCenter}
            "sendInvitationEmail" = ${SendInvitationEmail}
            "email" = ${Email}
        }

        return $PSO
    }

}