feat(chat-room) 채팅방 API

- 생성, 입장, 이전 메시지 로딩, 메시지 전송 API 추가
This commit is contained in:
Yu Sung
2025-09-04 00:49:16 +09:00
parent b74ec15de4
commit 154ca01a74
4 changed files with 86 additions and 1 deletions

View File

@@ -12,4 +12,27 @@ import Moya
class ChatRoomRepository {
private let talkApi = MoyaProvider<TalkApi>()
/**
* : +
*/
func enterChatRoom(roomId: Int, characterImageId: Int?) -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.enterChatRoom(roomId: roomId, characterImageId: characterImageId))
}
/**
* :
*/
func loadMoreMessages(roomId: Int, cursor: Int?) -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.getChatRoomMessages(roomId: roomId, cursor: cursor, limit: 20))
}
/**
* API
* - : .
* - : (ServerChatMessage) ( AI )
*/
func sendMessage(roomId: Int, message: String) -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.sendMessage(roomId: roomId, request: SendChatMessageRequest(message: message)))
}
}

View File

@@ -6,5 +6,5 @@
//
struct CreateChatRoomRequest: Encodable {
let characterId: Int64
let characterId: Int
}