pub struct MessagesClient { /* private fields */ }Expand description
Access to the /v1/relay/messages endpoints.
Obtain via Relay::messages.
Implementations§
Source§impl MessagesClient
impl MessagesClient
Sourcepub async fn send(&self, params: SendMessageParams) -> Result<Message, Error>
pub async fn send(&self, params: SendMessageParams) -> Result<Message, Error>
Send an event to all subscribed endpoints.
Maps to POST /v1/relay/messages.
§Example
use nautilus_rs::{Relay, SendMessageParams};
use serde_json::json;
let relay = Relay::new("vrn_relay_live_sk_…");
let msg = relay.messages().send(SendMessageParams {
event_type: "user.signed_up".into(),
payload: json!({ "user_id": "usr_abc" }),
..Default::default()
}).await?;
println!("message id: {}", msg.id);Sourcepub async fn list(
&self,
params: ListMessagesParams,
) -> Result<Paginated<Message>, Error>
pub async fn list( &self, params: ListMessagesParams, ) -> Result<Paginated<Message>, Error>
Retrieve a paginated list of past messages.
Maps to GET /v1/relay/messages.
§Example
use nautilus_rs::{Relay, ListMessagesParams};
let relay = Relay::new("vrn_relay_live_sk_…");
let page = relay.messages().list(ListMessagesParams {
limit: Some(20),
event_type: Some("order.placed".into()),
..Default::default()
}).await?;
for msg in &page.data {
println!("{} — {}", msg.timestamp, msg.event_type);
}Auto Trait Implementations§
impl !RefUnwindSafe for MessagesClient
impl !UnwindSafe for MessagesClient
impl Freeze for MessagesClient
impl Send for MessagesClient
impl Sync for MessagesClient
impl Unpin for MessagesClient
impl UnsafeUnpin for MessagesClient
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