pub struct CCCCClient { /* private fields */ }Expand description
Blocking CCCC Daemon IPC v1 client.
Implementations§
Source§impl CCCCClient
impl CCCCClient
Sourcepub fn discover() -> Result<Self>
pub fn discover() -> Result<Self>
Discover the currently running daemon.
Examples found in repository?
examples/compat_check.rs (line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = CCCCClient::discover()?;
5 let requirements = CompatibilityRequirements {
6 minimum_ipc_version: 1,
7 operations: vec![
8 "groups",
9 "group_show",
10 "send",
11 "tracked_send",
12 "reply",
13 "inbox_read",
14 "message_history",
15 "context_get",
16 "context_sync",
17 "group_preamble_get",
18 "send_files",
19 "terminal_history",
20 "term_resize",
21 "web_model_delivery_preferences_get",
22 "web_model_delivery_preferences_update",
23 "web_model_runtime_recover_turn",
24 ],
25 ..Default::default()
26 };
27 let daemon = client.assert_compatible(&requirements)?;
28 println!(
29 "CCCC {} ({}) is compatible with IPC v{}",
30 daemon.version, daemon.implementation, daemon.ipc_v
31 );
32 Ok(())
33}Sourcepub fn discover_in(cccc_home: Option<&Path>) -> Result<Self>
pub fn discover_in(cccc_home: Option<&Path>) -> Result<Self>
Discover a daemon under an explicit CCCC_HOME.
pub fn new(endpoint: DaemonEndpoint) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sourcepub fn endpoint(&self) -> &DaemonEndpoint
pub fn endpoint(&self) -> &DaemonEndpoint
The endpoint supplied to new or found during initial discovery.
Sourcepub fn current_endpoint(&self) -> DaemonEndpoint
pub fn current_endpoint(&self) -> DaemonEndpoint
The endpoint currently used for calls, including a successful rediscovery after daemon restart.
Sourcepub fn call(
&self,
op: &str,
args: Map<String, Value>,
) -> Result<Map<String, Value>>
pub fn call( &self, op: &str, args: Map<String, Value>, ) -> Result<Map<String, Value>>
Call any non-streaming daemon operation and return its result object.
Sourcepub fn call_raw(
&self,
op: &str,
args: Map<String, Value>,
) -> Result<DaemonResponse>
pub fn call_raw( &self, op: &str, args: Map<String, Value>, ) -> Result<DaemonResponse>
Call an operation and retain the full response envelope.
pub fn ping(&self) -> Result<PingResult>
pub fn groups(&self) -> Result<Map<String, Value>>
pub fn group_show(&self, group_id: &str) -> Result<Map<String, Value>>
pub fn send( &self, group_id: &str, text: &str, message_mode: MessageMode, by: &str, ) -> Result<Map<String, Value>>
pub fn reply( &self, group_id: &str, reply_to: &str, text: &str, by: &str, ) -> Result<Map<String, Value>>
pub fn reply_with_mode( &self, group_id: &str, reply_to: &str, text: &str, message_mode: ReplyMessageMode, by: &str, ) -> Result<Map<String, Value>>
pub fn reply_request_cancel( &self, group_id: &str, source_event_id: &str, by: &str, ) -> Result<Map<String, Value>>
pub fn message_deliver( &self, group_id: &str, source_event_id: &str, actor_ids: &[&str], by: &str, force_ambiguous: bool, ) -> Result<Map<String, Value>>
pub fn inbox_peek( &self, group_id: &str, actor_id: &str, by: &str, limit: Option<u32>, ) -> Result<Map<String, Value>>
pub fn inbox_read( &self, group_id: &str, actor_id: &str, by: &str, limit: Option<u32>, ) -> Result<Map<String, Value>>
Sourcepub fn message_history(
&self,
group_id: &str,
actor_id: &str,
by: &str,
mode: MessageHistoryMode,
query: Option<&str>,
before_event_id: Option<&str>,
limit: Option<u32>,
) -> Result<Map<String, Value>>
pub fn message_history( &self, group_id: &str, actor_id: &str, by: &str, mode: MessageHistoryMode, query: Option<&str>, before_event_id: Option<&str>, limit: Option<u32>, ) -> Result<Map<String, Value>>
Inspect actor-visible chat history without consuming Mail.
pub fn context_get(&self, group_id: &str) -> Result<Map<String, Value>>
pub fn context_get_with_detail( &self, group_id: &str, detail: ContextDetail, ) -> Result<Map<String, Value>>
pub fn context_sync( &self, group_id: &str, by: &str, operations: Vec<Value>, ) -> Result<Map<String, Value>>
pub fn context_sync_checked( &self, group_id: &str, by: &str, operations: Vec<Value>, if_version: Option<&str>, dry_run: bool, ) -> Result<Map<String, Value>>
pub fn terminal_history( &self, group_id: &str, actor_id: &str, options: &TerminalHistoryOptions, ) -> Result<TerminalHistoryResult>
pub fn terminal_since( &self, group_id: &str, actor_id: &str, after: u64, options: &TerminalSinceOptions, ) -> Result<TerminalSinceResult>
pub fn terminal_snapshot( &self, group_id: &str, actor_id: &str, options: &TerminalSnapshotOptions, ) -> Result<TerminalSnapshotResult>
Sourcepub fn term_resize(
&self,
group_id: &str,
actor_id: &str,
cols: u32,
rows: u32,
) -> Result<TerminalResizeResult>
pub fn term_resize( &self, group_id: &str, actor_id: &str, cols: u32, rows: u32, ) -> Result<TerminalResizeResult>
Resize a PTY using the normative op, with a compatibility fallback for
Rust daemon builds that temporarily exposed terminal_resize instead.
pub fn web_model_delivery_preferences_get( &self, group_id: &str, actor_id: &str, ) -> Result<WebModelDeliveryPreferencesResult>
pub fn web_model_delivery_preferences_update( &self, group_id: &str, actor_id: &str, mode: WebModelDeliveryMode, by: &str, ) -> Result<WebModelDeliveryPreferencesResult>
pub fn web_model_runtime_recover_turn( &self, group_id: &str, actor_id: &str, event_ids: &[String], ) -> Result<WebModelRuntimeRecoverTurnResult>
Sourcepub fn assert_compatible(
&self,
requirements: &CompatibilityRequirements<'_>,
) -> Result<PingResult>
pub fn assert_compatible( &self, requirements: &CompatibilityRequirements<'_>, ) -> Result<PingResult>
Validate protocol, advertised capabilities, and actual op recognition.
Examples found in repository?
examples/compat_check.rs (line 27)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = CCCCClient::discover()?;
5 let requirements = CompatibilityRequirements {
6 minimum_ipc_version: 1,
7 operations: vec![
8 "groups",
9 "group_show",
10 "send",
11 "tracked_send",
12 "reply",
13 "inbox_read",
14 "message_history",
15 "context_get",
16 "context_sync",
17 "group_preamble_get",
18 "send_files",
19 "terminal_history",
20 "term_resize",
21 "web_model_delivery_preferences_get",
22 "web_model_delivery_preferences_update",
23 "web_model_runtime_recover_turn",
24 ],
25 ..Default::default()
26 };
27 let daemon = client.assert_compatible(&requirements)?;
28 println!(
29 "CCCC {} ({}) is compatible with IPC v{}",
30 daemon.version, daemon.implementation, daemon.ipc_v
31 );
32 Ok(())
33}Source§impl CCCCClient
impl CCCCClient
pub fn connect_catalog( &self, options: &ConnectCatalogOptions, ) -> Result<Map<String, Value>>
pub fn connect_send( &self, options: &ConnectSendOptions, ) -> Result<Map<String, Value>>
Sourcepub fn connect_send_files(
&self,
options: &ConnectSendOptions,
paths: &[String],
) -> Result<Map<String, Value>>
pub fn connect_send_files( &self, options: &ConnectSendOptions, paths: &[String], ) -> Result<Map<String, Value>>
Paths are read by the daemon within the source Group’s active scope.
Trait Implementations§
Source§impl Clone for CCCCClient
impl Clone for CCCCClient
Source§fn clone(&self) -> CCCCClient
fn clone(&self) -> CCCCClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CCCCClient
impl RefUnwindSafe for CCCCClient
impl Send for CCCCClient
impl Sync for CCCCClient
impl Unpin for CCCCClient
impl UnsafeUnpin for CCCCClient
impl UnwindSafe for CCCCClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more