forked from shaioz/AFNetworking-AutoRetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AFHTTPSessionManager+AutoRetry.h
116 lines (95 loc) · 5.82 KB
/
AFHTTPSessionManager+AutoRetry.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
//
// Created by Shai Ohev Zion on 1/23/14.
// Copyright (c) 2014 shaioz. All rights reserved.
#ifdef DEBUG
#define ARLog(format, ...) NSLog(format, ## __VA_ARGS__)
#else
#define ARLog(...)
#endif
#import <Foundation/Foundation.h>
#import "AFHTTPSessionManager.h"
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedMethodInspection"
@interface AFHTTPSessionManager (AutoRetry)
- (NSURLSessionDataTask *)requestUrlWithAutoRetry:(int)retriesRemaining
retryInterval:(int)intervalInSeconds
originalRequestCreator:(NSURLSessionDataTask *(^)(void (^)(NSURLSessionDataTask *, NSError *)))taskCreator
originalFailure:(void (^)(NSURLSessionDataTask *, NSError *))failure;
- (NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id respo))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)HEAD:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(NSDictionary *)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)PUT:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)PATCH:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry
retryInterval:(int)intervalInSeconds;
- (NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id respo))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry;
- (NSURLSessionDataTask *)HEAD:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry;
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry;
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(NSDictionary *)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry;
- (NSURLSessionDataTask *)PUT:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry;
- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
autoRetry:(int)timesToRetry;
@property (strong) id tasksDict;
@property (copy) id retryDelayCalcBlock;
@end
#pragma clang diagnostic pop