forked from UweTrottmann/trakt-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSync.java
More file actions
371 lines (339 loc) · 12.4 KB
/
Sync.java
File metadata and controls
371 lines (339 loc) · 12.4 KB
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
package com.uwetrottmann.trakt5.services;
import com.uwetrottmann.trakt5.entities.BaseMovie;
import com.uwetrottmann.trakt5.entities.BaseShow;
import com.uwetrottmann.trakt5.entities.HistoryEntry;
import com.uwetrottmann.trakt5.entities.LastActivities;
import com.uwetrottmann.trakt5.entities.PlaybackResponse;
import com.uwetrottmann.trakt5.entities.RatedEpisode;
import com.uwetrottmann.trakt5.entities.RatedMovie;
import com.uwetrottmann.trakt5.entities.RatedSeason;
import com.uwetrottmann.trakt5.entities.RatedShow;
import com.uwetrottmann.trakt5.entities.SyncItems;
import com.uwetrottmann.trakt5.entities.SyncResponse;
import com.uwetrottmann.trakt5.entities.WatchlistedEpisode;
import com.uwetrottmann.trakt5.entities.WatchlistedSeason;
import com.uwetrottmann.trakt5.enums.Extended;
import com.uwetrottmann.trakt5.enums.HistoryType;
import com.uwetrottmann.trakt5.enums.RatingsFilter;
import org.threeten.bp.OffsetDateTime;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import java.util.List;
public interface Sync {
/**
* <b>OAuth Required</b>
*
* <p> This method is a useful first step in the syncing process. We recommended caching these dates locally, then
* you can compare to know exactly what data has changed recently. This can greatly optimize your syncs so you don't
* pull down a ton of data only to see nothing has actually changed.
*/
@GET("sync/last_activities")
Call<LastActivities> lastActivities();
/**
* <b>OAuth Required</b>
*
* <p> Get all collected movies in a user's collection. A collected item indicates availability to watch digitally
* or on physical media.
*/
@GET("sync/collection/movies")
Call<List<BaseMovie>> collectionMovies(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Get all collected shows in a user's collection. A collected item indicates availability to watch digitally or
* on physical media.
*/
@GET("sync/collection/shows")
Call<List<BaseShow>> collectionShows(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Add one or more items to a user's collection including the format of the item.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/collection")
Call<SyncResponse> addItemsToCollection(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Remove one or more items from a user's collection.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/collection/remove")
Call<SyncResponse> deleteItemsFromCollection(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all movies a user has watched.
*/
@GET("sync/watched/movies")
Call<List<BaseMovie>> watchedMovies(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all playbacks;
*/
@GET("sync/playback")
Call<List<PlaybackResponse>> getPlayback(
@Query("limit") Integer limit
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all playbacks;
*/
@GET("sync/playback/episodes")
Call<List<PlaybackResponse>> getPlaybackEpisodes(
@Query("limit") Integer limit
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all playbacks;
*/
@GET("sync/playback/movies")
Call<List<PlaybackResponse>> getPlaybackMovies(
@Query("limit") Integer limit
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all shows a user has watched.
*/
@GET("sync/watched/shows")
Call<List<BaseShow>> watchedShows(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Returns movies and episodes that the a user has watched, sorted by most recent.
*
* <p>The {@code id} uniquely identifies each history event and can be used to remove events individually using the
* {@code POST /sync/history/remove method}. The action will be set to {@code scrobble}, {@code checkin}, or {@code
* watch}.
*/
@GET("sync/history")
Call<List<HistoryEntry>> getHistory(
@Query("page") Integer page,
@Query("limit") Integer limit,
@Query(value = "extended", encoded = true) Extended extended,
@Query("start_at") OffsetDateTime startAt,
@Query("end_at") OffsetDateTime endAt
);
/**
* <b>OAuth Required</b>
*
* <p> Returns movies or episodes (depending on the <code>type</code>) that the a user has watched,
* sorted by most recent.
*
* <p>The {@code id} uniquely identifies each history event and can be used to remove events individually using the
* {@code POST /sync/history/remove method}. The action will be set to {@code scrobble}, {@code checkin}, or {@code
* watch}.
*/
@GET("sync/history/{type}")
Call<List<HistoryEntry>> getHistory(
@Path("type") HistoryType type,
@Query("page") Integer page,
@Query("limit") Integer limit,
@Query(value = "extended", encoded = true) Extended extended,
@Query("start_at") OffsetDateTime startAt,
@Query("end_at") OffsetDateTime endAt
);
/**
* <b>OAuth Required</b>
*
* <p>Returns the history for just the specified item. For example, {@code /sync/history/movies/12601} would return
* all watches for TRON: Legacy and {@code /sync/history/shows/1388} would return all watched episodes
* for Breaking Bad. If an invalid {@code id} is sent, a 404 error will be returned. If the {@code id} is valid,
* but there is no history, an empty array will be returned.
*
* <p>The {@code id} uniquely identifies each history event and can be used to remove events individually using the
* {@code POST /sync/history/remove method}. The action will be set to {@code scrobble}, {@code checkin}, or {@code
* watch}.
*/
@GET("sync/history/{type}/{id}")
Call<List<HistoryEntry>> getHistory(
@Path("type") HistoryType type,
@Path("id") int id,
@Query("page") Integer page,
@Query("limit") Integer limit,
@Query(value = "extended", encoded = true) Extended extended,
@Query("start_at") OffsetDateTime startAt,
@Query("end_at") OffsetDateTime endAt
);
/**
* <b>OAuth Required</b>
*
* <p> Add items to a user's watch history. Accepts shows, seasons, episodes and movies. If only a show is passed,
* assumes all seasons are to be marked watched. Same for seasons. Send a <code>watched_at</code> UTC datetime to
* mark items as watched in the past. This is useful for syncing past watches from a media center.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/history")
Call<SyncResponse> addItemsToWatchedHistory(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Remove items from a user's watch history including all watches, scrobbles, and checkins. Accepts shows,
* seasons, episodes and movies. If only a show is passed, assumes all seasons are to be removed from history. Same
* for seasons.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/history/remove")
Call<SyncResponse> deleteItemsFromWatchedHistory(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Get a user's ratings filtered by movies. You can filter for a specific rating between 1 and 10.
*
* @param filter Filter for a specific rating.
*/
@GET("sync/ratings/movies{rating}")
Call<List<RatedMovie>> ratingsMovies(
@Path(value = "rating", encoded = true) RatingsFilter filter,
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Get a user's ratings filtered by shows. You can filter for a specific rating between 1 and 10.
*
* @param filter Filter for a specific rating.
*/
@GET("sync/ratings/shows{rating}")
Call<List<RatedShow>> ratingsShows(
@Path(value = "rating", encoded = true) RatingsFilter filter,
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Get a user's ratings filtered by seasons. You can filter for a specific rating between 1 and 10.
*
* @param filter Filter for a specific rating.
*/
@GET("sync/ratings/seasons{rating}")
Call<List<RatedSeason>> ratingsSeasons(
@Path(value = "rating", encoded = true) RatingsFilter filter,
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Get a user's ratings filtered by episodes. You can filter for a specific rating between 1 and 10.
*
* @param filter Filter for a specific rating.
*/
@GET("sync/ratings/episodes{rating}")
Call<List<RatedEpisode>> ratingsEpisodes(
@Path(value = "rating", encoded = true) RatingsFilter filter,
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Rate one or more items.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/ratings")
Call<SyncResponse> addRatings(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Delete ratings for one or more items.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/ratings/remove")
Call<SyncResponse> deleteRatings(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all items in a user's watchlist filtered by movies. When an item is watched, it will be automatically
* removed from the watchlist. To track what the user is actively watching, use the progress APIs.
*/
@GET("sync/watchlist/movies")
Call<List<BaseMovie>> watchlistMovies(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all items in a user's watchlist filtered by shows. When an item is watched, it will be automatically
* removed from the watchlist. To track what the user is actively watching, use the progress APIs.
*/
@GET("sync/watchlist/shows")
Call<List<BaseShow>> watchlistShows(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all items in a user's watchlist filtered by seasons. When an item is watched, it will be
* automatically removed from the watchlist. To track what the user is actively watching, use the progress APIs.
*/
@GET("sync/watchlist/seasons")
Call<List<WatchlistedSeason>> watchlistSeasons(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Returns all items in a user's watchlist filtered by episodes. When an item is watched, it will be
* automatically removed from the watchlist. To track what the user is actively watching, use the progress APIs.
*/
@GET("sync/watchlist/episodes")
Call<List<WatchlistedEpisode>> watchlistEpisodes(
@Query(value = "extended", encoded = true) Extended extended
);
/**
* <b>OAuth Required</b>
*
* <p> Add one of more items to a user's watchlist.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/watchlist")
Call<SyncResponse> addItemsToWatchlist(
@Body SyncItems items
);
/**
* <b>OAuth Required</b>
*
* <p> Delete one or more items from a user's watchlist.
*
* @param items A list of movies, shows, seasons or episodes.
*/
@POST("sync/watchlist/remove")
Call<SyncResponse> deleteItemsFromWatchlist(
@Body SyncItems items
);
}