-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from ttoklip/feat/#4_honey_tips_fragment
Feat/#4 꿀팁 API 연동
- Loading branch information
Showing
85 changed files
with
5,295 additions
and
2,762 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
104 changes: 98 additions & 6 deletions
104
app/src/main/java/com/umc/ttoklip/data/api/HoneyTipApi.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,18 +1,110 @@ | ||
package com.umc.ttoklip.data.api | ||
|
||
import com.umc.ttoklip.data.model.CreateHoneyTipRequest | ||
import com.umc.ttoklip.data.model.CreateHoneyTipResponse | ||
import com.umc.ttoklip.data.model.honeytip.CreateHoneyTipResponse | ||
import com.umc.ttoklip.data.model.ResponseBody | ||
import com.umc.ttoklip.data.model.TestResponse | ||
import com.umc.ttoklip.data.model.honeytip.HoneyTipMainResponse | ||
import com.umc.ttoklip.data.model.honeytip.InquireHoneyTipResponse | ||
import com.umc.ttoklip.data.model.honeytip.InquireQuestionResponse | ||
import com.umc.ttoklip.data.model.honeytip.request.ReportRequest | ||
import okhttp3.MultipartBody | ||
import okhttp3.RequestBody | ||
import retrofit2.Response | ||
import retrofit2.http.Body | ||
import retrofit2.http.DELETE | ||
import retrofit2.http.GET | ||
import retrofit2.http.Multipart | ||
import retrofit2.http.PATCH | ||
import retrofit2.http.POST | ||
import retrofit2.http.Part | ||
import retrofit2.http.Path | ||
|
||
interface HoneyTipApi { | ||
@GET("/") | ||
suspend fun testGet(): Response<TestResponse> | ||
@GET("/api/v1/common/main") | ||
suspend fun getHoneyTipMain(): Response<ResponseBody<HoneyTipMainResponse>> | ||
|
||
//꿀팁 | ||
@Multipart | ||
@POST("/api/v1/honeytips/posts") | ||
suspend fun postNewHoneyTip(@Body request: CreateHoneyTipRequest): Response<ResponseBody<CreateHoneyTipResponse>> | ||
suspend fun postNewHoneyTip( | ||
@Part("title") title: RequestBody, | ||
@Part("content") content: RequestBody, | ||
@Part("category") category: RequestBody, | ||
@Part images: Array<MultipartBody.Part>, | ||
@Part("url") url: RequestBody | ||
): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@GET("/api/v1/honeytips/posts/{postId}") | ||
suspend fun getHoneyTip(@Path("postId") honeyTipId: Int): Response<ResponseBody<InquireHoneyTipResponse>> | ||
|
||
@POST("/api/v1/honeytips/posts/scrap/{postId}") | ||
suspend fun postHoneyTipScrap(@Path("postId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@DELETE("/api/v1/honeytips/posts/scrap/{postId}") | ||
suspend fun deleteHoneyTipScrap(@Path("postId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@POST("/api/v1/honeytips/posts/report/{postId}") | ||
suspend fun postReportHoneyTip( | ||
@Path("postId") honeyTipId: Int, | ||
@Body request: ReportRequest | ||
): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@POST("/api/v1/honeytips/posts/like/{postId}") | ||
suspend fun postLikeHoneyTip(@Path("postId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@DELETE("/api/v1/honeytips/posts/like/{postId}") | ||
suspend fun deleteLikeHoneyTip(@Path("postId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@DELETE("/api/v1/honeytips/posts/{postId}") | ||
suspend fun deleteHoneyTip(@Path("postId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@Multipart | ||
@PATCH("/api/v1/honeytips/posts/{postId}") | ||
suspend fun patchHoneyTip( | ||
@Path("postId") honeyTipId: Int, | ||
@Part("title") title: RequestBody, | ||
@Part("content") content: RequestBody, | ||
@Part("category") category: RequestBody, | ||
@Part images: Array<MultipartBody.Part>, | ||
@Part("url") url: RequestBody | ||
): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
//꿀팁 댓글 | ||
@POST("/api/v1/honeytip/comment/{postId}") | ||
suspend fun postCommentHoneyTip(@Path("postId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@POST("/api/v1/honeytip/comment/report/{commentId}") | ||
suspend fun postReportCommentHoneyTip(@Path("commentId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@DELETE("/api/v1/honeytip/comment/{commentId}") | ||
suspend fun deleteCommentHoneyTip(@Path("commentId") honeyTipId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
|
||
//질문 | ||
@Multipart | ||
@POST("/api/v1/question/post") | ||
suspend fun postNewQuestion( | ||
@Part("title") title: RequestBody, | ||
@Part("content") content: RequestBody, | ||
@Part("category") category: RequestBody, | ||
@Part images: Array<MultipartBody.Part> | ||
): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@GET("/api/v1/question/post/{postId}") | ||
suspend fun getQuestion(@Path("postId") questionId: Int): Response<ResponseBody<InquireQuestionResponse>> | ||
|
||
@POST("/api/v1/question/post/report/{postId}") | ||
suspend fun postReportQuestion( | ||
@Path("postId") questionId: Int, | ||
@Body request: ReportRequest | ||
): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
//질문 댓글 | ||
@POST("/api/v1/question/comment/{postId}") | ||
suspend fun postCommentQuestion(@Path("postId") questionId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@POST("/api/v1/question/comment/report/{commentId}") | ||
suspend fun postReportCommentQuestion(@Path("commentId") questionId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
|
||
@DELETE("/api/v1/question/comment/{commentId}") | ||
suspend fun deleteCommentQuestion(@Path("commentId") questionId: Int): Response<ResponseBody<CreateHoneyTipResponse>> | ||
} |
8 changes: 0 additions & 8 deletions
8
app/src/main/java/com/umc/ttoklip/data/model/CreateHoneyTipRequest.kt
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/umc/ttoklip/data/model/honeytip/CommentResponse.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,9 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class CommentResponse( | ||
val commentId: Int, | ||
val commentContent: String, | ||
val parentId: Int, | ||
val writer: String, | ||
val writtenTime: String | ||
) |
2 changes: 1 addition & 1 deletion
2
...klip/data/model/CreateHoneyTipResponse.kt → .../model/honeytip/CreateHoneyTipResponse.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
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/umc/ttoklip/data/model/honeytip/EditHoneyTip.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,12 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
import java.io.Serializable | ||
|
||
data class EditHoneyTip( | ||
val postId: Int, | ||
val title: String, | ||
val content: String, | ||
val category: String, | ||
val image: Array<String>, | ||
val url: String, | ||
): Serializable |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/umc/ttoklip/data/model/honeytip/HoneyTipCategory.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,8 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class HoneyTipCategory( | ||
val housework: List<HoneyTipMain>, | ||
val cooking: List<HoneyTipMain>, | ||
val safeLiving: List<HoneyTipMain>, | ||
val welfarePolicy: List<HoneyTipMain> | ||
) |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/umc/ttoklip/data/model/honeytip/HoneyTipMain.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,12 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class HoneyTipMain( | ||
val id: Int, | ||
val title: String, | ||
val content: String, | ||
val writer: String?, | ||
val likeCount: Int, | ||
val commentCount: Int, | ||
val scrapCount: Int, | ||
val writtenTime: String | ||
) |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/umc/ttoklip/data/model/honeytip/HoneyTipMainResponse.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,7 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class HoneyTipMainResponse( | ||
val questionCategory: QuestionCategory, | ||
val honeyTipCategory: HoneyTipCategory, | ||
val topFiveQuestions: List<HoneyTipMain> | ||
) |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/umc/ttoklip/data/model/honeytip/ImageUrl.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,7 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
import java.io.Serializable | ||
|
||
data class ImageUrl( | ||
val imageUrl : String | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/umc/ttoklip/data/model/honeytip/InquireHoneyTipResponse.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,14 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
|
||
data class InquireHoneyTipResponse( | ||
val honeyTipId: Int, | ||
val title: String, | ||
val content: String, | ||
val writer: String?, | ||
val writtenTime: String, | ||
val category: String, | ||
val imageUrls: List<ImageUrl>?, | ||
val commentResponse: List<CommentResponse>?, | ||
val urlResponses: List<Urls>? | ||
) |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/umc/ttoklip/data/model/honeytip/InquireQuestionResponse.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,13 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class InquireQuestionResponse( | ||
val questionId: Int, | ||
val title: String, | ||
val content: String, | ||
val writer: String?, | ||
val writtenTime: String, | ||
val category: String, | ||
val imageUrls: List<ImageUrl>?, | ||
val commentResponse: List<CommentResponse>?, | ||
val urlResponses: List<String>? | ||
) |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/umc/ttoklip/data/model/honeytip/QuestionCategory.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,8 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class QuestionCategory( | ||
val housework: List<HoneyTipMain>, | ||
val cooking: List<HoneyTipMain>, | ||
val safeLiving: List<HoneyTipMain>, | ||
val welfarePolicy: List<HoneyTipMain> | ||
) |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/umc/ttoklip/data/model/honeytip/UrlResponses.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,5 @@ | ||
package com.umc.ttoklip.data.model.honeytip | ||
|
||
data class Urls( | ||
val urls: String | ||
) |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/umc/ttoklip/data/model/honeytip/request/ReportRequest.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,6 @@ | ||
package com.umc.ttoklip.data.model.honeytip.request | ||
|
||
data class ReportRequest( | ||
val content: String, | ||
val reportType: String | ||
) |
10 changes: 0 additions & 10 deletions
10
app/src/main/java/com/umc/ttoklip/data/repository/HoneyTipRepository.kt
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
app/src/main/java/com/umc/ttoklip/data/repository/HoneyTipRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/umc/ttoklip/data/repository/honeytip/HoneyTipRepository.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,57 @@ | ||
package com.umc.ttoklip.data.repository.honeytip | ||
|
||
import com.umc.ttoklip.data.model.honeytip.CreateHoneyTipResponse | ||
import com.umc.ttoklip.data.model.honeytip.HoneyTipMainResponse | ||
import com.umc.ttoklip.data.model.honeytip.InquireHoneyTipResponse | ||
import com.umc.ttoklip.data.model.honeytip.InquireQuestionResponse | ||
import com.umc.ttoklip.data.model.honeytip.request.ReportRequest | ||
import com.umc.ttoklip.module.NetworkResult | ||
import okhttp3.MultipartBody | ||
import okhttp3.RequestBody | ||
import retrofit2.http.Body | ||
|
||
interface HoneyTipRepository { | ||
//꿀팁 | ||
suspend fun getHoneyTipMain(): NetworkResult<HoneyTipMainResponse> | ||
suspend fun createHoneyTip( | ||
title: RequestBody, | ||
content: RequestBody, | ||
category: RequestBody, | ||
images: Array<MultipartBody.Part>, | ||
url: RequestBody | ||
): NetworkResult<CreateHoneyTipResponse> | ||
|
||
suspend fun inquireHoneyTip(honeyTipId: Int): NetworkResult<InquireHoneyTipResponse> | ||
|
||
suspend fun deleteHoneyTip(honeyTipId: Int): NetworkResult<CreateHoneyTipResponse> | ||
|
||
suspend fun editHoneyTip( | ||
honeyTipId: Int, | ||
title: RequestBody, | ||
content: RequestBody, | ||
category: RequestBody, | ||
images: Array<MultipartBody.Part>, | ||
url: RequestBody | ||
): NetworkResult<CreateHoneyTipResponse> | ||
|
||
suspend fun reportHoneyTip( | ||
honeyTipId: Int, | ||
request: ReportRequest | ||
): NetworkResult<CreateHoneyTipResponse> | ||
|
||
//질문 | ||
suspend fun createQuestion( | ||
title: RequestBody, | ||
content: RequestBody, | ||
category: RequestBody, | ||
images: Array<MultipartBody.Part> | ||
): NetworkResult<CreateHoneyTipResponse> | ||
|
||
suspend fun inquireQuestion(questionId: Int): NetworkResult<InquireQuestionResponse> | ||
|
||
suspend fun reportQuestion( | ||
questionId: Int, | ||
request: ReportRequest | ||
): NetworkResult<CreateHoneyTipResponse> | ||
|
||
} |
Oops, something went wrong.