SPSBNetworkManager.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // SPSBNetworkManager.h
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/20.
  6. //
  7. #import <UIKit/UIKit.h>
  8. typedef NS_ENUM(NSInteger, SPSBNetworkErrorCode) {
  9. SPSBNetworkErrorCodeSuccess = 200,
  10. SPSBNetworkErrorCodeConnectErrorMessage,
  11. SPSBNetworkErrorCodeConnectError,
  12. SPSBNetworkErrorCodeNetwrokMiss,
  13. };
  14. typedef NS_ENUM(NSInteger, SPSBNetworkMethod) {
  15. SPSBNetworkMethodGET,
  16. SPSBNetworkMethodPOST,
  17. SPSBNetworkMethodPUT,
  18. SPSBNetworkMethodDELETE
  19. };
  20. NS_ASSUME_NONNULL_BEGIN
  21. UIKIT_EXTERN const NSInteger SPSBNetworkCallbackSuccessCode;
  22. UIKIT_EXTERN const NSInteger SPSBNetworkCallbackNeedLogin;
  23. UIKIT_EXTERN const NSInteger SPSBNetworkCallbackKeyInvalid;
  24. typedef void(^SPSBNetworkManagerCallbackBlock)(NSError *error, id _Nullable data);
  25. @interface SPSBNetworkManager : NSObject
  26. - (void)networkUseMethod:(SPSBNetworkMethod)method isLogin:(bool)isLogin url:(NSString *)url urlParameters:(nullable NSDictionary *)urlParameters parameters:(nullable NSDictionary *)parameters completion:(SPSBNetworkManagerCallbackBlock)completion;
  27. - (void)networkUseMethod:(SPSBNetworkMethod)method isLogin:(bool)isLogin url:(NSString *)url filtrationKey:(NSString *)filtrationKey urlParameters:(nullable NSDictionary *)urlParameters parameters:(nullable NSDictionary *)parameters completion:(SPSBNetworkManagerCallbackBlock)completion;
  28. - (void)cancelUrl:(NSString *)url filtrationKey:(NSString *)filtrationKey;
  29. - (void)cancelAll;
  30. - (void)networkDownloadImageWithUrl:(NSString *)url key:(NSString *)key completion:(SPSBNetworkManagerCallbackBlock)completion;
  31. - (void)networkPostImageWihtUrl:(NSString *)url parameters:(nullable NSDictionary *)parameters imageArray:(NSArray<UIImage *> *)imageArray completion:(SPSBNetworkManagerCallbackBlock)completion;
  32. @end
  33. NS_ASSUME_NONNULL_END