Create a model ios (Un-finished)

@interface CVAPIRequestModel : NSObject <NSCoding>

- (void)sendRequest:(CVAPIRequest*)request completion:(void (^)(NSDictionary*, NSError*))handler;
- (void)cancel;
- (void) updateModelWithResult:(NSDictionary*)apiResult error:(NSError*)error action:(NSString*)action;
- (void) dispatchWithResult:(NSDictionary*)apiResult error:(NSError*)error action:(NSString*)action;
- (void)updateModel:(NSDictionary*)apiResult action:(NSString*)action;
+ (BOOL) persistModel:(id<NSCoding>)model withId:(NSString*)modelId;
+ (id<NSCoding>)cachedModelWithId:(NSString*)modelId;


@interface CVAPIRequest : NSMutableURLRequest

// for beta2 api
- (id)initWithAPIPath:(NSString *)apiPath;
- (void)setHTTPMethod:(NSString *)method;
- (void)setPOSTParamString:(NSString *)paramString isJsonFormat:(BOOL)isJson;
- (void)setPUTParamString:(NSString *)paramString isJsonFormat:(BOOL)isJson;
- (void)setUploadFileParamString:(NSData*)data mimeType:(NSString*)mimeType fileName:(NSString*)fileName;
+ (NSString*)GETParamString:(NSDictionary *)parameters;
- (id)initWithAPIUrlString:(NSString *)apiPath;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s