// // HttpManager.h // TheoryNetwork // // Created by tederen on 2019/9/25. // Copyright © 2019 tederen. All rights reserved. // #import #import "FwzAppConfig.h" NS_ASSUME_NONNULL_BEGIN @class AFHTTPSessionManager; @interface HttpManager : NSObject @property (nonatomic, strong) AFHTTPSessionManager *manager; TDShareInstance_interface(HttpManager) - (void)GET:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; - (void)POST:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; #pragma mark - GET请求 /// GET请求接口 接收格式固定 - (void)GETUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// GET请求接口 接收格式可选 - (void)GETUrl:(NSString *)url parameters:(NSDictionary *)parameters responseStyle:(FWZRsponseStyle)style success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// 只需要传 api url 即可 - (void)GETWithUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; #pragma mark - POST请求 /// POST 请求接口 接收格式固定 - (void)POSTUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// POST 请求接口 接收格式可选 - (void)POSTUrl:(NSString *)url parameters:(NSDictionary *)parameters responseStyle:(FWZRsponseStyle)style success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// 只需要传 api url 即可 - (void)POSTWithUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; #pragma mark - PUT请求 /// PUT请求接口 - (void)PUTUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// PUT请求接口 接收格式可选 - (void)PUTUrl:(NSString *)url parameters:(NSDictionary *)parameters responseStyle:(FWZRsponseStyle)style success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; #pragma mark - Delete请求 /// Delete请求接口 接收格式固定 - (void)DeleteUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// Delete请求接口 接收格式可选 - (void)DeleteUrl:(NSString *)url parameters:(NSDictionary *)parameters responseStyle:(FWZRsponseStyle)style success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; /// 只需要传 api url 即可 Delete请求接口 接收格式固定 - (void)DeleteWithUrl:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successful failure:(void (^) (NSError *error))failure; #pragma mark - 图片上传 /** 图片上传接口(上传音频与图片是一致的,需要更改的只是 mimeType类型,根据要求设置对应的格式即可) @param url 请求接口 @param paramters 请求参数 @param pictureData 图片数据 @param pictureKey 与后台约定的 文件key @param successful 成功返回 @param failure 失败返回 */ - (void)HeaderUploadUrl:(NSString *)url parameters:(NSDictionary *)paramters pictureData:(NSData *)pictureData pictureKey:(NSString *)pictureKey success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure; - (void)HeaderUploadUrl:(NSString *)url parameters:(NSDictionary *)paramters pictureArray:(NSArray *)array pictureKey:(NSString *)pictureKey success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure; - (void)downloadUrl:(NSString *)url downloadFilePath:(NSString *)downloadFilePath success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure; - (void)HeaderUploadFileUrl:(NSString *)url parameters:(NSDictionary *)paramters fileData:(NSData *)fileData fileKey:(NSString *)fileKey fileName:(NSString *)fileName mimeType:(NSString *)mimeType success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure; - (void)cancelRequest; @end NS_ASSUME_NONNULL_END