Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,6 @@ fabric.properties

### AndroidStudio Patch ###

!/gradle/wrapper/gradle-wrapper.jar
!/gradle/wrapper/gradle-wrapper.jar

.DS_store
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package com.into.websoso.core.network.datasource.feed

import com.into.websoso.core.network.datasource.feed.model.request.CommentRequestDto
import com.into.websoso.core.network.datasource.feed.model.response.CommentsResponseDto
import com.into.websoso.core.network.datasource.feed.model.response.FeedDetailResponseDto
import com.into.websoso.core.network.datasource.feed.model.response.FeedsResponseDto
import com.into.websoso.core.network.datasource.feed.model.response.PopularFeedsResponseDto
import com.into.websoso.core.network.datasource.feed.model.response.UserInterestFeedsResponseDto
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query

internal interface FeedApi {
@GET("feeds")
suspend fun getFeeds(
@Query("category") category: String?,
@Query("lastFeedId") lastFeedId: Long,
@Query("size") size: Int,
): FeedsResponseDto

@Multipart
@POST("feeds")
suspend fun postFeed(
@Part feedRequestDto: MultipartBody.Part,
@Part images: List<MultipartBody.Part>?,
)

@Multipart
@PUT("feeds/{feedId}")
suspend fun putFeed(
@Path("feedId") feedId: Long,
@Part feedRequestDto: MultipartBody.Part,
@Part images: List<MultipartBody.Part>?,
)

@GET("feeds/{feedId}")
suspend fun getFeed(
@Path("feedId") feedId: Long,
): FeedDetailResponseDto

@GET("feeds/popular")
suspend fun getPopularFeeds(): PopularFeedsResponseDto

@GET("feeds/interest")
suspend fun getUserInterestFeeds(): UserInterestFeedsResponseDto

@DELETE("feeds/{feedId}")
suspend fun deleteFeed(
@Path("feedId") feedId: Long,
)

@POST("feeds/{feedId}/spoiler")
suspend fun postSpoilerFeed(
@Path("feedId") feedId: Long,
)

@POST("feeds/{feedId}/impertinence")
suspend fun postImpertinenceFeed(
@Path("feedId") feedId: Long,
)

@POST("feeds/{feedId}/likes")
suspend fun postLikes(
@Path("feedId") feedId: Long,
)

@DELETE("feeds/{feedId}/likes")
suspend fun deleteLikes(
@Path("feedId") feedId: Long,
)

@GET("feeds/{feedId}/comments")
suspend fun getComments(
@Path("feedId") feedId: Long,
): CommentsResponseDto

@POST("feeds/{feedId}/comments")
suspend fun postComment(
@Path("feedId") feedId: Long,
@Body commentRequestDto: CommentRequestDto,
)

@PUT("feeds/{feedId}/comments/{commentId}")
suspend fun putComment(
@Path("feedId") feedId: Long,
@Path("commentId") commentId: Long,
@Body commentRequestDto: CommentRequestDto,
)

@DELETE("feeds/{feedId}/comments/{commentId}")
suspend fun deleteComment(
@Path("feedId") feedId: Long,
@Path("commentId") commentId: Long,
)

@POST("feeds/{feedId}/comments/{commentId}/spoiler")
suspend fun postSpoilerComment(
@Path("feedId") feedId: Long,
@Path("commentId") commentId: Long,
)

@POST("feeds/{feedId}/comments/{commentId}/impertinence")
suspend fun postImpertinenceComment(
@Path("feedId") feedId: Long,
@Path("commentId") commentId: Long,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.into.websoso.core.network.datasource.feed.model.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class CommentRequestDto(
@SerialName("commentContent") val commentContent: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class CommentResponseDto(
@SerialName("userId")
val userId: Long,
@SerialName("nickname")
val nickname: String,
@SerialName("avatarImage")
val avatarImage: String,
@SerialName("commentId")
val commentId: Long,
@SerialName("createdDate")
val createdDate: String,
@SerialName("commentContent")
val commentContent: String,
@SerialName("isModified")
val isModified: Boolean,
@SerialName("isMyComment")
val isMyComment: Boolean,
@SerialName("isSpoiler")
val isSpoiler: Boolean,
@SerialName("isBlocked")
val isBlocked: Boolean,
@SerialName("isHidden")
val isHidden: Boolean,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class CommentsResponseDto(
@SerialName("comments")
val comments: List<CommentResponseDto>,
@SerialName("commentsCount")
val commentsCount: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class FeedDetailResponseDto(
@SerialName("userId")
val userId: Long,
@SerialName("feedId")
val feedId: Long,
@SerialName("nickname")
val nickname: String,
@SerialName("avatarImage")
val avatarImage: String,
@SerialName("createdDate")
val createdDate: String,
@SerialName("feedContent")
val feedContent: String,
@SerialName("likeCount")
val likeCount: Int,
@SerialName("isLiked")
val isLiked: Boolean,
@SerialName("commentCount")
val commentCount: Int,
@SerialName("novelId")
val novelId: Long?,
@SerialName("title")
val title: String?,
@SerialName("novelRating")
val novelRating: Float?,
@SerialName("novelRatingCount")
val novelRatingCount: Int?,
@SerialName("relevantCategories")
val relevantCategories: List<String>,
@SerialName("isSpoiler")
val isSpoiler: Boolean,
@SerialName("isModified")
val isModified: Boolean,
@SerialName("isMyFeed")
val isMyFeed: Boolean,
@SerialName("isPublic")
val isPublic: Boolean,
@SerialName("images")
val images: List<String>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class FeedResponseDto(
@SerialName("feedId")
val feedId: Long,
@SerialName("userId")
val userId: Long,
@SerialName("nickname")
val nickname: String,
@SerialName("avatarImage")
val avatarImage: String,
@SerialName("createdDate")
val createdDate: String,
@SerialName("feedContent")
val feedContent: String,
@SerialName("likeCount")
val likeCount: Int,
@SerialName("isLiked")
val isLiked: Boolean,
@SerialName("commentCount")
val commentCount: Int,
@SerialName("novelId")
val novelId: Long?,
@SerialName("title")
val title: String?,
@SerialName("novelRating")
val novelRating: Float?,
@SerialName("novelRatingCount")
val novelRatingCount: Int?,
@SerialName("relevantCategories")
val relevantCategories: List<String>,
@SerialName("isSpoiler")
val isSpoiler: Boolean,
@SerialName("isModified")
val isModified: Boolean,
@SerialName("isMyFeed")
val isMyFeed: Boolean,
@SerialName("isPublic")
val isPublic: Boolean,
@SerialName("thumbnailUrl")
val thumbnailUrl: String?,
@SerialName("imageCount")
val imageCount: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class FeedsResponseDto(
@SerialName("category")
val category: String,
@SerialName("isLoadable")
val isLoadable: Boolean,
@SerialName("feeds")
val feeds: List<FeedResponseDto>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class PopularFeedsResponseDto(
@SerialName("popularFeeds")
val popularFeeds: List<PopularFeedResponseDto>,
) {
@Serializable
data class PopularFeedResponseDto(
@SerialName("feedId")
val feedId: Long,
@SerialName("feedContent")
val feedContent: String,
@SerialName("likeCount")
val likeCount: Int,
@SerialName("commentCount")
val commentCount: Int,
@SerialName("isSpoiler")
val isSpoiler: Boolean,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.into.websoso.core.network.datasource.feed.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class UserInterestFeedsResponseDto(
@SerialName("recommendFeeds")
val userInterestFeeds: List<UserInterestFeedResponseDto>,
@SerialName("message")
val message: String,
) {
@Serializable
data class UserInterestFeedResponseDto(
@SerialName("avatarImage")
val avatarImage: String,
@SerialName("feedContent")
val feedContent: String,
@SerialName("nickname")
val nickname: String,
@SerialName("novelId")
val novelId: Int,
@SerialName("novelImage")
val novelImage: String,
@SerialName("novelRating")
val novelRating: Double,
@SerialName("novelRatingCount")
val novelRatingCount: Int,
@SerialName("novelTitle")
val novelTitle: String,
)
}
1 change: 1 addition & 0 deletions data/feed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
15 changes: 15 additions & 0 deletions data/feed/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import com.into.websoso.setNamespace

plugins {
id("websoso.android.library")
}

android {
setNamespace("data.feed")
}

dependencies {
implementation(projects.core.common)
implementation(projects.data.account)
implementation(libs.paging.runtime)
}
Empty file added data/feed/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions data/feed/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions data/feed/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Loading