collectAndUpload

suspend fun collectAndUpload(vararg credentials: TSCredentials, timeoutMs: Long? = null): TSCollection

Collects signals once and uploads the result to the server for each provided credentials in parallel. Signals are only collected once regardless of how many credentials are supplied.

All uploads are always attempted — a failure for one account does not cancel the others. If any uploads fail, a TSUploadException is thrown after all uploads have completed, containing every failing account ID and its cause.

Parameters

timeoutMs

Overrides TSConfiguration.collectionTimeoutMs for this call only. Defaults to the value configured at initialize when omitted.

Throws

if initialize has not been called.

if every long-running collector timed out before producing any data. When only some timed out, collection succeeds with TSCollection.timedOut set to true and missing fields as null.

if one or more uploads fail. Per-account causes are TSAuthenticationException (HTTP 401/403), TSUploadRejectedException (other non-2xx), or TSUploadTransportException (network/IO failure).


fun collectAndUpload(vararg credentials: TSCredentials, timeoutMs: Long? = null, onSuccess: (TSCollection) -> Unit, onError: (Exception) -> Unit)

Parameters

timeoutMs

Overrides TSConfiguration.collectionTimeoutMs for this call only. Defaults to the value configured at initialize when omitted.

onError

Receives IllegalArgumentException if credentials is empty, TSNotInitializedException if initialize has not been called, TSCollectionTimedOutException if every long-running collector timed out, or TSUploadException if one or more uploads fail (per-account causes: TSAuthenticationException, TSUploadRejectedException, TSUploadTransportException).