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