56 lines
1.6 KiB
Kotlin
56 lines
1.6 KiB
Kotlin
package stories.data.remote.api
|
|
|
|
import retrofit2.http.*
|
|
import okhttp3.MultipartBody
|
|
|
|
interface StoryApi {
|
|
@GET("stories")
|
|
suspend fun getStories(): List<StoryGroupDto>
|
|
|
|
@POST("stories")
|
|
suspend fun createStory(@Body data: CreateStoryRequest): StoryResponse
|
|
|
|
@Multipart
|
|
@POST("stories/video")
|
|
suspend fun uploadVideo(@Part file: MultipartBody.Part): UploadResponse
|
|
|
|
@POST("stories/{storyId}/view")
|
|
suspend fun viewStory(@Path("storyId") storyId: String)
|
|
|
|
@POST("stories/{storyId}/reaction")
|
|
suspend fun addReaction(@Path("storyId") storyId: String, @Body body: ReactionRequest)
|
|
|
|
@POST("stories/{storyId}/reply")
|
|
suspend fun addReply(@Path("storyId") storyId: String, @Body body: ReplyRequest)
|
|
}
|
|
|
|
data class StoryGroupDto(
|
|
val userId: String,
|
|
val username: String,
|
|
val avatar: String?,
|
|
val stories: List<StoryDto>
|
|
)
|
|
|
|
data class StoryDto(
|
|
val id: String,
|
|
val type: String, // "image" | "video"
|
|
val mediaUrl: String,
|
|
val content: String?,
|
|
val createdAt: String,
|
|
val reactions: List<StoryReactionDto> = emptyList()
|
|
)
|
|
|
|
data class StoryReactionDto(val userId: String, val emoji: String)
|
|
data class CreateStoryRequest(
|
|
val type: String, // "image" | "video"
|
|
val mediaUrl: String,
|
|
val content: String? = null, // JSON metadata for stickers/text or just text
|
|
val bgColor: String? = null,
|
|
val privacy: String = "all", // "all" | "contacts" | "selected"
|
|
val isMuted: Boolean = false
|
|
)
|
|
data class ReactionRequest(val emoji: String)
|
|
data class ReplyRequest(val content: String)
|
|
data class StoryResponse(val id: String)
|
|
data class UploadResponse(val url: String)
|