Pax8API/Public/Partner/Get-Pax8Product.ps1

<#
.SYNOPSIS
List Products
.DESCRIPTION
Returns a paginated list of Pax8 products filtered by optional query parameters
OpenAPI: GET /products
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER Page
The page number to request for in the products list
.PARAMETER Size
Return this number of products per page
.PARAMETER Sort
Return products sorted by the field and direction specified. Formatted as fieldName, direction - ex. sort=name,desc Suggested values: name, vendor.
.PARAMETER Search
Search on fields like name, vendor, SKU and ID.
.PARAMETER VendorName
Return only products matching the specified vendor name
.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-Pax8Product
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

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

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

        [ValidateSet('name', 'vendor')]
        [string]$Sort,

        [string]$Search,

        [string]$VendorName,

        [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
    }
}