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
list
list
- HTTP endpoint:
GET /api/executions/list(default) orGET /api/executions - Signature:
func list(apiKeyRoute: Bool = true, options: RequestOptions = .init()) async throws -> [Execution]
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
get
get
- HTTP endpoint:
GET /api/executions/{id} - Signature:
func get(_ id: String, options: RequestOptions = .init()) async throws -> Execution
get_execution.swift
delete
delete
- HTTP endpoint:
DELETE /api/executions/{id} - Signature:
func delete(_ id: String, options: RequestOptions = .init()) async throws -> JSONObject
delete_execution.swift
clear
clear
- HTTP endpoint:
POST /api/executions/clear - Signature:
func clear(options: RequestOptions = .init()) async throws -> JSONObject
clear_executions.swift
stop
stop
- HTTP endpoint:
POST /api/executions/stop - Signature:
func stop(runID: String, options: RequestOptions = .init()) async throws -> JSONObject
stop_execution.swift
stream
stream
- HTTP endpoint:
GET /api/executions/stream - Signature:
func stream(options: RequestOptions = .init()) -> AsyncThrowingStream<StreamEvent<JSONValue>, Error>
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
Swift.Task cancels the stream.watch
watch
- HTTP endpoint:
GET /api/executions/{id}(polled) - Signature:
func watch(_ executionID: String, interval: Duration = .seconds(1), options: RequestOptions = .init()) -> AsyncThrowingStream<Execution, Error>
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