mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
50 lines
1.6 KiB
Kotlin
50 lines
1.6 KiB
Kotlin
package com.github.libretube.api
|
|
|
|
import com.github.libretube.api.obj.DeArrowBody
|
|
import com.github.libretube.api.obj.PipedInstance
|
|
import com.github.libretube.api.obj.SubmitSegmentResponse
|
|
import com.github.libretube.obj.update.UpdateInfo
|
|
import retrofit2.http.Body
|
|
import retrofit2.http.GET
|
|
import retrofit2.http.POST
|
|
import retrofit2.http.Query
|
|
import retrofit2.http.Url
|
|
|
|
private const val GITHUB_API_URL = "https://api.github.com/repos/libre-tube/LibreTube/releases/latest"
|
|
private const val SB_API_URL = "https://sponsor.ajay.app"
|
|
|
|
interface ExternalApi {
|
|
// only for fetching servers list
|
|
@GET
|
|
suspend fun getInstances(@Url url: String): List<PipedInstance>
|
|
|
|
// fetch latest version info
|
|
@GET(GITHUB_API_URL)
|
|
suspend fun getLatestRelease(): UpdateInfo
|
|
|
|
@POST("$SB_API_URL/api/skipSegments")
|
|
suspend fun submitSegment(
|
|
@Query("videoID") videoId: String,
|
|
@Query("userID") userID: String,
|
|
@Query("userAgent") userAgent: String,
|
|
@Query("startTime") startTime: Float,
|
|
@Query("endTime") endTime: Float,
|
|
@Query("category") category: String,
|
|
@Query("duration") duration: Float? = null,
|
|
@Query("description") description: String = ""
|
|
): List<SubmitSegmentResponse>
|
|
|
|
@POST("$SB_API_URL/api/branding")
|
|
suspend fun submitDeArrow(@Body body: DeArrowBody)
|
|
|
|
/**
|
|
* @param score: 0 for downvote, 1 for upvote, 20 for undoing previous vote (if existent)
|
|
*/
|
|
@POST("$SB_API_URL/api/voteOnSponsorTime")
|
|
suspend fun voteOnSponsorTime(
|
|
@Query("UUID") uuid: String,
|
|
@Query("userID") userID: String,
|
|
@Query("type") score: Int
|
|
)
|
|
}
|