Model/ChangeTeamMemberPermission.ps1

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

<#
ChangeTeamMemberPermission<PSCustomObject>
#>


function New-ChangeTeamMemberPermission {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreateUpdateChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreatePrivateChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowDeleteChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowAddRemoveApps} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreateUpdateRemoveTabs} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreateUpdateRemoveConnectors} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowEditMessages} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowDeleteMessages} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowCreateUpdateChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowCreatePrivateChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowDeleteChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowAddRemoveApps} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowCreateUpdateRemoveTabs} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowCreateUpdateRemoveConnectors} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowEditMessages} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${OriginalAllowDeleteMessages} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "AllowCreateUpdateChannels" = ${AllowCreateUpdateChannels}
            "AllowCreatePrivateChannels" = ${AllowCreatePrivateChannels}
            "AllowDeleteChannels" = ${AllowDeleteChannels}
            "AllowAddRemoveApps" = ${AllowAddRemoveApps}
            "AllowCreateUpdateRemoveTabs" = ${AllowCreateUpdateRemoveTabs}
            "AllowCreateUpdateRemoveConnectors" = ${AllowCreateUpdateRemoveConnectors}
            "AllowEditMessages" = ${AllowEditMessages}
            "AllowDeleteMessages" = ${AllowDeleteMessages}
            "OriginalAllowCreateUpdateChannels" = ${OriginalAllowCreateUpdateChannels}
            "OriginalAllowCreatePrivateChannels" = ${OriginalAllowCreatePrivateChannels}
            "OriginalAllowDeleteChannels" = ${OriginalAllowDeleteChannels}
            "OriginalAllowAddRemoveApps" = ${OriginalAllowAddRemoveApps}
            "OriginalAllowCreateUpdateRemoveTabs" = ${OriginalAllowCreateUpdateRemoveTabs}
            "OriginalAllowCreateUpdateRemoveConnectors" = ${OriginalAllowCreateUpdateRemoveConnectors}
            "OriginalAllowEditMessages" = ${OriginalAllowEditMessages}
            "OriginalAllowDeleteMessages" = ${OriginalAllowDeleteMessages}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
ChangeTeamMemberPermission<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeTeamMemberPermission
        $AllProperties = $("AllowCreateUpdateChannels", "AllowCreatePrivateChannels", "AllowDeleteChannels", "AllowAddRemoveApps", "AllowCreateUpdateRemoveTabs", "AllowCreateUpdateRemoveConnectors", "AllowEditMessages", "AllowDeleteMessages", "OriginalAllowCreateUpdateChannels", "OriginalAllowCreatePrivateChannels", "OriginalAllowDeleteChannels", "OriginalAllowAddRemoveApps", "OriginalAllowCreateUpdateRemoveTabs", "OriginalAllowCreateUpdateRemoveConnectors", "OriginalAllowEditMessages", "OriginalAllowDeleteMessages", "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 "AllowCreateUpdateChannels"))) { #optional property not found
            $AllowCreateUpdateChannels = $null
        } else {
            $AllowCreateUpdateChannels = $JsonParameters.PSobject.Properties["AllowCreateUpdateChannels"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "AllowCreateUpdateChannels" = ${AllowCreateUpdateChannels}
            "AllowCreatePrivateChannels" = ${AllowCreatePrivateChannels}
            "AllowDeleteChannels" = ${AllowDeleteChannels}
            "AllowAddRemoveApps" = ${AllowAddRemoveApps}
            "AllowCreateUpdateRemoveTabs" = ${AllowCreateUpdateRemoveTabs}
            "AllowCreateUpdateRemoveConnectors" = ${AllowCreateUpdateRemoveConnectors}
            "AllowEditMessages" = ${AllowEditMessages}
            "AllowDeleteMessages" = ${AllowDeleteMessages}
            "OriginalAllowCreateUpdateChannels" = ${OriginalAllowCreateUpdateChannels}
            "OriginalAllowCreatePrivateChannels" = ${OriginalAllowCreatePrivateChannels}
            "OriginalAllowDeleteChannels" = ${OriginalAllowDeleteChannels}
            "OriginalAllowAddRemoveApps" = ${OriginalAllowAddRemoveApps}
            "OriginalAllowCreateUpdateRemoveTabs" = ${OriginalAllowCreateUpdateRemoveTabs}
            "OriginalAllowCreateUpdateRemoveConnectors" = ${OriginalAllowCreateUpdateRemoveConnectors}
            "OriginalAllowEditMessages" = ${OriginalAllowEditMessages}
            "OriginalAllowDeleteMessages" = ${OriginalAllowDeleteMessages}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}