collectAndUpload

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

Collects signals and uploads the result for a single account.

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 the upload fails with HTTP 401 or 403.

if the upload fails with any other non-2xx HTTP response.

if a network or IO failure prevents reaching the server.


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

Collects signals once and uploads the result for each account 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. Partial failures are returned in TSUploadOutcome.failures so the caller can inspect per-account outcomes without losing the successfully uploaded accounts.

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 every upload fails. Per-account causes are TSAuthenticationException (HTTP 401/403), TSUploadRejectedException (other non-2xx), or TSUploadTransportException (network/IO failure).


fun collectAndUpload(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 TSNotInitializedException if initialize has not been called, TSCollectionTimedOutException if every long-running collector timed out, TSAuthenticationException, TSUploadRejectedException, or TSUploadTransportException if the upload fails.


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

Parameters

timeoutMs

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

onError

Receives TSNotInitializedException if initialize has not been called, TSCollectionTimedOutException if every long-running collector timed out, or TSUploadException if every upload fails.