Public/Get-DattoBcdrAgent.ps1

function Get-DattoBcdrAgent {
<#
.SYNOPSIS
Returns protected agents for a BCDR device.
.DESCRIPTION
Implements GET /v1/bcdr/device/{serialNumber}/asset/agent. The supplied API contract documents only the page parameter for this operation.
.PARAMETER SerialNumber
The BCDR device serial number.
.PARAMETER Page
The one-based API page number.
.PARAMETER All
Retrieves every available page.
.PARAMETER RawResponse
Returns the API response body or envelope.
.PARAMETER Connection
A connection object, name, or ID.
.EXAMPLE
Get-DattoBcdrAgent -SerialNumber 'ABC123ABC1' -All
#>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory, ValueFromPipelineByPropertyName)][ValidateNotNullOrEmpty()][string]$SerialNumber,
        [Parameter()][ValidateRange(1, [int]::MaxValue)][int]$Page = 1,
        [Parameter()][switch]$All,
        [Parameter()][switch]$RawResponse,
        [Parameter()][AllowNull()][object]$Connection
    )
    process {
        $serial = ConvertTo-DattoApiPathSegment -Value $SerialNumber
        Invoke-DattoApiRequest -Path "/v1/bcdr/device/$serial/asset/agent" -Query @{ _page = $Page } -All:$All -RawResponse:$RawResponse -Connection $Connection
    }
}