Public/Curanet/Customers/Get-CuranetCustomer.ps1
function Get-CuranetCustomer() { Param( [Parameter()] [string]$CustomerName, [Parameter()] [string]$CustomerId, [Parameter(Mandatory)] [ValidateSet("3370", "3850")] [string]$Account ) try { $customers = Invoke-CuranetAPI -Account $Account -Uri "https://api.curanet.dk/customers/v1/Customers?itemsPerPage=9999" -Method GET } catch { throw "Failed to retreive customers from Curanet $($Account) API: $_" } if($CustomerName) { $Customers = $Customers | Where-Object { $_.companyName -eq $CustomerName } } elseif ($CustomerId) { $Customers = $Customers | Where-Object { $_.ID -eq $CustomerId } } return $Customers } |