Public/New-GCKnowledgeDocument.ps1

<#
.SYNOPSIS
    Creates a new knowledge document.

.DESCRIPTION
    Creates a new document in a knowledge base in Genesys Cloud.
    Uses the POST /api/v2/knowledge/knowledgebases/{knowledgeBaseId}/documents endpoint.

.PARAMETER KnowledgeBaseId
    The unique identifier of the knowledge base.

.PARAMETER Body
    The document definition object.

.EXAMPLE
    $docBody = @{ title = 'How to reset password'; answer = 'Steps to reset...' }
    New-GCKnowledgeDocument -KnowledgeBaseId 'kb-id' -Body $docBody

.NOTES
    Genesys Cloud API: POST /api/v2/knowledge/knowledgebases/{knowledgeBaseId}/documents
#>

function New-GCKnowledgeDocument {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$KnowledgeBaseId,

        [Parameter(Mandatory = $true)]
        [object]$Body
    )

    $endpoint = "knowledge/knowledgebases/$KnowledgeBaseId/documents"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method POST -Body $Body
}