Public/Curanet/Invoicing/Get-CuranetInvoice.ps1

function Get-CuranetInvoice() {
    Param(
        [Parameter(Mandatory)]
        [ValidateSet("3370", "3850")]
        [string]$Account,
        [string]$InvoiceID
    )

    try {
        if($InvoiceID) {
            $Invoices = Invoke-CuranetAPi -Account $Account -Uri "https://api.curanet.dk/invoicing/v1/Invoices/$($InvoiceID)" -Method GET
        } else {
            $Invoices = Invoke-CuranetAPI -Account $Account -Uri "https://api.curanet.dk/invoicing/v1/Invoices" -Method GET
        }

    } catch {
        throw "Failed to retreive invoices from Curanet $($Account) API: $_"
    }

    return $Invoices
}