2017-03-09 08:08:50 +11:00
|
|
|
package com.keylesspalace.tusky;
|
|
|
|
|
2017-03-09 09:19:03 +11:00
|
|
|
import com.keylesspalace.tusky.entity.Account;
|
2017-03-09 08:08:50 +11:00
|
|
|
import com.keylesspalace.tusky.entity.Media;
|
2017-03-09 10:27:37 +11:00
|
|
|
import com.keylesspalace.tusky.entity.Notification;
|
2017-03-09 08:08:50 +11:00
|
|
|
import com.keylesspalace.tusky.entity.Relationship;
|
2017-03-09 10:27:37 +11:00
|
|
|
import com.keylesspalace.tusky.entity.Status;
|
2017-03-09 08:08:50 +11:00
|
|
|
import com.keylesspalace.tusky.entity.StatusContext;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2017-03-10 02:59:18 +11:00
|
|
|
import okhttp3.MultipartBody;
|
2017-03-09 08:08:50 +11:00
|
|
|
import okhttp3.RequestBody;
|
2017-03-09 08:34:13 +11:00
|
|
|
import okhttp3.ResponseBody;
|
2017-03-09 08:08:50 +11:00
|
|
|
import retrofit2.Call;
|
|
|
|
import retrofit2.http.DELETE;
|
|
|
|
import retrofit2.http.Field;
|
|
|
|
import retrofit2.http.FormUrlEncoded;
|
|
|
|
import retrofit2.http.GET;
|
|
|
|
import retrofit2.http.Multipart;
|
|
|
|
import retrofit2.http.POST;
|
|
|
|
import retrofit2.http.Part;
|
|
|
|
import retrofit2.http.Path;
|
|
|
|
import retrofit2.http.Query;
|
|
|
|
|
2017-03-09 08:34:13 +11:00
|
|
|
public interface MastodonAPI {
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/timelines/home")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Status>> homeTimeline(
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/timelines/public")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Status>> publicTimeline(
|
|
|
|
@Query("local") Boolean local,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/timelines/tag/{hashtag}")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Status>> hashtagTimeline(
|
|
|
|
@Path("hashtag") String hashtag,
|
|
|
|
@Query("local") Boolean local,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/notifications")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Notification>> notifications(
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/notifications/clear")
|
2017-03-09 08:34:13 +11:00
|
|
|
Call<ResponseBody> clearNotifications();
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/notifications/{id}")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Notification> notification(@Path("id") String notificationId);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@Multipart
|
|
|
|
@POST("api/v1/media")
|
2017-03-10 02:59:18 +11:00
|
|
|
Call<Media> uploadMedia(@Part("file") MultipartBody.Part file);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("api/v1/statuses")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Status> createStatus(
|
|
|
|
@Field("status") String text,
|
|
|
|
@Field("in_reply_to_id") String inReplyToId,
|
|
|
|
@Field("spoiler_text") String warningText,
|
|
|
|
@Field("visibility") String visibility,
|
|
|
|
@Field("sensitive") Boolean sensitive,
|
|
|
|
@Field("media_ids[]") List<String> mediaIds);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/statuses/{id}")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Status> status(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/statuses/{id}/context")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<StatusContext> statusContext(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/statuses/{id}/reblogged_by")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> statusRebloggedBy(
|
|
|
|
@Path("id") String statusId,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/statuses/{id}/favourited_by")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> statusFavouritedBy(
|
|
|
|
@Path("id") String statusId,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@DELETE("api/v1/statuses/{id}")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<ResponseBody> deleteStatus(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/statuses/{id}/reblog")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Status> reblogStatus(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/statuses/{id}/unreblog")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Status> unreblogStatus(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/statuses/{id}/favourite")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Status> favouriteStatus(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/statuses/{id}/unfavourite")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Status> unfavouriteStatus(@Path("id") String statusId);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/accounts/verify_credentials")
|
|
|
|
Call<Account> accountVerifyCredentials();
|
|
|
|
@GET("api/v1/accounts/search")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> searchAccounts(
|
|
|
|
@Query("q") String q,
|
|
|
|
@Query("resolve") Boolean resolve,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/accounts/{id}")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Account> account(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/accounts/{id}/statuses")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Status>> accountStatuses(
|
|
|
|
@Path("id") String accountId,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/accounts/{id}/followers")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> accountFollowers(
|
|
|
|
@Path("id") String accountId,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@GET("api/v1/accounts/{id}/following")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> accountFollowing(
|
|
|
|
@Path("id") String accountId,
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/accounts/{id}/follow")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> followAccount(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/accounts/{id}/unfollow")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> unfollowAccount(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/accounts/{id}/block")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> blockAccount(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/accounts/{id}/unblock")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> unblockAccount(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/accounts/{id}/mute")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> muteAccount(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/accounts/{id}/unmute")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> unmuteAccount(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/accounts/relationships")
|
2017-03-09 11:01:45 +11:00
|
|
|
Call<List<Relationship>> relationships(@Query("id[]") List<String> accountIds);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/blocks")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> blocks(
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/mutes")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> mutes(
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/favourites")
|
2017-03-09 10:27:37 +11:00
|
|
|
Call<List<Status>> favourites(
|
2017-03-09 09:19:03 +11:00
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
|
|
|
|
@GET("api/v1/follow_requests")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<List<Account>> followRequests(
|
|
|
|
@Query("max_id") String maxId,
|
|
|
|
@Query("since_id") String sinceId,
|
|
|
|
@Query("limit") Integer limit);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/follow_requests/{id}/authorize")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> authorizeFollowRequest(@Path("id") String accountId);
|
2017-03-09 08:08:50 +11:00
|
|
|
@POST("api/v1/follow_requests/{id}/reject")
|
2017-03-09 09:19:03 +11:00
|
|
|
Call<Relationship> rejectFollowRequest(@Path("id") String accountId);
|
2017-03-10 02:59:18 +11:00
|
|
|
|
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("api/v1/reports")
|
|
|
|
Call<ResponseBody> report(@Field("account_id") String accountId, @Field("status_ids[]") List<String> statusIds, @Field("comment") String comment);
|
2017-03-09 08:08:50 +11:00
|
|
|
}
|