Module concord_core

Record Class ChatHistoryRequest

java.lang.Object
java.lang.Record
nl.andrewl.concord_core.msg.types.chat.ChatHistoryRequest
All Implemented Interfaces:
Message

public record ChatHistoryRequest(UUID channelId, String query) extends Record implements Message
A message which clients can send to the server to request some messages from the server's history of all sent messages from a particular source. Every request must provide the id of the source that messages should be fetched from, in addition to the type of source (channel, thread, dm).

The query string is a specially-formatted string that allows you to filter results to only certain messages, using different parameters that are separated by the ; character.

All query parameters are of the form param=value, where param is the case-sensitive name of the parameter, and value is the value of the parameter.

The following query parameters are supported:

  • count - Fetch up to N messages. Minimum of 1, and a server-specific maximum count, usually no higher than 1000.
  • from - ISO-8601 timestamp indicating the timestamp after which messages should be fetched. Only messages after this point in time are returned.
  • to - ISO-8601 timestamp indicating the timestamp before which messages should be fetched. Only messages before this point in time are returned.
  • id - A single message id to fetch. If this parameter is present, all others are ignored, and a list containing the single message is returned, if it could be found, otherwise an empty list.

Responses to this request are sent via ChatHistoryResponse, where the list of messages is always sorted by the timestamp.

  • Field Details

    • channelId

      private final UUID channelId
      The field for the channelId record component.
    • query

      private final String query
      The field for the query record component.
  • Constructor Details

    • ChatHistoryRequest

      public ChatHistoryRequest(UUID channelId)
    • ChatHistoryRequest

      public ChatHistoryRequest(UUID channelId, Map<String,String> params)
    • ChatHistoryRequest

      public ChatHistoryRequest(UUID channelId, String query)
      Creates an instance of a ChatHistoryRequest record class.
      Parameters:
      channelId - the value for the channelId record component
      query - the value for the query record component
  • Method Details

    • getQueryAsMap

      public Map<String,String> getQueryAsMap()
      Utility method to extract the query string's values as a key-value map.
      Returns:
      A map of the query parameters.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • channelId

      public UUID channelId()
      Returns the value of the channelId record component.
      Returns:
      the value of the channelId record component
    • query

      public String query()
      Returns the value of the query record component.
      Returns:
      the value of the query record component