Skip to content

Commit

Permalink
Merge pull request #56 from SamRisingTide/patch-1
Browse files Browse the repository at this point in the history
Create Get-HuduUsers.ps1
  • Loading branch information
greenlighttec authored Sep 16, 2024
2 parents ad5c554 + a43311c commit b5065a6
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions HuduAPI/Public/Get-HuduUsers.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
function Get-HuduUsers {
<#
.SYNOPSIS
Get a list of Users
.DESCRIPTION
Call Hudu API to retrieve Users
.PARAMETER Id
Id of requested users
.PARAMETER Users
Name of the requested user
.PARAMETER CompanyId
Id of the requested company
.PARAMETER Name
Filter by name
.PARAMETER Archived
Show archived results
.PARAMETER Slug
Filter by slug of user
.EXAMPLE
Get-HuduUsers -Name 'Jim'
#>

[CmdletBinding()]
Param (
[ValidateRange(1, [int]::MaxValue)]
[Int]$Id = '',
[string]$Email = '',
[string]$First_name = '',
[string]$Last_name = '',
[ValidateRange(1, [int]::MaxValue)]
[Int]$Portal_member_company_id = '',
[String]$Securitylevel = '',
[string]$Slug = ''
)

if ($Id) {
Invoke-HuduRequest -Method get -Resource "/api/v1/users/$Id"
} else {
$Params = @{}

if ($First_name) { $Params.first_name = $First_name}
if ($Last_name) { $Params.last_name = $Last_name}
if ($Email) { $Params.email = $Email}

$HuduRequest = @{
Method = 'GET'
Resource = '/api/v1/users'
Params = $Params
}

Invoke-HuduRequestPaginated -HuduRequest $HuduRequest -Property Users
}
}

0 comments on commit b5065a6

Please sign in to comment.