-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCCall.h
109 lines (86 loc) · 3.95 KB
/
RCCall.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
//
// RCCall.h
// RestClient
//
// Created by Alberto García Hierro on 16/04/09.
// Copyright 2009 Alberto García Hierro. All rights reserved.
//
#import <Foundation/Foundation.h>
@class RCManager;
typedef enum {
kRCCallMethodHEAD,
kRCCallMethodGET,
kRCCallMethodPOST,
kRCCallMethodPUT,
kRCCallMethodDELETE,
} RCCallMethod;
@interface RCCall : NSObject {
RCManager *manager_;
RCCallMethod callMethod_;
NSString *callURL_;
NSArray *parameters_;
id <NSObject> delegate_;
SEL didFinishSelector_;
SEL didFailSelector_;
NSMutableURLRequest *request_;
NSMutableData *responseBody_;
NSStringEncoding bodyEncoding_;
NSHTTPURLResponse *response_;
NSError *responseError_;
NSURLConnection *connection_;
void *context_;
}
@property(nonatomic, assign) RCManager *manager;
@property(nonatomic) RCCallMethod callMethod;
@property(nonatomic, copy) NSString *callURL;
@property(nonatomic, retain) NSArray *parameters;
@property(nonatomic, assign) id <NSObject> delegate;
@property(nonatomic) SEL didFinishSelector;
@property(nonatomic) SEL didFailSelector;
@property(nonatomic) NSStringEncoding bodyEncoding;
@property(nonatomic, readonly) NSMutableURLRequest *request;
@property(nonatomic, readonly) NSData *responseBody;
@property(nonatomic, readonly) NSHTTPURLResponse *response;
@property(nonatomic, readonly) NSInteger responseCode;
@property(nonatomic, readonly) NSError *responseError;
@property(nonatomic, readonly) NSString *responseBodyString;
@property(nonatomic, assign) void *context;
@property(nonatomic, readonly) BOOL didSucceed;
- (id)initWithCallURL:(NSString *)theCallURL parameters:(NSArray *)parameters;
- (id)initWithCallURL:(NSString *)theCallURL method:(RCCallMethod)theMethod
parameters:(NSArray *)theParameters didFinishSelector:(SEL)didFinishSelector
didFailSelector:(SEL)didFailSelector;
- (id)initWithCallURL:(NSString *)theCallURL parameters:(NSArray *)theParameters
didFinishSelector:(SEL)didFinishSelector didFailSelector:(SEL)didFailSelector;
- (id)initWithCallURL:(NSString *)theCallURL method:(RCCallMethod)theMethod
didFinishSelector:(SEL)didFinishSelector didFailSelector:(SEL)didFailSelector;
- (id)initWithCallURL:(NSString *)theCallURL didFinishSelector:(SEL)didFinishSelector
didFailSelector:(SEL)didFailSelector;
- (id)initWithCallURL:(NSString *)theCallURL method:(RCCallMethod)theMethod
parameters:(NSArray *)theParameters delegate:(id <NSObject>)delegate
didFinishSelector:(SEL)didFinishSelector didFailSelector:(SEL)didFailSelector;
- (void)prepareRequest;
- (void)perform;
- (void)cancel;
- (void)reset;
+ (id)callWithCallURL:(NSString *)theCallURL parameters:(NSArray *)parameters;
+ (id)callWithCallURL:(NSString *)theCallURL method:(RCCallMethod)theMethod
parameters:(NSArray *)theParameters didFinishSelector:(SEL)didFinishSelector
didFailSelector:(SEL)didFailSelector;
+ (id)callWithCallURL:(NSString *)theCallURL parameters:(NSArray *)theParameters
didFinishSelector:(SEL)didFinishSelector didFailSelector:(SEL)didFailSelector;
+ (id)callWithCallURL:(NSString *)theCallURL parameters:(NSArray *)theParameters
didFinishSelector:(SEL)didFinishSelector;
+ (id)callWithCallURL:(NSString *)theCallURL didFinishSelector:(SEL)didFinishSelector;
+ (id)callWithCallURL:(NSString *)theCallURL method:(RCCallMethod)theMethod
didFinishSelector:(SEL)didFinishSelector didFailSelector:(SEL)didFailSelector;
+ (id)callWithCallURL:(NSString *)theCallURL didFinishSelector:(SEL)didFinishSelector
didFailSelector:(SEL)didFailSelector;
+ (id)callWithCallURL:(NSString *)theCallURL method:(RCCallMethod)theMethod
parameters:(NSArray *)theParameters delegate:(id <NSObject>)delegate
didFinishSelector:(SEL)didFinishSelector didFailSelector:(SEL)didFailSelector;
+ (id)callWithCallURL:(NSString *)theCallURL delegate:(id <NSObject>)delegate
didFinishSelector:(SEL)didFinishSelector;
+ (id)callWithCallURL:(NSString *)theCallURL parameters:(NSArray *)parameters
delegate:(id <NSObject>)delegate didFinishSelector:(SEL)didFinishSelector;
@end