Public/FileManager/Rename-R1FileManagerDirectory.ps1

# .ExternalHelp psRadiantOne-help.xml
function Rename-R1FileManagerDirectory {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    [OutputType([void])]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [AllowEmptyString()]
        [string]$parentPath,

        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [string]$oldName,

        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [string]$newName
    )

    Begin {

        Assert-R1Session -RequireToken

    }#begin

    Process {

        $URI = Resolve-R1ServiceUrl -Service Settings -Path 'file_manager/directories/rename'

        $Body = $PSBoundParameters | Get-Parameter | ConvertTo-R1JsonBody

        if ($PSCmdlet.ShouldProcess("$parentPath/$oldName", "Rename to $newName")) {

            $null = Invoke-R1RestMethod -Uri $URI -Method PATCH -Body $Body

        }

    }#process

    End { }#end

}