Files
forkmessager/client-mobile/stories/data/remote/api/StoryApi.kt
2026-04-16 15:41:22 +03:00

59 lines
1.9 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(
@com.google.gson.annotations.SerializedName("userId")
val userId: String?,
@com.google.gson.annotations.SerializedName("username", alternate = ["userName"])
val username: String?,
@com.google.gson.annotations.SerializedName("avatar", alternate = ["avatarUrl"])
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)