pub struct TasksClient<'a, T = Uninitialized> { /* private fields */ }Implementations§
Source§impl<'a> TasksClient<'a, Uninitialized>
impl<'a> TasksClient<'a, Uninitialized>
pub fn new(client: &'a mut GoogleClient) -> Self
Sourcepub fn get_task_lists(self) -> TasksClient<'a, TaskListMode>
pub fn get_task_lists(self) -> TasksClient<'a, TaskListMode>
Get a list of tasklists from the specified user.
§Examples
Axum is used in this example, but it can be adapted to other frameworks like Actix or Rocket.
pub async fn get_tasks(State(state): State<AppState>,
Path((task_list_id): Path<(String, String) -> Json<TaskLists> {
let google_client_guard = state.google_client.lock().await;
let client = google_client_guard.as_ref().unwrap();
let res = TasksClient::new(client)
.get_tasks(&task_list_id)
.max_results(10)
.page_token(1)
.show_deleted(false)
.request()
.await.unwrap();
Json(res.unwrap_or_default())
}Sourcepub fn get_tasks(self, task_list_id: &str) -> TasksClient<'a, TasksMode>
pub fn get_tasks(self, task_list_id: &str) -> TasksClient<'a, TasksMode>
Get a list of tasks from the specified task list.
§Examples
Axum is used in this example, but it can be adapted to other frameworks like Actix or Rocket.
pub async fn get_tasks(State(state): State<AppState>,
Path((task_list_id): Path<(String, String) -> Json<Tasks> {
let google_client_guard = state.google_client.lock().await;
let client = google_client_guard.as_ref().unwrap();
let res = TasksClient::new(client)
.get_tasks(&task_list_id)
.max_results(10)
.page_token(1)
.show_deleted(false)
.request()
.await.unwrap();
Json(res.unwrap_or_default())
}Sourcepub fn insert_task(self, task_list_id: &str) -> TasksClient<'a, TaskInsertMode>
pub fn insert_task(self, task_list_id: &str) -> TasksClient<'a, TaskInsertMode>
Insert a task from the specified task list.
§Examples
Axum is used in this example, but it can be adapted to other frameworks like Actix or Rocket.
pub async fn get_tasks(State(state): State<AppState>,
Path((task_id, task_list_id): Path<(String, String) {
let google_client_guard = state.google_client.lock().await;
let client = google_client_guard.as_ref().unwrap();
let res = TasksClient::new(client)
.insert_task(&task_list_id)
.set_task_notes("This is a new task")
.set_task_title("New Task")
.request()
.await.unwrap();
}Sourcepub fn complete_task(
self,
task_id: &str,
task_list_id: &str,
) -> TasksClient<'a, TaskPatchMode>
pub fn complete_task( self, task_id: &str, task_list_id: &str, ) -> TasksClient<'a, TaskPatchMode>
Complete a task from the specified task list.
§Examples
Axum is used in this example, but it can be adapted to other frameworks like Actix or Rocket.
pub async fn get_tasks(State(state): State<AppState>,
Path((task_id, task_list_id): Path<(String, String) {
let google_client_guard = state.google_client.lock().await;
let client = google_client_guard.as_ref().unwrap();
let res = TasksClient::new(client)
.complete_task(&task_list_id, &task_id)
.request()
.await.unwrap();
}Sourcepub fn delete_task(
self,
task_id: &str,
task_list_id: &str,
) -> TasksClient<'a, TaskDeleteMode>
pub fn delete_task( self, task_id: &str, task_list_id: &str, ) -> TasksClient<'a, TaskDeleteMode>
Delete a task from the specified task list.
§Examples
Axum is used in this example, but it can be adapted to other frameworks like Actix or Rocket.
pub async fn get_tasks(State(state): State<AppState>,
Path((task_id, task_list_id): Path<(String, String) {
let google_client_guard = state.google_client.lock().await;
let client = google_client_guard.as_ref().unwrap();
let res = TasksClient::new(client)
.delete_task(&task_list_id, &task_id)
.request()
.await.unwrap();
}Source§impl<'a> TasksClient<'a, TaskListMode>
impl<'a> TasksClient<'a, TaskListMode>
Source§impl<'a> TasksClient<'a, TasksMode>
A client for interacting with the Google Tasks API in retrieval mode.
impl<'a> TasksClient<'a, TasksMode>
A client for interacting with the Google Tasks API in retrieval mode.
This client allows querying task lists with various filtering options such as completion status, due dates, and visibility settings.
§Example
let client = TasksClient::new(client);
let tasks = client.show_completed(true).get_due_min(some_date).request().await?;Sourcepub async fn request(&mut self) -> Result<Option<Tasks>, Error>
pub async fn request(&mut self) -> Result<Option<Tasks>, Error>
Makes a request to retrieve the tasks from the specified task list.
§Returns
Result<Option<Tasks>, Error>- A result containing the tasks if successful, or an error if the request failed. ReturnsNoneif no tasks were found.
Sourcepub fn get_completed_max(self, completed_max: DateTime<Utc>) -> Self
pub fn get_completed_max(self, completed_max: DateTime<Utc>) -> Self
Sourcepub fn get_completed_min(self, completed_min: DateTime<Utc>) -> Self
pub fn get_completed_min(self, completed_min: DateTime<Utc>) -> Self
Sourcepub fn get_due_max(self, due_max: DateTime<Utc>) -> Self
pub fn get_due_max(self, due_max: DateTime<Utc>) -> Self
Sourcepub fn get_due_min(self, due_min: DateTime<Utc>) -> Self
pub fn get_due_min(self, due_min: DateTime<Utc>) -> Self
Sourcepub fn show_completed(self, show_completed: bool) -> Self
pub fn show_completed(self, show_completed: bool) -> Self
Sourcepub fn show_deleted(self, show_due: bool) -> Self
pub fn show_deleted(self, show_due: bool) -> Self
Sourcepub fn get_updated_min(self, updated_min: DateTime<Utc>) -> Self
pub fn get_updated_min(self, updated_min: DateTime<Utc>) -> Self
Sourcepub fn show_assigned(self, show_assigned: bool) -> Self
pub fn show_assigned(self, show_assigned: bool) -> Self
Source§impl<'a> TasksClient<'a, TaskInsertMode>
A client for interacting with the Google Tasks API in task insertion mode.
impl<'a> TasksClient<'a, TaskInsertMode>
A client for interacting with the Google Tasks API in task insertion mode.
This client allows creating new tasks with various properties such as title, notes, due dates, and hierarchical placement.
§Example
let client = TasksClient::new(client);
let task = client.set_task_title("New Task").set_task_notes("Details").request().await?;Sourcepub async fn request(&mut self) -> Result<Option<Tasks>, Error>
pub async fn request(&mut self) -> Result<Option<Tasks>, Error>
Makes a request to create a task with the specified properties.
§Returns
Result<Option<Tasks>, Error>- A result containing the created task if successful, or an error if the request failed.
Sourcepub fn set_parent(self, parent_id: &str) -> Self
pub fn set_parent(self, parent_id: &str) -> Self
Sourcepub fn set_previous(self, previous_id: &str) -> Self
pub fn set_previous(self, previous_id: &str) -> Self
Sourcepub fn set_task_title(self, title: &str) -> Self
pub fn set_task_title(self, title: &str) -> Self
Sourcepub fn set_task_etag(self, etag: &str) -> Self
pub fn set_task_etag(self, etag: &str) -> Self
Sourcepub fn set_task_notes(self, notes: &str) -> Self
pub fn set_task_notes(self, notes: &str) -> Self
Sourcepub fn set_task_due(self, due: DateTime<Utc>) -> Self
pub fn set_task_due(self, due: DateTime<Utc>) -> Self
Sourcepub fn set_task_completed(self, completed: DateTime<Utc>) -> Self
pub fn set_task_completed(self, completed: DateTime<Utc>) -> Self
Source§impl<'a> TasksClient<'a, TaskPatchMode>
impl<'a> TasksClient<'a, TaskPatchMode>
Source§impl<'a> TasksClient<'a, TaskDeleteMode>
impl<'a> TasksClient<'a, TaskDeleteMode>
Trait Implementations§
Source§impl<'a, T: InitializedGetMode> PaginationRequestTrait for TasksClient<'a, T>
impl<'a, T: InitializedGetMode> PaginationRequestTrait for TasksClient<'a, T>
Source§fn max_results(self, max: i64) -> Self
fn max_results(self, max: i64) -> Self
Sets the maximum number of results to return.
Source§fn page_token(self, token: &str) -> Self
fn page_token(self, token: &str) -> Self
Sets the page token for pagination. Works with max_results.