renegade_sdk/renegade_wallet_client/actions/
get_task.rs

1//! Looks up a task by its ID in the relayer
2
3use renegade_external_api::{
4    http::task::{GET_TASK_BY_ID_ROUTE, GetTaskByIdResponse},
5    types::ApiTask,
6};
7use uuid::Uuid;
8
9use crate::{RenegadeClientError, actions::construct_http_path, client::RenegadeClient};
10
11// --- Public Actions --- //
12impl RenegadeClient {
13    /// Look up a task by its ID
14    pub async fn get_task(&self, task_id: Uuid) -> Result<ApiTask, RenegadeClientError> {
15        let path = construct_http_path!(GET_TASK_BY_ID_ROUTE, "account_id" => self.get_account_id(), "task_id" => task_id);
16
17        let GetTaskByIdResponse { task } = self.relayer_client.get(&path).await?;
18        Ok(task)
19    }
20}