Warply.h
26.4 KB
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!
@header Warply.h
Provides a functional interface for Warply service.
Use the methods declared here to launch or abolish Warply service, access and
manage available functionality managers, add events and send them, get campaigns
inbox and POST/GET context from/to Warply service.
@copyright Warply Inc.
*/
#import <Foundation/Foundation.h>
#import "WLGlobals.h"
#import "WLEvent.h"
#import "WLLocationManager.h"
#import "WLAnalyticsManager.h"
#import "FMDatabase.h"
#import "FMDatabaseAdditions.h"
#import "WLPushManager.h"
@class WLUserManager;
@protocol WLActionHandler;
/*!
@defined WL_FMDBLogError
@abstract Defines an error logger for the local DB.
*/
#define WL_FMDBLogError if ([_db hadError]) { WLLOG(@"Err %d: %@", [_db lastErrorCode], [_db lastErrorMessage]); }
/*!
@typedef _WLResultCodes
@abstract Warply related custom result codes.
@field WLResultCodesSuccess The call was sucessful.
@field WLResultCodesError The structure or the parameters of the call are wrong.
@field WLResultCodesReadOnly You can read only and not write the selected attribute.
@field WLResultCodesInvalidCampaignID Either the campaing is expired or revoked.
@field WLResultCodesInvalidAppID You need to set the correct app id as shown in Warply.
@field WLResultCodesDeviceRegistrationFailed Check that device token is in correct format.
@field WLResultCodesInvalidJsonPath Check the path you trying to access.
@field WLResultCodesNotImplemented The call doesn't exists yet.
@field WLResultCodesInvalidWebID Need to register device again.
@field WLResultCodesAuthorizationFailed Invalid hash was sent.
@field WLResultCodesNotRegistered Need to register device prior to make the call.
@discussion These result codes are custom and related to Warply service. They
indicate whether a call is sucessfull and if not why it failed.
*/
typedef enum {
WLResultCodesSuccess = 1,
WLResultCodesError,
WLResultCodesReadOnly,
WLResultCodesInvalidCampaignID,
WLResultCodesInvalidAppID,
WLResultCodesDeviceRegistrationFailed,
WLResultCodesInvalidJsonPath,
WLResultCodesNotImplemented,
WLResultCodesInvalidWebID,
WLResultCodesAuthorizationFailed,
WLResultCodesNotRegistered
} _WLResultCodes;
/*!
@typedef WLContextRequestType
@abstract Warply related request types.
@field WLContextRequestTypeGet A GET type request.
@field WLContextRequestTypePost A POST type request.
@discussion These two types of requests indicate whether a request is GET or POST.
*/
typedef enum {
WLContextRequestTypeGet,
WLContextRequestTypePost
}WLContextRequestType;
/*!
@typedef WLServerType
@abstract Warply related servers types.
@field WLServerTypeDevelopment The developement Warply server. Mainly, used for
development and testing.
@field WLServerTypeProduction The production Warply server. Used by all live apps.
*/
typedef enum {
WLServerTypeDevelopment = 0,
WLServerTypeProduction
}WLServerType;
/*!
@defined WLResultCodesDescriptions
@abstract Defines an array of Warply releated results status.
*/
#define WLResultCodesDescriptions [NSArray arrayWithObjects:@"Success", @"Error", @"Read-only or Invalid context property", @"Invalid Campaign ID", @"Invalid Application ID", @"Device Registration Failed", @"Invalid JSON Path", @"Not Implemented", @"Invalid web-id", @"Authorisation Failed", nil]
/*!
@class WLAppService
@discussion The WLAppService provides a functional interface for Warply service.
*/
@interface Warply : NSObject
{
@private
//DB
FMDatabase *_db;
//Services
WLPushManager *_pushManager;
WLLocationManager *_locationManager;
}
/*!
@methodgroup Getting Shared Instance
*/
/*!
@abstract Returns a shared instance of WLAppService.
*/
+ (Warply *)sharedService;
/*!
@methodgroup Launching and Abolishing Warp service.
*/
/*!
@abstract Launching the Warply service.
@discussion This class method initialises the shared instance of WLAppService,
passes the launch options (if any) to managers in order to handle them and
launches the communication with Warply service using the provided unique app identification.
@param appUUID A string with the unique app identification.
@param launchOptions A dictionary with the application launch options. May be
empty if application launched by user.
*/
+ (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions;
/*!
@abstract Launching the Warply service.
@discussion This class method initialises the shared instance of WLAppService,
passes the launch options (if any) to managers in order to handle them and
launches the communication with Warply service using the provided unique app identification.
@param launchOptions A dictionary with the application launch options. May be
empty if application launched by user.
@param appUUID A string with the unique app identification.
@param customPushDelegate an class conforming to the WLCustomPushDelegate protocol responsible for handling the push notification.
*/
+ (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushHandler:(id <WLCustomPushHandler>)customPushHandler;
/*!
@abstract Launching the Warply service.
@discussion This class method initialises the shared instance of WLAppService,
passes the launch options (if any) to managers in order to handle them and
launches the communication with Warply service using the provided unique app identification.
@param launchOptions A dictionary with the application launch options. May be
empty if application launched by user.
@param appUUID A string with the unique app identification.
@param customPushDelegate an class conforming to the WLCustomPushDelegate protocol responsible for handling the push notification.
@param baseUrl: A NSString parameter for defining the base url.
*/
+ (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)baseUrl;
/*!
@property baseURL
@abstract A string the url of Warply server. Read-only access.
*/
@property (nonatomic, readonly, copy) NSString *baseURL;
/*!
@property webId
@abstract A string with the unique web id of the device.
*/
@property (nonatomic, copy, readonly) NSString *webId;
/*!
@property apiKey
@abstract A string with the unique identifier of the application.
*/
@property (nonatomic, copy) NSString *apiKey;
//Services
/*!
@property pushManager
@abstract A WLPush Manager for handling received Remote Notifications (Push).
*/
@property (nonatomic, strong) WLPushManager *pushManager;
/*!
@property locationManager
@abstract A WLLocation Manager for handling and reporting device location.
*/
@property (nonatomic, readonly, strong) WLLocationManager *locationManager;
/*!
@property consumerDataManager
@abstract A WLConsumer Manager for handling user name,e-mail and MSISDN.
*/
@property (nonatomic, readonly, strong) WLUserManager *consumerDataManager;
/*!
@property allOffers
@abstract All cached campaigns that the Warply Service provides the application according to the appUUID.
*/
@property (nonatomic, strong) NSArray *allOffers;
@property (nonatomic, strong) NSArray *allProducts;
/*!
@defined WL_VERSION_INTERFACE
@abstract Defines macros for geeting the SDK version.
@parseOnly
*/
WL_VERSION_INTERFACE()
/*!
@methodgroup App Lifecycle Methods
@discussion Convenience methods for mananging Managers behaviour and sendining
in-app analytics according to app state.
*/
/*!
@abstract Notify that app did enter background.
@discussion This method notifies managers and sends in-app analytic that app did
enter background.
*/
- (void)applicationDidEnterBackground;
/*!
@abstract Notify that app will enter foreground.
@discussion This method notifies managers and sends in-app analytic that app will
enter foreground.
*/
- (void)applicationWillEnterForeground;
/*!
@abstract Notify that app did become active.
@discussion This method notifies managers and sends in-app analytic that app did
become active.
*/
- (void)applicationDidBecomeActive;
/*!
@abstract Notify that app will terminate.
@discussion This method notifies managers and sends in-app analytic that app will
terminate.
*/
- (void)applicationWillTerminate;
/*!
@methodgroup Public API
@discussion Convenience methods for doing the most common tasks
*/
/*!
@abstract Send an event.
@discussion This method sends an event. This event is stored into a local DB
and is sent over to Warply service when a threshold of stored events is exceeded or immediately if the priority parameter is YES
@param event A WLEvent object.
@param priority A BOOL value indicating if the event should be sent immediately or not.
@see //apple_ref/occ/cl/WLEvent WLEvent
@seealso //apple_ref/occ/instm/WLAppService/addPriorityEvent: addPriorityEvent:
*/
- (void)addEvent:(WLEvent *)event priority:(BOOL)priority;
/*!
@abstract Get inbox from Warply service.
@attributeblock successBlock This block is called when getInbox is sucessful and returns an array with the available WLInboxItem items.
@attributeblock failureBlock This block is called when getInbox fails and returns an error object with failure code and description.
@see //apple_ref/occ/cl/WLInboxItem WLInboxItem
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method gets the inbox with campaigns from Warply service. The
method returns an array with WLInboxItem objects (campaigns). The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)getInboxWithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
- (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params))success failureBlock:(void(^)(NSError *error))failure;
- (void)sendContactWithSuccessBlock:(NSString *)name andEmail:(NSString *)email andMsisdn:msisdn andMessage:message :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure;
- (void)getContentWithCategoryWithSuccessBlock:(NSString *)category andTags:(NSArray *)tags :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure;
- (void)getMerchantCategoriesWithSuccessBlock :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure;
- (void)getMerchantsWithSuccessBlock:(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure;
- (void)getTagsCategoriesWithSuccessBlock :(void(^)(NSMutableArray *tagsCategories))success failureBlock:(void(^)(NSError *error))failure;
- (void)getTagsWithSuccessBlock :(void(^)(NSMutableArray *tagsCategories))success failureBlock:(void(^)(NSError *error))failure;
- (void)loginWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)webAuthorizeWithSuccessBlock:(NSDictionary*)contextResponse andId:(NSString*)id andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)tokenWithSuccessBlock:(NSDictionary*)contextResponse andClientId:(NSString*)clientId andClientSecret:(NSString*)clientSecret andLoginType:(NSString*) loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)registerWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andName:(NSString*)name andEmail:(NSString*)email andSegmentation:(NSNumber*)segmentation andNewsletter:(NSNumber*)newsletter :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)refreshToken:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)changePasswordWithSuccessBlock:(NSString*)oldPassword andNewPassword:(NSString*)newPassword :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getProfileWithSuccessBlock :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)editProfileWithSuccessBlock:(NSString*)firstName andLastName:(NSString*)lastName andEmail:(NSString*)email andSalutation:(NSString*)salutation andMsisdn:(NSString*)msisdn
andNickname:(NSString*)nickname andGender:(NSString*)gender andBirthday:(NSString*)birthday andNameDay:(NSString*)nameday andTaxID:(NSString*)taxID andProfileMetadata:(NSDictionary*)profileMetadata optin:(NSNumber*) optin newsLetter:(NSNumber*)newsletter
andSMS:(NSNumber*)sms andSegmentation:(NSNumber*)segmentation andSMSSegmentation:(NSNumber*)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)changeProfileImageWithSuccessBlock:(NSString*)image andUserId:(NSString*)userId :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)addCardWithSuccessBlock:(NSString*)number andCardIssuer:(NSString*)cardIssuer andCardHolder:(NSString*)cardHolder andExpirationMonth:(NSString*)expirationMonth andExpirationYear:(NSString*)expirationYear :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getCardsWithSuccessBlock:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)deleteCardWithSuccessBlock:(NSString*)token :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getCouponsWithSuccessBlock:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getTransactionHistoryWithSuccessBlock:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getPointsHistoryWithSuccessBlock:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)verifyTicketWithSuccessBlock:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)addAddressWithSuccessBlock:(NSString*)friendlyName :(NSString*)addressName :(NSString*)addressNumber :(NSString*)postalCode :(NSNumber*)floorNumber :(NSString*)doorbel :(NSString*)region :(NSString*)latitude :(NSString*)longitude :(NSString*)notes :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getAddressWithSuccessBlock:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)editAddressWithSuccessBlock:(NSString*)friendlyName andAddressName:(NSString*)addressName andAddressNumber:(NSString*)addressNumber andPostalCode:(NSString*)postalCode andFloorNumber:(NSNumber*)floorNumber andDoorbel:(NSString*)doorbel andRegion:(NSString*)region andLatitude:(NSString*)latitude andLongitude:(NSString*)longitude andNotes:(NSString*)notes andUuid:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)deleteAddressWithSuccessBlock:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)redeemCouponWithSuccessBlock:(NSString*)id andUuid:(NSString*)uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)forgotPasswordWithIdWithSuccessBlock:(NSString*)id andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)requestOtpWithMsisdnWithSuccessBlock:(NSString*)msisdn andScope:(NSString*)scope :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)resetPasswordWithPasswordWithSuccessBlock:(NSString*)password andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid andConfToken:(NSString*)confToken :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
/*!
@abstract Get the full page add accordint to the display_type of a campaign.
@attributeblock successBlock This block is called when getInbox is sucessful and allOffers is empty or nil and returns an array with the available WLInboxItem items. Otherwise, the allOffers array is filtered.
@attributeblock failureBlock This block is called when getInbox fails and returns an error object with failure code and description.
@see //apple_ref/occ/cl/WLInboxItem WLInboxItem
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method gets the inbox with full_page campaigns from Warply service. The method returns an array with WLInboxItem objects (campaigns) with display_type = full_page. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)showFullPageAdIfExists:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
/*!
@abstract Get inbox from Warply service by filter.
@attributeblock successBlock This block is called when getInbox is sucessful and returns an array with the avaiable filtered WLInboxItem items.
@attributeblock failureBlock This block is called when getInbox fails and returns an error object with failure code and description.
@see //apple_ref/occ/cl/WLInboxItem WLInboxItem
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
*/
- (BOOL)getInboxByFilter:(NSString*)filter andValue:(NSString*)value withSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
/*!
@abstract Gets the inbox items that are linked to locations near the given location.
@attributeblock successBlock This block is called when getInbox is sucessful and returns an array with the avaiable WLInboxItem items.
@attributeblock failureBlock This block is called when getInbox fails and returns an error object with failure code and description.
@see //apple_ref/occ/cl/WLInboxItem WLInboxItem
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method gets the inbox with campaigns from Warply service. The
method returns an array with WLInboxItem objects (campaigns). The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)getInboxItemsNearLocation:(CLLocationCoordinate2D)coordinates withSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
/*!
@abstract Gets the inbox items that are linked to locations near user.
@attributeblock successBlock This block is called when getInbox is sucessful and returns an array with the avaiable WLInboxItem items.
@attributeblock failureBlock This block is called when getInbox fails and returns an error object with failure code and description.
@see //apple_ref/occ/cl/WLInboxItem WLInboxItem
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method gets the inbox with campaigns from Warply service. The
method returns an array with WLInboxItem objects (campaigns). The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)getInboxItemsNearMeWithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
/*
@abstract Get the statistics for the inbox.
@param success: A block that is executed when the call succeeds and has int parameters the count of the items in the inbox, the new items and the unread items;
@param failure: A block with an NSError parameter that gets called when the call fails.
*/
- (void)getInboxStatusWithSuccessBlock:(void (^)(int count, int newItems, int unread))success failureBlock:(void (^)(NSError *error))failure;
/*!
@methodgroup Low Level API
@discussion Convenience methods for either GET/POST context or send all events
stored in local DB.
*/
/*!
@abstract Get context for the specified path.
@param path A string with the path to access and get the value.
@attributeblock successBlock This block is called when getContex is sucessful and returns an id.
@attributeblock failureBlock This block is called when getInbox fails and returns an error object with failure code and description.
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method gets the context for the specified path. The success block has a parameter of type
id as the type of the data returned value may differ in each case depending on the specified
path. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)getContextWithPath:(NSString *)path
successBlock:(void (^)(id contextResponse))successBlock
failureBlock:(void (^)(NSError *error))failureBlock;
/*!
@abstract Post context to a specified path.
@param context The data you want to send to the server under the "context" key.
@attributeblock successBlock This block is called when sendContext is sucessful and returns an id.
@attributeblock failureBlock This block is called when the call fails and returns an error object with failure code and description.
@see //apple_ref/c/tdef/_WLResultCodes WLResultCodes
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method post the context for the specified path. Make sure that
the path, you are trying to access, has write and not only read permissions. If
it has only read permsissions the post will fail with WLResultCodesReadOnly error
code. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)sendContext:(NSData*)context
successBlock:(void (^)(NSDictionary *contextResponse))successBlock
failureBlock:(void (^)(NSError *error))failureBlock;
/*!
@abstract Send all localy stored events to Warply service.
@discussion This method flags and sends all the locally stored events to Warply
service. This happend independent if number of locally stored event threshold
has be reached or not. The events are deleted from local DB only when the call is
sucesful. Otherwise, the events remain stored until either the threshold of stored
events is excited and they automatically send to Warply service or this method is
called again.
@attributeblock completionBlock This block is called when sendAllEvents is sucessful.
@attributeblock failureBlock This block is called when sendAllEvents fails and returns an error object with failure code and description.
*/
- (void)sendAllEventsWithCompletionBlock:(void (^)(void))successBlock failureBlock:(void (^)(void))failureBlock;
//TODO: needs revision
/*!
@abstract Gets the context and updates properties relevant with feature (microapp) and application variables availability .
@attributeblock completionBlock This block is called when the call to the server is completed successfully.
@attributeblock failureBlock This block is called when the call to the server fails.
*/
- (void)getAppSettingsWithSuccessBlock:(void (^)(void))success failureBlock:(void(^)(NSError *error))failure;
// TODO: add documentation
- (void)registerActionHandler:(id <WLActionHandler>)handler;
- (BOOL)handleActionUrl:(NSURL *)url;
-(BOOL)checkIfUserLoactionIsInPois:(CLLocation *) location;
@end
// TODO: add documentation
@protocol WLActionHandler <NSObject>
- (BOOL)canHandleActionUrl:(NSURL *)url;
- (void)handleActionUrl:(NSURL *)url;
@end