summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonTimelinesService.java
blob: ae4c49c97e1e7484e85114dcdc7bd5a653afaaaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
package app.fedilab.android.mastodon.client.endpoints;
/* Copyright 2021 Thomas Schneider
 *
 * This file is a part of Fedilab
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * Fedilab 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 GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with Fedilab; if not,
 * see <http://www.gnu.org/licenses>. */

import java.util.List;

import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Conversation;
import app.fedilab.android.mastodon.client.entities.api.Marker;
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.lemmy.LemmyPost;
import app.fedilab.android.mastodon.client.entities.misskey.MisskeyNote;
import app.fedilab.android.mastodon.client.entities.nitter.Nitter;
import app.fedilab.android.mastodon.client.entities.peertube.PeertubeVideo;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface MastodonTimelinesService {

    //Public timelines
    @GET("timelines/public")
    Call<List<Status>> getPublic(
            @Header("Authorization") String token,
            @Query("local") Boolean local,
            @Query("remote") Boolean remote,
            @Query("only_media") Boolean only_media,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("min_id") String min_id,
            @Query("limit") Integer limit
    );

    @GET("timelines/bubble")
    Call<List<Status>> getBubble(
            @Header("Authorization") String token,
            @Query("only_media") Boolean only_media,
            @Query("remote") Boolean remote,
            @Query("with_muted") Boolean with_muted,
            @Query("exclude_visibilities") List<String> exclude_visibilities,
            @Query("reply_visibility") String reply_visibility,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("min_id") String min_id,
            @Query("limit") Integer limit
    );

    @GET("trends/statuses")
    Call<List<Status>> getStatusTrends(
            @Header("Authorization") String token,
            @Query("offset") String offset,
            @Query("limit") Integer limit);


    @GET("trends/tags")
    Call<List<Tag>> getTagTrends(@Header("Authorization") String token,
                                 @Query("offset") Integer offset,
                                 @Query("limit") Integer limit);

    //Public Tags timelines
    @GET("timelines/tag/{hashtag}")
    Call<List<Status>> getHashTag(
            @Header("Authorization") String token,
            @Path("hashtag") String hashtag,
            @Query("local") Boolean local,
            @Query("only_media") Boolean only_media,
            @Query("all[]") List<String> all,
            @Query("any[]") List<String> any,
            @Query("none[]") List<String> none,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("min_id") String min_id,
            @Query("limit") Integer limit
    );

    //Home timeline
    @GET("timelines/home")
    Call<List<Status>> getHome(
            @Header("Authorization") String token,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("min_id") String min_id,
            @Query("limit") Integer limit,
            @Query("local") Boolean local
    );

    //List timeline
    @GET("timelines/list/{list_id}")
    Call<List<Status>> getList(
            @Header("Authorization") String token,
            @Path("list_id") String list_id,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("min_id") String min_id,
            @Query("limit") Integer limit
    );

    //get conversations
    @GET("conversations")
    Call<List<Conversation>> getConversations(
            @Header("Authorization") String token,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("min_id") String min_id,
            @Query("limit") int limit
    );

    //Delete a conversation
    @DELETE("conversations/{id}")
    Call<Void> deleteConversation(
            @Header("Authorization") String token,
            @Path("id") String id
    );

    //Mark a conversation as read
    @FormUrlEncoded
    @POST("conversations/{id}/read")
    Call<Status> markReadConversation(
            @Header("Authorization") String token,
            @Path("id") String id
    );

    //Show user list
    @GET("lists")
    Call<List<MastodonList>> getLists(
            @Header("Authorization") String token
    );

    //Get Single list
    @GET("lists/{id}")
    Call<MastodonList> getList(
            @Header("Authorization") String token,
            @Path("id") String id
    );

    //Create a user list
    @FormUrlEncoded
    @POST("lists")
    Call<MastodonList> createList(
            @Header("Authorization") String token,
            @Field("title") String title,
            @Field("replies_policy") String replies_policy
    );

    //Update a list
    @FormUrlEncoded
    @PUT("lists/{id}")
    Call<MastodonList> updateList(
            @Header("Authorization") String token,
            @Path("id") String id,
            @Field("title") String title,
            @Field("replies_policy") String replies_policy
    );

    //Delete a conversation
    @DELETE("lists/{id}")
    Call<Void> deleteList(
            @Header("Authorization") String token,
            @Path("id") String id
    );

    //Get accounts in a list
    @GET("lists/{id}/accounts")
    Call<List<Account>> getAccountsInList(
            @Header("Authorization") String token,
            @Path("id") String id,
            @Query("max_id") String max_id,
            @Query("since_id") String since_id,
            @Query("limit") int limit
    );

    //Add account in a list
    @FormUrlEncoded
    @POST("lists/{id}/accounts")
    Call<Void> addAccountsList(
            @Header("Authorization") String token,
            @Path("id") String id,
            @Field("account_ids[]") List<String> account_ids
    );

    //Delete accounts in a list
    @DELETE("lists/{id}/accounts")
    Call<Void> deleteAccountsList(
            @Header("Authorization") String token,
            @Path("id") String id,
            @Query("account_ids[]") List<String> account_ids
    );

    //Get a marker
    @GET("markers")
    Call<Marker> getMarker(
            @Header("Authorization") String token,
            @Query("timeline") List<String> timeline
    );

    //Save marker
    @FormUrlEncoded
    @POST("markers")
    Call<Void> addMarker(
            @Header("Authorization") String token,
            @Field("home[last_read_id]") String home_last_read_id,
            @Field("notifications[last_read_id]") String notifications_last_read_id
    );


    @Headers({"Accept: application/json"})
    @POST("api/notes")
    Call<List<MisskeyNote>> getMisskey(@Body MisskeyNote.MisskeyParams params);


    @GET("api/v3/post/list")
    Call<LemmyPost.LemmyPosts> getLemmyMain(@Query("limit") Integer limit,
                                            @Query("page") String page);

    @GET("api/v3/comment/list")
    Call<LemmyPost.LemmyComments> getLemmyThread(@Query("post_id") String post_id,
                                                 @Query("limit") Integer limit,
                                                 @Query("page") String page);

    //Public timelines for Misskey
    @FormUrlEncoded
    @POST("api/notes")
    Call<List<MisskeyNote>> getMisskey(
            @Field("local") boolean local,
            @Field(