You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.5 KiB
101 lines
2.5 KiB
// |
|
// APIManager.h |
|
// LekangGuard |
|
// |
|
// Created by ecell on 2022/10/10. |
|
// |
|
|
|
#import <Foundation/Foundation.h> |
|
|
|
NS_ASSUME_NONNULL_BEGIN |
|
|
|
@class LoginModel,DeviceModel,LatestLocationModel,MyUserMsgModel; |
|
extern NSString *const sRelogin; |
|
extern NSString *const sDeviceKey; |
|
|
|
@interface APIManager : NSObject |
|
@property (nonatomic,strong) YYCache *cache; |
|
|
|
@property (nonatomic ,strong) LoginModel *loginModel; |
|
|
|
@property (nonatomic ,strong) LatestLocationModel *laloModel; |
|
|
|
@property (nonatomic ,strong) DeviceModel *deviceModel; |
|
|
|
@property (nonatomic ,strong) MyUserMsgModel *userModel; |
|
|
|
@property (nonatomic ,strong) NSMutableArray *deviceList; |
|
|
|
/** |
|
* 获取单例 |
|
*/ |
|
+ (instancetype)sharedManager; |
|
|
|
/// 清除数据 |
|
- (void)clearUserInfo; |
|
|
|
|
|
/// 解绑清除设备数据 |
|
- (void)cleardeviceInfo; |
|
|
|
|
|
/// POST请求 |
|
/// @param URL 接口名 |
|
/// @param parameters 接口传参 |
|
/// @param isJson 是否是json |
|
/// @param resultClass 返回数据类型模型 |
|
- (RACSignal *)APPOST:(NSString *)URL |
|
parameters:(id)parameters |
|
isJson:(BOOL)isJson |
|
resultClass:(Class __nullable)resultClass; |
|
|
|
/// GET请求 |
|
/// @param URL 接口名 |
|
/// @param parameters 接口传参 |
|
/// @param resultClass 返回数据类型模型 |
|
- (RACSignal *)APGET:(NSString *)URL |
|
parameters:(NSDictionary *)parameters |
|
resultClass:(Class __nullable)resultClass; |
|
|
|
#pragma mark- DELETE请求 |
|
/// DELETE请求 |
|
/// @param URL 接口名 |
|
/// @param parameters 接口传参 |
|
/// @param resultClass 返回数据类型模型 |
|
- (RACSignal *)APDELETE:(NSString *)URL |
|
parameters:(NSDictionary *)parameters |
|
resultClass:(Class __nullable)resultClass; |
|
|
|
/// 上传文件 |
|
/// @param url 接口名 |
|
/// @param parameters 参数 |
|
/// @param filePath 文件路径 |
|
/// @param fileData 文件 |
|
- (RACSignal *)uploadFileWithURL:(NSString *)url |
|
parameters:(NSDictionary *)parameters |
|
filePath:(NSString *)filePath |
|
fileData:(NSData *)fileData; |
|
|
|
|
|
|
|
/// 下载文件 |
|
/// @param url url |
|
/// @param path 下载目标路径 |
|
- (RACSignal *)downloadWithURL:(NSString *)url filePath:(NSString *)path; |
|
|
|
|
|
/// 使用body传数据 |
|
- (RACSignal *)PostBodyWithApi:(NSString *)api json:(id)json; |
|
|
|
/// 上传图片文件 |
|
/// @param url 接口名 |
|
/// @param parameters 参数 |
|
/// @param images 图片数组 |
|
- (RACSignal *)uploadImageWithURL:(NSString *)url |
|
parameters:(NSDictionary *)parameters |
|
images:(NSArray * __nullable)images; |
|
|
|
|
|
@end |
|
|
|
NS_ASSUME_NONNULL_END
|
|
|