PipedApi update

This commit is contained in:
rimthekid 2022-02-06 19:55:40 +04:00
parent 1900e7cd5f
commit 35e6641503
6 changed files with 45 additions and 5 deletions

View File

@ -1,9 +1,7 @@
package com.github.libretube package com.github.libretube
import com.github.libretube.obj.* import com.github.libretube.obj.*
import retrofit2.http.GET import retrofit2.http.*
import retrofit2.http.Path
import retrofit2.http.Query
interface PipedApi { interface PipedApi {
@GET("trending") @GET("trending")
@ -33,4 +31,20 @@ interface PipedApi {
@GET("nextpage/playlists/{playlistId}") @GET("nextpage/playlists/{playlistId}")
suspend fun getPlaylistNextPage(@Path("playlistId") playlistId: String, @Query("nextpage") nextPage: String): Playlist suspend fun getPlaylistNextPage(@Path("playlistId") playlistId: String, @Query("nextpage") nextPage: String): Playlist
@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>
} }

View File

@ -0,0 +1,6 @@
package com.github.libretube.obj
data class Login(
val username: String? = null,
val password: String? = null
)

View File

@ -10,7 +10,8 @@ data class StreamItem(
var uploadedDate: String?, var uploadedDate: String?,
var duration: Long?, var duration: Long?,
var views: Long?, var views: Long?,
var uploaderVerified: Boolean? var uploaderVerified: Boolean?,
var uploaded: Long?
){ ){
constructor() : this("","","","","","","",0,0,null) constructor() : this("","","","","","","",0,0,null,0)
} }

View File

@ -0,0 +1,5 @@
package com.github.libretube.obj
data class Subscribed(
var subscribed: Boolean? = null
)

View File

@ -0,0 +1,8 @@
package com.github.libretube.obj
data class Subscription(
var url: String? = null,
var name: String? = null,
var avatar: String? = null,
var verified: Boolean? = null
)

View File

@ -0,0 +1,6 @@
package com.github.libretube.obj
data class Token(
var token: String? = null,
var error: String? = null
)