RQURLParameters.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // RQURLParameters.h
  3. // RQCommon
  4. //
  5. // Created by 张嵘 on 2018/11/16.
  6. // Copyright © 2018 张嵘. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "RQKeyedSubscript.h"
  10. #import "RQHTTPServiceConstant.h"
  11. /// 请求Method
  12. /// GET 请求
  13. #define RQ_HTTTP_METHOD_GET @"GET"
  14. /// HEAD
  15. #define RQ_HTTTP_METHOD_HEAD @"HEAD"
  16. /// POST
  17. #define RQ_HTTTP_METHOD_POST @"POST"
  18. /// PUT
  19. #define RQ_HTTTP_METHOD_PUT @"PUT"
  20. /// POST
  21. #define RQ_HTTTP_METHOD_PATCH @"PATCH"
  22. /// DELETE
  23. #define RQ_HTTTP_METHOD_DELETE @"DELETE"
  24. //+ (NSString *)ver; // app版本号
  25. //+ (NSString *)token; // token,默认空字符串
  26. //+ (NSString *)deviceid; // 设备编号,自行生成
  27. //+ (NSString *)platform; // 平台 pc,wap,android,iOS
  28. //+ (NSString *)channel; // 渠道 AppStore
  29. //+ (NSString *)t; // 当前时间戳
  30. /// 项目额外的配置参数拓展 (PS)开发人员无需考虑
  31. @interface SBURLExtendsParameters : NSObject
  32. /// 类方法
  33. + (instancetype)extendsParameters;
  34. /// 用户token,默认空字符串
  35. @property (nonatomic, readonly, copy) NSString *token;
  36. /// 设备编号,自行生成
  37. @property (nonatomic, readonly, copy) NSString *deviceid;
  38. /// app版本号
  39. @property (nonatomic, readonly, copy) NSString *ver;
  40. /// 平台 pc,wap,android,iOS
  41. @property (nonatomic, readonly, copy) NSString *platform;
  42. /// 渠道 AppStore
  43. @property (nonatomic, readonly, copy) NSString *channel;
  44. /// 时间戳
  45. @property (nonatomic, readonly, copy) NSString *t;
  46. @end
  47. @interface RQURLParameters : NSObject
  48. /// 路径 (v14/order)
  49. @property (nonatomic, readwrite, strong) NSString *path;
  50. /// 参数列表
  51. @property (nonatomic, readwrite, strong) NSDictionary *parameters;
  52. /// 方法 (POST/GET)
  53. @property (nonatomic, readwrite, strong) NSString *method;
  54. /// 拓展的参数属性 (开发人员不必关心)
  55. @property (nonatomic, readwrite, strong) SBURLExtendsParameters *extendsParameters;
  56. /**
  57. 参数配置(统一用这个方法配置参数) (SBBaseUrl : https://api.cleancool.tenqing.com/)
  58. https://api.cleancool.tenqing.com/user/info?user_id=100013
  59. @param method 方法名 (GET/POST/...)
  60. @param path 文件路径 (user/info)
  61. @param parameters 具体参数 @{user_id:10013}
  62. @return 返回一个参数实例
  63. */
  64. + (instancetype)urlParametersWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters;
  65. @end