pub struct Messages {
pub client: Client,
}
Fields§
§client: Client
Implementations§
Source§impl Messages
impl Messages
Sourcepub async fn reply_to_conversation<'a>(
&'a self,
conversation_id: &'a str,
body: &OutboundReplyMessage,
) -> Result<MessageResponse, Error>
pub async fn reply_to_conversation<'a>( &'a self, conversation_id: &'a str, body: &OutboundReplyMessage, ) -> Result<MessageResponse, Error>
Reply to conversation
Reply to a conversation by sending a message and appending it to the conversation.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_messages_reply_to_conversation() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::MessageResponse = client
.messages()
.reply_to_conversation(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn get<'a>(
&'a self,
message_id: &'a str,
) -> Result<MessageResponse, Error>
pub async fn get<'a>( &'a self, message_id: &'a str, ) -> Result<MessageResponse, Error>
Get message
Fetch a message.
Parameters:
message_id: &'astr
: The message ID (required)
async fn example_messages_get() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::MessageResponse = client.messages().get("some-string").await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn get_seen_status<'a>(
&'a self,
message_id: &'a str,
) -> Result<GetMessageSeenStatusResponse, Error>
pub async fn get_seen_status<'a>( &'a self, message_id: &'a str, ) -> Result<GetMessageSeenStatusResponse, Error>
Get message seen status
Get the seen receipts for the given message. If no seen-by information is available, there will be a single entry for the first time the message was seen by any recipient. If seen-by information is available, there will be an entry for each recipient who has seen the message.
Parameters:
message_id: &'astr
: The message ID (required)
async fn example_messages_get_seen_status() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::GetMessageSeenStatusResponse =
client.messages().get_seen_status("some-string").await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn mark_seen<'a>(
&'a self,
message_id: &'a str,
body: &MarkMessageSeenRequestBody,
) -> Result<(), Error>
pub async fn mark_seen<'a>( &'a self, message_id: &'a str, body: &MarkMessageSeenRequestBody, ) -> Result<(), Error>
Mark message seen
Mark an outbound message from Front as seen. Note, the message seen route should only be called in response to an actual end-user’s message-seen action. In accordance with this behavior, the route is rate limited to 10 requests per hour.
Parameters:
message_id: &'astr
: The message ID (required)
async fn example_messages_mark_seen() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.messages()
.mark_seen("some-string", &front_api::types::MarkMessageSeenRequestBody {})
.await?;
Ok(())
}
Sourcepub async fn create_conversation<'a>(
&'a self,
channel_id: &'a str,
body: &OutboundMessage,
) -> Result<MessageResponse, Error>
pub async fn create_conversation<'a>( &'a self, channel_id: &'a str, body: &OutboundMessage, ) -> Result<MessageResponse, Error>
Create conversation
Send a new message from a channel.
Parameters:
channel_id: &'astr
: The sending channel ID (required)
async fn example_messages_create_conversation() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::MessageResponse = client
.messages()
.create_conversation(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn receive_custom<'a>(
&'a self,
channel_id: &'a str,
body: &CustomMessage,
) -> Result<ReceiveCustomMessageResponse, Error>
pub async fn receive_custom<'a>( &'a self, channel_id: &'a str, body: &CustomMessage, ) -> Result<ReceiveCustomMessageResponse, Error>
Receive custom messages
Receive a custom message in Front. This endpoint is available for custom channels ONLY.
Parameters:
channel_id: &'astr
: The channel ID (required)
async fn example_messages_receive_custom() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ReceiveCustomMessageResponse = client
.messages()
.receive_custom(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn import_inbox<'a>(
&'a self,
inbox_id: &'a str,
body: &ImportMessage,
) -> Result<ImportInboxMessageResponse, Error>
pub async fn import_inbox<'a>( &'a self, inbox_id: &'a str, body: &ImportMessage, ) -> Result<ImportInboxMessageResponse, Error>
Import message
Import a new message in an inbox.
Parameters:
inbox_id: &'astr
: The Inbox ID (required)
async fn example_messages_import_inbox() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ImportInboxMessageResponse = client
.messages()
.import_inbox(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Messages
impl !RefUnwindSafe for Messages
impl Send for Messages
impl Sync for Messages
impl Unpin for Messages
impl !UnwindSafe for Messages
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more