Pax8API/Public/Partner/Get-Pax8Subscription.ps1

<#
.SYNOPSIS
List Subscriptions
.DESCRIPTION
Fetch a paginated list of subscriptions. Default page is 0 and default size is 10. The maximum page size is 200
OpenAPI: GET /subscriptions
Scope: Partner. Audience: https://api.pax8.com.
.PARAMETER Page
The page number to request in the subscriptions list
.PARAMETER Size
Returns _this_ number of subscriptions per page
.PARAMETER Sort
Return subscriptions sorted by this field and direction Formatted as fieldName,direction - ex. sort=createdDate,desc Suggested values: quantity,asc, quantity,desc, startDate,asc, startDate,desc, endDate,asc, endDate,desc, createdDate,asc, createdDate,desc, billingStart,asc, billingStart,desc, price,asc, price,desc.
.PARAMETER Status
Return only subscriptions matching this ```status``` value Suggested values: Active, Cancelled, PendingManual, PendingAutomated, PendingCancel, WaitingForDetails, Trial, Converted, PendingActivation, Activated.
.PARAMETER BillingTerm
Return only subscriptions matching this ```billingTerm``` value Suggested values: Monthly, Annual, 2-Year, 3-Year, One-Time, Trial, Activation.
.PARAMETER CompanyId
Return only subscriptions matching this ```companyId``` value
.PARAMETER ProductId
Return only subscriptions matching this ```productId``` 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-Pax8Subscription
.LINK
https://devx.pax8.com/openapi/partner-endpoints.json
#>

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

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

        [ValidateSet('quantity,asc', 'quantity,desc', 'startDate,asc', 'startDate,desc', 'endDate,asc', 'endDate,desc', 'createdDate,asc', 'createdDate,desc', 'billingStart,asc', 'billingStart,desc', 'price,asc', 'price,desc')]
        [string]$Sort,

        [ValidateSet('Active', 'Cancelled', 'PendingManual', 'PendingAutomated', 'PendingCancel', 'WaitingForDetails', 'Trial', 'Converted', 'PendingActivation', 'Activated')]
        [string]$Status,

        [ValidateSet('Monthly', 'Annual', '2-Year', '3-Year', 'One-Time', 'Trial', 'Activation')]
        [string]$BillingTerm,

        [guid]$CompanyId,

        [guid]$ProductId,

        [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-Pax8Subscriptions' -Value 'Get-Pax8Subscription'