Public/Start-ConnectorSyncSession.ps1

<#
.SYNOPSIS
    Initializes a new connector sync session.

.DESCRIPTION
    Starts a new sync session by resetting the in-memory collection of sync session objects.
    Objects are then accumulated using Add-ConnectorSyncSessionObject, compared against the API
    with Get-ConnectorSyncSessionOperation, and applied with Complete-ConnectorSyncSessionOperation.
    Requires an active connection established by Connect-Connector.

.EXAMPLE
    Start-ConnectorSyncSession

.NOTES
    Calling this function discards any objects accumulated in a previous sync session.
#>

function Start-ConnectorSyncSession {
    [CmdletBinding()]
    param ()

    process {    
        if ([String]::IsNullOrEmpty($Script:APIRoot)) {
            throw "Please connect first"
        }
        
        $Script:SyncSessionObjects = @{}
        Write-Verbose "Started new connector sync session for connector $($Script:ConnectorConfiguration.Id)"
    }
}