commit | author | age
|
a6c014
|
1 |
/* |
L |
2 |
* Copyright 2018 Google |
|
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 |
#import <Foundation/Foundation.h> |
|
18 |
|
|
19 |
#import "GDTCOREventDataObject.h" |
|
20 |
#import "GDTCORTargets.h" |
|
21 |
|
|
22 |
@class GDTCORClock; |
|
23 |
|
|
24 |
NS_ASSUME_NONNULL_BEGIN |
|
25 |
|
|
26 |
/** The different possible quality of service specifiers. High values indicate high priority. */ |
|
27 |
typedef NS_ENUM(NSInteger, GDTCOREventQoS) { |
|
28 |
/** The QoS tier wasn't set, and won't ever be sent. */ |
|
29 |
GDTCOREventQoSUnknown = 0, |
|
30 |
|
|
31 |
/** This event is internal telemetry data that should not be sent on its own if possible. */ |
|
32 |
GDTCOREventQoSTelemetry = 1, |
|
33 |
|
|
34 |
/** This event should be sent, but in a batch only roughly once per day. */ |
|
35 |
GDTCOREventQoSDaily = 2, |
|
36 |
|
|
37 |
/** This event should be sent when requested by the uploader. */ |
|
38 |
GDTCOREventQosDefault = 3, |
|
39 |
|
|
40 |
/** This event should be sent immediately along with any other data that can be batched. */ |
|
41 |
GDTCOREventQoSFast = 4, |
|
42 |
|
|
43 |
/** This event should only be uploaded on wifi. */ |
|
44 |
GDTCOREventQoSWifiOnly = 5, |
|
45 |
}; |
|
46 |
|
|
47 |
@interface GDTCOREvent : NSObject <NSSecureCoding> |
|
48 |
|
|
49 |
/** The unique ID of the event. */ |
|
50 |
@property(readonly, nonatomic) NSString *eventID; |
|
51 |
|
|
52 |
/** The mapping identifier, to allow backends to map the transport bytes to a proto. */ |
|
53 |
@property(nullable, readonly, nonatomic) NSString *mappingID; |
|
54 |
|
|
55 |
/** The identifier for the backend this event will eventually be sent to. */ |
|
56 |
@property(readonly, nonatomic) GDTCORTarget target; |
|
57 |
|
|
58 |
/** The data object encapsulated in the transport of your choice, as long as it implements |
|
59 |
* the GDTCOREventDataObject protocol. */ |
|
60 |
@property(nullable, nonatomic) id<GDTCOREventDataObject> dataObject; |
|
61 |
|
|
62 |
/** The serialized bytes from calling [dataObject transportBytes]. */ |
|
63 |
@property(nullable, readonly, nonatomic) NSData *serializedDataObjectBytes; |
|
64 |
|
|
65 |
/** The quality of service tier this event belongs to. */ |
|
66 |
@property(nonatomic) GDTCOREventQoS qosTier; |
|
67 |
|
|
68 |
/** The clock snapshot at the time of the event. */ |
|
69 |
@property(nonatomic) GDTCORClock *clockSnapshot; |
|
70 |
|
|
71 |
/** The expiration date of the event. Default is 604800 seconds (7 days) from creation. */ |
|
72 |
@property(nonatomic) NSDate *expirationDate; |
|
73 |
|
|
74 |
/** Bytes that can be used by an uploader later on. */ |
|
75 |
@property(nullable, nonatomic) NSData *customBytes; |
|
76 |
|
|
77 |
/** Initializes an instance using the given mappingID. |
|
78 |
* |
|
79 |
* @param mappingID The mapping identifier. |
|
80 |
* @param target The event's target identifier. |
|
81 |
* @return An instance of this class. |
|
82 |
*/ |
|
83 |
- (nullable instancetype)initWithMappingID:(NSString *)mappingID target:(GDTCORTarget)target; |
|
84 |
|
|
85 |
@end |
|
86 |
|
|
87 |
NS_ASSUME_NONNULL_END |