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 <Foundation/Foundation.h> |
|
19 |
#import <TwitterKit/TWTRTimelineDataSource.h> |
|
20 |
|
|
21 |
@class TWTRAPIClient; |
|
22 |
@class TWTRTimelineFilter; |
|
23 |
|
|
24 |
NS_ASSUME_NONNULL_BEGIN |
|
25 |
|
|
26 |
/** |
|
27 |
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. |
|
28 |
|
|
29 |
## Search Queries: |
|
30 |
|
|
31 |
* `watching now` containing both “watching” and “now”. Default. |
|
32 |
* `“happy hour”` containing the exact phrase “happy hour”. |
|
33 |
* `love OR hate` containing either “love” or “hate” (or both). |
|
34 |
* `beer -root` containing “beer” but not “root”. |
|
35 |
* `#haiku` containing the hashtag “haiku”. |
|
36 |
* `from:alexiskold`sent from person “alexiskold”. |
|
37 |
* `to:techcrunch` sent to person “techcrunch”. |
|
38 |
* `@mashable` referencing person “mashable”. |
|
39 |
* `flight :(` containing “flight” and with a negative attitude. |
|
40 |
* `traffic ?` containing “traffic” and asking a question. |
|
41 |
* `movie -scary :)`containing “movie”, but not “scary”, and with a positive attitude. |
|
42 |
* `hilarious filter:links` containing “hilarious” and linking to URL. |
|
43 |
* `news source:twitterfeed`containing “news” and entered via TwitterFeed |
|
44 |
* `superhero since:2010-12-27` containing “superhero” and sent since date “2010-12-27” (year-month-day). |
|
45 |
* `ftw until:2010-12-27` containing “ftw” and sent before the date “2010-12-27”. |
|
46 |
|
|
47 |
@see https://dev.twitter.com/rest/public/search |
|
48 |
*/ |
|
49 |
@interface TWTRSearchTimelineDataSource : NSObject <TWTRTimelineDataSource> |
|
50 |
|
|
51 |
/** |
|
52 |
* The search query. This matches what you would type into https://twitter.com/search |
|
53 |
*/ |
|
54 |
@property (nonatomic, copy, readonly) NSString *searchQuery; |
|
55 |
|
|
56 |
/** |
|
57 |
* 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. |
|
58 |
* |
|
59 |
* @see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes |
|
60 |
*/ |
|
61 |
@property (nonatomic, copy, readonly, nullable) NSString *languageCode; |
|
62 |
|
|
63 |
/** |
|
64 |
* 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. |
|
65 |
*/ |
|
66 |
@property (nonatomic, readonly) NSUInteger maxTweetsPerRequest; |
|
67 |
|
|
68 |
/** |
|
69 |
* The geocode details to narrow search results. The format is "latitude,longitude,radius" e.g. "37.781157,-122.398720,1mi" |
|
70 |
* |
|
71 |
* @see https://dev.twitter.com/rest/public/search |
|
72 |
*/ |
|
73 |
@property (nonatomic, copy, nullable) NSString *geocodeSpecifier; |
|
74 |
|
|
75 |
/** |
|
76 |
* Filter out sensitive (containing nudity or violence) tweets. |
|
77 |
* |
|
78 |
* Defaults to YES. |
|
79 |
*/ |
|
80 |
@property (nonatomic) BOOL filterSensitiveTweets; |
|
81 |
|
|
82 |
/* |
|
83 |
* A filtering object that hides certain tweets. |
|
84 |
*/ |
|
85 |
@property (nonatomic, copy, nullable) TWTRTimelineFilter *timelineFilter; |
|
86 |
|
|
87 |
/* |
|
88 |
* Specifies search result type to be recent or popular Tweets, or a mix of both. |
|
89 |
* |
|
90 |
* @param resultType possible options are recent, popular, or mixed. |
|
91 |
*/ |
|
92 |
@property (nonatomic, copy, nullable) NSString *resultType; |
|
93 |
|
|
94 |
/** |
|
95 |
* Convenience initializer. Uses default values for `languageCode` and `maxTweetsPerRequest`. |
|
96 |
* |
|
97 |
* @param searchQuery (required) The query string that you would type into https://twitter.com/search |
|
98 |
* @param client (required) An instance of `TWTRAPIClient` with which API calls will be made. |
|
99 |
* |
|
100 |
* @return A fully initialized search timeline datasource or `nil` if any of the required parameters are missing. |
|
101 |
*/ |
|
102 |
- (instancetype)initWithSearchQuery:(NSString *)searchQuery APIClient:(TWTRAPIClient *)client; |
|
103 |
|
|
104 |
/** |
|
105 |
* Create a new search timeline data source. |
|
106 |
* |
|
107 |
* @param searchQuery (required) The query string that you would type into https://twitter.com/search |
|
108 |
* @param client (required) An instance of `TWTRAPIClient` with which API calls will be made. |
|
109 |
* @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. |
|
110 |
* @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. |
|
111 |
* @param resultType (optional) The result type for timeline. It is default to 'mixed' if not assigned. |
|
112 |
* |
|
113 |
* @return A fully initialized search timeline datasource or `nil` if any of the required parameters are missing. |
|
114 |
*/ |
|
115 |
- (instancetype)initWithSearchQuery:(NSString *)searchQuery APIClient:(TWTRAPIClient *)client languageCode:(nullable NSString *)languageCode maxTweetsPerRequest:(NSUInteger)maxTweetsPerRequest resultType:(nullable NSString *)resultType NS_DESIGNATED_INITIALIZER; |
|
116 |
|
|
117 |
- (instancetype)init NS_UNAVAILABLE; |
|
118 |
|
|
119 |
@end |
|
120 |
|
|
121 |
NS_ASSUME_NONNULL_END |