/Mobile/iPhone/StoffiRemote/StoffiRemote/RESTRequest.h

http://yet-another-music-application.googlecode.com/ · C Header · 37 lines · 20 code · 10 blank · 7 comment · 0 complexity · d8da38e296149a0dbcddad91e2d2c245 MD5 · raw file

  1. //
  2. // RestRequest.h
  3. // StoffiRemote
  4. //
  5. // Created by Fredrik Gadnell on 9/18/11.
  6. // Copyright 2011 __MyCompanyName__. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @class RESTRequest;
  10. @protocol RestRequestDelegate <NSObject>
  11. @required
  12. - (void)restRequest:(RESTRequest *)request didLoadResult:(id)jsonObject;
  13. - (void)restRequestDidFail:(RESTRequest *)request;
  14. @end
  15. #define kRequestTypeNone -1
  16. @interface RESTRequest : NSObject {
  17. id<RestRequestDelegate> delegate;
  18. int requestType;
  19. NSURLConnection *connection;
  20. NSMutableData *receivedData;
  21. }
  22. @property (readwrite) int requestType;
  23. @property (assign) id<RestRequestDelegate> delegate;
  24. @property (assign) NSURLConnection *connection;
  25. @property (readwrite) BOOL shouldLog;
  26. + (RESTRequest *)restRequestWithURL:(NSString *)url method:(NSString *)httpMethod delegate:(id<RestRequestDelegate>)delegate;
  27. @end