MMEEvent.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #import <Foundation/Foundation.h>
  2. #import "MMETypes.h"
  3. NS_ASSUME_NONNULL_BEGIN
  4. @class MMECommonEventData;
  5. /*! @brief represents a telemetry event, with a name, date and attributes */
  6. @interface MMEEvent : NSObject <NSCopying,NSSecureCoding>
  7. /*! @brief date on which the event occured - MMEEventKeyDateCreated */
  8. @property (nonatomic, readonly, copy) NSDate *date;
  9. /*! @brief name of the event, from MMEConstants.h - MMEEventKeyEvent */
  10. @property (nonatomic, readonly, copy) NSString *name;
  11. /*! @brief attributes of the event, a dictionary for which [NSJSONSerialization isValidJSONObject:] returns YES */
  12. @property (nonatomic, readonly, copy) NSDictionary *attributes;
  13. /*! @brief Designated Initilizer for events
  14. @param eventAttributes attributes of the event
  15. @param error present if the event could not be created with the properties provided
  16. @return a new event with the date, name and attributes provided
  17. */
  18. - (instancetype)initWithAttributes:(NSDictionary *)eventAttributes error:(NSError **)error NS_DESIGNATED_INITIALIZER;
  19. #pragma mark - Generic Events
  20. /*! @brief eventWithAttributes: - initilization errors are reported to the EventsManagerDelegate
  21. @param attributes attrs
  22. @return event
  23. */
  24. + (instancetype)eventWithAttributes:(NSDictionary *)attributes;
  25. /*! @brief eventWithAttributes: - initilization errors are reported to the EventsManagerDelegate
  26. @param attributes attrs
  27. @return event
  28. */
  29. + (instancetype)eventWithAttributes:(NSDictionary *)attributes error:(NSError **)error;
  30. #pragma mark - Custom Events
  31. /*! @brief turnstileEventWithAttributes:
  32. @param attributes event attrs
  33. @return turnstile event
  34. */
  35. + (instancetype)turnstileEventWithAttributes:(NSDictionary *)attributes;
  36. /*! @brief visitEventWithAttributes:
  37. @param attributes attrs
  38. @return event
  39. */
  40. + (instancetype)visitEventWithAttributes:(NSDictionary *)attributes;
  41. #pragma mark - Crash Events
  42. /*! @brief crashEventReporting:error:
  43. @param eventsError error to report
  44. @param createError pointer to an error creating the report
  45. @return event
  46. */
  47. + (instancetype)crashEventReporting:(NSError *)eventsError error:(NSError **)createError;
  48. #pragma mark - Debug Devents
  49. /*! @brief debugEventWithAttributes: debug logging event with attributes provided
  50. @param attributes attrs
  51. @return event
  52. */
  53. + (instancetype)debugEventWithAttributes:(NSDictionary *)attributes MME_DEPRECATED;
  54. /*! @brief debugEventWithError: debug logging event with the error provided
  55. @param error error
  56. @return event
  57. */
  58. + (instancetype)debugEventWithError:(NSError *)error MME_DEPRECATED;
  59. /*! @brief debugEventWithException: debug logging event the the exception provided
  60. @param except exception
  61. @return event
  62. */
  63. + (instancetype)debugEventWithException:(NSException *)except MME_DEPRECATED;
  64. #pragma mark - Deprecated
  65. #pragma mark - Deprecated (MMECommonEventData)
  66. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  67. @note please use eventWithAttributes:error:
  68. */
  69. + (instancetype)locationEventWithAttributes:(NSDictionary *)attributes instanceIdentifer:(NSString *)instanceIdentifer commonEventData:(MMECommonEventData *)commonEventData
  70. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  71. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  72. @note replacment TBD
  73. */
  74. + (instancetype)mapLoadEventWithDateString:(NSString *)dateString commonEventData:(MMECommonEventData *)commonEventData
  75. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  76. #pragma mark - Deprecated (Event Name)
  77. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  78. @note please use eventWithAttributes:error:
  79. */
  80. + (instancetype)eventWithName:(NSString *)eventName attributes:(NSDictionary *)attributes
  81. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  82. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  83. @note please use eventWithAttributes:error:
  84. */
  85. + (instancetype)navigationEventWithName:(NSString *)name attributes:(NSDictionary *)attributes
  86. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  87. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  88. @note please use eventWithAttributes:error:
  89. */
  90. + (instancetype)visionEventWithName:(NSString *)name attributes:(NSDictionary *)attributes
  91. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  92. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  93. @note please use eventWithAttributes:error:
  94. */
  95. + (instancetype)searchEventWithName:(NSString *)name attributes:(NSDictionary *)attributes
  96. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  97. /*! brief deprecated in MabboxMobileEvents 1.0.0 or later
  98. @note please use eventWithAttributes:error:
  99. */
  100. + (instancetype)carplayEventWithName:(NSString *)name attributes:(NSDictionary *)attributes
  101. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  102. #pragma mark - Deprecated (Date String)
  103. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  104. @note please use eventWithName:attributes:
  105. */
  106. + (instancetype)telemetryMetricsEventWithDateString:(NSString *)dateString attributes:(NSDictionary *)attributes
  107. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  108. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  109. @note map gesture events are no longer supported
  110. */
  111. + (instancetype)mapTapEventWithDateString:(NSString *)dateString attributes:(NSDictionary *)attributes
  112. MME_DEPRECATED_MSG("map gesture events are no longer supported");
  113. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  114. @note map gesture events are no longer supported
  115. */
  116. + (instancetype)mapDragEndEventWithDateString:(NSString *)dateString attributes:(NSDictionary *)attributes
  117. MME_DEPRECATED_MSG("map gesture events are no longer supported");
  118. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  119. @note please use eventWithName:attributes:
  120. */
  121. + (instancetype)mapOfflineDownloadStartEventWithDateString:(NSString *)dateString attributes:(NSDictionary *)attributes
  122. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  123. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  124. @note please use eventWithName:attributes:
  125. */
  126. + (instancetype)mapOfflineDownloadEndEventWithDateString:(NSString *)dateString attributes:(NSDictionary *)attributes
  127. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  128. /*! @brief deprecated in MabboxMobileEvents 1.0.0 or later
  129. @note please use eventWithName:attributes:
  130. */
  131. + (instancetype)eventWithDateString:(NSString *)dateString name:(NSString *)name attributes:(NSDictionary *)attributes
  132. MME_DEPRECATED_GOTO("use eventWithAttributes:error:", "-eventWithAttributes:error:");
  133. @end
  134. NS_ASSUME_NONNULL_END