新增房间成员管理功能
- 新增了批量添加/移除用户和智能体(Agent)到房间的API接口。 - 定义了相关的数据传输对象(DTOs),包括请求体、响应体以及成功/失败/跳过的项目。 - 在服务层(`RoomService`)实现了对这些新API的调用逻辑。 - 添加了API数据模型到领域实体模型(Entity)的转换扩展函数。
This commit is contained in:
@@ -6,7 +6,19 @@ import com.aiosman.ravenow.data.api.UpdateRoomRuleRequestBody
|
||||
import com.aiosman.ravenow.data.api.RoomRuleQuota
|
||||
import com.aiosman.ravenow.data.api.RoomRule
|
||||
import com.aiosman.ravenow.data.api.RoomRuleCreator
|
||||
import com.aiosman.ravenow.entity.AddAgentToRoomFailedItemEntity
|
||||
import com.aiosman.ravenow.entity.AddAgentToRoomItemEntity
|
||||
import com.aiosman.ravenow.entity.AddAgentToRoomResultEntity
|
||||
import com.aiosman.ravenow.entity.AddUserToRoomFailedItemEntity
|
||||
import com.aiosman.ravenow.entity.AddUserToRoomItemEntity
|
||||
import com.aiosman.ravenow.entity.AddUserToRoomResultEntity
|
||||
import com.aiosman.ravenow.entity.CreatorEntity
|
||||
import com.aiosman.ravenow.entity.RemoveAgentFromRoomFailedItemEntity
|
||||
import com.aiosman.ravenow.entity.RemoveAgentFromRoomItemEntity
|
||||
import com.aiosman.ravenow.entity.RemoveAgentFromRoomResultEntity
|
||||
import com.aiosman.ravenow.entity.RemoveUserFromRoomFailedItemEntity
|
||||
import com.aiosman.ravenow.entity.RemoveUserFromRoomItemEntity
|
||||
import com.aiosman.ravenow.entity.RemoveUserFromRoomResultEntity
|
||||
import com.aiosman.ravenow.entity.RoomEntity
|
||||
import com.aiosman.ravenow.entity.RoomRuleEntity
|
||||
import com.aiosman.ravenow.entity.RoomRuleCreatorEntity
|
||||
@@ -173,6 +185,68 @@ interface RoomService {
|
||||
roomId: Int? = null,
|
||||
trtcId: String? = null
|
||||
): RoomRuleQuotaEntity
|
||||
|
||||
// ========== Room Member Management ==========
|
||||
|
||||
/**
|
||||
* 添加用户到房间
|
||||
*
|
||||
* @param roomId 房间ID,与 trtcId 二选一
|
||||
* @param trtcId TRTC群组ID,与 roomId 二选一
|
||||
* @param openIds 要添加的用户OpenID列表
|
||||
* @return 添加结果实体
|
||||
* @throws ServiceException 添加失败时抛出异常
|
||||
*/
|
||||
suspend fun addUserToRoom(
|
||||
roomId: Int? = null,
|
||||
trtcId: String? = null,
|
||||
openIds: List<String>
|
||||
): AddUserToRoomResultEntity
|
||||
|
||||
/**
|
||||
* 添加智能体到房间
|
||||
*
|
||||
* @param roomId 房间ID,与 trtcId 二选一
|
||||
* @param trtcId TRTC群组ID,与 roomId 二选一
|
||||
* @param agentOpenIds 要添加的智能体OpenID列表
|
||||
* @return 添加结果实体
|
||||
* @throws ServiceException 添加失败时抛出异常
|
||||
*/
|
||||
suspend fun addAgentToRoom(
|
||||
roomId: Int? = null,
|
||||
trtcId: String? = null,
|
||||
agentOpenIds: List<String>
|
||||
): AddAgentToRoomResultEntity
|
||||
|
||||
/**
|
||||
* 从房间移除智能体
|
||||
*
|
||||
* @param roomId 房间ID,与 trtcId 二选一
|
||||
* @param trtcId TRTC群组ID,与 roomId 二选一
|
||||
* @param agentOpenIds 要移除的智能体OpenID列表
|
||||
* @return 移除结果实体
|
||||
* @throws ServiceException 移除失败时抛出异常
|
||||
*/
|
||||
suspend fun removeAgentFromRoom(
|
||||
roomId: Int? = null,
|
||||
trtcId: String? = null,
|
||||
agentOpenIds: List<String>
|
||||
): RemoveAgentFromRoomResultEntity
|
||||
|
||||
/**
|
||||
* 从房间移除用户
|
||||
*
|
||||
* @param roomId 房间ID,与 trtcId 二选一
|
||||
* @param trtcId TRTC群组ID,与 roomId 二选一
|
||||
* @param userIds 要移除的用户ID列表(OpenID)
|
||||
* @return 移除结果实体
|
||||
* @throws ServiceException 移除失败时抛出异常
|
||||
*/
|
||||
suspend fun removeUserFromRoom(
|
||||
roomId: Int? = null,
|
||||
trtcId: String? = null,
|
||||
userIds: List<String>
|
||||
): RemoveUserFromRoomResultEntity
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,6 +327,78 @@ class RoomServiceImpl : RoomService {
|
||||
|
||||
return data.toRoomRuleQuotaEntity()
|
||||
}
|
||||
|
||||
override suspend fun addUserToRoom(
|
||||
roomId: Int?,
|
||||
trtcId: String?,
|
||||
openIds: List<String>
|
||||
): AddUserToRoomResultEntity {
|
||||
val resp = ApiClient.api.addUserToRoom(
|
||||
com.aiosman.ravenow.data.api.AddUserToRoomRequestBody(
|
||||
roomId = roomId,
|
||||
trtcId = trtcId,
|
||||
openIds = openIds
|
||||
)
|
||||
)
|
||||
val body = resp.body() ?: throw ServiceException("添加用户到房间失败")
|
||||
val data = body.data ?: throw ServiceException("添加用户响应数据为空")
|
||||
|
||||
return data.result.toAddUserToRoomResultEntity()
|
||||
}
|
||||
|
||||
override suspend fun addAgentToRoom(
|
||||
roomId: Int?,
|
||||
trtcId: String?,
|
||||
agentOpenIds: List<String>
|
||||
): AddAgentToRoomResultEntity {
|
||||
val resp = ApiClient.api.addAgentToRoom(
|
||||
com.aiosman.ravenow.data.api.AddAgentToRoomRequestBody(
|
||||
roomId = roomId,
|
||||
trtcId = trtcId,
|
||||
agentOpenIds = agentOpenIds
|
||||
)
|
||||
)
|
||||
val body = resp.body() ?: throw ServiceException("添加智能体到房间失败")
|
||||
val data = body.data ?: throw ServiceException("添加智能体响应数据为空")
|
||||
|
||||
return data.result.toAddAgentToRoomResultEntity()
|
||||
}
|
||||
|
||||
override suspend fun removeAgentFromRoom(
|
||||
roomId: Int?,
|
||||
trtcId: String?,
|
||||
agentOpenIds: List<String>
|
||||
): RemoveAgentFromRoomResultEntity {
|
||||
val resp = ApiClient.api.removeAgentFromRoom(
|
||||
com.aiosman.ravenow.data.api.RemoveAgentFromRoomRequestBody(
|
||||
roomId = roomId,
|
||||
trtcId = trtcId,
|
||||
agentOpenIds = agentOpenIds
|
||||
)
|
||||
)
|
||||
val body = resp.body() ?: throw ServiceException("从房间移除智能体失败")
|
||||
val data = body.data ?: throw ServiceException("移除智能体响应数据为空")
|
||||
|
||||
return data.toRemoveAgentFromRoomResultEntity()
|
||||
}
|
||||
|
||||
override suspend fun removeUserFromRoom(
|
||||
roomId: Int?,
|
||||
trtcId: String?,
|
||||
userIds: List<String>
|
||||
): RemoveUserFromRoomResultEntity {
|
||||
val resp = ApiClient.api.removeUserFromRoom(
|
||||
com.aiosman.ravenow.data.api.RemoveUserFromRoomRequestBody(
|
||||
roomId = roomId,
|
||||
trtcId = trtcId,
|
||||
userIds = userIds
|
||||
)
|
||||
)
|
||||
val body = resp.body() ?: throw ServiceException("从房间移除用户失败")
|
||||
val data = body.data ?: throw ServiceException("移除用户响应数据为空")
|
||||
|
||||
return data.toRemoveUserFromRoomResultEntity()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,6 +441,128 @@ fun RoomRuleQuota.toRoomRuleQuotaEntity(): RoomRuleQuotaEntity {
|
||||
)
|
||||
}
|
||||
|
||||
// ========== Room Member Management 扩展函数 ==========
|
||||
|
||||
/**
|
||||
* AddUserToRoomResult 扩展函数,转换为 AddUserToRoomResultEntity
|
||||
*/
|
||||
fun com.aiosman.ravenow.data.api.AddUserToRoomResult.toAddUserToRoomResultEntity(): AddUserToRoomResultEntity {
|
||||
return AddUserToRoomResultEntity(
|
||||
totalCount = totalCount,
|
||||
successCount = successCount,
|
||||
failedCount = failedCount,
|
||||
skippedCount = skippedCount,
|
||||
successItems = successItems.map { it.toAddUserToRoomItemEntity() },
|
||||
failedItems = failedItems.map { it.toAddUserToRoomFailedItemEntity() },
|
||||
skippedItems = skippedItems.map { it.toAddUserToRoomItemEntity() }
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.AddUserToRoomItem.toAddUserToRoomItemEntity(): AddUserToRoomItemEntity {
|
||||
return AddUserToRoomItemEntity(
|
||||
userId = userId,
|
||||
type = type
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.AddUserToRoomFailedItem.toAddUserToRoomFailedItemEntity(): AddUserToRoomFailedItemEntity {
|
||||
return AddUserToRoomFailedItemEntity(
|
||||
userId = userId,
|
||||
type = type,
|
||||
error = error
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* AddAgentToRoomResult 扩展函数,转换为 AddAgentToRoomResultEntity
|
||||
*/
|
||||
fun com.aiosman.ravenow.data.api.AddAgentToRoomResult.toAddAgentToRoomResultEntity(): AddAgentToRoomResultEntity {
|
||||
return AddAgentToRoomResultEntity(
|
||||
totalCount = totalCount,
|
||||
successCount = successCount,
|
||||
failedCount = failedCount,
|
||||
skippedCount = skippedCount,
|
||||
successItems = successItems.map { it.toAddAgentToRoomItemEntity() },
|
||||
failedItems = failedItems.map { it.toAddAgentToRoomFailedItemEntity() },
|
||||
skippedItems = skippedItems.map { it.toAddAgentToRoomItemEntity() }
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.AddAgentToRoomItem.toAddAgentToRoomItemEntity(): AddAgentToRoomItemEntity {
|
||||
return AddAgentToRoomItemEntity(
|
||||
agentOpenId = agentOpenId,
|
||||
type = type
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.AddAgentToRoomFailedItem.toAddAgentToRoomFailedItemEntity(): AddAgentToRoomFailedItemEntity {
|
||||
return AddAgentToRoomFailedItemEntity(
|
||||
agentOpenId = agentOpenId,
|
||||
type = type,
|
||||
error = error
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* RemoveAgentFromRoomResult 扩展函数,转换为 RemoveAgentFromRoomResultEntity
|
||||
*/
|
||||
fun com.aiosman.ravenow.data.api.RemoveAgentFromRoomResult.toRemoveAgentFromRoomResultEntity(): RemoveAgentFromRoomResultEntity {
|
||||
return RemoveAgentFromRoomResultEntity(
|
||||
totalCount = totalCount,
|
||||
successCount = successCount,
|
||||
failedCount = failedCount,
|
||||
skippedCount = skippedCount,
|
||||
successItems = successItems.map { it.toRemoveAgentFromRoomItemEntity() },
|
||||
failedItems = failedItems.map { it.toRemoveAgentFromRoomFailedItemEntity() },
|
||||
skippedItems = skippedItems.map { it.toRemoveAgentFromRoomItemEntity() }
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.RemoveAgentFromRoomItem.toRemoveAgentFromRoomItemEntity(): RemoveAgentFromRoomItemEntity {
|
||||
return RemoveAgentFromRoomItemEntity(
|
||||
agentOpenId = agentOpenId,
|
||||
type = type
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.RemoveAgentFromRoomFailedItem.toRemoveAgentFromRoomFailedItemEntity(): RemoveAgentFromRoomFailedItemEntity {
|
||||
return RemoveAgentFromRoomFailedItemEntity(
|
||||
agentOpenId = agentOpenId,
|
||||
type = type,
|
||||
error = error
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* RemoveUserFromRoomResult 扩展函数,转换为 RemoveUserFromRoomResultEntity
|
||||
*/
|
||||
fun com.aiosman.ravenow.data.api.RemoveUserFromRoomResult.toRemoveUserFromRoomResultEntity(): RemoveUserFromRoomResultEntity {
|
||||
return RemoveUserFromRoomResultEntity(
|
||||
totalCount = totalCount,
|
||||
successCount = successCount,
|
||||
failedCount = failedCount,
|
||||
skippedCount = skippedCount,
|
||||
successItems = successItems.map { it.toRemoveUserFromRoomItemEntity() },
|
||||
failedItems = failedItems.map { it.toRemoveUserFromRoomFailedItemEntity() },
|
||||
skippedItems = skippedItems.map { it.toRemoveUserFromRoomItemEntity() }
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.RemoveUserFromRoomItem.toRemoveUserFromRoomItemEntity(): RemoveUserFromRoomItemEntity {
|
||||
return RemoveUserFromRoomItemEntity(
|
||||
userId = userId,
|
||||
type = type
|
||||
)
|
||||
}
|
||||
|
||||
fun com.aiosman.ravenow.data.api.RemoveUserFromRoomFailedItem.toRemoveUserFromRoomFailedItemEntity(): RemoveUserFromRoomFailedItemEntity {
|
||||
return RemoveUserFromRoomFailedItemEntity(
|
||||
userId = userId,
|
||||
type = type,
|
||||
error = error
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -274,6 +274,260 @@ data class RemoveAccountRequestBody(
|
||||
val password: String,
|
||||
)
|
||||
|
||||
// ========== Room Member Management 相关数据类 ==========
|
||||
|
||||
/**
|
||||
* 添加用户到房间请求体
|
||||
* @param roomId 房间ID(与trtcId互斥,二者必须提供其一)
|
||||
* @param trtcId TRTC群组ID(与roomId互斥,二者必须提供其一)
|
||||
* @param openIds 要添加的用户OpenID列表
|
||||
*/
|
||||
data class AddUserToRoomRequestBody(
|
||||
@SerializedName("roomId")
|
||||
val roomId: Int? = null,
|
||||
@SerializedName("trtcId")
|
||||
val trtcId: String? = null,
|
||||
@SerializedName("openIds")
|
||||
val openIds: List<String>
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体到房间请求体
|
||||
* @param roomId 房间ID(与trtcId互斥,二者必须提供其一)
|
||||
* @param trtcId TRTC群组ID(与roomId互斥,二者必须提供其一)
|
||||
* @param agentOpenIds 要添加的智能体OpenID列表
|
||||
*/
|
||||
data class AddAgentToRoomRequestBody(
|
||||
@SerializedName("roomId")
|
||||
val roomId: Int? = null,
|
||||
@SerializedName("trtcId")
|
||||
val trtcId: String? = null,
|
||||
@SerializedName("agentOpenIds")
|
||||
val agentOpenIds: List<String>
|
||||
)
|
||||
|
||||
/**
|
||||
* 从房间移除智能体请求体
|
||||
* @param roomId 房间ID(与trtcId互斥,二者必须提供其一)
|
||||
* @param trtcId TRTC群组ID(与roomId互斥,二者必须提供其一)
|
||||
* @param agentOpenIds 要移除的智能体OpenID列表
|
||||
*/
|
||||
data class RemoveAgentFromRoomRequestBody(
|
||||
@SerializedName("roomId")
|
||||
val roomId: Int? = null,
|
||||
@SerializedName("trtcId")
|
||||
val trtcId: String? = null,
|
||||
@SerializedName("agentOpenIds")
|
||||
val agentOpenIds: List<String>
|
||||
)
|
||||
|
||||
/**
|
||||
* 从房间移除用户请求体
|
||||
* @param roomId 房间ID(与trtcId互斥,二者必须提供其一)
|
||||
* @param trtcId TRTC群组ID(与roomId互斥,二者必须提供其一)
|
||||
* @param userIds 要移除的用户ID列表(OpenID)
|
||||
*/
|
||||
data class RemoveUserFromRoomRequestBody(
|
||||
@SerializedName("roomId")
|
||||
val roomId: Int? = null,
|
||||
@SerializedName("trtcId")
|
||||
val trtcId: String? = null,
|
||||
@SerializedName("userIds")
|
||||
val userIds: List<String>
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加用户成功项目
|
||||
*/
|
||||
data class AddUserToRoomItem(
|
||||
@SerializedName("userId")
|
||||
val userId: String,
|
||||
@SerializedName("type")
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加用户失败项目
|
||||
*/
|
||||
data class AddUserToRoomFailedItem(
|
||||
@SerializedName("userId")
|
||||
val userId: String,
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
@SerializedName("error")
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加用户到房间的结果
|
||||
*/
|
||||
data class AddUserToRoomResult(
|
||||
@SerializedName("totalCount")
|
||||
val totalCount: Int,
|
||||
@SerializedName("successCount")
|
||||
val successCount: Int,
|
||||
@SerializedName("failedCount")
|
||||
val failedCount: Int,
|
||||
@SerializedName("skippedCount")
|
||||
val skippedCount: Int,
|
||||
@SerializedName("successItems")
|
||||
val successItems: List<AddUserToRoomItem>,
|
||||
@SerializedName("failedItems")
|
||||
val failedItems: List<AddUserToRoomFailedItem>,
|
||||
@SerializedName("skippedItems")
|
||||
val skippedItems: List<AddUserToRoomItem>
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加用户到房间响应
|
||||
*/
|
||||
data class AddUserToRoomResponse(
|
||||
@SerializedName("message")
|
||||
val message: String,
|
||||
@SerializedName("operationType")
|
||||
val operationType: String,
|
||||
@SerializedName("result")
|
||||
val result: AddUserToRoomResult
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体成功项目
|
||||
*/
|
||||
data class AddAgentToRoomItem(
|
||||
@SerializedName("agentOpenId")
|
||||
val agentOpenId: String,
|
||||
@SerializedName("type")
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体失败项目
|
||||
*/
|
||||
data class AddAgentToRoomFailedItem(
|
||||
@SerializedName("agentOpenId")
|
||||
val agentOpenId: String,
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
@SerializedName("error")
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体到房间的结果
|
||||
*/
|
||||
data class AddAgentToRoomResult(
|
||||
@SerializedName("totalCount")
|
||||
val totalCount: Int,
|
||||
@SerializedName("successCount")
|
||||
val successCount: Int,
|
||||
@SerializedName("failedCount")
|
||||
val failedCount: Int,
|
||||
@SerializedName("skippedCount")
|
||||
val skippedCount: Int,
|
||||
@SerializedName("successItems")
|
||||
val successItems: List<AddAgentToRoomItem>,
|
||||
@SerializedName("failedItems")
|
||||
val failedItems: List<AddAgentToRoomFailedItem>,
|
||||
@SerializedName("skippedItems")
|
||||
val skippedItems: List<AddAgentToRoomItem>
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体到房间响应
|
||||
*/
|
||||
data class AddAgentToRoomResponse(
|
||||
@SerializedName("message")
|
||||
val message: String,
|
||||
@SerializedName("operationType")
|
||||
val operationType: String,
|
||||
@SerializedName("result")
|
||||
val result: AddAgentToRoomResult
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除智能体成功项目
|
||||
*/
|
||||
data class RemoveAgentFromRoomItem(
|
||||
@SerializedName("agentOpenId")
|
||||
val agentOpenId: String,
|
||||
@SerializedName("type")
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除智能体失败项目
|
||||
*/
|
||||
data class RemoveAgentFromRoomFailedItem(
|
||||
@SerializedName("agentOpenId")
|
||||
val agentOpenId: String,
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
@SerializedName("error")
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 从房间移除智能体的结果
|
||||
*/
|
||||
data class RemoveAgentFromRoomResult(
|
||||
@SerializedName("totalCount")
|
||||
val totalCount: Int,
|
||||
@SerializedName("successCount")
|
||||
val successCount: Int,
|
||||
@SerializedName("failedCount")
|
||||
val failedCount: Int,
|
||||
@SerializedName("skippedCount")
|
||||
val skippedCount: Int,
|
||||
@SerializedName("successItems")
|
||||
val successItems: List<RemoveAgentFromRoomItem>,
|
||||
@SerializedName("failedItems")
|
||||
val failedItems: List<RemoveAgentFromRoomFailedItem>,
|
||||
@SerializedName("skippedItems")
|
||||
val skippedItems: List<RemoveAgentFromRoomItem>
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除用户成功项目
|
||||
*/
|
||||
data class RemoveUserFromRoomItem(
|
||||
@SerializedName("userId")
|
||||
val userId: String,
|
||||
@SerializedName("type")
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除用户失败项目
|
||||
*/
|
||||
data class RemoveUserFromRoomFailedItem(
|
||||
@SerializedName("userId")
|
||||
val userId: String,
|
||||
@SerializedName("type")
|
||||
val type: String,
|
||||
@SerializedName("error")
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 从房间移除用户的结果
|
||||
*/
|
||||
data class RemoveUserFromRoomResult(
|
||||
@SerializedName("totalCount")
|
||||
val totalCount: Int,
|
||||
@SerializedName("successCount")
|
||||
val successCount: Int,
|
||||
@SerializedName("failedCount")
|
||||
val failedCount: Int,
|
||||
@SerializedName("skippedCount")
|
||||
val skippedCount: Int,
|
||||
@SerializedName("successItems")
|
||||
val successItems: List<RemoveUserFromRoomItem>,
|
||||
@SerializedName("failedItems")
|
||||
val failedItems: List<RemoveUserFromRoomFailedItem>,
|
||||
@SerializedName("skippedItems")
|
||||
val skippedItems: List<RemoveUserFromRoomItem>
|
||||
)
|
||||
|
||||
// API 错误响应(用于加入房间等接口的错误处理)
|
||||
data class ApiErrorResponse(
|
||||
@SerializedName("err")
|
||||
@@ -1605,5 +1859,132 @@ interface RaveNowAPI {
|
||||
@Query("promptReplaceTrans") promptReplaceTrans: Boolean? = null
|
||||
): Response<RecommendationsResponse>
|
||||
|
||||
// ========== Room Member Management API ==========
|
||||
|
||||
/**
|
||||
* 添加用户到房间
|
||||
*
|
||||
* 功能说明:
|
||||
* - 向房间批量添加用户
|
||||
* - 支持通过房间ID或TRTC群组ID添加
|
||||
* - 只有房间创建者可以使用此接口
|
||||
* - 添加数量受房间容量限制
|
||||
* - 成功添加后会自动扣除房间创建者的积分用于扩容
|
||||
*
|
||||
* @param body 添加用户请求体
|
||||
* - roomId: 房间ID(与 trtcId 二选一)
|
||||
* - trtcId: TRTC群组ID(与 roomId 二选一)
|
||||
* - openIds: 要添加的用户OpenID列表
|
||||
*
|
||||
* @return 成功时返回操作结果,包含成功、失败、跳过的用户列表
|
||||
*
|
||||
* 示例:
|
||||
* ```kotlin
|
||||
* val request = AddUserToRoomRequestBody(
|
||||
* roomId = 123,
|
||||
* openIds = listOf("user_openid_1", "user_openid_2")
|
||||
* )
|
||||
* val response = api.addUserToRoom(request)
|
||||
* ```
|
||||
*/
|
||||
@POST("outside/rooms/add-user")
|
||||
suspend fun addUserToRoom(
|
||||
@Body body: AddUserToRoomRequestBody
|
||||
): Response<DataContainer<AddUserToRoomResponse>>
|
||||
|
||||
/**
|
||||
* 添加智能体到房间
|
||||
*
|
||||
* 功能说明:
|
||||
* - 向房间批量添加智能体(Agent)
|
||||
* - 支持通过房间ID或TRTC群组ID添加
|
||||
* - 房间创建者可以使用此接口
|
||||
* - 当容量不足时会自动扩容并扣除房间创建者的积分
|
||||
* - 如果积分不足以支付扩容费用,将返回错误
|
||||
*
|
||||
* @param body 添加智能体请求体
|
||||
* - roomId: 房间ID(与 trtcId 二选一)
|
||||
* - trtcId: TRTC群组ID(与 roomId 二选一)
|
||||
* - agentOpenIds: 要添加的智能体OpenID列表
|
||||
*
|
||||
* @return 成功时返回操作结果,包含成功、失败、跳过的智能体列表
|
||||
*
|
||||
* 示例:
|
||||
* ```kotlin
|
||||
* val request = AddAgentToRoomRequestBody(
|
||||
* roomId = 123,
|
||||
* agentOpenIds = listOf("agent_openid_1", "agent_openid_2")
|
||||
* )
|
||||
* val response = api.addAgentToRoom(request)
|
||||
* ```
|
||||
*/
|
||||
@POST("outside/rooms/add-agent")
|
||||
suspend fun addAgentToRoom(
|
||||
@Body body: AddAgentToRoomRequestBody
|
||||
): Response<DataContainer<AddAgentToRoomResponse>>
|
||||
|
||||
/**
|
||||
* 从房间移除智能体
|
||||
*
|
||||
* 功能说明:
|
||||
* - 从房间批量移除智能体(Agent)
|
||||
* - 支持通过房间ID或TRTC群组ID操作
|
||||
* - 只有房间创建者可以使用此接口
|
||||
* - 单聊房间不支持移除智能体
|
||||
* - 移除操作会同步到OpenIM系统
|
||||
*
|
||||
* @param body 移除智能体请求体
|
||||
* - roomId: 房间ID(与 trtcId 二选一)
|
||||
* - trtcId: TRTC群组ID(与 roomId 二选一)
|
||||
* - agentOpenIds: 要移除的智能体OpenID列表
|
||||
*
|
||||
* @return 成功时返回操作结果,包含成功、失败、跳过的智能体列表
|
||||
*
|
||||
* 示例:
|
||||
* ```kotlin
|
||||
* val request = RemoveAgentFromRoomRequestBody(
|
||||
* roomId = 123,
|
||||
* agentOpenIds = listOf("agent_openid_1", "agent_openid_2")
|
||||
* )
|
||||
* val response = api.removeAgentFromRoom(request)
|
||||
* ```
|
||||
*/
|
||||
@POST("outside/rooms/remove-agent")
|
||||
suspend fun removeAgentFromRoom(
|
||||
@Body body: RemoveAgentFromRoomRequestBody
|
||||
): Response<DataContainer<RemoveAgentFromRoomResult>>
|
||||
|
||||
/**
|
||||
* 从房间移除用户
|
||||
*
|
||||
* 功能说明:
|
||||
* - 从房间批量移除用户
|
||||
* - 支持通过房间ID或TRTC群组ID操作
|
||||
* - 只有房间创建者可以使用此接口
|
||||
* - 单聊房间不支持移除用户
|
||||
* - 群主不能移除自己
|
||||
* - 移除操作会同步到OpenIM系统
|
||||
*
|
||||
* @param body 移除用户请求体
|
||||
* - roomId: 房间ID(与 trtcId 二选一)
|
||||
* - trtcId: TRTC群组ID(与 roomId 二选一)
|
||||
* - userIds: 要移除的用户ID列表(OpenID)
|
||||
*
|
||||
* @return 成功时返回操作结果,包含成功、失败、跳过的用户列表
|
||||
*
|
||||
* 示例:
|
||||
* ```kotlin
|
||||
* val request = RemoveUserFromRoomRequestBody(
|
||||
* roomId = 123,
|
||||
* userIds = listOf("user_openid_1", "user_openid_2")
|
||||
* )
|
||||
* val response = api.removeUserFromRoom(request)
|
||||
* ```
|
||||
*/
|
||||
@POST("outside/rooms/remove-user")
|
||||
suspend fun removeUserFromRoom(
|
||||
@Body body: RemoveUserFromRoomRequestBody
|
||||
): Response<DataContainer<RemoveUserFromRoomResult>>
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,128 @@ data class RoomRuleQuotaEntity(
|
||||
val usagePercent: Double
|
||||
)
|
||||
|
||||
// ========== Room Member Management 实体类 ==========
|
||||
|
||||
/**
|
||||
* 添加用户成功项目
|
||||
*/
|
||||
data class AddUserToRoomItemEntity(
|
||||
val userId: String,
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加用户失败项目
|
||||
*/
|
||||
data class AddUserToRoomFailedItemEntity(
|
||||
val userId: String,
|
||||
val type: String,
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加用户到房间的结果
|
||||
*/
|
||||
data class AddUserToRoomResultEntity(
|
||||
val totalCount: Int,
|
||||
val successCount: Int,
|
||||
val failedCount: Int,
|
||||
val skippedCount: Int,
|
||||
val successItems: List<AddUserToRoomItemEntity>,
|
||||
val failedItems: List<AddUserToRoomFailedItemEntity>,
|
||||
val skippedItems: List<AddUserToRoomItemEntity>
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体成功项目
|
||||
*/
|
||||
data class AddAgentToRoomItemEntity(
|
||||
val agentOpenId: String,
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体失败项目
|
||||
*/
|
||||
data class AddAgentToRoomFailedItemEntity(
|
||||
val agentOpenId: String,
|
||||
val type: String,
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 添加智能体到房间的结果
|
||||
*/
|
||||
data class AddAgentToRoomResultEntity(
|
||||
val totalCount: Int,
|
||||
val successCount: Int,
|
||||
val failedCount: Int,
|
||||
val skippedCount: Int,
|
||||
val successItems: List<AddAgentToRoomItemEntity>,
|
||||
val failedItems: List<AddAgentToRoomFailedItemEntity>,
|
||||
val skippedItems: List<AddAgentToRoomItemEntity>
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除智能体成功项目
|
||||
*/
|
||||
data class RemoveAgentFromRoomItemEntity(
|
||||
val agentOpenId: String,
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除智能体失败项目
|
||||
*/
|
||||
data class RemoveAgentFromRoomFailedItemEntity(
|
||||
val agentOpenId: String,
|
||||
val type: String,
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 从房间移除智能体的结果
|
||||
*/
|
||||
data class RemoveAgentFromRoomResultEntity(
|
||||
val totalCount: Int,
|
||||
val successCount: Int,
|
||||
val failedCount: Int,
|
||||
val skippedCount: Int,
|
||||
val successItems: List<RemoveAgentFromRoomItemEntity>,
|
||||
val failedItems: List<RemoveAgentFromRoomFailedItemEntity>,
|
||||
val skippedItems: List<RemoveAgentFromRoomItemEntity>
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除用户成功项目
|
||||
*/
|
||||
data class RemoveUserFromRoomItemEntity(
|
||||
val userId: String,
|
||||
val type: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 移除用户失败项目
|
||||
*/
|
||||
data class RemoveUserFromRoomFailedItemEntity(
|
||||
val userId: String,
|
||||
val type: String,
|
||||
val error: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 从房间移除用户的结果
|
||||
*/
|
||||
data class RemoveUserFromRoomResultEntity(
|
||||
val totalCount: Int,
|
||||
val successCount: Int,
|
||||
val failedCount: Int,
|
||||
val skippedCount: Int,
|
||||
val successItems: List<RemoveUserFromRoomItemEntity>,
|
||||
val failedItems: List<RemoveUserFromRoomFailedItemEntity>,
|
||||
val skippedItems: List<RemoveUserFromRoomItemEntity>
|
||||
)
|
||||
|
||||
class RoomLoader : DataLoader<AgentEntity,AgentLoaderExtraArgs>() {
|
||||
override suspend fun fetchData(
|
||||
page: Int,
|
||||
|
||||
Reference in New Issue
Block a user