pub struct Conversations {
pub client: Client,
}
Fields§
§client: Client
Implementations§
Source§impl Conversations
impl Conversations
Sourcepub async fn list<'a>(
&'a self,
limit: Option<i64>,
page_token: Option<String>,
q: Option<String>,
) -> Result<ListConversationsResponse, Error>
pub async fn list<'a>( &'a self, limit: Option<i64>, page_token: Option<String>, q: Option<String>, ) -> Result<ListConversationsResponse, Error>
List conversations
List the conversations in the company in reverse chronological order (most recently updated first). For more advanced filtering, see the search endpoint.
⚠️ Deprecated field included
This endpoint returns a deprecated
last_message
field in the top-level conversation bodies listed. Please use the_links.related.last_message
field instead.
Parameters:
limit: Option<i64>
: Max number of results per pagepage_token: Option<String>
: Token to use to request the next pageq: Option<String>
: Search query object with a propertystatuses
, whose value should be a list of conversation statuses (assigned
,unassigned
,archived
, ordeleted
).
async fn example_conversations_list() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ListConversationsResponse = client
.conversations()
.list(
Some(4 as i64),
Some("some-string".to_string()),
Some("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn create<'a>(
&'a self,
body: &CreateConversation,
) -> Result<ConversationResponse, Error>
pub async fn create<'a>( &'a self, body: &CreateConversation, ) -> Result<ConversationResponse, Error>
Create conversation
Create a conversation.
⚠️ Currently, only discussions can be created with this endpoint.
async fn example_conversations_create() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ConversationResponse = client
.conversations()
.create(&serde_json::Value::String("some-string".to_string()))
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn get_by_id<'a>(
&'a self,
conversation_id: &'a str,
) -> Result<ConversationResponse, Error>
pub async fn get_by_id<'a>( &'a self, conversation_id: &'a str, ) -> Result<ConversationResponse, Error>
Get conversation
Fetch a conversation.
⚠️ Deprecated field included
This endpoint returns a deprecated
last_message
field in the main body. Please use the_links.related.last_message
field instead.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_get_by_id() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ConversationResponse =
client.conversations().get_by_id("some-string").await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn update<'a>(
&'a self,
conversation_id: &'a str,
body: &UpdateConversation,
) -> Result<(), Error>
pub async fn update<'a>( &'a self, conversation_id: &'a str, body: &UpdateConversation, ) -> Result<(), Error>
Update conversation
Update a conversation.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_update() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.update(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
Ok(())
}
Sourcepub async fn update_assignee<'a>(
&'a self,
conversation_id: &'a str,
body: &UpdateConversationAssignee,
) -> Result<(), Error>
pub async fn update_assignee<'a>( &'a self, conversation_id: &'a str, body: &UpdateConversationAssignee, ) -> Result<(), Error>
Update conversation assignee
Assign or unassign a conversation.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_update_assignee() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.update_assignee(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
Ok(())
}
Sourcepub async fn add_tag<'a>(
&'a self,
conversation_id: &'a str,
body: &TagIds,
) -> Result<(), Error>
pub async fn add_tag<'a>( &'a self, conversation_id: &'a str, body: &TagIds, ) -> Result<(), Error>
Add conversation tag
Adds one or more tags to a conversation
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_add_tag() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.add_tag(
"some-string",
&front_api::types::TagIds {
tag_ids: vec!["some-string".to_string()],
},
)
.await?;
Ok(())
}
Sourcepub async fn remove_tag<'a>(
&'a self,
conversation_id: &'a str,
body: &TagIds,
) -> Result<(), Error>
pub async fn remove_tag<'a>( &'a self, conversation_id: &'a str, body: &TagIds, ) -> Result<(), Error>
Remove conversation tag
Removes one or more tags to a conversation
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_remove_tag() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.remove_tag(
"some-string",
&front_api::types::TagIds {
tag_ids: vec!["some-string".to_string()],
},
)
.await?;
Ok(())
}
Sourcepub async fn add_link<'a>(
&'a self,
conversation_id: &'a str,
body: &AddConversationLinkRequestBody,
) -> Result<(), Error>
pub async fn add_link<'a>( &'a self, conversation_id: &'a str, body: &AddConversationLinkRequestBody, ) -> Result<(), Error>
Add conversation link
Adds one or more links to a conversation
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_add_link() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.add_link(
"some-string",
&front_api::types::AddConversationLinkRequestBody {
link_ids: Some(vec!["some-string".to_string()]),
link_external_urls: Some(vec!["some-string".to_string()]),
},
)
.await?;
Ok(())
}
Sourcepub async fn remove_link<'a>(
&'a self,
conversation_id: &'a str,
body: &RemoveConversationLinkRequestBody,
) -> Result<(), Error>
pub async fn remove_link<'a>( &'a self, conversation_id: &'a str, body: &RemoveConversationLinkRequestBody, ) -> Result<(), Error>
Remove conversation links
Removes one or more links to a conversation
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_remove_link() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.remove_link(
"some-string",
&front_api::types::RemoveConversationLinkRequestBody {
link_ids: vec!["some-string".to_string()],
},
)
.await?;
Ok(())
}
Sourcepub async fn list_inboxes<'a>(
&'a self,
conversation_id: &'a str,
) -> Result<ListConversationInboxesResponse, Error>
pub async fn list_inboxes<'a>( &'a self, conversation_id: &'a str, ) -> Result<ListConversationInboxesResponse, Error>
List conversation inboxes
List the inboxes in which a conversation is listed.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_list_inboxes() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ListConversationInboxesResponse =
client.conversations().list_inboxes("some-string").await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn list_followers<'a>(
&'a self,
conversation_id: &'a str,
) -> Result<ListConversationFollowersResponse, Error>
pub async fn list_followers<'a>( &'a self, conversation_id: &'a str, ) -> Result<ListConversationFollowersResponse, Error>
List conversation followers
List the teammates following a conversation.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_list_followers() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ListConversationFollowersResponse =
client.conversations().list_followers("some-string").await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn add_followers<'a>(
&'a self,
conversation_id: &'a str,
body: &AddConversationFollowersRequestBody,
) -> Result<(), Error>
pub async fn add_followers<'a>( &'a self, conversation_id: &'a str, body: &AddConversationFollowersRequestBody, ) -> Result<(), Error>
Add conversation followers
Adds teammates to the list of followers of a conversation.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_add_followers() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.add_followers(
"some-string",
&front_api::types::AddConversationFollowersRequestBody {
teammate_ids: vec!["some-string".to_string()],
},
)
.await?;
Ok(())
}
Sourcepub async fn delete_followers<'a>(
&'a self,
conversation_id: &'a str,
body: &DeleteConversationFollowersRequestBody,
) -> Result<(), Error>
pub async fn delete_followers<'a>( &'a self, conversation_id: &'a str, body: &DeleteConversationFollowersRequestBody, ) -> Result<(), Error>
Delete conversation followers
Removes teammates from the list of followers of a conversation.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_delete_followers() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.delete_followers(
"some-string",
&front_api::types::DeleteConversationFollowersRequestBody {
teammate_ids: vec!["some-string".to_string()],
},
)
.await?;
Ok(())
}
Sourcepub async fn list_messages<'a>(
&'a self,
conversation_id: &'a str,
limit: Option<i64>,
page_token: Option<String>,
) -> Result<ListConversationMessagesResponse, Error>
pub async fn list_messages<'a>( &'a self, conversation_id: &'a str, limit: Option<i64>, page_token: Option<String>, ) -> Result<ListConversationMessagesResponse, Error>
List conversation messages
List the messages in a conversation in reverse chronological order (newest first).
Parameters:
conversation_id: &'astr
: The conversation ID (required)limit: Option<i64>
: Max number of results per pagepage_token: Option<String>
: Token to use to request the next page
async fn example_conversations_list_messages() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ListConversationMessagesResponse = client
.conversations()
.list_messages(
"some-string",
Some(4 as i64),
Some("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn list_events<'a>(
&'a self,
conversation_id: &'a str,
limit: Option<i64>,
page_token: Option<String>,
) -> Result<ListConversationEventsResponse, Error>
pub async fn list_events<'a>( &'a self, conversation_id: &'a str, limit: Option<i64>, page_token: Option<String>, ) -> Result<ListConversationEventsResponse, Error>
List conversation events
List the events that occured for a conversation in reverse chronological order (newest first).
Parameters:
conversation_id: &'astr
: The conversation ID (required)limit: Option<i64>
: Max number of results per pagepage_token: Option<String>
: Token to use to request the next page
async fn example_conversations_list_events() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::ListConversationEventsResponse = client
.conversations()
.list_events(
"some-string",
Some(4 as i64),
Some("some-string".to_string()),
)
.await?;
println!("{:?}", result);
Ok(())
}
Sourcepub async fn update_reminders<'a>(
&'a self,
conversation_id: &'a str,
body: &UpdateConversationReminders,
) -> Result<(), Error>
pub async fn update_reminders<'a>( &'a self, conversation_id: &'a str, body: &UpdateConversationReminders, ) -> Result<(), Error>
Update conversation reminders
Snooze or unsnooze a conversation for the provided user. For private conversations, reminders can only be created and edited through the API for teammates that own the conversation. For shared conversations, reminders created and edited through the API are shared for all teammates within the shared inbox(es) that the conversation belongs to.
Parameters:
conversation_id: &'astr
: The conversation ID (required)
async fn example_conversations_update_reminders() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
client
.conversations()
.update_reminders(
"some-string",
&serde_json::Value::String("some-string".to_string()),
)
.await?;
Ok(())
}
Sourcepub async fn search<'a>(
&'a self,
limit: Option<i64>,
page_token: Option<String>,
query: &'a str,
) -> Result<SearchConversationsResponse, Error>
pub async fn search<'a>( &'a self, limit: Option<i64>, page_token: Option<String>, query: &'a str, ) -> Result<SearchConversationsResponse, Error>
Search conversations
Search for conversations. Response will include a count of total matches and an array of conversations in descending order by last activity. See the search syntax documentation for usage examples.
⚠️ Deprecated field included
This endpoint returns a deprecated
last_message
field in the top-level conversation bodies listed. Please use the_links.related.last_message
field instead.
Parameters:
limit: Option<i64>
: Max number of results per pagepage_token: Option<String>
: Token to use to request the next pagequery: &'astr
: Search query string. See available Conversation Search Parameters below (required)
async fn example_conversations_search() -> anyhow::Result<()> {
let client = front_api::Client::new_from_env();
let result: front_api::types::SearchConversationsResponse = client
.conversations()
.search(
Some(4 as i64),
Some("some-string".to_string()),
"some-string",
)
.await?;
println!("{:?}", result);
Ok(())
}
Trait Implementations§
Source§impl Clone for Conversations
impl Clone for Conversations
Source§fn clone(&self) -> Conversations
fn clone(&self) -> Conversations
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for Conversations
impl !RefUnwindSafe for Conversations
impl Send for Conversations
impl Sync for Conversations
impl Unpin for Conversations
impl !UnwindSafe for Conversations
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