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 |
#import <Foundation/Foundation.h> |
|
23 |
#import "TFSScribe.h" |
|
24 |
#import "TWTRScribeClientEventNamespace.h" |
|
25 |
#import "TWTRScribeItem.h" |
|
26 |
|
|
27 |
NS_ASSUME_NONNULL_BEGIN |
|
28 |
|
655e66
|
29 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionClient; |
H |
30 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionPage; |
|
31 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionSectionTweet; |
|
32 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionSectionQuoteTweet; |
|
33 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionSectionVideo; |
|
34 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionSectionGallery; |
|
35 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionSectionAuth; |
a0a843
|
36 |
|
655e66
|
37 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionComponent; |
H |
38 |
FOUNDATION_EXTERN NSString *const TWTRScribeEmptyKey; |
|
39 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionTypeLoad; |
|
40 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionTypeImpression; |
|
41 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionTypeShare; |
|
42 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventImpressionAction; |
|
43 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventActionClick; |
|
44 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventActionFilter; |
a0a843
|
45 |
|
655e66
|
46 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventUniquesClient; |
H |
47 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventUniquesPageTweetViews; |
|
48 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventUniquesPageLogin; |
|
49 |
FOUNDATION_EXTERN NSString *const TWTRScribeEventUniquesAction; |
a0a843
|
50 |
|
655e66
|
51 |
FOUNDATION_EXTERN NSString *const TWTRScribeActionLike; |
H |
52 |
FOUNDATION_EXTERN NSString *const TWTRScribeActionUnlike; |
|
53 |
FOUNDATION_EXTERN NSString *const TWTRScribeActionStart; |
|
54 |
FOUNDATION_EXTERN NSString *const TWTRScribeActionSuccess; |
|
55 |
FOUNDATION_EXTERN NSString *const TWTRScribeActionCancelled; |
|
56 |
FOUNDATION_EXTERN NSString *const TWTRScribeActionFailure; |
a0a843
|
57 |
|
H |
58 |
/** |
|
59 |
* Possible values for which category to scribe events to. |
|
60 |
*/ |
|
61 |
typedef NS_ENUM(NSUInteger, TWTRScribeEventCategory) { |
|
62 |
/** |
|
63 |
* Used for logging impressions and feature usage for Tweet views. |
|
64 |
*/ |
|
65 |
TWTRScribeEventCategoryImpressions = 1, |
|
66 |
/** |
|
67 |
* Used only for logging number of uniques using the Kit. There are no browsing history logged, |
|
68 |
* so we can keep the events longer to calculate monthly actives. |
|
69 |
*/ |
|
70 |
TWTRScribeEventCategoryUniques |
|
71 |
}; |
|
72 |
|
|
73 |
@interface TWTRScribeEvent : NSObject <TFSScribeEventParameters> |
|
74 |
|
|
75 |
@property (nonatomic, copy, readonly, nullable) NSString *userID; |
|
76 |
@property (nonatomic, copy, readonly, nullable) NSString *tweetID; |
|
77 |
@property (nonatomic, copy, readonly) NSString *eventInfo; |
|
78 |
@property (nonatomic, assign, readonly) TWTRScribeEventCategory category; |
|
79 |
@property (nonatomic, copy, readonly) TWTRScribeClientEventNamespace *eventNamespace; |
|
80 |
@property (nonatomic, copy, readonly) NSArray<TWTRScribeItem *> *items; |
|
81 |
|
655e66
|
82 |
- (instancetype)init NS_UNAVAILABLE; |
a0a843
|
83 |
- (instancetype)initWithUserID:(nullable NSString *)userID tweetID:(nullable NSString *)tweetID category:(TWTRScribeEventCategory)category eventNamespace:(TWTRScribeClientEventNamespace *)eventNamespace items:(nullable NSArray<TWTRScribeItem *> *)items; |
H |
84 |
|
|
85 |
- (instancetype)initWithUserID:(nullable NSString *)userID eventInfo:(nullable NSString *)eventInfo category:(TWTRScribeEventCategory)category eventNamespace:(TWTRScribeClientEventNamespace *)eventNamespace items:(nullable NSArray<TWTRScribeItem *> *)items; |
|
86 |
|
|
87 |
#pragma mark - TFSScribeEventParameters |
|
88 |
|
|
89 |
- (NSDictionary *)dictionaryRepresentation; |
|
90 |
- (NSString *)userID; |
|
91 |
- (NSData *)data; |
|
92 |
|
|
93 |
@end |
|
94 |
|
|
95 |
/** |
|
96 |
* A Scribe event for logging errors to the Twitter backend |
|
97 |
*/ |
|
98 |
@interface TWTRErrorScribeEvent : TWTRScribeEvent |
|
99 |
|
|
100 |
@property (nonatomic, readonly) NSError *error; |
|
101 |
@property (nonatomic, copy, readonly) NSString *errorMessage; |
|
102 |
|
|
103 |
/** |
|
104 |
* Initializer |
|
105 |
* |
|
106 |
* @param error (optional) An NSError object representing this error case. |
|
107 |
* @param errorMessage (required) An error message describing the error situation. |
|
108 |
* |
|
109 |
* @return A fully initialized scribe object ready to enqueue or nil if any of |
|
110 |
* the required parameters are missing. |
|
111 |
*/ |
|
112 |
- (instancetype)initWithError:(nullable NSError *)error message:(NSString *)errorMessage; |
|
113 |
|
|
114 |
@end |
|
115 |
|
|
116 |
NS_ASSUME_NONNULL_END |