Files
sodalive-ios/SodaLive/Sources/Chat/Talk/Room/ChatRoomRepository.swift
Yu Sung 2576c851ee feat(chat-room) 채팅방 API
- 채팅방 입장 API 연동
- 채팅 쿼터가 없을 때 표시할 UI 추가
2025-09-04 04:25:28 +09:00

44 lines
1.4 KiB
Swift

//
// ChatRoomRepository.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import Foundation
import CombineMoya
import Combine
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)))
}
/** */
func getChatQuotaStatus() -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.getChatQuotaStatus)
}
}