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 |
*/ |
|
17 |
|
a0a843
|
18 |
@class TWTRScribeFilterDetails; |
H |
19 |
@class TWTRScribeMediaDetails; |
|
20 |
@class TWTRScribeCardEvent; |
|
21 |
|
|
22 |
#import <Foundation/Foundation.h> |
|
23 |
#import "TWTRScribeSerializable.h" |
|
24 |
|
|
25 |
NS_ASSUME_NONNULL_BEGIN |
|
26 |
|
|
27 |
/** |
|
28 |
* The type of item (tweet, user, trend, list, etc). Certain values are deprecated so be sure to |
|
29 |
* check `client_app.thrift` before adding more fields. The raw values here are exactly as they appear |
|
30 |
* on the backend so do not change without double checking against the thrift IDL. |
|
31 |
*/ |
|
32 |
typedef NS_ENUM(NSUInteger, TWTRScribeItemType) { TWTRScribeItemTypeTweet = 0, TWTRScribeItemTypeUser = 3, TWTRScribeItemTypeMessage = 6, TWTRScribeItemTypeCustomTimeline = 17 }; |
|
33 |
|
|
34 |
/** |
|
35 |
* Model object describing Scribe event details. `Items` is a property of `EventDetails` containing |
|
36 |
* details of what the specific item being scribed is e.g. type = Tweet and Tweet ID. This model only |
|
37 |
* contains a subset of what's defined in `client_app.thrift`. |
|
38 |
* @see https://cgit.twitter.biz/source/tree/science/src/thrift/com/twitter/clientapp/gen/client_app.thrift |
|
39 |
*/ |
|
40 |
@interface TWTRScribeItem : NSObject <TWTRScribeSerializable> |
|
41 |
|
|
42 |
@property (nonatomic, assign, readonly) TWTRScribeItemType itemType; |
|
43 |
/** |
|
44 |
* Using String instead of 64-bit int on the backend for convenience. |
|
45 |
*/ |
|
46 |
@property (nonatomic, copy, readonly, nullable) NSString *itemID; |
|
47 |
|
|
48 |
@property (nonatomic, readonly, nullable) TWTRScribeCardEvent *cardEvent; |
|
49 |
|
|
50 |
@property (nonatomic, readonly, nullable) TWTRScribeMediaDetails *mediaDetails; |
|
51 |
|
|
52 |
@property (nonatomic, readonly, nullable) TWTRScribeFilterDetails *filterDetails; |
|
53 |
|
|
54 |
- (instancetype)init __attribute__((unavailable("Every attribute is optional on the backend but we want to be stricter on the client."))); |
|
55 |
- (instancetype)initWithItemType:(TWTRScribeItemType)itemType itemID:(NSString *)itemID; |
|
56 |
- (instancetype)initWithItemType:(TWTRScribeItemType)itemType itemID:(nullable NSString *)itemID cardEvent:(nullable TWTRScribeCardEvent *)cardEvent mediaDetails:(nullable TWTRScribeMediaDetails *)mediaDetails; |
|
57 |
/** |
|
58 |
* Initiatizes a generic Scribe Item typically displayed in streams or dashboard modules e.g. Timelines |
|
59 |
* |
|
60 |
* @param itemType the type of item displayed |
|
61 |
* @param itemID corresponds to `Item.id` but `id` is keyword in ObjC. This is used to describe |
|
62 |
* the `Item`'s identifier e.g. Tweet ID |
|
63 |
* @param cardEvent Information pertaining to the Twitter Card displayed. |
|
64 |
* @param mediaDetails Information pertaining to the media rendered in the item. |
|
65 |
* @param filterDetails Information pertainng to the timeline filter. |
|
66 |
* |
|
67 |
*/ |
|
68 |
- (instancetype)initWithItemType:(TWTRScribeItemType)itemType itemID:(nullable NSString *)itemID cardEvent:(nullable TWTRScribeCardEvent *)cardEvent mediaDetails:(nullable TWTRScribeMediaDetails *)mediaDetails filterDetails:(nullable TWTRScribeFilterDetails *)filterDetails NS_DESIGNATED_INITIALIZER; |
|
69 |
|
|
70 |
@end |
|
71 |
|
|
72 |
NS_ASSUME_NONNULL_END |