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

82 lines
2.9 KiB
Kotlin
Raw Normal View History

2022-02-01 21:22:06 +05:30
package com.github.libretube
2021-12-18 16:34:14 +05:30
2022-02-06 18:40:27 +05:30
import com.github.libretube.obj.*
2022-02-06 21:25:40 +05:30
import retrofit2.http.*
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
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
@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}")
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}")
suspend fun getPlaylistNextPage(@Path("playlistId") playlistId: String, @Query("nextpage") nextPage: String): Playlist
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
@GET("feed")
suspend fun getFeed(@Query("authToken") token: String?): List<StreamItem>
@GET("subscribed")
suspend fun isSubscribed(@Query("channelId") channelId: String, @Header("Authorization") token: String): Subscribed
@GET("subscriptions")
suspend fun subscriptions(@Header("Authorization") token: String): List<Subscription>
2022-02-09 23:40:39 +05:30
@POST("subscribe")
2022-02-13 17:23: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-02-13 17:23: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-04-16 11:51:50 +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-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")
suspend fun deletePlaylist(@Header("Authorization") token: String, @Body playlistId: PlaylistId): Message
2022-04-15 16:56:06 +05:30
@POST("user/playlists/create")
2022-04-16 23:46:43 +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")
suspend fun addToPlaylist(@Header("Authorization") token: String, @Body playlistId: PlaylistId): Message
@POST("user/playlists/remove")
suspend fun removeFromPlaylist(@Header("Authorization") token: String, @Body playlistId: PlaylistId): Message
2022-02-10 17:48:38 +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-02-09 23:40:39 +05:30
2022-03-31 23:04:19 +05:30
2021-12-18 16:34:14 +05:30
}