ICMessageStore

This interface defines the methods used to persist and retrieve data related to In-App Messages from an underlying data persistence mechanism. The message store capability is enabled by passing an ICMessageStore implementation to the SDK via ICMessaging.setMessageStore.

Implementors of the interface should ensure they comply with the intentions of each method as documented below.

Methods:

deleteAll

Deletes all data from the store.

  Syntax: boolean deleteAll()

  Return Value: true if the operation is successful, otherwise false

deleteMessage

Deletes a single message that matches the provided transaction id.

  Syntax: boolean deleteMessage(String transactionId)

Parameters

ParameterTypeDescription
transactionIdStringThe transactionId of the message that should be deleted

  Return Value: true if the message was deleted otherwise false.

deleteThread

Deletes a single thread that matches the provided thread id.

  Syntax: boolean deleteThread(String threadId)

Parameters

ParameterTypeDescription
threadIdStringThe id of the thread to be deleted

  Return Value: true if the thread was deleted, otherwise false.

getMessageCount

Gets the total count of messages that belong to the provided thread id.

  Syntax: int getMessageCount(String threadId)

Parameters

ParameterTypeDescription
threadIdStringThe id of the thread whose message count should be returned.

  Return Value: The count of messages contained within the store for the provided thread id.

getThreadCount

Gets the total number of threads contained within the store.

  Syntax: int getThreadCount()

  Return Value:The count of threads contained within the store.

getUnreadMessageCount

Get the total count of unread messages that are contained within the store for the provided thread id.

  Syntax: long getUnreadMessageCount(String threadId)

Parameters

ParameterTypeDescription
threadIdStringThe id of the thread whose unread message count should be returned.

  Return Value: The count of unread messages contained within the store for the provided thread id.

getUnreadThreadCount

Gets the total number of unread threads contained within the store. A thread is considered as unread if it has at least one unread message.

  Syntax: int getUnreadThreadCount()

  Return Value:The count of unread threads contained within the store.

loadMessage

Loads a single ICMessage from the store that matches the provided transaction id.

  Syntax: ICMessage loadMessage(String transactionId)

Parameters

ParameterTypeDescription
transactionIdStringThe transaction id of the message to be retrieved from the store

  Return Value: An ICMessage instance if a match exists within the store, otherwise null

loadMessages


Loads an array of ICMessage that match the provided parameters. The result set is ordered newest to oldest.

  Syntax: ICMessage[] loadMessages(String threadId, Date submittedBefore, Date submittedAfter, int limit)

Parameters

ParameterTypeDescription
threadIdStringThe id of the thread to which the messages must belong
submittedBeforeDateFilters the result set to contain messages whose submittedAt date is before the specified date. If a null value is passed, the behavior should be similar to passing the current device date.
submittedAfterDateFilters the result set to contain messages whose submittedAt date is after the specified date. If a null value is passed, the behavior should be similar to passing the current device date.
limitintLimits the number of messages returned in the result set.

  Return Value: An array of ICMessage instances that match the provided parameters.

loadMessages


Loads an array of ICMessage that match the provided parameters. The result set is ordered newest to oldest.

  Syntax: ICMessage[] loadMessages(String threadId, Date submittedBefore, int limit)

Parameters

ParameterTypeDescription
threadIdStringThe id of the thread to which the messages must belong
submittedBeforeDateFilters the result set to contain messages whose submittedAt date is before the specified date. If a null value is passed, the behavior should be similar to passing the current device date.
limitintLimits the number of messages returned in the result set.

  Return Value: An array of ICMessage instances that match the provided parameters.

loadThread

Loads a single ICThread that matches the provided id.

   Syntax: ICThread[] loadThread(String threadId)

Parameters

ParameterqTypeDescriptioin
threadIdStringThe id of the thread to be retrieved

  Return Value: Returns an ICThread instance if a match exists within the store, otherwise null

loadThreads

Loads an array of ICThread that match the provided parameters. The result set is ordered newest to oldest.

  Syntax: ICThread[] loadThreads(Date modifiedBefore, Date modifiedAfter, int limit)

Parameters

ParameterTypeDescription
modifiedBeforeDateFilters the result set to contain threads whose modifiedDate is before the provided date. If a null value is passed, the behavior should be similar to passing the current device date.
modifiedAfterDateFilters the result set to contain threads whose modifiedDate is after the provided date. If a null value is passed, the behavior should be similar to passing the current device date.
limitintLimits the number of threads returned in the result set.

  Return Value: An array of ICThread instances that match the provided criteria.

loadThreads

Loads an array of ICThread that match the provided parameters. The result set is ordered newest to oldest.

  Syntax: ICThread[] loadThreads(Date modifiedBefore, int limit)

Parameters

ParameterTypeDescription
modifiedBeforeDateFilters the result set to contain threads whose modifiedDate is before the provided date. If a null value is passed, the behavior should be similar to passing the current device date.
limitintLimits the number of threads returned in the result set.

  Return Value: An array of ICThread instances that match the provided criteria.

loadUnreadThreads


Loads an array of unread ICThread instance, a thread is considered unread if it contains at least one unread message. The result set is ordered newest to oldest.

  Syntax: ICThread[] loadUnreadThreads(int limit)

Parameters

ParameterTypeDescription
limitintLimits the number of threads returned in the result set.

  Return Value: An array of ICThread instances that match the provided criteria.

saveMessage


Saves a single ICMessage to the store.

  Syntax: boolean saveMessage(ICMessage message)

Parameters

ParameterTypeDescription
MessageICMessageThe message to be saved to the store.

  Return Value: true if the message was stored, otherwise false

saveMessages

Saves an array of ICMessage to the store.

  Syntax: boolean saveMessages(ICMessage[] messages)

Parameters

ParameterTypeDescription
messagesICMessageThe array of messages to be saved to the store

  Return Value: true if the messages were stored, otherwise false.

saveThread


Saves a single ICThread to the store.

  Syntax: boolean saveThread(ICThread thread)

Parameters

ParameterTypeDescription
threadICThreadThe thread to be saved to the store

  Return Value: true if the thread was saved, otherwise false.

saveThreads

Saves an array of ICThread instances to the store.

  Syntax: boolean saveThreads(ICThread[] threads).

Parameters

ParameterTypeDescription
threadsICThreadThe array of threads to be saved to the store

  Return Value: true if the threads were saved, otherwise false.