Skip to content

Commit

Permalink
feat #144: NetworkController 내 함수들 FirebaseRepository 내 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
minsangKang committed Jun 29, 2024
1 parent 138d552 commit 1a7e0db
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Project_Timer/Data/Repository/FirebaseRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,32 @@ final class FirebaseRepository {
.map { $0.base.value }
.catchDecodeError()
}

func getTiTiFunctions() -> AnyPublisher<[FunctionInfo], NetworkError> {
return self.api.requestPublisher(.getTiTiFunctions)
.map(FunctionResponse.self)
.map { $0.functionInfos }
.catchDecodeError()
}

func getUpdateHistorys() -> AnyPublisher<[UpdateHistoryInfo], NetworkError> {
return self.api.requestPublisher(.getUpdateHistorys)
.map(UpdateHistoryResponse.self)
.map { $0.updateInfos }
.catchDecodeError()
}

func getYoutubeLink() -> AnyPublisher<String, NetworkError> {
return self.api.requestPublisher(.getYoutubeLink)
.map(YoutubeLinkResponse.self)
.map { $0.url.value }
.catchDecodeError()
}

func getSurveys() -> AnyPublisher<[SurveyInfo], NetworkError> {
return self.api.requestPublisher(.getSurveys)
.map(SurveyResponse.self)
.map { $0.surveyInfos ?? [] }
.catchDecodeError()
}
}

0 comments on commit 1a7e0db

Please sign in to comment.