Public/Users/Get-ZoomUserAssistants.ps1

<#
 
.SYNOPSIS
List user assistants.
 
.DESCRIPTION
List user assistants.
 
.PARAMETER UserId
The user ID or email address.
 
.PARAMETER ApiKey
The Api Key.
 
.PARAMETER ApiSecret
The Api Secret.
 
.EXAMPLE
Get-ZoomUserAssistants jmcevoy@lawfirm.com
 
.OUTPUTS
A hastable with the Zoom API response.
 
 
#>


function Get-ZoomUserAssistants {
    [CmdletBinding()]
    param (
        [Parameter(
            Mandatory = $True, 
            Position = 0, 
            ValueFromPipeline = $True,
            ValueFromPipelineByPropertyName = $True
        )]
        [Alias('Email', 'EmailAddress', 'Id', 'user_id', 'userids', 'ids', 'emailaddresses','emails')]
        [string[]]$UserId,

        [ValidateNotNullOrEmpty()]
        [string]$ApiKey,

        [ValidateNotNullOrEmpty()]
        [string]$ApiSecret
    )

    begin {
        #Generate Header with JWT (JSON Web Token) using the Api Key/Secret
        $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret
    }

    process {
        foreach ($id in $UserId) {
            $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$Id/assistants"

            try {
                $response = Invoke-RestMethod -Uri $request.Uri -Headers $headers -Method GET
            } catch {
                Write-Error -Message "$($_.Exception.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation
            }
    
            Write-Output $response
        }
    }
}