Public/Curanet/Subscriptions/Get-CuranetCustomerSubscriptions.ps1
function Get-CuranetCustomerSubscriptions() { Param( [Parameter()] [string]$CustomerId, [Parameter(Mandatory)] [ValidateSet("3370", "3850")] [string]$Account ) if($CustomerId) { try { $Subscriptions = Invoke-CuranetAPI -Account $Account -Uri "https://api.curanet.dk/customers/v1/Customers/$($CustomerId)/Subscriptions" -Method GET } catch { throw "Failed to retreive subscriptions from Curanet $($Account) API: $_" } } else { try { $Subscriptions = Invoke-CuranetAPI -Account $Account -Uri "https://api.curanet.dk/customers/v1/Customers/Subscriptions" -Method GET } catch { throw "Failed to retreive subscriptions from Curanet $($Account) API: $_" } } return $Subscriptions } |