Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ package io.getstream.chat.android.client.api2.endpoint
import io.getstream.chat.android.client.api.AuthenticatedApi
import io.getstream.chat.android.client.api.QueryParams
import io.getstream.chat.android.client.api2.UrlQueryPayload
import io.getstream.chat.android.client.api2.model.dto.UnreadDto
import io.getstream.chat.android.client.api2.model.requests.QueryMembersRequest
import io.getstream.chat.android.client.api2.model.requests.SyncHistoryRequest
import io.getstream.chat.android.client.api2.model.response.QueryMembersResponse
import io.getstream.chat.android.client.api2.model.response.SearchMessagesResponse
import io.getstream.chat.android.client.api2.model.response.SyncHistoryResponse
import io.getstream.chat.android.client.call.RetrofitCall
import io.getstream.chat.android.network.models.SearchPayload
import io.getstream.chat.android.network.models.WrappedUnreadCountsResponse
import okhttp3.ResponseBody
import retrofit2.http.Body
import retrofit2.http.GET
Expand Down Expand Up @@ -56,5 +56,5 @@ internal interface GeneralApi {
): RetrofitCall<QueryMembersResponse>

@GET("/unread")
fun getUnreadCounts(): RetrofitCall<UnreadDto>
fun getUnreadCounts(): RetrofitCall<WrappedUnreadCountsResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ import io.getstream.chat.android.client.api2.model.dto.PrivacySettingsDto
import io.getstream.chat.android.client.api2.model.dto.ReadReceiptsDto
import io.getstream.chat.android.client.api2.model.dto.SearchWarningDto
import io.getstream.chat.android.client.api2.model.dto.TypingIndicatorsDto
import io.getstream.chat.android.client.api2.model.dto.UnreadChannelByTypeDto
import io.getstream.chat.android.client.api2.model.dto.UnreadChannelDto
import io.getstream.chat.android.client.api2.model.dto.UnreadDto
import io.getstream.chat.android.client.api2.model.dto.UnreadThreadDto
import io.getstream.chat.android.client.api2.model.response.BannedUserResponse
import io.getstream.chat.android.client.api2.model.response.MessageResponse
import io.getstream.chat.android.client.api2.model.response.QueryPollVotesResponse
Expand Down Expand Up @@ -135,7 +131,11 @@ import io.getstream.chat.android.network.models.AppResponseFields
import io.getstream.chat.android.network.models.BlockUsersResponse
import io.getstream.chat.android.network.models.DeviceResponse
import io.getstream.chat.android.network.models.GetApplicationResponse
import io.getstream.chat.android.network.models.UnreadCountsChannel
import io.getstream.chat.android.network.models.UnreadCountsChannelType
import io.getstream.chat.android.network.models.UnreadCountsThread
import io.getstream.chat.android.network.models.UserGroupResponse
import io.getstream.chat.android.network.models.WrappedUnreadCountsResponse
import java.util.Date
import io.getstream.chat.android.network.models.Command as CommandDto
import io.getstream.chat.android.network.models.FileUploadConfig as UploadConfigDto
Expand Down Expand Up @@ -897,32 +897,32 @@ internal class DomainMapping(
next = next,
)

internal fun UnreadDto.toDomain(): UnreadCounts = UnreadCounts(
messagesCount = total_unread_count,
threadsCount = total_unread_threads_count,
messagesCountByTeam = total_unread_count_by_team.orEmpty(),
internal fun WrappedUnreadCountsResponse.toDomain(): UnreadCounts = UnreadCounts(
messagesCount = totalUnreadCount,
threadsCount = totalUnreadThreadsCount,
messagesCountByTeam = totalUnreadCountByTeam.orEmpty(),
channels = channels.map { it.toDomain() },
threads = threads.map { it.toDomain() },
channelsByType = channel_type.map { it.toDomain() },
channelsByType = channelType.map { it.toDomain() },
)

internal fun UnreadChannelDto.toDomain(): UnreadChannel = UnreadChannel(
cid = channel_id,
messagesCount = unread_count,
lastRead = last_read,
internal fun UnreadCountsChannel.toDomain(): UnreadChannel = UnreadChannel(
cid = channelId,
messagesCount = unreadCount,
lastRead = lastRead,
)

internal fun UnreadThreadDto.toDomain(): UnreadThread = UnreadThread(
parentMessageId = parent_message_id,
messagesCount = unread_count,
lastRead = last_read,
lastReadMessageId = last_read_message_id,
internal fun UnreadCountsThread.toDomain(): UnreadThread = UnreadThread(
parentMessageId = parentMessageId,
messagesCount = unreadCount,
lastRead = lastRead,
lastReadMessageId = lastReadMessageId,
)

internal fun UnreadChannelByTypeDto.toDomain(): UnreadChannelByType = UnreadChannelByType(
channelType = channel_type,
channelsCount = channel_count,
messagesCount = unread_count,
internal fun UnreadCountsChannelType.toDomain(): UnreadChannelByType = UnreadChannelByType(
channelType = channelType,
channelsCount = channelCount,
messagesCount = unreadCount,
)

internal fun DownstreamPushPreferenceDto.toDomain(): PushPreference = PushPreference(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-chat-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport",
)

package io.getstream.chat.android.network.models

import com.squareup.moshi.Json

/**
*
*/
@com.squareup.moshi.JsonClass(generateAdapter = true)
internal data class UnreadCountsChannel(
@Json(name = "channel_id")
internal val channelId: String,

@Json(name = "last_read")
internal val lastRead: java.util.Date,

@Json(name = "unread_count")
internal val unreadCount: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-chat-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport",
)

package io.getstream.chat.android.network.models

import com.squareup.moshi.Json

/**
*
*/
@com.squareup.moshi.JsonClass(generateAdapter = true)
internal data class UnreadCountsChannelType(
@Json(name = "channel_count")
internal val channelCount: Int,

@Json(name = "channel_type")
internal val channelType: String,

@Json(name = "unread_count")
internal val unreadCount: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-chat-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport",
)

package io.getstream.chat.android.network.models

import com.squareup.moshi.Json

/**
*
*/
@com.squareup.moshi.JsonClass(generateAdapter = true)
internal data class UnreadCountsThread(
@Json(name = "last_read")
internal val lastRead: java.util.Date,

@Json(name = "last_read_message_id")
internal val lastReadMessageId: String,

@Json(name = "parent_message_id")
internal val parentMessageId: String,

@Json(name = "unread_count")
internal val unreadCount: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-chat-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport",
)

package io.getstream.chat.android.network.models

import com.squareup.moshi.Json

/**
* Basic response information
*/
@com.squareup.moshi.JsonClass(generateAdapter = true)
internal data class WrappedUnreadCountsResponse(
@Json(name = "duration")
internal val duration: String,

@Json(name = "total_unread_count")
internal val totalUnreadCount: Int,

@Json(name = "total_unread_threads_count")
internal val totalUnreadThreadsCount: Int,

@Json(name = "channel_type")
internal val channelType: List<io.getstream.chat.android.network.models.UnreadCountsChannelType> = emptyList(),

@Json(name = "channels")
internal val channels: List<io.getstream.chat.android.network.models.UnreadCountsChannel> = emptyList(),

@Json(name = "threads")
internal val threads: List<io.getstream.chat.android.network.models.UnreadCountsThread> = emptyList(),

@Json(name = "total_unread_count_by_team")
internal val totalUnreadCountByTeam: Map<String, Int>? = emptyMap(),
)
Loading
Loading