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 "GDTCOREventTransformer.h" |
|
20 |
#import "GDTCORTargets.h" |
|
21 |
|
|
22 |
@class GDTCOREvent; |
|
23 |
|
|
24 |
NS_ASSUME_NONNULL_BEGIN |
|
25 |
|
|
26 |
@interface GDTCORTransport : NSObject |
|
27 |
|
|
28 |
// Please use the designated initializer. |
|
29 |
- (instancetype)init NS_UNAVAILABLE; |
|
30 |
|
|
31 |
/** Initializes a new transport that will send events to the given target backend. |
|
32 |
* |
|
33 |
* @param mappingID The mapping identifier used by the backend to map the data object transport |
|
34 |
* bytes to a proto. |
|
35 |
* @param transformers A list of transformers to be applied to events that are sent. |
|
36 |
* @param target The target backend of this transport. |
|
37 |
* @return A transport that will send events. |
|
38 |
*/ |
|
39 |
- (nullable instancetype)initWithMappingID:(NSString *)mappingID |
|
40 |
transformers: |
|
41 |
(nullable NSArray<id<GDTCOREventTransformer>> *)transformers |
|
42 |
target:(GDTCORTarget)target NS_DESIGNATED_INITIALIZER; |
|
43 |
|
|
44 |
/** Copies and sends an internal telemetry event. Events sent using this API are lower in priority, |
|
45 |
* and sometimes won't be sent on their own. |
|
46 |
* |
|
47 |
* @note This will convert the event's data object to data and release the original event. |
|
48 |
* |
|
49 |
* @param event The event to send. |
|
50 |
* @param completion A block that will be called when the event has been written or dropped. |
|
51 |
*/ |
|
52 |
- (void)sendTelemetryEvent:(GDTCOREvent *)event |
|
53 |
onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion; |
|
54 |
|
|
55 |
/** Copies and sends an internal telemetry event. Events sent using this API are lower in priority, |
|
56 |
* and sometimes won't be sent on their own. |
|
57 |
* |
|
58 |
* @note This will convert the event's data object to data and release the original event. |
|
59 |
* |
|
60 |
* @param event The event to send. |
|
61 |
*/ |
|
62 |
- (void)sendTelemetryEvent:(GDTCOREvent *)event; |
|
63 |
|
|
64 |
/** Copies and sends an SDK service data event. Events send using this API are higher in priority, |
|
65 |
* and will cause a network request at some point in the relative near future. |
|
66 |
* |
|
67 |
* @note This will convert the event's data object to data and release the original event. |
|
68 |
* |
|
69 |
* @param event The event to send. |
|
70 |
* @param completion A block that will be called when the event has been written or dropped. |
|
71 |
*/ |
|
72 |
- (void)sendDataEvent:(GDTCOREvent *)event |
|
73 |
onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion; |
|
74 |
|
|
75 |
/** Copies and sends an SDK service data event. Events send using this API are higher in priority, |
|
76 |
* and will cause a network request at some point in the relative near future. |
|
77 |
* |
|
78 |
* @note This will convert the event's data object to data and release the original event. |
|
79 |
* |
|
80 |
* @param event The event to send. |
|
81 |
*/ |
|
82 |
- (void)sendDataEvent:(GDTCOREvent *)event; |
|
83 |
|
|
84 |
/** Creates an event for use by this transport. |
|
85 |
* |
|
86 |
* @return An event that is suited for use by this transport. |
|
87 |
*/ |
|
88 |
- (GDTCOREvent *)eventForTransport; |
|
89 |
|
|
90 |
@end |
|
91 |
|
|
92 |
NS_ASSUME_NONNULL_END |