feat(chat): DM 채팅 API 모델을 추가한다
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.main.chat.dm.data
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Header
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.Path
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
interface DmChatApi {
|
||||||
|
@POST("/api/v2/user-creator-chat/rooms/create")
|
||||||
|
fun createDmChatRoom(
|
||||||
|
@Header("Authorization") authHeader: String,
|
||||||
|
@Body request: CreateDmChatRoomRequest
|
||||||
|
): Single<ApiResponse<CreateDmChatRoomResponse>>
|
||||||
|
|
||||||
|
@GET("/api/v2/user-creator-chat/rooms/{roomId}/open")
|
||||||
|
fun openDmChatRoom(
|
||||||
|
@Header("Authorization") authHeader: String,
|
||||||
|
@Path("roomId") roomId: Long,
|
||||||
|
@Query("limit") limit: Int = 20
|
||||||
|
): Single<ApiResponse<DmChatRoomOpenResponse>>
|
||||||
|
|
||||||
|
@GET("/api/v2/user-creator-chat/rooms/{roomId}/messages")
|
||||||
|
fun getDmChatMessages(
|
||||||
|
@Header("Authorization") authHeader: String,
|
||||||
|
@Path("roomId") roomId: Long,
|
||||||
|
@Query("cursor") cursor: Long?,
|
||||||
|
@Query("limit") limit: Int = 20
|
||||||
|
): Single<ApiResponse<DmChatMessagesPageResponse>>
|
||||||
|
|
||||||
|
@POST("/api/v2/user-creator-chat/rooms/{roomId}/messages/text")
|
||||||
|
fun sendDmTextMessage(
|
||||||
|
@Header("Authorization") authHeader: String,
|
||||||
|
@Path("roomId") roomId: Long,
|
||||||
|
@Body request: SendDmTextMessageRequest
|
||||||
|
): Single<ApiResponse<SendDmChatMessageResponse>>
|
||||||
|
|
||||||
|
@POST("/api/v2/user-creator-chat/rooms/{roomId}/events/disconnect")
|
||||||
|
fun disconnectRealtime(
|
||||||
|
@Header("Authorization") authHeader: String,
|
||||||
|
@Path("roomId") roomId: Long
|
||||||
|
): Single<ApiResponse<Boolean>>
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.main.chat.dm.data
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class CreateDmChatRoomRequest(
|
||||||
|
@SerializedName("creatorId") val creatorId: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class CreateDmChatRoomResponse(
|
||||||
|
@SerializedName("roomId") val roomId: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class DmChatRoomOpenResponse(
|
||||||
|
@SerializedName("roomId") val roomId: Long,
|
||||||
|
@SerializedName("opponentNickname") val opponentNickname: String,
|
||||||
|
@SerializedName("opponentProfileImageUrl") val opponentProfileImageUrl: String,
|
||||||
|
@SerializedName("messages") val messages: List<DmChatMessageResponse>,
|
||||||
|
@SerializedName("hasMore") val hasMore: Boolean,
|
||||||
|
@SerializedName("nextCursor") val nextCursor: Long?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class DmChatMessagesPageResponse(
|
||||||
|
@SerializedName("messages") val messages: List<DmChatMessageResponse>,
|
||||||
|
@SerializedName("hasMore") val hasMore: Boolean,
|
||||||
|
@SerializedName("nextCursor") val nextCursor: Long?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class DmChatMessageResponse(
|
||||||
|
@SerializedName("messageId") val messageId: Long,
|
||||||
|
@SerializedName("messageType") val messageType: String,
|
||||||
|
@SerializedName("mine") val mine: Boolean,
|
||||||
|
@SerializedName("createdAt") val createdAt: Long,
|
||||||
|
@SerializedName("textMessage") val textMessage: String?,
|
||||||
|
@SerializedName("voiceMessageUrl") val voiceMessageUrl: String?,
|
||||||
|
@SerializedName("senderId") val senderId: Long,
|
||||||
|
@SerializedName("senderNickname") val senderNickname: String,
|
||||||
|
@SerializedName("senderProfileImageUrl") val senderProfileImageUrl: String
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class SendDmTextMessageRequest(
|
||||||
|
@SerializedName("textMessage") val textMessage: String
|
||||||
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class SendDmChatMessageResponse(
|
||||||
|
@SerializedName("message") val message: DmChatMessageResponse,
|
||||||
|
@SerializedName("deliveredRealtime") val deliveredRealtime: Boolean,
|
||||||
|
@SerializedName("pushSent") val pushSent: Boolean
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user