137 lines
5.6 KiB
Objective-C
137 lines
5.6 KiB
Objective-C
//
|
|
// HBNetWorkingUtility.h
|
|
// QinJiuTV
|
|
//
|
|
// Created by 秦九 on 2024/4/29.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "HtyoNetWorking.h"
|
|
#import "HBNetWorkingUtilityResult.h"
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef void(^HBResponseComplateBlock)(BOOL success, id data, NSString * message);
|
|
|
|
|
|
@interface HBNetWorkingUtility : NSObject
|
|
|
|
///// POST 请求
|
|
///// - Parameters:
|
|
///// - api: 这里不能填完整url 只需要填 接口api
|
|
///// - parameters:参数
|
|
///// - responseBlock: 请求回调
|
|
//+ (void)postRequestWithApi:(nonnull NSString *)api
|
|
// parameters:(nullable NSDictionary *)parameters
|
|
// response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
/// 数据请求 默认传入了 token
|
|
/// - Parameters:
|
|
/// - method: 请求方式
|
|
/// - api: 这里不能填完整url 只需要填 接口api
|
|
/// - authorization: authorization
|
|
/// - parameters: 参数
|
|
/// - responseBlock: 请求回调
|
|
+ (void)tokenRequestWithHTTPMethod:(HTTPMethod)method
|
|
api:(nonnull NSString *)api
|
|
parameters:(nullable NSDictionary *)parameters
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
/// 数据请求
|
|
/// - Parameters:
|
|
/// - method: 请求方式
|
|
/// - api: 这里不能填完整url 只需要填 接口api
|
|
/// - authorization: authorization
|
|
/// - parameters: 参数
|
|
/// - responseBlock: 请求回调
|
|
+ (void)requestWithHTTPMethod:(HTTPMethod)method
|
|
api:(nonnull NSString *)api
|
|
authorization:(nullable NSString *)authorization
|
|
parameters:(nullable NSDictionary *)parameters
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
/// 数据请求
|
|
/// - Parameters:
|
|
/// - method: 请求方式
|
|
/// - api: 这里不能填完整url 只需要填 接口api
|
|
/// - authorization: authorization
|
|
/// - parameters: 参数
|
|
/// - responseBlock: 请求回调
|
|
+ (void)requestWithHTTPMethod:(HTTPMethod)method
|
|
api:(nonnull NSString *)api
|
|
headers:(nullable NSDictionary *)headers
|
|
parameters:(nullable NSDictionary *)parameters
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
/// 数据请求
|
|
/// - Parameters:
|
|
/// - method: 请求方式
|
|
/// - urlString: 这里需要填写完整的url
|
|
/// - authorization: authorization
|
|
/// - parameters: 参数
|
|
/// - responseBlock: 请求回调
|
|
+ (void)requestWithHTTPMethod:(HTTPMethod)method
|
|
urlString:(nonnull NSString *) urlString
|
|
authorization:(nullable NSString *)authorization
|
|
parameters:(nullable NSDictionary *)parameters
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
/// 数据请求
|
|
/// - Parameters:
|
|
/// - method: 请求方式
|
|
/// - urlString: 这里需要填写完整的url
|
|
/// - headers: headers
|
|
/// - parameters: 参数
|
|
/// - responseBlock: 请求回调
|
|
+ (void)requestWithHTTPMethod:(HTTPMethod)method
|
|
urlString:(nonnull NSString *)urlString
|
|
headers:(nullable NSDictionary *)headers
|
|
parameters:(nullable NSDictionary *)parameters
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
/// POST 上传文件请求
|
|
/// - Parameters:
|
|
/// - api: 这里不能填完整url 只需要填 接口api
|
|
/// - parameters: 参数
|
|
/// - block: 需要上传的文件 在block里 配置
|
|
/// - uploadProgress: 上传进度
|
|
/// - responseBlock: 请求回调
|
|
+ (void)postRequestWithApi:(nonnull NSString *)api
|
|
parameters:(nullable NSDictionary *)parameters
|
|
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
|
|
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
/// POST 上传文件请求
|
|
/// - Parameters:
|
|
/// - api: 这里不能填完整url 只需要填 接口api
|
|
/// - authorization: authorization
|
|
/// - parameters: 参数
|
|
/// - block: 需要上传的文件 在block里 配置
|
|
/// - uploadProgress: 上传进度
|
|
/// - responseBlock: 请求回调
|
|
+ (void)postRequestWithApi:(nonnull NSString *)api
|
|
authorization:(nullable NSString *)authorization
|
|
parameters:(nullable NSDictionary *)parameters
|
|
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
|
|
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
/// POST 上传文件请求
|
|
/// - Parameters:
|
|
/// - urlString: 这里需要完整的url
|
|
/// - authorization: authorization
|
|
/// - parameters: 参数
|
|
/// - block: 需要上传的文件 在block里 配置
|
|
/// - uploadProgress: 上传进度
|
|
/// - responseBlock: 请求回调
|
|
+ (void)postRequestWitUrlString:(nonnull NSString *)urlString
|
|
authorization:(nullable NSString *)authorization
|
|
parameters:(nullable NSDictionary *)parameters
|
|
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
|
|
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
|
|
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|