Public/Issues/New-AspireIssue.ps1

<#
.SYNOPSIS
    Creates a new issue in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a POST request to the /Issues endpoint.
.PARAMETER AssignedTo
    The user or entity the issue is assigned to (required).
.PARAMETER Subject
    The subject of the issue (required, max 200 characters).
.PARAMETER Notes
    The notes for the issue (required).
.PARAMETER DueDate
    Optional due date for the issue (ISO 8601 date-time string).
.PARAMETER OpportunityID
    Optional opportunity ID associated with the issue.
.PARAMETER Priority
    Optional priority of the issue.
.PARAMETER PropertyID
    Optional property ID associated with the issue.
.PARAMETER StartDate
    Optional start date for the issue (ISO 8601 date-time string).
.PARAMETER WorkTicketID
    Optional work ticket ID associated with the issue.
.PARAMETER IncludeClient
    Optional flag to include client.
.PARAMETER PublicComment
    Optional flag for public comment.
.OUTPUTS
    The ID of the created issue.
.EXAMPLE
    New-AspireIssue -AssignedTo "user@example.com" -Subject "Test Issue" -Notes "This is a test issue"
#>

function New-AspireIssue {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$AssignedTo,
        [Parameter(Mandatory = $true)]
        [string]$Subject,
        [Parameter(Mandatory = $true)]
        [string]$Notes,
        [string]$DueDate = $null,
        [int]$OpportunityID = $null,
        [string]$Priority = $null,
        [int]$PropertyID = $null,
        [string]$StartDate = $null,
        [int]$WorkTicketID = $null,
        [bool]$IncludeClient = $null,
        [bool]$PublicComment = $null
    )

    $body = @{
        AssignedTo = $AssignedTo
        Subject = $Subject
        Notes = $Notes
    }

    if ($DueDate) { $body.DueDate = $DueDate }
    if ($OpportunityID) { $body.OpportunityID = $OpportunityID }
    if ($Priority) { $body.Priority = $Priority }
    if ($PropertyID) { $body.PropertyID = $PropertyID }
    if ($StartDate) { $body.StartDate = $StartDate }
    if ($WorkTicketID) { $body.WorkTicketID = $WorkTicketID }
    if ($IncludeClient) { $body.IncludeClient = $IncludeClient }
    if ($PublicComment) { $body.PublicComment = $PublicComment }

    return Invoke-AspireRequest -Method POST -Path "/Issues" -Body $body
}