-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPHNAPIRequestQueue.h
More file actions
69 lines (47 loc) · 1.75 KB
/
Copy pathPHNAPIRequestQueue.h
File metadata and controls
69 lines (47 loc) · 1.75 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
//
// PHNAPIRequestQueue.h
// PHGMobileTracking
//
// Created by Owain Brown on 30/10/2015.
//
//
#import <Foundation/Foundation.h>
#import "PHNSimpleStore.h"
NS_ASSUME_NONNULL_BEGIN
@class PHNEventRequest;
@class PHNRequestFactory;
@class PHNRequestQueue;
@class PHNRequest;
@protocol PHNAPIRequest <NSObject>
- (PHNRequest*) requestWithFactory:(PHNRequestFactory*)factory;
@end
@interface PHNAPIRequestQueue : NSObject <PHNSimplyStoreable>
- (instancetype) initWithRequestQueue:(PHNRequestQueue*)requestQueue
andFactory:(PHNRequestFactory*)factory;
+ (instancetype) APIQueueWithRequestQueue:(PHNRequestQueue*)requestQueue
andFactory:(PHNRequestFactory*)factory;
/**
* Adds api request to queue.
*
* If request is ready (it can produce transport form), and queue is ready
* (not paused). It will be immediately passed to the transport queue. If not, it is stored for later sending.
* @param
*/
- (void) addRequest:(PHNEventRequest*)request;
- (BOOL) executeRequest:(id<PHNAPIRequest>)request;
- (BOOL) requestInProgessWithIdentifier:(NSString*)identifier;
- (void) cancelRequestWithIdentifier:(NSString*)requestIdentifier;
/**
* clears all incomplete requests from the queue.
*/
- (void) clearQueue;
- (void) setTransportQueuePaused:(Boolean)isPaused;
@property(nonatomic) NSString* _Nullable trackingID;
@property(nonatomic, readonly) NSInteger incompleteRequests;
@property(nonatomic, readonly) NSInteger requestsInProgess;
///Transport queue for the request sending.
@property(nonatomic, readonly) PHNRequestQueue* transportQueue;
/// isQueuePaused - if paused, the queue won't allow requests to move to the transport queue.
@property(nonatomic) BOOL isQueuePaused;
@end
NS_ASSUME_NONNULL_END