Thorium-android-app/app/src/main/java/net/schueller/peertube/network/GetVideoDataService.java

83 lines
2.7 KiB
Java
Raw Normal View History

2018-12-29 14:19:17 +01:00
/*
2020-11-28 22:36:47 +01:00
* Copyright (C) 2020 Stefan Schüller <sschueller@techdroid.com>
2018-12-29 14:19:17 +01:00
*
* This program is free software: you can redistribute it and/or modify
2020-11-28 22:36:47 +01:00
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2018-12-29 14:19:17 +01:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2020-11-28 22:36:47 +01:00
* GNU Affero General Public License for more details.
2018-12-29 14:19:17 +01:00
*
2020-11-28 22:36:47 +01:00
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-12-29 14:19:17 +01:00
*/
2018-03-03 01:10:13 +01:00
package net.schueller.peertube.network;
import net.schueller.peertube.model.Rating;
import net.schueller.peertube.model.Video;
2018-03-03 01:10:13 +01:00
import net.schueller.peertube.model.VideoList;
import java.util.Set;
2019-01-04 23:19:10 +01:00
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
2018-03-03 01:10:13 +01:00
import retrofit2.Call;
2019-01-04 23:19:10 +01:00
import retrofit2.http.Body;
import retrofit2.http.Field;
2018-03-03 01:10:13 +01:00
import retrofit2.http.GET;
2019-01-04 23:19:10 +01:00
import retrofit2.http.PUT;
import retrofit2.http.Path;
2018-03-03 01:10:13 +01:00
import retrofit2.http.Query;
public interface GetVideoDataService {
@GET("videos/")
Call<VideoList> getVideosData(
2018-03-03 01:10:13 +01:00
@Query("start") int start,
@Query("count") int count,
@Query("sort") String sort,
2018-12-29 15:20:06 +01:00
@Query("nsfw") String nsfw,
@Query("filter") String filter,
@Query("languageOneOf") Set<String> languages
2018-03-03 01:10:13 +01:00
);
@GET("videos/{id}")
Call<Video> getVideoData(
@Path(value = "id", encoded = true) String id
);
2018-07-01 17:04:50 +02:00
2018-11-10 22:40:27 +01:00
@GET("search/videos/")
2018-07-01 17:04:50 +02:00
Call<VideoList> searchVideosData(
@Query("start") int start,
@Query("count") int count,
@Query("sort") String sort,
2018-11-10 22:40:27 +01:00
@Query("nsfw") String nsfw,
2018-12-29 15:20:06 +01:00
@Query("search") String search,
@Query("filter") String filter,
@Query("languageOneOf") Set<String> languages
2018-07-01 17:04:50 +02:00
);
2019-01-04 23:19:10 +01:00
@GET("users/me/videos/{id}/rating")
Call<Rating> getVideoRating(
@Path(value = "id", encoded = true) Integer id
);
2019-01-04 23:19:10 +01:00
@PUT("videos/{id}/rate")
Call<ResponseBody> rateVideo(
@Path(value = "id", encoded = true) Integer id,
@Body RequestBody params
);
// https://troll.tv/api/v1/accounts/theouterlinux@peertube.mastodon.host/videos?start=0&count=8&sort=-publishedAt
@GET("accounts/{displayNameAndHost}/videos")
Call<VideoList> getAccountVideosData(
@Path(value = "displayNameAndHost", encoded = true) String displayNameAndHost,
@Query("start") int start,
@Query("count") int count,
@Query("sort") String sort
);
2018-03-03 01:10:13 +01:00
}