Public/Get-DattoBcdrShare.ps1

function Get-DattoBcdrShare {
<#
.SYNOPSIS
Returns protected shares for a BCDR device.
.DESCRIPTION
Implements GET /v1/bcdr/device/{serialNumber}/asset/share and handles either the documented direct-array or paginated-envelope response shape.
.PARAMETER SerialNumber
The BCDR device serial number.
.PARAMETER Page
The one-based API page number.
.PARAMETER PerPage
The number of records requested per page.
.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-DattoBcdrShare -SerialNumber 'ABC123ABC1' -All
#>

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