-
Notifications
You must be signed in to change notification settings - Fork 1
/
UnREST.h
52 lines (37 loc) · 1.35 KB
/
UnREST.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
//
// UnREST.h
// UnREST
//
#define kUnRESTBoundary @"----UnR3ST"
#define kUnRESTMultipartName @"name"
#define kUnRESTMultipartType @"type"
#define kUnRESTMultipartContent @"content"
#define kUnRESTMultipartFilename @"filename"
#define kUnRESTContentTypePlain @"text/plain"
#define kUnRESTContentTypeImageJPEG @"image/jpeg"
#define kUnRESTJPEGQuality 0.8f
@protocol UnRESTDelegate;
@interface UnREST : NSObject {
NSString* urlString;
NSURLConnection* connection;
NSMutableData* responseData;
NSMutableArray* multiparts;
id<UnRESTDelegate> delegate;
}
@property (nonatomic, retain) NSString* urlString;
@property (nonatomic, assign) id<UnRESTDelegate> delegate;
+ (UnREST*) unrestWithURLString:(NSString*)urlString delegate:(id<UnRESTDelegate>)delegate;
- (id) initWithURLString:(NSString*)urlString delegate:(id<UnRESTDelegate>)delegate;
- (void) get;
- (void) sendString:(NSString*)string withHttpMethod:(NSString*)method;
- (void) putString:(NSString*)string;
- (void) postString:(NSString*)string;
- (void) postMultipart:(NSArray*)parts;
- (void) addTextPart:(NSString*)text name:(NSString*)name;
- (void) addImagePart:(UIImage*)image name:(NSString*)name;
- (void) postParts;
@end
@protocol UnRESTDelegate
- (void) unrest:(UnREST*)unrest didFinishWithResponse:(NSData*)response;
- (void) unrest:(UnREST*)unrest didFailWithError:(NSError*)error;
@end