Public/Get-SlackUserGroup.ps1

function Get-RyverUserGroup {
    <#
    .SYNOPSIS
        Get Ryver user groups
    .DESCRIPTION
        Get Ryver user groups
    .PARAMETER Token
        Token to use for the Ryver API
        Default value is the value set by Set-PSRyverConfig
    .PARAMETER IncludeUsers
        If specified, include users
 
        If you update the user map ahead of time, we parse user IDs to user names:
            Get-RyverUserMap -Update ahead of team
    .PARAMETER IncludeDisabled
        If specified, include disabled users
    .Parameter Raw
        Return raw output. If specified, Name parameter is ignored
    .EXAMPLE
        Get-RyverUserGroup
        # Get ryver user group info
    .EXAMPLE
        $null = Get-RyverUserMap -Update
        Get-RyverUserGroup -IncludeUsers
 
        # Get user id to name map, pull user groups and their members
    .FUNCTIONALITY
        Ryver
    #>

    [CmdletBinding(
        HelpUri = 'https://tlindsay42.github.io/PSRyver/Public/Get-RyverUserGroup/'
    )]
    param (
        [String] $Token = $Script:PSRyver.Token,
        [Switch]$IncludeUsers,
        [Switch]$IncludeDisabled,
        [Switch]$Raw
    )
    begin {
        Write-Verbose "$($PSBoundParameters | Remove-SensitiveData | Out-String)"
        $body = @{}
        if ($IncludeUsers) {
            $body.add('include_users', $true)
        }
        if ($IncludeDisabled) {
            $body.add('include_disabled', $true)
        }

        $params = @{
            Token  = $Token
            Method = 'usergroups.list'
        }
        if ($body.keys.count -gt 0) {
            $params.add('body', $body)
        }

        $RawGroups = Invoke-RyverRestMethod @params
        if ($Raw) {
            $RawGroups
        }
        else {
            Format-RyverV1UserGroupObject -InputObject $RawGroups.usergroups
        }
    }
}