Public/Jira/Avatars/Get-AtlassianCloudJiraAvatarByOwner.ps1

function Get-AtlassianCloudJiraAvatarByOwner{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory, Position=0)]
        [ValidateNotNullOrEmpty()]
        [string]$Type,
 
        [Parameter(Mandatory, Position=1)]
        [ValidateNotNullOrEmpty()]
        [string]$EntityId,

        [Parameter(Mandatory = $false, Position=2)]
        [ValidateSet('xsmall','small','medium','large','xlarge')]
        [string]$Size,

        [Parameter(Mandatory = $false, Position=3)]
        [ValidateSet('png','svg')]
        [string]$Format,

        [Parameter(Mandatory, Position=2)]
        [ValidateNotNullOrEmpty()]
        [string]$AtlassianOrgName,

        [Parameter(Mandatory, Position=3)]
        [ValidateNotNullOrEmpty()]
        [string]$Pat
    )

    $endpoint = "universal_avatar/view/type/$Type/owner/$EntityId"

    if ($Size -or $Format) {
        $endpoint += '?'

        if ($Size) {
            $endpoint += "size=$Size"
            if ($Format) {
                $endpoint += "&format=$Format"
            }
        } else {
            if ($Format) {
                $endpoint += "format=$Format"
            }
        }
    }

    return Get-AtlassianCloudJiraEntity -AtlassianOrgName $AtlassianOrgName -Endpoint $endpoint -Experimental -Pat $Pat -Verbose:($Verbose.IsPresent)
}