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 @@ -65,7 +65,6 @@ import io.getstream.chat.android.client.api2.model.requests.SendMessageRequest
import io.getstream.chat.android.client.api2.model.requests.SyncHistoryRequest
import io.getstream.chat.android.client.api2.model.requests.TruncateChannelRequest
import io.getstream.chat.android.client.api2.model.requests.UpdateChannelRequest
import io.getstream.chat.android.client.api2.model.requests.UpdateLiveLocationRequest
import io.getstream.chat.android.client.api2.model.requests.UpdateMessageRequest
import io.getstream.chat.android.client.api2.model.requests.UpsertPushPreferencesRequest
import io.getstream.chat.android.client.api2.model.response.ChannelResponse
Expand Down Expand Up @@ -163,6 +162,7 @@ import io.getstream.chat.android.network.models.SendReactionRequest
import io.getstream.chat.android.network.models.SortParamRequest
import io.getstream.chat.android.network.models.UnblockUsersRequest
import io.getstream.chat.android.network.models.UpdateChannelPartialRequest
import io.getstream.chat.android.network.models.UpdateLiveLocationRequest
import io.getstream.chat.android.network.models.UpdateMemberPartialRequest
import io.getstream.chat.android.network.models.UpdateMessagePartialRequest
import io.getstream.chat.android.network.models.UpdatePollOptionRequest
Expand Down Expand Up @@ -1989,10 +1989,9 @@ constructor(
override fun updateLiveLocation(location: Location): Call<Location> =
userApi.updateLiveLocation(
UpdateLiveLocationRequest(
message_id = location.messageId,
messageId = location.messageId,
latitude = location.latitude,
longitude = location.longitude,
created_by_device_id = location.deviceId,
),
).mapDomain { response ->
response.toDomain()
Expand All @@ -2001,9 +2000,8 @@ constructor(
override fun stopLiveLocation(location: Location): Call<Location> =
userApi.updateLiveLocation(
UpdateLiveLocationRequest(
message_id = location.messageId,
created_by_device_id = location.deviceId,
end_at = location.endAt,
messageId = location.messageId,
endAt = location.endAt,
),
).mapDomain { response ->
response.toDomain()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ 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.DownstreamLocationDto
import io.getstream.chat.android.client.api2.model.requests.UpdateLiveLocationRequest
import io.getstream.chat.android.client.api2.model.response.LiveLocationsResponse
import io.getstream.chat.android.client.api2.model.response.QueryBlockedUsersResponse
import io.getstream.chat.android.client.api2.model.response.UpdateUsersResponse
Expand All @@ -31,6 +30,7 @@ import io.getstream.chat.android.network.models.BlockUsersResponse
import io.getstream.chat.android.network.models.QueryUsersPayload
import io.getstream.chat.android.network.models.UnblockUsersRequest
import io.getstream.chat.android.network.models.UnblockUsersResponse
import io.getstream.chat.android.network.models.UpdateLiveLocationRequest
import io.getstream.chat.android.network.models.UpdateUsersPartialRequest
import io.getstream.chat.android.network.models.UpdateUsersRequest
import retrofit2.http.Body
Expand Down

This file was deleted.

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 UpdateLiveLocationRequest(
@Json(name = "message_id")
internal val messageId: String,

@Json(name = "end_at")
internal val endAt: java.util.Date? = null,

@Json(name = "latitude")
internal val latitude: Double? = null,

@Json(name = "longitude")
internal val longitude: Double? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import io.getstream.chat.android.client.api2.model.requests.MuteUserRequest
import io.getstream.chat.android.client.api2.model.requests.PinnedMessagesRequest
import io.getstream.chat.android.client.api2.model.requests.QueryBannedUsersRequest
import io.getstream.chat.android.client.api2.model.requests.RejectInviteRequest
import io.getstream.chat.android.client.api2.model.requests.UpdateLiveLocationRequest
import io.getstream.chat.android.client.api2.model.requests.UpdateMemberPartialResponse
import io.getstream.chat.android.client.api2.model.requests.UpsertPushPreferencesRequest
import io.getstream.chat.android.client.api2.model.response.ChannelResponse
Expand Down Expand Up @@ -170,6 +169,7 @@ import io.getstream.chat.android.network.models.SortParamRequest
import io.getstream.chat.android.network.models.UnblockUsersRequest
import io.getstream.chat.android.network.models.UnblockUsersResponse
import io.getstream.chat.android.network.models.UpdateChannelPartialRequest
import io.getstream.chat.android.network.models.UpdateLiveLocationRequest
import io.getstream.chat.android.network.models.UpdateMemberPartialRequest
import io.getstream.chat.android.network.models.UpdateMessagePartialRequest
import io.getstream.chat.android.network.models.UpdatePollOptionRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import io.getstream.chat.android.client.api2.model.dto.DownstreamLocationDto
import io.getstream.chat.android.client.api2.model.dto.DownstreamReminderDto
import io.getstream.chat.android.client.api2.model.dto.HealthEventDto
import io.getstream.chat.android.client.api2.model.dto.utils.internal.ExactDate
import io.getstream.chat.android.client.api2.model.requests.UpdateLiveLocationRequest
import io.getstream.chat.android.client.api2.model.requests.UpdateMemberPartialResponse
import io.getstream.chat.android.client.api2.model.response.ChannelResponse
import io.getstream.chat.android.client.api2.model.response.EventResponse
Expand Down Expand Up @@ -84,6 +83,7 @@ import io.getstream.chat.android.network.models.Response
import io.getstream.chat.android.network.models.SearchRolesResponse
import io.getstream.chat.android.network.models.SearchUserGroupsResponse
import io.getstream.chat.android.network.models.UnblockUsersResponse
import io.getstream.chat.android.network.models.UpdateLiveLocationRequest
import io.getstream.chat.android.network.models.UpdateUserGroupResponse
import io.getstream.chat.android.positiveRandomInt
import io.getstream.chat.android.randomBoolean
Expand Down Expand Up @@ -671,10 +671,9 @@ internal object MoshiChatApiTestArguments {
run {
val location = randomLocation()
val request = UpdateLiveLocationRequest(
message_id = location.messageId,
messageId = location.messageId,
latitude = location.latitude,
longitude = location.longitude,
created_by_device_id = location.deviceId,
)
val response = DownstreamLocationDto(
message_id = location.messageId,
Expand All @@ -694,9 +693,8 @@ internal object MoshiChatApiTestArguments {
run {
val location = randomLocation()
val request = UpdateLiveLocationRequest(
message_id = location.messageId,
created_by_device_id = location.deviceId,
end_at = location.endAt,
messageId = location.messageId,
endAt = location.endAt,
)
val response = DownstreamLocationDto(
message_id = location.messageId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.
*/

package io.getstream.chat.android.client.parser2

import io.getstream.chat.android.client.parser2.testdata.UpdateLiveLocationRequestTestData
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test

internal class UpdateLiveLocationRequestAdapterTest {
private val parser = ParserFactory.createMoshiChatParser()

@Test
fun `Serialize UpdateLiveLocationRequest with new coordinates`() {
val json = parser.toJson(UpdateLiveLocationRequestTestData.coordinateUpdate)
Assertions.assertEquals(UpdateLiveLocationRequestTestData.coordinateUpdateJson, json)
}

@Test
fun `Serialize UpdateLiveLocationRequest that stops sharing`() {
val json = parser.toJson(UpdateLiveLocationRequestTestData.stopSharing)
Assertions.assertEquals(UpdateLiveLocationRequestTestData.stopSharingJson, json)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.
*/

package io.getstream.chat.android.client.parser2.testdata

import io.getstream.chat.android.network.models.UpdateLiveLocationRequest
import org.intellij.lang.annotations.Language
import java.util.Date

internal object UpdateLiveLocationRequestTestData {

// Coordinates a 32-bit float cannot represent, so the test fails if they are ever narrowed.
private const val LATITUDE = 37.7749295
private const val LONGITUDE = -122.4194155

@Language("JSON")
val coordinateUpdateJson =
"""{
"message_id": "messageId",
"latitude": 37.7749295,
"longitude": -122.4194155
}""".withoutWhitespace()

val coordinateUpdate = UpdateLiveLocationRequest(
messageId = "messageId",
latitude = LATITUDE,
longitude = LONGITUDE,
)

@Language("JSON")
val stopSharingJson =
"""{
"message_id": "messageId",
"end_at": "2020-06-10T11:04:31.588Z"
}""".withoutWhitespace()

val stopSharing = UpdateLiveLocationRequest(
messageId = "messageId",
endAt = Date(1591787071588),
)
}
Loading