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

152 lines
5.5 KiB
Kotlin
Raw Normal View History

2022-08-14 13:25:28 +05:30
package com.github.libretube.api
2021-12-18 16:34:14 +05:30
2022-09-22 21:29:15 +05:30
import retrofit2.http.*
2021-12-18 16:34:14 +05:30
interface PipedApi {
@GET("trending")
2022-09-20 23:23:34 +05:30
suspend fun getTrending(@Query("region") region: String): List<com.github.libretube.api.obj.StreamItem>
2021-12-18 16:34:14 +05:30
@GET("streams/{videoId}")
2022-09-20 23:23:34 +05:30
suspend fun getStreams(@Path("videoId") videoId: String): com.github.libretube.api.obj.Streams
2021-12-28 01:37:07 +05:30
2022-05-08 03:14:29 +05:30
@GET("comments/{videoId}")
2022-09-20 23:23:34 +05:30
suspend fun getComments(@Path("videoId") videoId: String): com.github.libretube.api.obj.CommentsPage
2022-05-08 03:14:29 +05:30
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
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.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
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.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
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.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
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.SearchResult
2022-05-15 16:42:46 +05:30
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}")
2022-09-20 23:23:34 +05:30
suspend fun getChannel(@Path("channelId") channelId: String): com.github.libretube.api.obj.Channel
2022-02-05 19:39:50 +05:30
@GET("user/{name}")
2022-09-20 23:23:34 +05:30
suspend fun getChannelByName(@Path("name") channelName: String): com.github.libretube.api.obj.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
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.Channel
2022-02-06 18:40:27 +05:30
@GET("playlists/{playlistId}")
2022-09-20 23:23:34 +05:30
suspend fun getPlaylist(@Path("playlistId") playlistId: String): com.github.libretube.api.obj.Playlist
2022-02-06 18:40:27 +05:30
@GET("nextpage/playlists/{playlistId}")
2022-05-20 03:52:10 +05:30
suspend fun getPlaylistNextPage(
@Path("playlistId") playlistId: String,
@Query("nextpage") nextPage: String
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.Playlist
2022-02-06 18:40:27 +05:30
2022-02-06 21:25:40 +05:30
@POST("login")
2022-09-20 23:23:34 +05:30
suspend fun login(@Body login: com.github.libretube.api.obj.Login): com.github.libretube.api.obj.Token
2022-02-06 21:25:40 +05:30
@POST("register")
2022-09-20 23:23:34 +05:30
suspend fun register(@Body login: com.github.libretube.api.obj.Login): com.github.libretube.api.obj.Token
2022-02-06 21:25:40 +05:30
2022-06-25 21:25:03 +05:30
@POST("user/delete")
suspend fun deleteAccount(
@Header("Authorization") token: String,
2022-09-20 23:23:34 +05:30
@Body password: com.github.libretube.api.obj.DeleteUserRequest
2022-06-26 00:56:37 +05:30
)
2022-06-25 21:25:03 +05:30
2022-02-06 21:25:40 +05:30
@GET("feed")
2022-09-20 23:23:34 +05:30
suspend fun getFeed(@Query("authToken") token: String?): List<com.github.libretube.api.obj.StreamItem>
2022-02-06 21:25:40 +05:30
2022-08-03 17:11:45 +05:30
@GET("feed/unauthenticated")
2022-09-20 23:23:34 +05:30
suspend fun getUnauthenticatedFeed(@Query("channels") channels: String): List<com.github.libretube.api.obj.StreamItem>
2022-08-03 17:11:45 +05:30
2022-02-06 21:25:40 +05:30
@GET("subscribed")
2022-05-20 03:52:10 +05:30
suspend fun isSubscribed(
@Query("channelId") channelId: String,
@Header("Authorization") token: String
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.Subscribed
2022-02-06 21:25:40 +05:30
@GET("subscriptions")
2022-09-20 23:23:34 +05:30
suspend fun subscriptions(@Header("Authorization") token: String): List<com.github.libretube.api.obj.Subscription>
2022-02-06 21:25:40 +05:30
2022-08-03 17:11:45 +05:30
@GET("subscriptions/unauthenticated")
2022-09-20 23:23:34 +05:30
suspend fun unauthenticatedSubscriptions(@Query("channels") channels: String): List<com.github.libretube.api.obj.Subscription>
2022-08-03 17:11:45 +05:30
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,
2022-09-20 23:23:34 +05:30
@Body subscribe: com.github.libretube.api.obj.Subscribe
): com.github.libretube.api.obj.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,
2022-09-20 23:23:34 +05:30
@Body subscribe: com.github.libretube.api.obj.Subscribe
): com.github.libretube.api.obj.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>
2022-09-20 23:23:34 +05:30
): com.github.libretube.api.obj.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-09-20 23:23:34 +05:30
@Body playlistId: com.github.libretube.api.obj.PlaylistId
): com.github.libretube.api.obj.Message
2022-06-20 22:16:00 +05:30
2022-04-12 23:55:08 +05:30
@GET("user/playlists")
2022-09-20 23:23:34 +05:30
suspend fun playlists(@Header("Authorization") token: String): List<com.github.libretube.api.obj.Playlists>
2022-04-12 23:55:08 +05:30
2022-09-10 16:07:13 +05:30
@POST("user/playlists/rename")
suspend fun renamePlaylist(
@Header("Authorization") token: String,
2022-09-20 23:23:34 +05:30
@Body playlistId: com.github.libretube.api.obj.PlaylistId
2022-09-10 16:07:13 +05:30
)
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,
2022-09-20 23:23:34 +05:30
@Body playlistId: com.github.libretube.api.obj.PlaylistId
): com.github.libretube.api.obj.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,
2022-09-20 23:23:34 +05:30
@Body name: com.github.libretube.api.obj.Playlists
): com.github.libretube.api.obj.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,
2022-09-20 23:23:34 +05:30
@Body playlistId: com.github.libretube.api.obj.PlaylistId
): com.github.libretube.api.obj.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,
2022-09-20 23:23:34 +05:30
@Body playlistId: com.github.libretube.api.obj.PlaylistId
): com.github.libretube.api.obj.Message
2022-05-20 03:52:10 +05:30
}