Skip to main content
The ExecutionsResource on the Figranium Swift SDK gives you full visibility and control over every task run. Use it to list past executions, inspect a single run, clean up history, stop active runs, subscribe to a live Server-Sent Events stream of execution updates, and watch a specific execution by polling for status changes.
ExecutionsResource.swift

Methods

  • HTTP endpoint: GET /api/executions/list (default) or GET /api/executions
  • Signature: func list(apiKeyRoute: Bool = true, options: RequestOptions = .init()) async throws -> [Execution]
Returns a list of executions. By default it calls GET /api/executions/list, which is the route intended for API-key access. If you pass apiKeyRoute: false, the SDK switches to GET /api/executions instead.
Most callers should leave apiKeyRoute at its default (true). Only override it when your deployment requires the alternate route.
list_executions.swift
  • HTTP endpoint: GET /api/executions/{id}
  • Signature: func get(_ id: String, options: RequestOptions = .init()) async throws -> Execution
Fetches a single execution by its ID.
get_execution.swift
  • HTTP endpoint: DELETE /api/executions/{id}
  • Signature: func delete(_ id: String, options: RequestOptions = .init()) async throws -> JSONObject
Removes a single execution record.
delete_execution.swift
  • HTTP endpoint: POST /api/executions/clear
  • Signature: func clear(options: RequestOptions = .init()) async throws -> JSONObject
Deletes all executions in bulk.
clear_executions.swift
  • HTTP endpoint: POST /api/executions/stop
  • Signature: func stop(runID: String, options: RequestOptions = .init()) async throws -> JSONObject
Sends a stop signal to an active run.
stop_execution.swift
  • HTTP endpoint: GET /api/executions/stream
  • Signature: func stream(options: RequestOptions = .init()) -> AsyncThrowingStream<StreamEvent<JSONValue>, Error>
Opens a Server-Sent Events connection and yields each event as it arrives. The stream stays open until the server closes the connection, the consumer stops iterating, or the request is aborted. The stream sends only accept and auth headers, not default or per-call headers, and uses options.timeout.For details on the StreamEvent shape and how cancellation works, see Streaming. For error handling, see Errors.
stream_executions.swift
Cancelling the consuming Swift.Task cancels the stream.
  • HTTP endpoint: GET /api/executions/{id} (polled)
  • Signature: func watch(_ executionID: String, interval: Duration = .seconds(1), options: RequestOptions = .init()) -> AsyncThrowingStream<Execution, Error>
Polls get at the given interval and yields an Execution only when the status changes. The stream finishes automatically when the execution reaches an outcome or status of success, error, stopped, crashed, or anti_bot. Cancelling the consuming Swift.Task cancels the polling loop.
watch_execution.swift

End-to-end example

This example lists recent executions, inspects the newest one, and stops it if it is still running.
execution_workflow.swift