Model/TeamFunSetting.ps1

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

<#
TeamFunSetting<PSCustomObject>
#>


function New-TeamFunSetting {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowGiphy} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${GiphyContentRating} = "Moderate",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowStickersAndMemes} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCustomMemes} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "AllowGiphy" = ${AllowGiphy}
            "GiphyContentRating" = ${GiphyContentRating}
            "AllowStickersAndMemes" = ${AllowStickersAndMemes}
            "AllowCustomMemes" = ${AllowCustomMemes}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
TeamFunSetting<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in TeamFunSetting
        $AllProperties = $("AllowGiphy", "GiphyContentRating", "AllowStickersAndMemes", "AllowCustomMemes", "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 "AllowGiphy"))) { #optional property not found
            $AllowGiphy = $null
        } else {
            $AllowGiphy = $JsonParameters.PSobject.Properties["AllowGiphy"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "AllowGiphy" = ${AllowGiphy}
            "GiphyContentRating" = ${GiphyContentRating}
            "AllowStickersAndMemes" = ${AllowStickersAndMemes}
            "AllowCustomMemes" = ${AllowCustomMemes}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}