|
1
|
// |
|
2
|
// TWTRSearchTimelineDataSource.h |
|
3
|
// TwitterKit |
|
4
|
// |
|
5
|
// Copyright (c) 2015 Twitter. All rights reserved. |
|
6
|
// |
|
7
|
|
|
8
|
#import <Foundation/Foundation.h> |
|
9
|
#import <TwitterKit/TWTRTimelineDataSource.h> |
|
10
|
|
|
11
|
@class TWTRAPIClient; |
|
12
|
@class TWTRTimelineFilter; |
|
13
|
|
|
14
|
NS_ASSUME_NONNULL_BEGIN |
|
15
|
|
|
16
|
/** |
|
17
|
Data source representing a Search Timeline. Provides TWTRTweet objects to a TWTRTimelineViewController in pages determined by the TWTRTimelineCursor object passed in to the `loadNext:` and `loadPrevious:` methods. |
|
18
|
|
|
19
|
## Search Queries: |
|
20
|
|
|
21
|
* `watching now` containing both “watching” and “now”. Default. |
|
22
|
* `“happy hour”` containing the exact phrase “happy hour”. |
|
23
|
* `love OR hate` containing either “love” or “hate” (or both). |
|
24
|
* `beer -root` containing “beer” but not “root”. |
|
25
|
* `#haiku` containing the hashtag “haiku”. |
|
26
|
* `from:alexiskold`sent from person “alexiskold”. |
|
27
|
* `to:techcrunch` sent to person “techcrunch”. |
|
28
|
* `@mashable` referencing person “mashable”. |
|
29
|
* `flight :(` containing “flight” and with a negative attitude. |
|
30
|
* `traffic ?` containing “traffic” and asking a question. |
|
31
|
* `movie -scary :)`containing “movie”, but not “scary”, and with a positive attitude. |
|
32
|
* `hilarious filter:links` containing “hilarious” and linking to URL. |
|
33
|
* `news source:twitterfeed`containing “news” and entered via TwitterFeed |
|
34
|
* `superhero since:2010-12-27` containing “superhero” and sent since date “2010-12-27” (year-month-day). |
|
35
|
* `ftw until:2010-12-27` containing “ftw” and sent before the date “2010-12-27”. |
|
36
|
|
|
37
|
@see https://dev.twitter.com/rest/public/search |
|
38
|
Not implemented: `result_type` |
|
39
|
*/ |
|
40
|
@interface TWTRSearchTimelineDataSource : NSObject <TWTRTimelineDataSource> |
|
41
|
|
|
42
|
/** |
|
43
|
* The search query. This matches what you would type into https://twitter.com/search |
|
44
|
*/ |
|
45
|
@property (nonatomic, copy, readonly) NSString *searchQuery; |
|
46
|
|
|
47
|
/** |
|
48
|
* Restricts tweets returned to a given language, specified by its ISO 639-1 code (for example: en, es). Language detection is best-effort. The server defaults to returning Tweets in all languages. |
|
49
|
* |
|
50
|
* @see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes |
|
51
|
*/ |
|
52
|
@property (nonatomic, copy, readonly, nullable) NSString *languageCode; |
|
53
|
|
|
54
|
/** |
|
55
|
* The number of Tweets to request in each network request for more Tweets. By default requests 30 tweets. If set to `0` the parameter will not be set on the request and the Twitter API will use the default size for the endpoint. |
|
56
|
*/ |
|
57
|
@property (nonatomic, readonly) NSUInteger maxTweetsPerRequest; |
|
58
|
|
|
59
|
/** |
|
60
|
* The geocode details to narrow search results. The format is "latitude,longitude,radius" e.g. "37.781157,-122.398720,1mi" |
|
61
|
* |
|
62
|
* @see https://dev.twitter.com/rest/public/search |
|
63
|
*/ |
|
64
|
@property (nonatomic, copy, nullable) NSString *geocodeSpecifier; |
|
65
|
|
|
66
|
/** |
|
67
|
* Only search top-ranked Tweets. When debugging, you may want to turn this off in order to |
|
68
|
* show new and unfiltered Tweets. |
|
69
|
* |
|
70
|
* Default to YES. |
|
71
|
*/ |
|
72
|
@property (nonatomic) BOOL topTweetsOnly; |
|
73
|
|
|
74
|
/** |
|
75
|
* Filter out sensitive (containing nudity or violence) tweets. |
|
76
|
* |
|
77
|
* Defaults to YES. |
|
78
|
*/ |
|
79
|
@property (nonatomic) BOOL filterSensitiveTweets; |
|
80
|
|
|
81
|
/* |
|
82
|
* A filtering object that hides certain tweets. |
|
83
|
*/ |
|
84
|
@property (nonatomic, copy, nullable) TWTRTimelineFilter *timelineFilter; |
|
85
|
|
|
86
|
/** |
|
87
|
* Convenience initializer. Uses default values for `languageCode` and `maxTweetsPerRequest`. |
|
88
|
* |
|
89
|
* @param searchQuery (required) The query string that you would type into https://twitter.com/search |
|
90
|
* @param client (required) An instance of `TWTRAPIClient` with which API calls will be made. |
|
91
|
* |
|
92
|
* @return A fully initialized search timeline datasource or `nil` if any of the required parameters are missing. |
|
93
|
*/ |
|
94
|
- (instancetype)initWithSearchQuery:(NSString *)searchQuery APIClient:(TWTRAPIClient *)client; |
|
95
|
|
|
96
|
/** |
|
97
|
* Create a new search timeline data source. |
|
98
|
* |
|
99
|
* @param searchQuery (required) The query string that you would type into https://twitter.com/search |
|
100
|
* @param client (required) An instance of `TWTRAPIClient` with which API calls will be made. |
|
101
|
* @param languageCode (optional) The ISO 639-1 language code to restrict Tweets to. A `nil` value will not add the parameter to the server request and so use the server default. |
|
102
|
* @param maxTweetsPerRequest (optional) The number of tweets to request in each query to the Twitter API. A value of 0 will not add to the parameters and thus use the server default. |
|
103
|
* |
|
104
|
* @return A fully initialized search timeline datasource or `nil` if any of the required parameters are missing. |
|
105
|
*/ |
|
106
|
- (instancetype)initWithSearchQuery:(NSString *)searchQuery APIClient:(TWTRAPIClient *)client languageCode:(nullable NSString *)languageCode maxTweetsPerRequest:(NSUInteger)maxTweetsPerRequest NS_DESIGNATED_INITIALIZER; |
|
107
|
|
|
108
|
- (instancetype)init NS_UNAVAILABLE; |
|
109
|
|
|
110
|
@end |
|
111
|
|
|
112
|
NS_ASSUME_NONNULL_END |