Public/FileManager/Set-R1FileContent.ps1

# .ExternalHelp psRadiantOne-help.xml
function Set-R1FileContent {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    [OutputType([void])]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [Alias('file')]
        [string]$id,

        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [AllowEmptyString()]
        [string]$contents
    )

    Begin {

        Assert-R1Session -RequireToken

    }#begin

    Process {

        $URI = Resolve-R1ServiceUrl -Service Settings -Path 'file_manager/files/contents'

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

        if ($PSCmdlet.ShouldProcess($id, 'Update File Contents')) {

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

        }

    }#process

    End { }#end

}