-
Notifications
You must be signed in to change notification settings - Fork 157
/
cordova-fabric-plugin.d.ts
275 lines (242 loc) · 10.2 KB
/
cordova-fabric-plugin.d.ts
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
// Type definitions for cordova-fabric-plugin 1.0.0
// Project: https://github.com/sarriaroman/FabricPlugin
// Definitions by: Justin Unterreiner <https://github.com/Justin-Credible>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module FabricPlugin {
interface FabricPluginStatic {
/**
* API for interacting with the Crashlytics kit.
*
* https://docs.fabric.io/ios/crashlytics/index.html
*/
Crashlytics: Crashlytics;
/**
* API for interacting with the Answers kit.
*
* https://docs.fabric.io/ios/answers/index.html
*/
Answers: Answers;
}
/**
* API for interacting with the Crashlytics kit.
*
* https://docs.fabric.io/ios/crashlytics/index.html
*/
interface Crashlytics {
/**
* Add logging that will be sent with your crash data. This logging will not show up
* in the system.log and will only be visible in your Crashlytics dashboard.
*/
addLog(message: string): void;
/**
* Used to simulate a native platform crash (useful for testing Crashlytics logging).
*/
sendCrash(): void;
/**
* Used to log a non-fatal error message (Android only).
*/
sendNonFatalCrash(message: string, stacktrace?: any): void;
/**
* Used to record a non-fatal error message (iOS only).
*/
recordError(message: string, code: number): void;
/**
* Sets the user's identifier for logging to Crashlytics backend.
*/
setUserIdentifier(userId: string): void;
/**
* Sets the user's name for logging to Crashlytics backend.
*/
setUserName(userName: string): void;
/**
* Sets the user's email address for logging to Crashlytics backend.
*/
setUserEmail(email: string): void;
/**
* Sets a custom key/value pair for logging to Crashlytics backend.
*/
setStringValueForKey(value: string, key: string): void;
/**
* Sets a custom key/value pair for logging to Crashlytics backend.
*/
setIntValueForKey(value: number, key: string): void;
/**
* Sets a custom key/value pair for logging to Crashlytics backend.
*/
setBoolValueForKey(value: boolean, key: string): void;
/**
* Sets a custom key/value pair for logging to Crashlytics backend.
*/
setFloatValueForKey(value: number, key: string): void;
}
/**
* API for interacting with the Answers kit.
*
* https://docs.fabric.io/ios/answers/index.html
*/
interface Answers {
/**
* Sends the Purchase tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#purchase
*
* @param itemPrice The item's amount in the currency specified.
* @param currency The ISO4217 currency code.
* @param success Was the purchase completed succesfully?
* @param itemName The human-readable name for the item.
* @param itemType The category the item falls under.
* @param itemId A unique identifier used to track the item.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendPurchase(itemPrice?: number, currency?: string, success?: boolean, itemName?: string, itemType?: string, itemId?: string, attributes?: Attributes): void;
/**
* Sends the Add To Cart tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#add-to-cart
*
* @param itemPrice The item's amount in the currency specified.
* @param currency The ISO4217 currency code.
* @param itemName The human-readable name for the item.
* @param itemType The category the item falls under.
* @param itemId A unique identifier used to track the item.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendAddToCart(itemPrice?: number, currency?: string, itemName?: string, itemType?: string, itemId?: string, attributes?: Attributes): void;
/**
* Sends the Start Checkout tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#start-checkout
*
* @param totalPrice The total price of all items in cart in the currency specified.
* @param currency The ISO4217 currency code.
* @param itemCount The count of items in cart.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendStartCheckout(totalPrice?: number, currency?: string, itemCount?: number, attributes?: Attributes): void;
/**
* Sends the Search tracking event.
*
* https://docs.fabric.io/android/answers/answers-events.html#search
*
* @param query What the user is searching for.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendSearch(query: string, attributes?: Attributes): void;
/**
* Sends the Share tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#share
*
* @param method The method used to share content.
* @param contentName The description of the content.
* @param contentType The type or genre of content.
* @param contentId A unique key identifying the content.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendShare(method?: string, contentName?: string, contentType?: string, contentId?: string, attributes?: Attributes): void;
/**
* Sends the Rated Content tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#rated-content
*
* @param rating An integer rating of the content.
* @param contentName The human-readable name of content.
* @param contentType The category your item falls under.
* @param contentId A unique identifier used to track the item.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendRatedContent(rating?: number, contentName?: string, contentType?: string, contentId?: string, attributes?: Attributes): void;
/**
* Sends the Sign Up tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#sign-up
*
* @param method An optional description of the sign up method (Twitter, Facebook, etc.); defaults to "Direct".
* @param success An optional flag that indicates sign up success; defaults to true.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendSignUp(method?: string, success?: boolean, attributes?: Attributes): void;
/**
* Sends the Log In tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#log-in
*
* @param method An optional description of the sign in method (Twitter, Facebook, etc.); defaults to "Direct".
* @param success An optional flag that indicates sign in success; defaults to true.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendLogIn(method?: string, success?: boolean, attributes?: Attributes): void;
/**
* Sends the Invite tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#invite
*
* @param method An optional description of the sign in method (Twitter, Facebook, etc.); defaults to "Direct".
* @param attributes Any additional user-defined attributes to be logged.
*/
sendInvite(method?: string, attributes?: Attributes): void;
/**
* Sends the Level Start tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#level-start
*
* @param levelName String key describing the level.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendLevelStart(levelName?: string, attributes?: Attributes): void;
/**
* Sends the Level End tracking event.
*
* All parameters are optional.
*
* https://docs.fabric.io/android/answers/answers-events.html#level-end
*
* @param levelName String key describing the level.
* @param score The score for this level.
* @param success Completed the level or failed trying.
* @param attributes Any additional user-defined attributes to be logged.
*/
sendLevelEnd(levelName?: string, score?: number, success?: boolean, attributes?: Attributes): void;
/**
* Send the Content View tracking event.
*
* https://docs.fabric.io/android/answers/answers-events.html#content-view
*/
sendContentView(name: string, type?: string, id?: string, attributes?: Attributes): void;
/**
* Shortcut for sendContentView(...) using type of "Screen".
*/
sendScreenView(name: string, id: string, attributes?: Attributes): void;
/**
* Send a custom tracking event with the given name.
*
* https://docs.fabric.io/android/answers/answers-events.html#custom-event
*/
sendCustomEvent(name: string, attributes?: Attributes): void;
}
/**
* A key/value pair of strings.
*/
interface Attributes {
[index: string]: String;
}
}
declare var fabric: FabricPlugin.FabricPluginStatic;