Merge branch 'fix/get-user-search-fields#35' into develop

This commit is contained in:
Petri Asikainen 2021-05-16 13:14:01 +03:00
commit a3ab7f4fd9

View file

@ -33,7 +33,7 @@ Get-User -url "https://assets.example.com" -token "token..." | Where-Object {$_.
function Get-User() {
Param(
[string]$search,
[string]$id,
[int]$company_id,
@ -44,6 +44,10 @@ function Get-User() {
[int]$department_id,
[string]$username,
[string]$email,
[ValidateSet("asc", "desc")]
[string]$order = "desc",
@ -61,15 +65,15 @@ function Get-User() {
)
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
$apiurl = "$url/api/v1/users"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/users/$id"
$apiurl= "$url/api/v1/users/$id"
}
$Parameters = @{
Uri = $apiurl
@ -85,8 +89,8 @@ function Get-User() {
while ($true) {
$callargs['offset'] = $offstart
$callargs['limit'] = $limit
$res=Get-User @callargs
$callargs['limit'] = $limit
$res=Get-User @callargs
$res
if ($res.count -lt $limit) {
break