Pax8API/Public/Partner/Get-Pax8Company.ps1

<#
.SYNOPSIS
List Companies
.DESCRIPTION
Returns a paginated list of all your companies filtered by optional parameters
OpenAPI: GET /companies
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER Page
The page number to request for in the companies list
.PARAMETER Size
Return this number of company records per page
.PARAMETER Sort
Return companies sorted by this field and direction. Formatted as fieldName,direction - ex. sort=name,desc Suggested values: name, city, country, stateOrProvince, postalCode.
.PARAMETER City
Return only companies matching this ```city``` value
.PARAMETER Country
Return only companies matching this ```country``` value
.PARAMETER StateOrProvince
Return only companies matching this ```stateOrProvince``` value
.PARAMETER PostalCode
Return only companies matching this ```postalCode``` value
.PARAMETER SelfServiceAllowed
Return only companies matching this ```selfServiceAllowed``` value
.PARAMETER BillOnBehalfOfEnabled
Return only companies matching this ```billOnBehalfOfEnabled``` value
.PARAMETER OrderApprovalRequired
Return only companies matching this ```orderApprovalRequired``` value
.PARAMETER Status
Return only companies matching this ```status``` value Suggested values: Active, Inactive, Deleted.
.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-Pax8Company
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

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

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

        [ValidateSet('name', 'city', 'country', 'stateOrProvince', 'postalCode')]
        [string]$Sort,

        [string]$City,

        [string]$Country,

        [string]$StateOrProvince,

        [string]$PostalCode,

        [bool]$SelfServiceAllowed,

        [bool]$BillOnBehalfOfEnabled,

        [bool]$OrderApprovalRequired,

        [ValidateSet('Active', 'Inactive', 'Deleted')]
        [string]$Status,

        [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-Pax8Companies' -Value 'Get-Pax8Company'