Model/CreateLibraryGallery.ps1

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

<#
CreateLibraryGallery<PSCustomObject>
#>


function New-CreateLibraryGallery {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${NameDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${VersionSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${NavigationSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LibraryUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ConstructedUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PermissionSettings},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LibraryDesign},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ContentTypes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PnpTemplate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${FolderDefaultValues},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryInternalName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${GalleryMetadata}
    )

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

        
        $PSO = [PSCustomObject]@{
            "NameDescription" = ${NameDescription}
            "VersionSetting" = ${VersionSetting}
            "NavigationSetting" = ${NavigationSetting}
            "LibraryUrl" = ${LibraryUrl}
            "ConstructedUrl" = ${ConstructedUrl}
            "PermissionSettings" = ${PermissionSettings}
            "LibraryDesign" = ${LibraryDesign}
            "ContentTypes" = ${ContentTypes}
            "PnpTemplate" = ${PnpTemplate}
            "FolderDefaultValues" = ${FolderDefaultValues}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }
}

<#
CreateLibraryGallery<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateLibraryGallery
        $AllProperties = $("NameDescription", "VersionSetting", "NavigationSetting", "LibraryUrl", "ConstructedUrl", "PermissionSettings", "LibraryDesign", "ContentTypes", "PnpTemplate", "FolderDefaultValues", "ListFullUrl", "GalleryType", "GalleryInternalName", "GalleryMetadata")
        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 "NameDescription"))) { #optional property not found
            $NameDescription = $null
        } else {
            $NameDescription = $JsonParameters.PSobject.Properties["NameDescription"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "NameDescription" = ${NameDescription}
            "VersionSetting" = ${VersionSetting}
            "NavigationSetting" = ${NavigationSetting}
            "LibraryUrl" = ${LibraryUrl}
            "ConstructedUrl" = ${ConstructedUrl}
            "PermissionSettings" = ${PermissionSettings}
            "LibraryDesign" = ${LibraryDesign}
            "ContentTypes" = ${ContentTypes}
            "PnpTemplate" = ${PnpTemplate}
            "FolderDefaultValues" = ${FolderDefaultValues}
            "ListFullUrl" = ${ListFullUrl}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }

}