pub struct Workflows<'a> { /* private fields */ }Expand description
/v1/workflows.
Implementations§
Source§impl Workflows<'_>
impl Workflows<'_>
Sourcepub async fn list_with(&self, query: &[(&str, &str)]) -> Result<Page<Workflow>>
pub async fn list_with(&self, query: &[(&str, &str)]) -> Result<Page<Workflow>>
GET /v1/workflows with query params (active_only, limit).
Sourcepub async fn update(&self, id: i64, patch: Value) -> Result<Workflow>
pub async fn update(&self, id: i64, patch: Value) -> Result<Workflow>
PATCH /v1/workflows/:id — sparse update.
Sourcepub async fn run(&self, id: i64, opts: &RunOptions) -> Result<RunStarted>
pub async fn run(&self, id: i64, opts: &RunOptions) -> Result<RunStarted>
POST /v1/workflows/:id/run → 202 {run_id, status:"running"}.
Observe the run with [RunsApi::events] / [RunsApi::get], or use
Self::run_wait to have the daemon block and hand back the result directly.
Sourcepub async fn run_wait(
&self,
id: i64,
opts: &RunOptions,
timeout: Option<Duration>,
) -> Result<RunCompleted>
pub async fn run_wait( &self, id: i64, opts: &RunOptions, timeout: Option<Duration>, ) -> Result<RunCompleted>
POST /v1/workflows/:id/run?wait=true — run the workflow and BLOCK on the daemon
until it reaches a terminal state, returning the run’s own result. One request: no
SSE, no poll loop.
timeout is how long the daemon may block (clamped server-side to [1s, 3600s],
default 120 s). A run that FAILS is returned as Ok with status == "failed" —
check it. Only an expired budget is an Err, and it is
WritError::RunTimeout carrying the still-valid run_id, so you can collect the
run rather than start a second one.
Prefer Self::run_and_wait when you want live events, the enriched run feed item,
or a deadline longer than the daemon’s own ceiling.
Sourcepub async fn dry_run(&self, id: i64, opts: &RunOptions) -> Result<Value>
pub async fn dry_run(&self, id: i64, opts: &RunOptions) -> Result<Value>
POST /v1/workflows/:id/run with dry_run: true → 200 validate-only
step-plan report (nothing is executed).
Sourcepub async fn cancel(&self, id: i64) -> Result<CancelOutcome>
pub async fn cancel(&self, id: i64) -> Result<CancelOutcome>
POST /v1/workflows/:id/cancel — cancel the newest live run of this
workflow. A 409 not_running is a valid CancelOutcome, not an error.
Sourcepub async fn session(&self, id: i64) -> Result<Value>
pub async fn session(&self, id: i64) -> Result<Value>
GET /v1/workflows/:id/session — browserless-HTTP-lane session status.
Sourcepub async fn clear_session(&self, id: i64) -> Result<Value>
pub async fn clear_session(&self, id: i64) -> Result<Value>
DELETE /v1/workflows/:id/session — drop the persisted session.
Sourcepub async fn run_and_wait(
&self,
id: i64,
opts: &RunOptions,
) -> Result<RunOutcome>
pub async fn run_and_wait( &self, id: i64, opts: &RunOptions, ) -> Result<RunOutcome>
Run the workflow and wait for the terminal state (DESIGN.md §8):
start the run, follow the SSE event stream, and on SSE failure fall back to
polling runs().get() every second. Overall deadline
RunOptions::wait_timeout (default 600 s) — on timeout the run is
NOT cancelled; it keeps executing on the daemon. Returns the final
RunFeedItem (plus runs().results() when
RunOptions::include_results is set).