Public/Build-ConnectorObject.ps1

<#
.SYNOPSIS
    Builds a connector object to be used with the Connector Data API.
#>

function Build-ConnectorObject {
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param (
        [Parameter(Mandatory = $true)]
        [string] $ExternalId,
        
        [Parameter(Mandatory = $true)]
        [string] $ObjectType,

        [Parameter(Mandatory = $true)]
        [System.Collections.Hashtable] $Data
    ) 
    
    process {
        if([string]::IsNullOrEmpty($ObjectType)) {
            throw "ObjectType cannot be null"
        }

        if([string]::IsNullOrEmpty($ExternalId)) {
            throw "ExternalId cannot be null"
        }

        @{
            ExternalId = $ExternalId
            Data       = $Data
            ObjectType = $ObjectType
        }
    }
}