BUNetworkRequest.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // BUAdNetworkRequest.h
  3. // BUFoundation
  4. //
  5. // Created by bytedance on 2020/12/15.
  6. //
  7. #if __has_include(<BURelyFoundation/BUBaseRequest.h>)
  8. #import <BURelyFoundation/BUBaseRequest.h>
  9. #elif __has_include(<BURelyFoundation_Global/BUBaseRequest.h>)
  10. #import <BURelyFoundation_Global/BUBaseRequest.h>
  11. #else
  12. #import "BUBaseRequest.h"
  13. #endif
  14. NS_ASSUME_NONNULL_BEGIN
  15. @interface BUNetworkRequest : BUBaseRequest
  16. @property (nonatomic,copy ) NSString *buRequestUrl;
  17. @property (nonatomic,strong) NSDictionary *parameter;
  18. @property (nonatomic,assign) BURequestMethod method;
  19. @property (nonatomic,assign) BURequestSerializerType buRequestSerializerType;
  20. @property (nonatomic,assign) BUResponseSerializerType buResponseSerializerType;
  21. - (instancetype)initWithUrl:(NSString * _Nullable)url
  22. method:(BURequestMethod)method
  23. parameter:(NSDictionary * _Nullable)parameter;
  24. + (instancetype)requestWithURL:(NSString *)url
  25. method:(BURequestMethod)method
  26. parameter:(NSDictionary *)paraDic
  27. completionWithSuccess:(BURequestCompletionBlock _Nullable)success
  28. failure:(BURequestCompletionBlock _Nullable)failure;
  29. + (instancetype)requestWithURL:(NSString *)url
  30. parameter:(NSDictionary *)paraDic
  31. completionWithSuccess:(BURequestCompletionBlock _Nullable)success
  32. failure:(BURequestCompletionBlock _Nullable)failure;
  33. @end
  34. @interface BUNetworkRequest (TNC)
  35. // 使用TNC服务的标识,自定义,唯一即可
  36. - (NSString *)TNCServiceKey;
  37. // 请求失败回调,如果需要TNC,请使用`failureCompletionBlockWithTNC`替换`failureCompletionBlock`的实现
  38. - (BURequestCompletionBlock)failureCompletionBlockWithTNC;
  39. // 请求成功回调,如果需要TNC,请使用`successCompletionBlockWithTNC`替换`successCompletionBlock`的实现
  40. - (BURequestCompletionBlock)successCompletionBlockWithTNC;
  41. @end
  42. NS_ASSUME_NONNULL_END