forked from aws-amplify/aws-sdk-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AWSPinpointAnalyticsClient.h
170 lines (128 loc) · 5.95 KB
/
AWSPinpointAnalyticsClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//
// Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://aws.amazon.com/apache2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
@class AWSPinpointEvent, AWSTask, AWSPinpointEventRecorder;
NS_ASSUME_NONNULL_BEGIN
typedef __nullable id(^AWSPinpointCompletionBlock)(AWSTask *task);
@interface AWSPinpointAnalyticsClient : NSObject
/**
Returns the `AWSPinpointEventRecorder` which is the low level client used to record events to local storage.
You can use it for more advanced fine grained control over the events recorded.
@returns the `AWSPinpointEventRecorder` used for storing events.
*/
@property (nonatomic, readonly) AWSPinpointEventRecorder * eventRecorder;
/**
Adds the specified attribute to all subsequent recorded events.
@param theValue the value of the attribute.
@param theKey the name of the attribute to add.
*/
- (void)addGlobalAttribute:(NSString *)theValue
forKey:(NSString *)theKey;
/**
Adds the specified attribute to all subsequent recorded events with the specified event type.
@param theValue the value of the attribute.
@param theKey the name of the attribute to add.
@param theEventType the type of events to add the attribute to.
*/
- (void)addGlobalAttribute:(NSString *)theValue
forKey:(NSString *)theKey
forEventType:(NSString *)theEventType;
/**
Adds the specified metric to all subsequent recorded events.
@param theValue the value of the metric
@param theKey the name of the metric to add
*/
- (void)addGlobalMetric:(NSNumber *)theValue
forKey:(NSString *)theKey;
/**
Adds the specified metric to all subsequent recorded events with the specified event type.
@param theValue the value of the metric
@param theKey the name of the metric to add
@param theEventType the type of events to add the metric to
*/
- (void)addGlobalMetric:(NSNumber *)theValue
forKey:(NSString *)theKey
forEventType:(NSString *)theEventType;
/**
Removes the specified attribute. All subsequent recorded events will no longer have this global attribute.
@param theKey the key of the attribute to remove
*/
- (void)removeGlobalAttributeForKey:(NSString*) theKey;
/**
Removes the specified attribute. All subsequent recorded events with the specified event type will no longer have this global attribute.
@param theKey the key of the attribute to remove
@param theEventType the type of events to remove the attribute from
*/
- (void)removeGlobalAttributeForKey:(NSString*) theKey
forEventType:(NSString*) theEventType;
/**
Removes the specified metric. All subsequent recorded events will no longer have this global metric.
@param theKey the key of the metric to remove
*/
- (void)removeGlobalMetricForKey:(NSString*) theKey;
/**
Removes the specified metric. All subsequent recorded events with the specified event type will no longer have this global metric.
@param theKey the key of the metric to remove
@param theEventType the type of events to remove the metric from
*/
- (void)removeGlobalMetricForKey:(NSString*) theKey
forEventType:(NSString*) theEventType;
/**
Records the specified AWSPinpointEvent to the local filestore.
@param theEvent The AWSPinpointEvent to persist
@return AWSTask - task.result is always nil.
*/
-(AWSTask *) recordEvent:(AWSPinpointEvent *) theEvent;
/**
Create an AWSPinpointEvent with the specified theEventType
@param theEventType the type of event to create
@returns an AWSPinpointEvent with the specified event type
*/
- (AWSPinpointEvent *)createEventWithEventType:(NSString *)theEventType;
/**
Create an Apple monetization AWSPinpointEvent of type "_monetization.purchase" with the specified parameters.
@param transaction A SKPaymentTransaction object returned from an IAP
@param product A SKProduct object of the an IAP
@returns an AWSPinpointEvent with the specified event type
*/
- (AWSPinpointEvent *)createAppleMonetizationEventWithTransaction:(SKPaymentTransaction *) transaction withProduct:(SKProduct *) product;
/**
Create a Virtual monetization AWSPinpointEvent of type "_monetization.purchase" with the specified parameters.
@param theProductId A product identifier for your virtual monitization event
@param theItemPrice An item price for your virtual monitization event
@param theQuantity A quantity of how many products sold for your virtual monitization event
@param theCurrency The currency for your virtual monitization event
@returns an AWSPinpointEvent with the specified event type
*/
- (AWSPinpointEvent *)createVirtualMonetizationEventWithProductId:(NSString *)theProductId
withItemPrice:(double)theItemPrice
withQuantity:(NSInteger)theQuantity
withCurrency:(NSString *)theCurrency;
/**
Submits all recorded events to Pinpoint.
Events are automatically submitted when the application goes into the background.
@return AWSTask - task.result contains successful submitted events.
*/
- (AWSTask *) submitEvents;
/**
Submits all recorded events to Pinpoint.
Events are automatically submitted when the application goes into the background.
@param completionBlock The block to be executed after submission has completed.
@return AWSTask - task.result is always nil.
*/
- (AWSTask *) submitEventsWithCompletionBlock:(AWSPinpointCompletionBlock) completionBlock;
@end
NS_ASSUME_NONNULL_END