root / asi-http-request-with-pithos / Classes / ASIFormDataRequest.h @ be116d22
History | View | Annotate | Download (2.6 kB)
1 |
//
|
---|---|
2 |
// ASIFormDataRequest.h
|
3 |
// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
|
4 |
//
|
5 |
// Created by Ben Copsey on 07/11/2008.
|
6 |
// Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
|
7 |
//
|
8 |
|
9 |
#import <Foundation/Foundation.h>
|
10 |
#import "ASIHTTPRequest.h" |
11 |
#import "ASIHTTPRequestConfig.h" |
12 |
|
13 |
typedef enum _ASIPostFormat { |
14 |
ASIMultipartFormDataPostFormat = 0,
|
15 |
ASIURLEncodedPostFormat = 1
|
16 |
|
17 |
} ASIPostFormat; |
18 |
|
19 |
@interface ASIFormDataRequest : ASIHTTPRequest <NSCopying> {
|
20 |
|
21 |
// Parameters that will be POSTed to the url
|
22 |
NSMutableArray *postData; |
23 |
|
24 |
// Files that will be POSTed to the url
|
25 |
NSMutableArray *fileData; |
26 |
|
27 |
ASIPostFormat postFormat; |
28 |
|
29 |
NSStringEncoding stringEncoding; |
30 |
|
31 |
#if DEBUG_FORM_DATA_REQUEST
|
32 |
// Will store a string version of the request body that will be printed to the console when ASIHTTPREQUEST_DEBUG is set in GCC_PREPROCESSOR_DEFINITIONS
|
33 |
NSString *debugBodyString; |
34 |
#endif
|
35 |
|
36 |
} |
37 |
|
38 |
#pragma mark utilities
|
39 |
- (NSString*)encodeURL:(NSString *)string; |
40 |
|
41 |
#pragma mark setup request
|
42 |
|
43 |
// Add a POST variable to the request
|
44 |
- (void)addPostValue:(id <NSObject>)value forKey:(NSString *)key;
|
45 |
|
46 |
// Set a POST variable for this request, clearing any others with the same key
|
47 |
- (void)setPostValue:(id <NSObject>)value forKey:(NSString *)key;
|
48 |
|
49 |
// Add the contents of a local file to the request
|
50 |
- (void)addFile:(NSString *)filePath forKey:(NSString *)key;
|
51 |
|
52 |
// Same as above, but you can specify the content-type and file name
|
53 |
- (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
|
54 |
|
55 |
// Add the contents of a local file to the request, clearing any others with the same key
|
56 |
- (void)setFile:(NSString *)filePath forKey:(NSString *)key;
|
57 |
|
58 |
// Same as above, but you can specify the content-type and file name
|
59 |
- (void)setFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
|
60 |
|
61 |
// Add the contents of an NSData object to the request
|
62 |
- (void)addData:(NSData *)data forKey:(NSString *)key;
|
63 |
|
64 |
// Same as above, but you can specify the content-type and file name
|
65 |
- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
|
66 |
|
67 |
// Add the contents of an NSData object to the request, clearing any others with the same key
|
68 |
- (void)setData:(NSData *)data forKey:(NSString *)key;
|
69 |
|
70 |
// Same as above, but you can specify the content-type and file name
|
71 |
- (void)setData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
|
72 |
|
73 |
|
74 |
@property (assign) ASIPostFormat postFormat;
|
75 |
@property (assign) NSStringEncoding stringEncoding;
|
76 |
@end
|