samhuri.net-ios/Pods/OMGHTTPURLRQ/OMGHTTPURLRQ.h
2014-10-18 14:19:51 -07:00

41 lines
1.4 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSURLRequest.h>
#import <Foundation/NSString.h>
@interface OMGHTTPURLRQ : NSObject
+ (NSMutableURLRequest *)GET:(NSString *)url :(NSDictionary *)parameters;
+ (NSMutableURLRequest *)POST:(NSString *)url :(id)parametersOrMultipartFormData;
+ (NSMutableURLRequest *)POST:(NSString *)url JSON:(id)JSONObject;
+ (NSMutableURLRequest *)PUT:(NSString *)url :(NSDictionary *)parameters;
+ (NSMutableURLRequest *)PUT:(NSString *)url JSON:(id)JSONObject;
+ (NSMutableURLRequest *)DELETE:(NSString *)url :(NSDictionary *)parameters;
@end
/**
POST this with `OMGHTTPURLRQ`s `-POST::` class method.
*/
@interface OMGMultipartFormData : NSObject
/**
The `filename` parameter is optional. The content-type is optional, and
if left `nil` will default to *octet-stream*.
*/
- (void)addFile:(NSData *)data parameterName:(NSString *)parameterName filename:(NSString *)filename contentType:(NSString *)contentType;
- (void)addText:(NSString *)text parameterName:(NSString *)parameterName;
/**
Technically adding parameters to a multipart/form-data request is abusing
the specification. What we do is add each parameter as a text-item. Any
API that expects parameters in a multipart/form-data request will expect
the parameters to be encoded in this way.
*/
- (void)addParameters:(NSDictionary *)parameters;
@end