Function wicrs_server::api::get_messages[][src]

pub async fn get_messages(
    user_id: &str,
    hub_id: ID,
    channel_id: ID,
    from: DateTime<Utc>,
    to: DateTime<Utc>,
    invert: bool,
    max: usize
) -> Result<Vec<SignedMessage>>
Expand description

Gets a set of messages between two times (both in milliseconds since Unix Epoch). If successful they are returned in an array. The array is orderd oldest message to newest unless the invert argument is true in which case the order is newest to oldest message. If there are no messages in the given time frame, an empty array is returned.

Arguments

  • user_id - ID of the user who is requesting the message.
  • hub_id - ID of the hub where the message is located.
  • channel_id - ID of the channel where the message is located.
  • from - Earliest time a message can be sent to be included in the results.
  • to - Latest time a message can be sent to be included in the results.
  • invert - If true the search is done from newest message to oldest message, if false the search is done from oldest message to newest message.
  • max - The maximum number of messages to retreive.

Errors

This function may return an error for any of the following reasons:

  • The user is not in the hub.
  • The channel could not be found in the hub.
  • The channel could not be gotten for any of the reasons outlined by Hub::get_channel.
  • The hub could not be loaded for any of the reasons outlined by Hub::load.