1 //
2 // TWTRTimelineDataSource.h
3 // TwitterKit
4 //
5 // Copyright (c) 2015 Twitter. All rights reserved.
6 //
7
8 #import "TWTRTimelineType.h"
9
10 @class TWTRAPIClient;
11 @class TWTRTimelineCursor;
12 @class TWTRTimelineFilter;
13 @class TWTRTweet;
14
15 NS_ASSUME_NONNULL_BEGIN
16
17 typedef void (^TWTRLoadTimelineCompletion)(NSArray<TWTRTweet *> * _Nullable tweets, TWTRTimelineCursor * _Nullable cursor, NSError * _Nullable error);
18
19 /**
20 * Responsible for building network parameters for requesting a timeline of Tweets.
21 *
22 * Implementations of this protocol don't need to be thread-safe. All the methods will be invoked on the main thread.
23 */
24 @protocol TWTRTimelineDataSource <NSObject>
25
26 /**
27 * Load Tweets before a given position. For time-based timelines this generally
28 * corresponds to Tweets older than a position.
29 *
30 * @param position (optional) The position or Tweet ID before the page
31 * of Tweets to be loaded.
32 * @param completion (required) Invoked with the Tweets and the cursor in case of success, or nil
33 * and an error in case of error. This must be called on the main thread.
34 */
35 - (void)loadPreviousTweetsBeforePosition:(nullable NSString *)position completion:(TWTRLoadTimelineCompletion)completion;
36
37 /*
38 * The type of the timeline that this data source represents.
39 */
40 @property (nonatomic, readonly) TWTRTimelineType timelineType;
41
42 /*
43 * An object with a set of filters to hide certain tweets.
44 */
45 @property (nonatomic, copy, nullable) TWTRTimelineFilter *timelineFilter;
46
47 /**
48 * The API client to use with this data source.
49 * You will, likely, not need to alter this value unless you are implementing your
50 * own timeline view controller.
51 */
52 @property (nonatomic) TWTRAPIClient *APIClient;
53
54 @end
55
56 NS_ASSUME_NONNULL_END