MBXHttpRequest.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // This file is generated and will be overwritten automatically.
  2. #import <Foundation/Foundation.h>
  3. #import <MapboxCommon/MBXHttpMethod.h>
  4. #import <MapboxCommon/MBXNetworkRestriction.h>
  5. @class MBXUAComponents;
  6. /** HttpRequest holds basic information for construction of an HTTP request */
  7. NS_SWIFT_NAME(HttpRequest)
  8. __attribute__((visibility ("default")))
  9. @interface MBXHttpRequest : NSObject
  10. // This class provides custom init which should be called
  11. - (nonnull instancetype)init NS_UNAVAILABLE;
  12. // This class provides custom init which should be called
  13. + (nonnull instancetype)new NS_UNAVAILABLE;
  14. - (nonnull instancetype)initWithUrl:(nonnull NSString *)url
  15. headers:(nonnull NSDictionary<NSString *, NSString *> *)headers
  16. uaComponents:(nonnull MBXUAComponents *)uaComponents
  17. body:(nullable NSData *)body;
  18. - (nonnull instancetype)initWithMethod:(MBXHttpMethod)method
  19. url:(nonnull NSString *)url
  20. headers:(nonnull NSDictionary<NSString *, NSString *> *)headers
  21. keepCompression:(BOOL)keepCompression
  22. timeout:(uint64_t)timeout
  23. networkRestriction:(MBXNetworkRestriction)networkRestriction
  24. uaComponents:(nonnull MBXUAComponents *)uaComponents
  25. body:(nullable NSData *)body;
  26. /**
  27. * HTTP defines a set of request methods to indicate the desired action to be performed for a given resource.
  28. * Specify desired method using this parameter.
  29. */
  30. @property (nonatomic, readwrite) MBXHttpMethod method;
  31. /** URL the request should be sent to */
  32. @property (nonatomic, readonly, nonnull, copy) NSString *url;
  33. /**
  34. * HTTP headers to include.
  35. * If you provide `User-Agent` header using this `headers` field, then resulting `User-Agent` will also contain
  36. * information about application, platform, device, and Common SDK's version.
  37. * If you provide duplicate headers then `request` call will be immediately failed.
  38. */
  39. @property (nonatomic, readwrite, nonnull, copy) NSDictionary<NSString *, NSString *> *headers;
  40. /**
  41. * Keep compression flag. If set to true, responses will not be automatically decompressed.
  42. * Default is false.
  43. */
  44. @property (nonatomic, readonly, getter=isKeepCompression) BOOL keepCompression;
  45. /**
  46. * Timeout defines how long, in seconds, the request is allowed to take in total (including connecting to the host).
  47. * Default is 0, meaning no timeout.
  48. */
  49. @property (nonatomic, readonly) uint64_t timeout;
  50. /**
  51. * Restrict the request to the specified network types. If none of the specified network types is available, the
  52. * download fails with a connection error.
  53. *
  54. * Default is allowed to all network types
  55. */
  56. @property (nonatomic, readonly) MBXNetworkRestriction networkRestriction;
  57. /**
  58. * Application and SDK information for generating a User-Agent string.
  59. * Attention! Setting this field has no effect, please use `headers` field instead.
  60. * This field will be removed in the next major versions.
  61. */
  62. @property (nonatomic, readonly, nonnull) MBXUAComponents *uaComponents;
  63. /**
  64. * HTTP Body data transmitted in an HTTP transaction message immediately following the headers if there is any.
  65. * Body data is used by POST HTTP methods.
  66. */
  67. @property (nonatomic, readonly, nullable) NSData *body;
  68. @end