#[non_exhaustive]pub struct SessionClient { /* private fields */ }Expand description
A JmapClient bound to a JMAP session.
Obtain via JmapTasksExt::with_tasks_session.
All JMAP Tasks methods are available on this type without needing to pass
&Session on every call.
§Session lifecycle
SessionClient captures the Session at construction time. After
re-fetching the session via JmapClient::fetch_session, construct a new
SessionClient with the updated session. Reusing a stale SessionClient
after session expiry will result in unknownAccount or similar errors
from the server.
Clone is derived because JmapClient is itself cheap-to-clone (it
already implements Clone and with_tasks_session clones one
internally), enabling parallel-task fan-out with one bound session.
Debug is implemented manually to redact the inner JmapClient (which
holds an HTTP client and is intentionally not Debug in
jmap-base-client); only the Session is shown. This lets callers
embed a SessionClient in a #[derive(Debug)] struct without manual
impls of their own.
Implementations§
Source§impl SessionClient
impl SessionClient
Sourcepub async fn task_get(
&self,
ids: Option<&[Id]>,
properties: Option<&[&str]>,
) -> Result<GetResponse<Task>, ClientError>
pub async fn task_get( &self, ids: Option<&[Id]>, properties: Option<&[&str]>, ) -> Result<GetResponse<Task>, ClientError>
Fetch Task objects by IDs (draft-tasks-06 §4.5).
If ids is None, the server returns all Tasks for the account.
Pass properties: None to return all fields.
Sourcepub async fn task_changes(
&self,
since_state: &State,
max_changes: Option<u64>,
) -> Result<ChangesResponse, ClientError>
pub async fn task_changes( &self, since_state: &State, max_changes: Option<u64>, ) -> Result<ChangesResponse, ClientError>
Fetch changes to Task objects since since_state (draft-tasks-06 §4.6).
Sourcepub async fn task_set(
&self,
create: Option<Value>,
update: Option<HashMap<Id, PatchObject>>,
destroy: Option<Vec<Id>>,
) -> Result<SetResponse<Task>, ClientError>
pub async fn task_set( &self, create: Option<Value>, update: Option<HashMap<Id, PatchObject>>, destroy: Option<Vec<Id>>, ) -> Result<SetResponse<Task>, ClientError>
Create, update, or destroy Task objects (draft-tasks-06 §4.7).
update is Option<HashMap<Id, PatchObject>> (RFC 8620 §5.3). Wire
format is unchanged from a plain JSON object because PatchObject
is #[serde(transparent)]; the typed parameter binds the JSON Pointer
key + null-leaf removal contract to the type system.
Sourcepub async fn task_copy(
&self,
from_account_id: &Id,
create: Value,
) -> Result<SetResponse<Task>, ClientError>
pub async fn task_copy( &self, from_account_id: &Id, create: Value, ) -> Result<SetResponse<Task>, ClientError>
Copy Tasks from another account (draft-tasks-06 §4.8).
from_account_id is the source account. The tasks are copied into the
current primary Tasks account.
Sourcepub async fn task_query(
&self,
filter: Option<Value>,
sort: Option<Value>,
position: Option<u64>,
limit: Option<u64>,
) -> Result<QueryResponse, ClientError>
pub async fn task_query( &self, filter: Option<Value>, sort: Option<Value>, position: Option<u64>, limit: Option<u64>, ) -> Result<QueryResponse, ClientError>
Query Task IDs with optional filter and sort (draft-tasks-06 §4.13).
Sourcepub async fn task_query_changes(
&self,
since_query_state: &State,
max_changes: Option<u64>,
) -> Result<QueryChangesResponse, ClientError>
pub async fn task_query_changes( &self, since_query_state: &State, max_changes: Option<u64>, ) -> Result<QueryChangesResponse, ClientError>
Fetch query-result changes for Task since since_query_state
(draft-tasks-06 §4.14).
Source§impl SessionClient
impl SessionClient
Sourcepub async fn task_list_get(
&self,
ids: Option<&[Id]>,
properties: Option<&[&str]>,
) -> Result<GetResponse<TaskList>, ClientError>
pub async fn task_list_get( &self, ids: Option<&[Id]>, properties: Option<&[&str]>, ) -> Result<GetResponse<TaskList>, ClientError>
Fetch TaskList objects by IDs (draft-tasks-06 §3.5).
If ids is None, the server returns all TaskLists for the account.
Pass properties: None to return all fields.
Sourcepub async fn task_list_changes(
&self,
since_state: &State,
max_changes: Option<u64>,
) -> Result<ChangesResponse, ClientError>
pub async fn task_list_changes( &self, since_state: &State, max_changes: Option<u64>, ) -> Result<ChangesResponse, ClientError>
Fetch changes to TaskList objects since since_state (draft-tasks-06 §3.6).
If has_more_changes is true in the response, call again with new_state
as since_state until the flag is false.
Sourcepub async fn task_list_set(
&self,
create: Option<Value>,
update: Option<HashMap<Id, PatchObject>>,
destroy: Option<Vec<Id>>,
on_destroy_remove_tasks: Option<bool>,
) -> Result<SetResponse<TaskList>, ClientError>
pub async fn task_list_set( &self, create: Option<Value>, update: Option<HashMap<Id, PatchObject>>, destroy: Option<Vec<Id>>, on_destroy_remove_tasks: Option<bool>, ) -> Result<SetResponse<TaskList>, ClientError>
Create, update, or destroy TaskList objects (draft-tasks-06 §3.7).
on_destroy_remove_tasks: if true, any tasks in destroyed task lists
are also destroyed. If false (default), attempting to destroy a task list
that still contains tasks returns a taskListHasTasks error for that id.
Pass create, update, and/or destroy as needed. All three are
optional; pass None to omit any operation from the request.
update is Option<HashMap<Id, PatchObject>> (RFC 8620 §5.3). Wire
format is unchanged from a plain JSON object because PatchObject
is #[serde(transparent)]; the typed parameter binds the JSON Pointer
key + null-leaf removal contract to the type system.
Source§impl SessionClient
impl SessionClient
Sourcepub async fn task_notification_get(
&self,
ids: Option<&[Id]>,
properties: Option<&[&str]>,
) -> Result<GetResponse<TaskNotification>, ClientError>
pub async fn task_notification_get( &self, ids: Option<&[Id]>, properties: Option<&[&str]>, ) -> Result<GetResponse<TaskNotification>, ClientError>
Fetch TaskNotification objects by IDs (draft-tasks-06 §5.2).
If ids is None, the server returns all TaskNotifications for the account.
Sourcepub async fn task_notification_changes(
&self,
since_state: &State,
max_changes: Option<u64>,
) -> Result<ChangesResponse, ClientError>
pub async fn task_notification_changes( &self, since_state: &State, max_changes: Option<u64>, ) -> Result<ChangesResponse, ClientError>
Fetch changes to TaskNotification objects since since_state
(draft-tasks-06 §5.3).
Sourcepub async fn task_notification_set(
&self,
destroy: Vec<Id>,
) -> Result<SetResponse, ClientError>
pub async fn task_notification_set( &self, destroy: Vec<Id>, ) -> Result<SetResponse, ClientError>
Destroy TaskNotification objects (draft-tasks-06 §5.4).
Destroy-only: TaskNotification/set only supports destroy.
The server creates notifications automatically; clients may only remove them.
Passing an empty destroy list is valid and produces an empty /set response.
Sourcepub async fn task_notification_query(
&self,
filter: Option<Value>,
sort: Option<Value>,
position: Option<u64>,
limit: Option<u64>,
) -> Result<QueryResponse, ClientError>
pub async fn task_notification_query( &self, filter: Option<Value>, sort: Option<Value>, position: Option<u64>, limit: Option<u64>, ) -> Result<QueryResponse, ClientError>
Query TaskNotification IDs with optional filter and sort (draft-tasks-06 §5.5).
Sourcepub async fn task_notification_query_changes(
&self,
since_query_state: &State,
max_changes: Option<u64>,
) -> Result<QueryChangesResponse, ClientError>
pub async fn task_notification_query_changes( &self, since_query_state: &State, max_changes: Option<u64>, ) -> Result<QueryChangesResponse, ClientError>
Fetch query-result changes for TaskNotification since since_query_state
(draft-tasks-06 §5.6).
Trait Implementations§
Source§impl Clone for SessionClient
impl Clone for SessionClient
Source§fn clone(&self) -> SessionClient
fn clone(&self) -> SessionClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more