Model/ChangeSharedMailboxModel.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
ChangeSharedMailboxModel<PSCustomObject>
#>


function New-ChangeSharedMailboxModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${MailboxId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OfficeTenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => ChangeSharedMailboxModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "MailboxId" = ${MailboxId}
            "OfficeTenantId" = ${OfficeTenantId}
            "Name" = ${Name}
            "Email" = ${Email}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
ChangeSharedMailboxModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSharedMailboxModel
        $AllProperties = $("MailboxId", "OfficeTenantId", "Name", "Email", "ActivityId")
        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 "MailboxId"))) { #optional property not found
            $MailboxId = $null
        } else {
            $MailboxId = $JsonParameters.PSobject.Properties["MailboxId"].value
        }

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "Name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["Name"].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 "ActivityId"))) { #optional property not found
            $ActivityId = $null
        } else {
            $ActivityId = $JsonParameters.PSobject.Properties["ActivityId"].value
        }

        $PSO = [PSCustomObject]@{
            "MailboxId" = ${MailboxId}
            "OfficeTenantId" = ${OfficeTenantId}
            "Name" = ${Name}
            "Email" = ${Email}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}