00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #import <Foundation/Foundation.h>
00031
00034
00035 @class JSONRPCMethodCall;
00036 @protocol JSONRPCDelegate;
00037
00038
00039
00046 @interface NSObject (JSONInitializer)
00047 -(id)initWithJson:(NSDictionary*)dict;
00048 @end
00049
00050
00061 @interface JSONRPCResponseHandler : NSObject
00062 {
00064 JSONRPCMethodCall* _methodCall;
00065 NSMutableData* _receivedData;
00066
00067 id<NSObject> _delegate;
00068 SEL _callbackSelector;
00069 #if NS_BLOCKS_AVAILABLE
00070 void(^_completionBlock)(JSONRPCMethodCall*,id,NSError*);
00071 #endif
00072
00073 Class _resultClass;
00074 int _maxRetryAttempts;
00075 NSTimeInterval _delayBeforeRetry;
00076 }
00077 @property(nonatomic,retain) JSONRPCMethodCall* methodCall;
00078
00081 @property(nonatomic,retain) id<NSObject> delegate;
00093 @property(nonatomic,assign) SEL callback;
00102 @property(nonatomic,assign) Class resultClass;
00103
00108 -(void)setDelegate:(id<NSObject>)aDelegate callback:(SEL)callback;
00117 -(void)setDelegate:(id<NSObject>)aDelegate callback:(SEL)callback resultClass:(Class)cls;
00118
00119 #if NS_BLOCKS_AVAILABLE
00120
00123 -(void)completion:(void(^)(JSONRPCMethodCall* methodCall,id result,NSError* error))completionBlock;
00128 -(void)completion:(void(^)(JSONRPCMethodCall* methodCall,id result,NSError* error))completionBlock resultClass:(Class)cls;
00129 #endif
00130
00131 @property(nonatomic, assign) int maxRetryAttempts;
00132 @property(nonatomic, assign) NSTimeInterval delayBeforeRetry;
00133 -(void)retryRequest;
00134 @end
00135