UNICORN - iOS
R9HTTPRequestExtension.h
1 //
2 // R9HTTPRequestExtension.h
3 //
4 // Created by 藤田 泰介 on 12/02/25.
5 // Modified by saimushi on 14/06/16.
6 // Copyright (c) 2012 Revolution 9. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 
11 typedef void(^CompletionHandler)(NSHTTPURLResponse *responseHeader, NSString *responseString);
12 typedef void(^UploadProgressHandler)(float newProgress);
13 typedef void(^FailedHandler)(NSError *error);
14 
15 @interface R9HTTPRequestExtension : NSOperation <NSURLConnectionDataDelegate>
16 
17 @property (copy, nonatomic) CompletionHandler completionHandler;
18 @property (copy, nonatomic) FailedHandler failedHandler;
19 @property (copy, nonatomic) UploadProgressHandler uploadProgressHandler;
20 @property (strong, nonatomic) NSString *HTTPMethod;
21 @property (nonatomic, getter = isShouldRedirect) BOOL shouldRedirect;
22 @property (nonatomic, getter = isRunOnMainThread) BOOL runOnMainThread;
23 
24 - (id)initWithURL:(NSURL *)targetUrl;
25 
26 - (void)addHeader:(NSString *)value forKey:(NSString *)key;
27 
28 - (void)addBody:(NSString *)value forKey:(NSString *)key;
29 
30 - (void)setData:(NSData *)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
31 
32 /* TimeoutInterval must be greater than 240 seconds. */
33 - (void)setTimeoutInterval:(NSTimeInterval)seconds;
34 
35 - (void)startRequest;
36 
37 /* 拡張 */
38 - (NSMutableURLRequest *)getRequest;
39 - (NSData *)createMultipartBodyData;
40 - (NSData *)createBodyData;
41 
42 @end
Definition: R9HTTPRequestExtension.h:15