Pax8API/Public/Partner/Get-Pax8Invoice.ps1

<#
.SYNOPSIS
List Invoices
.DESCRIPTION
Fetch a paginated list of invoices. Default page is 0 and default size is 10. The maximum page size is 200
OpenAPI: GET /invoices
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER Page
The page number to request in the invoices list
.PARAMETER Size
Returns _this_ number of invoices per page
.PARAMETER Sort
Return invoices sorted by this field and direction Formatted as fieldName,direction - ex. sort=invoiceDate,desc Suggested values: invoiceDate, dueDate, status, partnerName, total, balance, carriedBalance.
.PARAMETER Status
Return only invoices matching this ```status``` value Suggested values: Unpaid, Paid, Void, Carried, Nothing Due, Credited.
.PARAMETER InvoiceDate
Return only invoices matching this ```invoiceDate``` value
.PARAMETER InvoiceDateRangeStart
Return only invoices with an ```invoiceDate``` greater than or equal to this date
.PARAMETER InvoiceDateRangeEnd
Return only invoices with an ```invoiceDate``` less than or equal to this date
.PARAMETER DueDate
Return only invoices matching this ```dueDate``` value
.PARAMETER Total
Return only invoices matching this ```total``` value
.PARAMETER Balance
Return only invoices matching this ```balance``` value
.PARAMETER CarriedBalance
Return only invoices matching this ```carriedBalance``` value
.PARAMETER CompanyId
Return only invoices matching this ```companyId``` value
.PARAMETER Direction
Optional sort direction. When provided, the module sends sort as field,direction.
.PARAMETER Raw
Returns the unmodified API response instead of unwrapping paginated content.
.EXAMPLE
Get-Pax8Invoice
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

function Get-Pax8Invoice {
    [CmdletBinding()]
    param (
        [double]$Page,

        [ValidateRange(1, 200)]
        [double]$Size,

        [ValidateSet('invoiceDate', 'dueDate', 'status', 'partnerName', 'total', 'balance', 'carriedBalance')]
        [string]$Sort,

        [ValidateSet('Unpaid', 'Paid', 'Void', 'Carried', 'Nothing Due', 'Credited')]
        [string]$Status,

        [string]$InvoiceDate,

        [string]$InvoiceDateRangeStart,

        [string]$InvoiceDateRangeEnd,

        [string]$DueDate,

        [double]$Total,

        [double]$Balance,

        [double]$CarriedBalance,

        [guid]$CompanyId,

        [ValidateSet('asc', 'desc')]
        [string]$Direction,

        [switch]$All,

        [switch]$Raw
    )

    process {
        $boundParameters = @{}
        foreach ($entry in $PSBoundParameters.GetEnumerator()) {
            $boundParameters[$entry.Key] = $entry.Value
        }

        Invoke-Pax8ApiOperation -CommandName $MyInvocation.MyCommand.Name -Parameters $boundParameters
    }
}

Set-Alias -Name 'Get-Pax8Invoices' -Value 'Get-Pax8Invoice'