Files
sodalive-ios/SodaLive/Sources/Chat/Talk/Room/ChatRoomRepository.swift
Yu Sung f6af20bd7e feat(chat-settings-view): 대화설정
- 배경 이미지 숨김
- 대화 초기화 기능 추가
2025-09-04 10:20:22 +09:00

66 lines
2.2 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 purchaseMessage(roomId: Int, messageId: Int64) -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(
.purchaseMessage(
roomId: roomId,
messageId: messageId,
request: ChatMessagePurchaseRequest()
)
)
}
/** */
func getChatQuotaStatus() -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.getChatQuotaStatus)
}
func purchaseChatQuota() -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.purchaseChatQuota(request: ChatQuotaPurchaseRequest()))
}
func resetChatRoom(roomId: Int) -> AnyPublisher<Response, MoyaError> {
return talkApi.requestPublisher(.resetChatRoom(roomId: roomId, request: ChatRoomResetRequest()))
}
}