pub struct Client { /* private fields */ }Expand description
Client for Compose Channels
Channel linking, status, and disconnect for WhatsApp, Telegram, Slack, and Discord.
The channels service runs at https://services.compose.market.
Version: 0.8.6
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: Client) -> Self
pub fn new_with_client(baseurl: &str, client: Client) -> Self
Construct a new client with an existing reqwest::Client,
allowing more control over its configuration.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub fn list(&self) -> List<'_>
pub fn list(&self) -> List<'_>
List available channels
Sends a GET request to /channels
let response = client.list()
.send()
.await;Sourcepub fn slack_manifest(&self) -> SlackManifest<'_>
pub fn slack_manifest(&self) -> SlackManifest<'_>
Get Slack app manifest
Sends a GET request to /channels/slack/manifest
let response = client.slack_manifest()
.send()
.await;Sourcepub fn get(&self) -> Get<'_>
pub fn get(&self) -> Get<'_>
Get channel info and available endpoints
Sends a GET request to /channels/{channel}
let response = client.get()
.channel(channel)
.send()
.await;Sourcepub fn disconnect(&self) -> Disconnect<'_>
pub fn disconnect(&self) -> Disconnect<'_>
Disconnect routes for a channel
Sends a POST request to /channels/{channel}/disconnect
let response = client.disconnect()
.channel(channel)
.body(body)
.send()
.await;Sourcepub fn link(&self) -> Link<'_>
pub fn link(&self) -> Link<'_>
Create a linking code for a channel
Generates a short-lived linking code that pairs a user’s wallet with an agent on the specified channel. The response includes a URL or action that the user must follow to complete the linking process (QR code for WhatsApp, OAuth redirect for Slack/Discord, bot link for Telegram).
Sends a POST request to /channels/{channel}/link
let response = client.link()
.channel(channel)
.body(body)
.send()
.await;Sourcepub fn status(&self) -> Status<'_>
pub fn status(&self) -> Status<'_>
Check connection status and list routes
Sends a GET request to /channels/{channel}/status
Arguments:
channelaccount_idagent_wallethai_id: Required when scope is local.scope: Route scope. Omit or use global for hosted/global ties; use local with haiId for HAI-bound local ties.thread_iduser_address
let response = client.status()
.channel(channel)
.account_id(account_id)
.agent_wallet(agent_wallet)
.hai_id(hai_id)
.scope(scope)
.thread_id(thread_id)
.user_address(user_address)
.send()
.await;