Struct Conversations

Source
pub struct Conversations {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

Source§

impl Conversations

Source

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 page
  • page_token: Option<String>: Token to use to request the next page
  • q: Option<String>: Search query object with a property statuses, whose value should be a list of conversation statuses (assigned, unassigned, archived, or deleted).
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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}

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(())
}

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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(())
}
Source

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 page
  • page_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(())
}
Source

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 page
  • page_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(())
}
Source

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(())
}
Source

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 page
  • page_token: Option<String>: Token to use to request the next page
  • query: &'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

Source§

fn clone(&self) -> Conversations

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Conversations

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoResult<T> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more