Model/ChangeSharedChannelModel.ps1

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

<#
ChangeSharedChannelModel<PSCustomObject>
#>


function New-ChangeSharedChannelModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ChannelId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ChannelName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ChannelSiteUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TeamId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OfficeTenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TeamName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TeamEmail},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "ChannelId" = ${ChannelId}
            "ChannelName" = ${ChannelName}
            "ChannelSiteUrl" = ${ChannelSiteUrl}
            "TeamId" = ${TeamId}
            "OfficeTenantId" = ${OfficeTenantId}
            "TeamName" = ${TeamName}
            "TeamEmail" = ${TeamEmail}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
ChangeSharedChannelModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSharedChannelModel
        $AllProperties = $("ChannelId", "ChannelName", "ChannelSiteUrl", "TeamId", "OfficeTenantId", "TeamName", "TeamEmail", "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 "ChannelId"))) { #optional property not found
            $ChannelId = $null
        } else {
            $ChannelId = $JsonParameters.PSobject.Properties["ChannelId"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "ChannelId" = ${ChannelId}
            "ChannelName" = ${ChannelName}
            "ChannelSiteUrl" = ${ChannelSiteUrl}
            "TeamId" = ${TeamId}
            "OfficeTenantId" = ${OfficeTenantId}
            "TeamName" = ${TeamName}
            "TeamEmail" = ${TeamEmail}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}