ADJEvent.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. //
  2. // ADJEvent.h
  3. // adjust
  4. //
  5. // Created by Pedro Filipe on 15/10/14.
  6. // Copyright (c) 2014 adjust GmbH. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. /**
  10. * @brief Adjust event class.
  11. */
  12. @interface ADJEvent : NSObject<NSCopying>
  13. /**
  14. * @brief Revenue attached to the event.
  15. */
  16. @property (nonatomic, copy, readonly, nonnull) NSNumber *revenue;
  17. /**
  18. * @brief Event token.
  19. */
  20. @property (nonatomic, copy, readonly, nonnull) NSString *eventToken;
  21. /**
  22. * @brief IAP transaction ID.
  23. */
  24. @property (nonatomic, copy, readonly, nonnull) NSString *transactionId;
  25. /**
  26. * @brief Custom user defined event ID.
  27. */
  28. @property (nonatomic, copy, readonly, nonnull) NSString *callbackId;
  29. /**
  30. * @brief Currency value.
  31. */
  32. @property (nonatomic, copy, readonly, nonnull) NSString *currency;
  33. /**
  34. * @brief IAP receipt.
  35. */
  36. @property (nonatomic, copy, readonly, nonnull) NSData *receipt;
  37. /**
  38. * @brief List of partner parameters.
  39. */
  40. @property (nonatomic, readonly, nonnull) NSDictionary *partnerParameters;
  41. /**
  42. * @brief List of callback parameters.
  43. */
  44. @property (nonatomic, readonly, nonnull) NSDictionary *callbackParameters;
  45. /**
  46. * @brief Is the given receipt empty.
  47. */
  48. @property (nonatomic, assign, readonly) BOOL emptyReceipt;
  49. /**
  50. * @brief Create Event object with event token.
  51. *
  52. * @param eventToken Event token that is created in the dashboard
  53. * at http://adjust.com and should be six characters long.
  54. */
  55. + (nullable ADJEvent *)eventWithEventToken:(nonnull NSString *)eventToken;
  56. - (nullable id)initWithEventToken:(nonnull NSString *)eventToken;
  57. /**
  58. * @brief Add a key-pair to a callback URL.
  59. *
  60. * @param key String key in the callback URL.
  61. * @param value String value of the key in the Callback URL.
  62. *
  63. * @note In your dashboard at http://adjust.com you can assign a callback URL to each
  64. * event type. That URL will get called every time the event is triggered. On
  65. * top of that you can add callback parameters to the following method that
  66. * will be forwarded to these callbacks.
  67. */
  68. - (void)addCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
  69. /**
  70. * @brief Add a key-pair to be fowarded to a partner.
  71. *
  72. * @param key String key to be fowarded to the partner.
  73. * @param value String value of the key to be fowarded to the partner.
  74. */
  75. - (void)addPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
  76. /**
  77. * @brief Set the revenue and associated currency of the event.
  78. *
  79. * @param amount The amount in units (example: for 1.50 EUR is 1.5).
  80. * @param currency String of the currency with ISO 4217 format.
  81. * It should be 3 characters long (example: for 1.50 EUR is @"EUR").
  82. *
  83. * @note The event can contain some revenue. The amount revenue is measured in units.
  84. * It must include a currency in the ISO 4217 format.
  85. */
  86. - (void)setRevenue:(double)amount currency:(nonnull NSString *)currency;
  87. /**
  88. * @brief Set the transaction ID of a In-App Purchases to avoid revenue duplications.
  89. *
  90. * @note A transaction ID can be used to avoid duplicate revenue events. The last ten
  91. * transaction identifiers are remembered.
  92. *
  93. * @param transactionId The identifier used to avoid duplicate revenue events.
  94. */
  95. - (void)setTransactionId:(nonnull NSString *)transactionId;
  96. /**
  97. * @brief Set the custom user defined ID for the event which will be reported in
  98. * success/failure callbacks.
  99. *
  100. * @param callbackId Custom user defined identifier for the event
  101. */
  102. - (void)setCallbackId:(nonnull NSString *)callbackId;
  103. /**
  104. * @brief Check if created adjust event object is valid.
  105. *
  106. * @return Boolean indicating whether the adjust event object is valid or not.
  107. */
  108. - (BOOL)isValid;
  109. /**
  110. * @brief Validate a in-app-purchase receipt.
  111. *
  112. * @param receipt The receipt to validate.
  113. * @param transactionId The identifier used to validate the receipt and to avoid duplicate revenue events.
  114. *
  115. * @note This method is obsolete and should not be used.
  116. * For more information, visit: https://github.com/adjust/ios_purchase_sdk
  117. */
  118. - (void)setReceipt:(nonnull NSData *)receipt transactionId:(nonnull NSString *)transactionId;
  119. @end