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