diff --git a/chat-android/src/main/java/com/ably/chat/ChatApi.kt b/chat-android/src/main/java/com/ably/chat/ChatApi.kt index 339aa36b..a0cce128 100644 --- a/chat-android/src/main/java/com/ably/chat/ChatApi.kt +++ b/chat-android/src/main/java/com/ably/chat/ChatApi.kt @@ -196,8 +196,8 @@ private fun QueryOptions.toParams() = buildList { Param( "direction", when (orderBy) { - QueryOptions.MessageOrder.NewestFirst -> "backwards" - QueryOptions.MessageOrder.OldestFirst -> "forwards" + QueryOptions.ResultOrder.NewestFirst -> "backwards" + QueryOptions.ResultOrder.OldestFirst -> "forwards" }, ), ) diff --git a/chat-android/src/main/java/com/ably/chat/Messages.kt b/chat-android/src/main/java/com/ably/chat/Messages.kt index fd084504..cb072eeb 100644 --- a/chat-android/src/main/java/com/ably/chat/Messages.kt +++ b/chat-android/src/main/java/com/ably/chat/Messages.kt @@ -2,7 +2,7 @@ package com.ably.chat -import com.ably.chat.QueryOptions.MessageOrder.NewestFirst +import com.ably.chat.QueryOptions.ResultOrder.NewestFirst import com.google.gson.JsonObject import io.ably.lib.realtime.AblyRealtime import io.ably.lib.realtime.ChannelState @@ -49,7 +49,7 @@ interface Messages : EmitsDiscontinuities { start: Long? = null, end: Long? = null, limit: Int = 100, - orderBy: QueryOptions.MessageOrder = NewestFirst, + orderBy: QueryOptions.ResultOrder = NewestFirst, ): PaginatedResult /** @@ -109,12 +109,12 @@ data class QueryOptions( /** * The order of messages in the query result. */ - val orderBy: MessageOrder = NewestFirst, + val orderBy: ResultOrder = NewestFirst, ) { /** * Represents direction to query messages in. */ - enum class MessageOrder { + enum class ResultOrder { /** * The response will include messages from the start of the time window to the end. */ @@ -306,7 +306,7 @@ internal class DefaultMessages( ) } - override suspend fun get(start: Long?, end: Long?, limit: Int, orderBy: QueryOptions.MessageOrder): PaginatedResult = + override suspend fun get(start: Long?, end: Long?, limit: Int, orderBy: QueryOptions.ResultOrder): PaginatedResult = chatApi.getMessages( roomId, QueryOptions(start, end, limit, orderBy),