YH_HttpEngine.h
3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//
// YH_HttpEngine.h
// YH_FRAME
//
// Created by Leo on 14-5-23.
// Copyright (c) 2014年 YOHO. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AFNetworking.h"
//非登陆接口超时时间设为10秒
#define YHNetworkingTimeoutInterval (10.0f)
//登录接口超时时间为40秒
#define YHNetworkingTimeoutIntervalLogin (40.0f)
//上传文件接口超时时间为60秒
#define YHNetworkingTimeoutIntervalUpload (60.0f)
//全球购购物车结算接口超时时间为10秒
#define YHNetworkingTimeoutIntervalGlobalCart (10.0f)
@interface YH_HttpEngine : NSObject
@property (nonatomic, strong) NSString *httpURLString;
+ (instancetype)manager;
+ (instancetype)roomEngine;
+ (instancetype)validateAnchorEngine;
/**
* @author Kennaki Kai, 16-08-19 13:08:36
*
* @brief Start or stop push notification.
*
* @return null
*
* @since 1.0.1
*/
+ (instancetype)pushStatusEngine;
/**
* @author Kennaki Kai, 16-08-19 13:08:48
*
* @brief Get push room list.
*
* @return null
*
* @since 1.0.1
*/
+ (instancetype)roomListEngine;
/**
* @author Kennaki Kai, 16-08-18 15:08:20
*
* @brief Get live barrage socket address
*
* @return Socket address.
*
* @since 1.0
*/
+ (instancetype)socketAddrEngine;
+ (instancetype)liveEngine;
+ (instancetype)apiEngine;
/**
@brief 支付引擎
@param hostName 支付数据请求域名
@return self
@since 4.5
*/
+ (instancetype)paymentEngine:(NSString *)hostName;
-(void)post:(NSDictionary*)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
-(void)post:(NSDictionary*)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
timeout:(NSTimeInterval)timeoutInterval;
-(void)post:(NSDictionary *)parameters
resourcePath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
-(void)post:(NSDictionary *)parameters
resourcePath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
timeout:(NSTimeInterval)timeoutInterval;
- (AFHTTPRequestOperation *)POST:(NSDictionary *)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
completion:(void (^)(id response, NSError *error))completion;
-(void)get:(NSDictionary*)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
-(void)get:(NSDictionary*)parameters
resourcePath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
-(void)getHtml:(NSDictionary*)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
//数据鉴权
- (NSMutableDictionary *)encodeParams:(NSDictionary *)parameters;
- (NSMutableDictionary *)encodeParams:(NSDictionary *)parameters withPrivateKey:(NSString *)key;
@end