Model/ChangeSitePicture.ps1

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

<#
ChangeSitePicture<PSCustomObject>
#>


function New-ChangeSitePicture {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${BlobName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FileName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FileUri},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ChangePictureOptionType} = "AllowRequesterToChangePicture",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsDeleteInRequest} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "BlobName" = ${BlobName}
            "FileName" = ${FileName}
            "FileUri" = ${FileUri}
            "ChangePictureOptionType" = ${ChangePictureOptionType}
            "IsDeleteInRequest" = ${IsDeleteInRequest}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
ChangeSitePicture<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSitePicture
        $AllProperties = $("BlobName", "FileName", "FileUri", "ChangePictureOptionType", "IsDeleteInRequest", "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 "BlobName"))) { #optional property not found
            $BlobName = $null
        } else {
            $BlobName = $JsonParameters.PSobject.Properties["BlobName"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "BlobName" = ${BlobName}
            "FileName" = ${FileName}
            "FileUri" = ${FileUri}
            "ChangePictureOptionType" = ${ChangePictureOptionType}
            "IsDeleteInRequest" = ${IsDeleteInRequest}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}