LibreTube/app/src/main/java/com/github/libretube/util/PipedApi.kt

164 lines
4.8 KiB
Kotlin
Raw Normal View History

2022-06-03 00:40:16 +05:30
package com.github.libretube.util
2021-12-18 16:34:14 +05:30
2022-05-21 13:32:04 +05:30
import com.github.libretube.obj.Channel
import com.github.libretube.obj.CommentsPage
2022-06-25 21:25:03 +05:30
import com.github.libretube.obj.DeleteUserRequest
2022-05-21 13:32:04 +05:30
import com.github.libretube.obj.Instances
import com.github.libretube.obj.Login
import com.github.libretube.obj.Message
import com.github.libretube.obj.Playlist
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.Playlists
import com.github.libretube.obj.SearchResult
import com.github.libretube.obj.Segments
import com.github.libretube.obj.StreamItem
import com.github.libretube.obj.Streams
import com.github.libretube.obj.Subscribe
import com.github.libretube.obj.Subscribed
import com.github.libretube.obj.Subscription
import com.github.libretube.obj.Token
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.Url
2021-12-18 16:34:14 +05:30
interface PipedApi {
@GET("trending")
suspend fun getTrending(@Query("region") region: String): List<StreamItem>
@GET("streams/{videoId}")
suspend fun getStreams(@Path("videoId") videoId: String): Streams
2021-12-28 01:37:07 +05:30
2022-05-08 03:14:29 +05:30
@GET("comments/{videoId}")
suspend fun getComments(@Path("videoId") videoId: String): CommentsPage
2022-05-16 15:41:22 +05:30
@GET("sponsors/{videoId}")
2022-05-21 13:32:04 +05:30
suspend fun getSegments(
@Path("videoId") videoId: String,
@Query("category") category: String
): Segments
2022-05-16 15:41:22 +05:30
@GET("nextpage/comments/{videoId}")
2022-05-20 03:52:10 +05:30
suspend fun getCommentsNextPage(
@Path("videoId") videoId: String,
@Query("nextpage") nextPage: String
): CommentsPage
2021-12-28 01:37:07 +05:30
@GET("search")
suspend fun getSearchResults(
@Query("q") searchQuery: String,
2021-12-28 23:41:51 +05:30
@Query("filter") filter: String
): SearchResult
2021-12-28 01:37:07 +05:30
2022-05-15 16:42:46 +05:30
@GET("nextpage/search")
suspend fun getSearchResultsNextPage(
@Query("q") searchQuery: String,
@Query("filter") filter: String,
@Query("nextpage") nextPage: String
): SearchResult
2021-12-28 01:37:07 +05:30
@GET("suggestions")
suspend fun getSuggestions(@Query("query") query: String): List<String>
2022-02-05 00:25:05 +05:30
@GET("channel/{channelId}")
suspend fun getChannel(@Path("channelId") channelId: String): Channel
2022-02-05 19:39:50 +05:30
@GET("nextpage/channel/{channelId}")
2022-05-20 03:52:10 +05:30
suspend fun getChannelNextPage(
@Path("channelId") channelId: String,
@Query("nextpage") nextPage: String
): Channel
2022-02-06 18:40:27 +05:30
@GET("playlists/{playlistId}")
suspend fun getPlaylist(@Path("playlistId") playlistId: String): Playlist
@GET("nextpage/playlists/{playlistId}")
2022-05-20 03:52:10 +05:30
suspend fun getPlaylistNextPage(
@Path("playlistId") playlistId: String,
@Query("nextpage") nextPage: String
): Playlist
2022-02-06 18:40:27 +05:30
2022-02-06 21:25:40 +05:30
@POST("login")
suspend fun login(@Body login: Login): Token
@POST("register")
suspend fun register(@Body login: Login): Token
2022-06-25 21:25:03 +05:30
@POST("user/delete")
suspend fun deleteAccount(
@Header("Authorization") token: String,
@Body password: DeleteUserRequest
): Message
2022-02-06 21:25:40 +05:30
@GET("feed")
suspend fun getFeed(@Query("authToken") token: String?): List<StreamItem>
@GET("subscribed")
2022-05-20 03:52:10 +05:30
suspend fun isSubscribed(
@Query("channelId") channelId: String,
@Header("Authorization") token: String
): Subscribed
2022-02-06 21:25:40 +05:30
@GET("subscriptions")
suspend fun subscriptions(@Header("Authorization") token: String): List<Subscription>
2022-02-09 23:40:39 +05:30
@POST("subscribe")
2022-05-21 13:32:04 +05:30
suspend fun subscribe(
@Header("Authorization") token: String,
@Body subscribe: Subscribe
): Message
2022-02-09 23:40:39 +05:30
@POST("unsubscribe")
2022-05-21 13:32:04 +05:30
suspend fun unsubscribe(
@Header("Authorization") token: String,
@Body subscribe: Subscribe
): Message
2022-02-09 23:40:39 +05:30
2022-03-31 23:04:19 +05:30
@POST("import")
2022-05-20 03:52:10 +05:30
suspend fun importSubscriptions(
@Query("override") override: Boolean,
@Header("Authorization") token: String,
@Body channels: List<String>
): Message
2022-03-31 23:04:19 +05:30
2022-06-20 22:16:00 +05:30
@POST("import/playlist")
suspend fun importPlaylist(
@Header("Authorization") token: String,
2022-06-20 23:19:12 +05:30
@Body playlistId: PlaylistId
2022-06-20 22:16:00 +05:30
): Message
2022-04-12 23:55:08 +05:30
@GET("user/playlists")
suspend fun playlists(@Header("Authorization") token: String): List<Playlists>
2022-04-15 00:21:54 +05:30
@POST("user/playlists/delete")
2022-05-21 13:32:04 +05:30
suspend fun deletePlaylist(
@Header("Authorization") token: String,
@Body playlistId: PlaylistId
): Message
2022-04-15 00:21:54 +05:30
2022-04-15 16:56:06 +05:30
@POST("user/playlists/create")
2022-05-21 13:32:04 +05:30
suspend fun createPlaylist(
@Header("Authorization") token: String,
@Body name: Playlists
): PlaylistId
2022-04-15 16:56:06 +05:30
2022-04-18 00:20:10 +05:30
@POST("user/playlists/add")
2022-05-21 13:32:04 +05:30
suspend fun addToPlaylist(
@Header("Authorization") token: String,
@Body playlistId: PlaylistId
): Message
2022-04-18 00:20:10 +05:30
@POST("user/playlists/remove")
2022-05-20 03:52:10 +05:30
suspend fun removeFromPlaylist(
@Header("Authorization") token: String,
@Body playlistId: PlaylistId
): Message
2022-04-18 00:20:10 +05:30
2022-05-20 03:52:10 +05:30
// only for fetching servers list
2022-02-25 12:33:56 +05:30
@GET
suspend fun getInstances(@Url url: String): List<Instances>
2022-05-20 03:52:10 +05:30
}