-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat/#63] 메인-문답-답변 API 연결
- Loading branch information
Showing
39 changed files
with
319 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/src/main/java/com/sopt/umbba_android/data/datasource/QuestionAnswerRemoteDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package com.sopt.umbba_android.data.datasource | ||
|
||
import com.sopt.umbba_android.data.model.ServicePool | ||
import com.sopt.umbba_android.data.model.request.AnswerRequestDto | ||
import retrofit2.http.Header | ||
|
||
class QuestionAnswerRemoteDataSource { | ||
private val questionAnswerService = ServicePool.questionAnswerService | ||
suspend fun getQuestionAnswer() = questionAnswerService.getQuestionAnswer() | ||
suspend fun postAnswer(answerRequestDto : AnswerRequestDto) = questionAnswerService.postAnswer(answerRequestDto) | ||
} |
7 changes: 6 additions & 1 deletion
7
app/src/main/java/com/sopt/umbba_android/data/model/request/AnswerRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
package com.sopt.umbba_android.data.model.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AnswerRequestDto( | ||
val answer: String | ||
@SerialName("answer") | ||
val answer: String? | ||
) |
6 changes: 5 additions & 1 deletion
6
app/src/main/java/com/sopt/umbba_android/data/model/response/AnswerResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package com.sopt.umbba_android.data.model.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AnswerResponseDto( | ||
val answer: String | ||
@SerialName("status") | ||
val status: Int, | ||
@SerialName("message") | ||
val message: String | ||
) |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/sopt/umbba_android/data/model/response/HomeCaseResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.sopt.umbba_android.data.model.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class HomeCaseResponseDto( | ||
@SerialName("status") | ||
val status: Int, | ||
@SerialName("message") | ||
val message: String, | ||
@SerialName("data") | ||
val data: HomeCaseData | ||
) { | ||
@Serializable | ||
data class HomeCaseData( | ||
@SerialName("response_case") | ||
val responseCase: Int, | ||
@SerialName("invite_code") | ||
val inviteCode: String?, | ||
@SerialName("invite_username") | ||
val inviteUserName: String?, | ||
@SerialName("install_url") | ||
val installUrl: String?, | ||
@SerialName("relative_user_active") | ||
val relativeUserActive: Boolean? | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
app/src/main/java/com/sopt/umbba_android/data/service/HomeService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
package com.sopt.umbba_android.data.service | ||
|
||
import com.sopt.umbba_android.data.model.response.HomeCaseResponseDto | ||
import com.sopt.umbba_android.data.model.response.HomeResponseDto | ||
import retrofit2.http.GET | ||
import retrofit2.http.Header | ||
import retrofit2.http.Headers | ||
|
||
interface HomeService { | ||
@Headers("Content-Type: application/json") | ||
@GET("/home") | ||
suspend fun getHomeData(): HomeResponseDto | ||
@Headers("Content-Type: application/json") | ||
@GET("/home/case") | ||
suspend fun getResponseCase() : HomeCaseResponseDto | ||
} |
2 changes: 2 additions & 0 deletions
2
app/src/main/java/com/sopt/umbba_android/domain/repository/HomeRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package com.sopt.umbba_android.domain.repository | ||
|
||
import com.sopt.umbba_android.data.model.response.HomeCaseResponseDto | ||
import com.sopt.umbba_android.data.model.response.HomeResponseDto | ||
|
||
interface HomeRepository { | ||
suspend fun getHomeData():Result<HomeResponseDto> | ||
suspend fun getResponseCase():Result<HomeCaseResponseDto> | ||
} |
4 changes: 3 additions & 1 deletion
4
app/src/main/java/com/sopt/umbba_android/domain/repository/QuestionAnswerRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package com.sopt.umbba_android.domain.repository | ||
|
||
import com.sopt.umbba_android.data.model.request.AnswerRequestDto | ||
import com.sopt.umbba_android.data.model.response.AnswerResponseDto | ||
import com.sopt.umbba_android.data.model.response.QuestionAnswerResponseDto | ||
|
||
interface QuestionAnswerRepository { | ||
suspend fun getQuestionAnswer(): Result<QuestionAnswerResponseDto> | ||
suspend fun postAnswer() | ||
suspend fun postAnswer(answerRequestDto: AnswerRequestDto): Result<AnswerResponseDto> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.