commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
a0a843
|
17 |
|
H |
18 |
#import "TWTRTimelineType.h" |
|
19 |
|
|
20 |
@class TWTRAPIClient; |
|
21 |
@class TWTRTimelineCursor; |
|
22 |
@class TWTRTimelineFilter; |
|
23 |
@class TWTRTweet; |
|
24 |
|
|
25 |
NS_ASSUME_NONNULL_BEGIN |
|
26 |
|
|
27 |
typedef void (^TWTRLoadTimelineCompletion)(NSArray<TWTRTweet *> *_Nullable tweets, TWTRTimelineCursor *_Nullable cursor, NSError *_Nullable error); |
|
28 |
|
|
29 |
/** |
|
30 |
* Responsible for building network parameters for requesting a timeline of Tweets. |
|
31 |
* |
|
32 |
* Implementations of this protocol don't need to be thread-safe. All the methods will be invoked on the main thread. |
|
33 |
*/ |
|
34 |
@protocol TWTRTimelineDataSource <NSObject> |
|
35 |
|
|
36 |
/** |
|
37 |
* Load Tweets before a given position. For time-based timelines this generally |
|
38 |
* corresponds to Tweets older than a position. |
|
39 |
* |
|
40 |
* @param position (optional) The position or Tweet ID before the page |
|
41 |
* of Tweets to be loaded. |
|
42 |
* @param completion (required) Invoked with the Tweets and the cursor in case of success, or nil |
|
43 |
* and an error in case of error. This must be called on the main thread. |
|
44 |
*/ |
|
45 |
- (void)loadPreviousTweetsBeforePosition:(nullable NSString *)position completion:(TWTRLoadTimelineCompletion)completion; |
|
46 |
|
|
47 |
/* |
|
48 |
* The type of the timeline that this data source represents. |
|
49 |
*/ |
|
50 |
@property (nonatomic, readonly) TWTRTimelineType timelineType; |
|
51 |
|
|
52 |
/* |
|
53 |
* An object with a set of filters to hide certain tweets. |
|
54 |
*/ |
|
55 |
@property (nonatomic, copy, nullable) TWTRTimelineFilter *timelineFilter; |
|
56 |
|
|
57 |
/** |
|
58 |
* The API client to use with this data source. |
|
59 |
* You will, likely, not need to alter this value unless you are implementing your |
|
60 |
* own timeline view controller. |
|
61 |
*/ |
|
62 |
@property (nonatomic) TWTRAPIClient *APIClient; |
|
63 |
|
|
64 |
@end |
|
65 |
|
|
66 |
NS_ASSUME_NONNULL_END |