pollStatus
Polls for the challenge status and emits the current polling status.
This method returns a Flow that emits PollingStatus updates throughout the polling lifecycle. The polling behavior depends on the configuration set during init:
Challenge Status Polling Mode
When pollChallengeStatus is true and challenge is not empty:
Extracts configuration from continueNode.input:
_links.next.href: Used to construct base URLinteractionId: Required header for polling requestsConstructs polling URL:
{baseUrl}/davinci/user/credentials/challenge/{challenge}/statusPolling loop (repeats up to pollRetries times):
Delays for pollInterval milliseconds
Makes HTTP POST request with
interactionIdheaderParses JSON response for
isChallengeCompletefieldIf HTTP error (status ≠ 200): Emits PollingStatus.Expired and stops polling
If challenge complete: Emits PollingStatus.Complete with server status and exits
If not complete: Emits PollingStatus.Continue and continues polling
If exception occurs: Emits PollingStatus.Error and exits
If max retries reached: Emits PollingStatus.TimedOut
If configuration missing: Emits PollingStatus.Error immediately
Simple Polling Mode
When pollChallengeStatus is false or challenge is empty:
Validates pollInterval (must be 0)
Delays for pollInterval milliseconds
Decrements retriesAllowed
If retries remain: Emits PollingStatus.Continue with remaining retries
If retries exhausted: Emits PollingStatus.TimedOut
If invalid interval: Emits PollingStatus.Error
Flow Interception
After emission but before the caller receives it, the flow uses onEach to set the value property based on the emitted status:
| PollingStatus.Complete | Server status (e.g., "approved") |
| PollingStatus.TimedOut | "timedOut" |
| PollingStatus.Expired | "expired" |
| PollingStatus.Error | "error" |
| PollingStatus.Continue | "continue" |
Return
A Flow of PollingStatus that emits status updates throughout the polling operation. The Flow completes naturally when polling finishes (Complete, TimedOut, Expired, or Error).
See also
Throws
if continueNode or davinci are not initialized (challenge mode only)