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:

  1. Extracts configuration from continueNode.input:

    • _links.next.href: Used to construct base URL

    • interactionId: Required header for polling requests

  2. Constructs polling URL: {baseUrl}/davinci/user/credentials/challenge/{challenge}/status

  3. Polling loop (repeats up to pollRetries times):

  4. If max retries reached: Emits PollingStatus.TimedOut

  5. If configuration missing: Emits PollingStatus.Error immediately

Simple Polling Mode

When pollChallengeStatus is false or challenge is empty:

  1. Validates pollInterval (must be 0)

  2. Delays for pollInterval milliseconds

  3. Decrements retriesAllowed

  4. If retries remain: Emits PollingStatus.Continue with remaining retries

  5. If retries exhausted: Emits PollingStatus.TimedOut

  6. 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.CompleteServer 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)