ZYLNetworkClient.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // ZYLNetworkClient.h
  3. // NetworkLayerBuild
  4. //
  5. // Created by 翟玉磊 on 2017/8/31.
  6. // Copyright © 2017年 翟玉磊. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "ZYLUploadFile.h"
  10. #import "ZYLNetworkConfig.h"
  11. @interface ZYLNetworkClient : NSObject
  12. + (instancetype)sharedInstance;
  13. - (NSURLSessionDataTask *)dataTaskWithUrlPath:(NSString *)urlPath
  14. useHttps:(BOOL)useHttps
  15. requestType:(ZYLNetworkRequestType)requestType
  16. params:(NSDictionary *)params
  17. header:(NSDictionary *)header
  18. completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler;
  19. - (NSNumber *)dispatchTaskWithUrlPath:(NSString *)urlPath
  20. useHttps:(BOOL)useHttps
  21. requestType:(ZYLNetworkRequestType)requestType
  22. params:(NSDictionary *)params
  23. header:(NSDictionary *)header
  24. completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler;
  25. - (NSNumber *)dispathTask:(NSURLSessionTask *)task;
  26. - (NSNumber *)uploadDataWithUrlPath:(NSString *)urlPath
  27. useHttps:(BOOL)useHttps
  28. contents:(NSArray<ZYLUploadFile *> *)contents
  29. params:(NSDictionary *)params
  30. header:(NSDictionary *)header
  31. progressHandler:(void (^)(NSProgress *))progressHandler
  32. completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))comletionHandler;
  33. - (void)cancelAllTask;
  34. - (void)cancelTaskWithTaskIdentifier:(NSNumber *)taskIdentifier;
  35. ///获取请求中的task任务(请求完成后自动移除task任务)
  36. - (NSURLSessionDataTask *)getTask:(NSNumber *)taskIdentifier;
  37. @end