00001
00002
00003
00004
00005
00006
00007
00008
00009 #import <Foundation/Foundation.h>
00010
00011 @class RMResponse;
00012 @class ASIFormDataRequest;
00013
00017 @protocol RMCallProtocol <NSObject>
00018
00019 @optional
00029 - (BOOL) requestShouldSend: (ASIFormDataRequest*) request
00030 method: (NSString*) method
00031 arguments: (NSDictionary*) arguments;
00032
00033 @optional
00041 - (void) requestWillSend: (ASIFormDataRequest*) request
00042 method: (NSString*) method
00043 arguments: (NSDictionary*) arguments;
00044
00045 @optional
00053 - (void) requestDidSend: (ASIFormDataRequest*) request
00054 method: (NSString*) method
00055 arguments: (NSDictionary*) arguments;
00056
00057 @required
00065 - (void) adjustRequest: (ASIFormDataRequest*) request
00066 method: (NSString*) method
00067 arguments: (NSDictionary*) arguments;
00068
00069 @optional
00075 - (BOOL) isAsynchronous;
00076
00077 @end
00078
00082 @protocol RMResultDelegate <NSObject>
00083
00084 @required
00090 - (void) finished: (RMResponse*) response;
00091
00092 @required
00099 - (void) failed: (RMResponse*) response
00100 error: (NSError*) error;
00101
00102 @end
00103
00107 @interface RMCall : NSObject {
00108 id<RMCallProtocol> protocol;
00109 NSMutableArray *protocolStack;
00110 NSMutableArray *responseQueue;
00111 NSMutableArray *delegateChain;
00112 NSAutoreleasePool *autoReleasePool;
00113 }
00114
00118 @property(readonly) id<RMCallProtocol> protocol;
00122 @property(readonly,getter=semaphore) id semaphore;
00123
00129 - (id)initWithProtocol: (id<RMCallProtocol>) protocol;
00130
00139 - (BOOL)call:(NSString*) method
00140 arguments:(NSDictionary*) arguments;
00141
00151 - (BOOL)call:(NSString*) method
00152 arguments:(NSDictionary*) arguments
00153 delegate:(id) delegate;
00154
00167 - (BOOL)call:(NSString*) method
00168 arguments:(NSDictionary*) arguments
00169 protocol:(id<RMCallProtocol>) protocol;
00170
00181 - (BOOL)call:(NSString*) method
00182 arguments:(NSDictionary*) arguments
00183 delegate:(id) delegate
00184 protocol:(id<RMCallProtocol>) protocol;
00185
00191 - (void) pushProtocol: (id<RMCallProtocol>) protocol;
00197 - (id<RMCallProtocol>) popProtocol;
00203 - (id<RMCallProtocol>) topProtocol;
00204
00210 - (void) addDelegate: (id<RMResultDelegate>) delegate;
00211
00217 - (void) removeDelegate: (id<RMResultDelegate>) delegate;
00218
00219 @end