dm-10
This commit is contained in:
parent
210bccb4ea
commit
a1982de47a
2 changed files with 50 additions and 1 deletions
|
|
@ -84,4 +84,10 @@ interface TecnologiaApi {
|
||||||
@GET("api/dm/rooms")
|
@GET("api/dm/rooms")
|
||||||
suspend fun getChatRooms(): Response<RoomListResponse>
|
suspend fun getChatRooms(): Response<RoomListResponse>
|
||||||
|
|
||||||
|
// Get dm message
|
||||||
|
@GET("api/dm/{room_id}/messages")
|
||||||
|
suspend fun getChatMessages(
|
||||||
|
@Path("room_id") roomId: String
|
||||||
|
): Response<MessageResponse>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -72,3 +72,46 @@ val Partner.fullContactAvatarUrl: Any
|
||||||
} else {
|
} else {
|
||||||
"http://192.168.0.217$avatarUrl" // 否則補上 Base URL
|
"http://192.168.0.217$avatarUrl" // 否則補上 Base URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Message DM
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
|
data class MessageResponse(
|
||||||
|
@Json(name = "has_more") val hasMore: Boolean,
|
||||||
|
@Json(name = "limit") val limit: Int,
|
||||||
|
@Json(name = "messages") val messages: List<Message>,
|
||||||
|
@Json(name = "next_cursor") val nextCursor: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
|
data class Message(
|
||||||
|
@Json(name = "id") val id: String,
|
||||||
|
@Json(name = "chat_room_id") val chatRoomId: String,
|
||||||
|
@Json(name = "sender_id") val senderId: String,
|
||||||
|
@Json(name = "content") val content: String,
|
||||||
|
@Json(name = "type") val type: String,
|
||||||
|
@Json(name = "created_at") val createdAt: String,
|
||||||
|
@Json(name = "edited_at") val editedAt: String? = null,
|
||||||
|
@Json(name = "deleted_at") val deletedAt: String? = null,
|
||||||
|
@Json(name = "is_edited") val isEdited: Boolean,
|
||||||
|
@Json(name = "is_deleted") val isDeleted: Boolean,
|
||||||
|
@Json(name = "reply_to_id") val replyToId: String? = null,
|
||||||
|
@Json(name = "forwarded_from_id") val forwardedFromId: String? = null,
|
||||||
|
@Json(name = "forwarded_from_room_id") val forwardedFromRoomId: String? = null,
|
||||||
|
@Json(name = "attachment") val attachment: Attachment? = null,
|
||||||
|
@Json(name = "reactions") val reactions: List<Reaction> = emptyList() // 若 API 沒給此欄位,給予空列表
|
||||||
|
){
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
|
data class Attachment(
|
||||||
|
@Json(name = "filename") val filename: String,
|
||||||
|
@Json(name = "mime_type") val mimeType: String,
|
||||||
|
@Json(name = "size") val size: Long
|
||||||
|
)
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
|
data class Reaction(
|
||||||
|
@Json(name = "emoji") val emoji: String,
|
||||||
|
@Json(name = "count") val count: Int,
|
||||||
|
@Json(name = "me_reacted") val meReacted: Boolean
|
||||||
|
)
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue