8000 Get-HuduUsers · Issue #61 · lwhitelock/HuduAPI · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Get-HuduUsers #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tyrellm04 opened this issue Mar 4, 2025 · 0 comments
Open

Get-HuduUsers #61

tyrellm04 opened this issue Mar 4, 2025 · 0 comments

Comments

@tyrellm04
Copy link
tyrellm04 commented Mar 4, 2025

Hi, I needed to leverage the Get-HuduUsers and it wasn't showing as available in the API even though it's in the Public folder in GitHub. I suspect it just wasn't marked as such in the manifest.

I've also updated it slightly to include clearer synopsis and the ability to leverage the archived parameter. It is pulling correct data. Below is the module if you care to use it.

function Get-HuduUsers {
    <#
    .SYNOPSIS
    Get a list of Users

    .DESCRIPTION
    Call Hudu API to retrieve Users

    .PARAMETER Id
    Id of requested users

    .PARAMETER Email
    Email address of requested users

    .PARAMETER First_name
    First Name of the requested user

    .PARAMETER Last_name
    Last Name of the requested user

    .PARAMETER CompanyId
    Id of the requested User's company

    .PARAMETER Portal_Member_Company_Id
    Company Id of portal member's company

    .PARAMETER Slug
    Filter by slug of user

    .PARAMETER Archived
    Filter by archived status

    .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 = '',
        [bool]$archived = $false
    )

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

        if ($Email) { $Params.email = $Email}
        if ($First_name) { $Params.first_name = $First_name}
        if ($Last_name) { $Params.last_name = $Last_name}
        if ($Portal_member_company_id) {$Params.Portal_member_company_id = $Portal_member_company_id}
        if ($Securitylevel) {$Params.Securitylevel = $Securitylevel}
        if ($Slug) {$Params.slug = $Slug}
        if ($archived) {$Params.archived = $archived}



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

        Invoke-HuduRequestPaginated -HuduRequest $HuduRequest -Property Users
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0