pub struct TasksHandler { /* private fields */ }Expand description
Handler for asynchronous task operations
Tracks and manages long-running operations, providing status updates, progress monitoring, and result retrieval for asynchronous API calls.
Implementations§
Source§impl TasksHandler
impl TasksHandler
Sourcepub fn new(client: CloudClient) -> Self
pub fn new(client: CloudClient) -> Self
Create a new handler
Sourcepub async fn get_all_tasks(&self) -> Result<Vec<TaskStateUpdate>>
pub async fn get_all_tasks(&self) -> Result<Vec<TaskStateUpdate>>
Get tasks Gets a list of all currently running tasks for this account.
The OpenAPI spec defines the response as TasksStateUpdate { tasks: [...] }
(a wrapper object). In practice the API also returns:
- an empty object
{}when there are no tasks, - and historically a bare JSON array.
All three shapes deserialize cleanly to Vec<TaskStateUpdate>. Any other
shape surfaces as CloudError::JsonError rather than silently returning
an empty list, so a future schema change is loud instead of invisible.
GET /tasks
Sourcepub async fn get_all_tasks_raw(&self) -> Result<Value>
pub async fn get_all_tasks_raw(&self) -> Result<Value>
Get tasks (raw JSON) Gets a list of all currently running tasks for this account.
GET /tasks
Sourcepub async fn get_task_by_id(&self, task_id: String) -> Result<TaskStateUpdate>
pub async fn get_task_by_id(&self, task_id: String) -> Result<TaskStateUpdate>
Get a single task Gets details and status of a single task by the Task ID.
GET /tasks/{taskId}
§Example
use redis_cloud::CloudClient;
let client = CloudClient::builder()
.api_key("your-api-key")
.api_secret("your-api-secret")
.build()?;
let task = client.tasks().get_task_by_id("task-id".to_string()).await?;
println!("Task status: {:?}", task.status);Sourcepub async fn list(&self) -> Result<Vec<TaskStateUpdate>>
pub async fn list(&self) -> Result<Vec<TaskStateUpdate>>
List tasks (simplified)
Alias for get_all_tasks.
§Example
use redis_cloud::CloudClient;
let client = CloudClient::builder()
.api_key("your-api-key")
.api_secret("your-api-secret")
.build()?;
let tasks = client.tasks().list().await?;Sourcepub async fn get(&self, task_id: String) -> Result<TaskStateUpdate>
pub async fn get(&self, task_id: String) -> Result<TaskStateUpdate>
Get a task by ID (simplified)
Alias for get_task_by_id.
§Arguments
task_id- The task ID
§Example
use redis_cloud::CloudClient;
let client = CloudClient::builder()
.api_key("your-api-key")
.api_secret("your-api-secret")
.build()?;
let task = client.tasks().get("task-id".to_string()).await?;