TasksResource on the Figranium Swift SDK is the primary way to manage tasks. Use it to list, create, update, version, and run tasks. Every method is async throws and accepts an optional options parameter for per-request overrides such as custom headers or timeouts. The client-level convenience client.runTask(id:input:options:) proxies directly to client.tasks.run(id:input:options:).
TasksResource.swift
The SDK’s model type
Task shadows Swift’s concurrency Task. Use Swift.Task { } or Figranium.Task to disambiguate when necessary.Methods
list
list
Retrieve every task in the workspace.Returns an array of
- HTTP endpoint:
GET /api/tasks - Signature:
func list(options: RequestOptions = .init()) async throws -> [Task]
list_tasks.swift
Task structs.listSummaries
listSummaries
Fetch a lightweight summary of all tasks.Each
- HTTP endpoint:
GET /api/tasks/list - Signature:
func listSummaries(options: RequestOptions = .init()) async throws -> [TaskSummary]
list_summaries.swift
TaskSummary contains id, name, and an optional description.save
save
Create or update a task. Pass Returns the saved
createVersion: true to snapshot the current version before saving.- HTTP endpoint:
POST /api/tasks(with?version=truewhencreateVersionis set) - Signature:
func save(_ task: Task, createVersion: Bool = false, options: RequestOptions = .init()) async throws -> Task
save_task.swift
Task, including any server-generated id. For more about building actions, see Actions. For variable substitution, see Variables.touch
touch
Refresh a task’s
last_opened timestamp without changing its definition.- HTTP endpoint:
POST /api/tasks/{id}/touch - Signature:
func touch(_ id: String, options: RequestOptions = .init()) async throws -> Task
touch_task.swift
update
update
Apply a partial patch to an existing task.
- HTTP endpoint:
PATCH /api/tasks/{id} - Signature:
func update(_ id: String, patch: JSONObject, options: RequestOptions = .init()) async throws -> JSONObject
update_task.swift
delete
delete
Remove a task by ID.
- HTTP endpoint:
DELETE /api/tasks/{id} - Signature:
func delete(_ id: String, options: RequestOptions = .init()) async throws -> JSONObject
delete_task.swift
versions
versions
List all saved versions for a task.
- HTTP endpoint:
GET /api/tasks/{id}/versions - Signature:
func versions(_ id: String, options: RequestOptions = .init()) async throws -> [TaskVersion]
list_versions.swift
version
version
Retrieve a specific version snapshot.
- HTTP endpoint:
GET /api/tasks/{id}/versions/{versionId} - Signature:
func version(_ id: String, versionID: String, options: RequestOptions = .init()) async throws -> JSONObject
get_version.swift
clearVersions
clearVersions
Delete all stored versions for a task.
- HTTP endpoint:
POST /api/tasks/{id}/versions/clear - Signature:
func clearVersions(_ id: String, options: RequestOptions = .init()) async throws -> JSONObject
clear_versions.swift
rollback
rollback
Restore a task to a previous version snapshot.
- HTTP endpoint:
POST /api/tasks/{id}/rollback - Signature:
func rollback(_ id: String, versionID: String, options: RequestOptions = .init()) async throws -> Task
rollback_task.swift
generateSelector
generateSelector
Generate a CSS selector for a task action using an AI prompt.Returns the generated CSS selector string.
- HTTP endpoint:
POST /api/tasks/generate-selector - Signature:
func generateSelector(task: Task, actionIndex: Int, prompt: String, options: RequestOptions = .init()) async throws -> String
generate_selector.swift
generateScript
generateScript
Generate a JavaScript extraction script from a description.Returns the generated script string.
- HTTP endpoint:
POST /api/tasks/generate-script - Signature:
func generateScript(_ description: String, options: RequestOptions = .init()) async throws -> String
generate_script.swift
run
run
Execute a task and return its result. This is the public execution endpoint, reachable at The
/tasks/{id}/api.- HTTP endpoint:
POST /tasks/{id}/api - Signature:
func run<Value: Codable & Sendable>(_ id: String, input: ExecuteTaskOptions = .init(), options: RequestOptions = .init()) async throws -> ExecutionResult<Value>
run_task.swift
input object accepts variables, taskVariables, webhookUrl, and runId. For more about execution results and streaming, see ExecutionsResource. To learn about task variables and runtime substitution, see Variables and Actions. For per-request overrides, see RequestOptions.