-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMAPIClient.h
57 lines (38 loc) · 1.97 KB
/
MAPIClient.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
//
// MAPIClient.h
// Advocate
//
// Created by Ben Gotow on 6/29/13.
// Copyright (c) 2013 Bloganizer Inc. All rights reserved.
//
#import "MUser.h"
#define NOTIF_USER_CHANGED @"m_user_changed"
#define NOTIF_COLLECTION_CHANGED @"m_collection_changed"
#define NOTIF_MODEL_CHANGED @"m_model_changed"
#define NOTIF_API_QUEUE_CHANGED @"m_api_queue_changed"
#define CHANGE_NOTIF_FOR(x) [NSString stringWithFormat:@"m_collection_%@_changed", x]
typedef void (^RefreshCallbackBlock)(BOOL successBlock);
@interface MAPIClient : AFHTTPRequestOperationManager
{
NSMutableArray * _transactionsQueue;
BOOL _hasDisplayedDisconnectionNotice;
BOOL _updateDiskCacheTriggered;
NSMutableDictionary * _globalObjectStore;
}
@property (nonatomic, retain) MUser * user;
+ (MAPIClient *)shared;
- (void)updateDiskCache:(BOOL)immediate;
- (void)updateDiskCacheDebounced;
#pragma mark Requesting Object Data
- (void)dictionaryAtPath:(NSString*)path userTriggered:(BOOL)triggered success:(void (^)(id responseObject))successCallback failure:(void (^)(NSError *err))failureCallback;
- (void)arrayAtPath:(NSString*)path userTriggered:(BOOL)triggered success:(void (^)(id responseObject))successCallback failure:(void (^)(NSError *err))failureCallback;
- (void)requestPath:(NSString*)path withMethod:(NSString*)method withParameters: params userTriggered:(BOOL)triggered expectedClass:(Class)expectation success:(void (^)(id responseObject))successCallback failure:(void (^)(NSError *err))failureCallback;
#pragma mark Tracking API Access and Recovering from Offline State
- (NSUInteger)numberOfQueuedActions;
- (void)queueAPITransaction:(MAPITransaction*)a;
- (void)removeQueuedTransactionsFor:(MModel*)obj;
- (void)finishedAPITransaction:(MAPITransaction*)a withError:(NSError*)err;
- (void)performNextAction;
#pragma mark Handling Request Results
- (void)displayNetworkError:(NSError*)error forOperation:(AFHTTPRequestOperation*)operation withGoal:(NSString*)goal;
@end