growsurf-ruby 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/growsurf_ruby/client.rb +4 -0
  5. data/lib/growsurf_ruby/models/account.rb +90 -0
  6. data/lib/growsurf_ruby/models/account_create_params.rb +46 -0
  7. data/lib/growsurf_ruby/models/account_create_response.rb +64 -0
  8. data/lib/growsurf_ruby/models/account_resend_verification_email_response.rb +33 -0
  9. data/lib/growsurf_ruby/models/account_rotate_api_key_response.rb +17 -0
  10. data/lib/growsurf_ruby/models/account_update_params.rb +35 -0
  11. data/lib/growsurf_ruby/models/campaign/campaign_reward_list_response.rb +2 -2
  12. data/lib/growsurf_ruby/models/campaign/create.rb +5 -1
  13. data/lib/growsurf_ruby/models/campaign/participant_activity_logs_response.rb +65 -0
  14. data/lib/growsurf_ruby/models/campaign/participant_analytics_response.rb +421 -0
  15. data/lib/growsurf_ruby/models/campaign/participant_bulk_delete_params.rb +35 -0
  16. data/lib/growsurf_ruby/models/campaign/participant_bulk_delete_response.rb +151 -0
  17. data/lib/growsurf_ruby/models/campaign/participant_email_params.rb +76 -0
  18. data/lib/growsurf_ruby/models/campaign/participant_email_response.rb +38 -0
  19. data/lib/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rb +46 -0
  20. data/lib/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rb +98 -0
  21. data/lib/growsurf_ruby/models/campaign/participant_update_params.rb +21 -1
  22. data/lib/growsurf_ruby/models/campaign/reward.rb +17 -6
  23. data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +25 -15
  24. data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +25 -15
  25. data/lib/growsurf_ruby/models/campaign/webhook.rb +72 -0
  26. data/lib/growsurf_ruby/models/campaign/webhook_create_params.rb +52 -0
  27. data/lib/growsurf_ruby/models/campaign/webhook_delete_params.rb +28 -0
  28. data/lib/growsurf_ruby/models/campaign/webhook_delete_response.rb +24 -0
  29. data/lib/growsurf_ruby/models/campaign/webhook_event.rb +23 -0
  30. data/lib/growsurf_ruby/models/campaign/webhook_list_response.rb +18 -0
  31. data/lib/growsurf_ruby/models/campaign/webhook_test_params.rb +42 -0
  32. data/lib/growsurf_ruby/models/campaign/webhook_test_response.rb +50 -0
  33. data/lib/growsurf_ruby/models/campaign/webhook_update_params.rb +59 -0
  34. data/lib/growsurf_ruby/models/campaign.rb +17 -6
  35. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_params.rb +36 -1
  36. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_response.rb +538 -1
  37. data/lib/growsurf_ruby/models/campaign_update_params.rb +0 -3
  38. data/lib/growsurf_ruby/models/commission_structure.rb +8 -2
  39. data/lib/growsurf_ruby/models/referral_flow_screenshots_response.rb +72 -0
  40. data/lib/growsurf_ruby/models.rb +8 -0
  41. data/lib/growsurf_ruby/resources/account.rb +159 -0
  42. data/lib/growsurf_ruby/resources/campaign/design.rb +9 -7
  43. data/lib/growsurf_ruby/resources/campaign/emails.rb +8 -5
  44. data/lib/growsurf_ruby/resources/campaign/installation.rb +8 -6
  45. data/lib/growsurf_ruby/resources/campaign/options.rb +8 -5
  46. data/lib/growsurf_ruby/resources/campaign/participant.rb +170 -2
  47. data/lib/growsurf_ruby/resources/campaign/rewards.rb +17 -21
  48. data/lib/growsurf_ruby/resources/campaign/webhooks.rb +157 -0
  49. data/lib/growsurf_ruby/resources/campaign.rb +30 -2
  50. data/lib/growsurf_ruby/version.rb +1 -1
  51. data/lib/growsurf_ruby.rb +26 -0
  52. data/rbi/growsurf_ruby/client.rbi +3 -0
  53. data/rbi/growsurf_ruby/models/account.rbi +125 -0
  54. data/rbi/growsurf_ruby/models/account_create_params.rbi +73 -0
  55. data/rbi/growsurf_ruby/models/account_create_response.rbi +115 -0
  56. data/rbi/growsurf_ruby/models/account_resend_verification_email_response.rbi +76 -0
  57. data/rbi/growsurf_ruby/models/account_rotate_api_key_response.rbi +30 -0
  58. data/rbi/growsurf_ruby/models/account_update_params.rbi +65 -0
  59. data/rbi/growsurf_ruby/models/campaign/campaign_reward_list_response.rbi +2 -2
  60. data/rbi/growsurf_ruby/models/campaign/create.rbi +8 -0
  61. data/rbi/growsurf_ruby/models/campaign/participant_activity_logs_response.rbi +111 -0
  62. data/rbi/growsurf_ruby/models/campaign/participant_analytics_response.rbi +630 -0
  63. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_params.rbi +56 -0
  64. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbi +285 -0
  65. data/rbi/growsurf_ruby/models/campaign/participant_email_params.rbi +118 -0
  66. data/rbi/growsurf_ruby/models/campaign/participant_email_response.rbi +84 -0
  67. data/rbi/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rbi +74 -0
  68. data/rbi/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbi +207 -0
  69. data/rbi/growsurf_ruby/models/campaign/participant_update_params.rbi +24 -0
  70. data/rbi/growsurf_ruby/models/campaign/reward.rbi +25 -4
  71. data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +34 -9
  72. data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +34 -9
  73. data/rbi/growsurf_ruby/models/campaign/webhook.rbi +93 -0
  74. data/rbi/growsurf_ruby/models/campaign/webhook_create_params.rbi +91 -0
  75. data/rbi/growsurf_ruby/models/campaign/webhook_delete_params.rbi +48 -0
  76. data/rbi/growsurf_ruby/models/campaign/webhook_delete_response.rbi +33 -0
  77. data/rbi/growsurf_ruby/models/campaign/webhook_event.rbi +60 -0
  78. data/rbi/growsurf_ruby/models/campaign/webhook_list_response.rbi +36 -0
  79. data/rbi/growsurf_ruby/models/campaign/webhook_test_params.rbi +69 -0
  80. data/rbi/growsurf_ruby/models/campaign/webhook_test_response.rbi +102 -0
  81. data/rbi/growsurf_ruby/models/campaign/webhook_update_params.rbi +98 -0
  82. data/rbi/growsurf_ruby/models/campaign.rbi +25 -4
  83. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_params.rbi +91 -0
  84. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_response.rbi +1011 -3
  85. data/rbi/growsurf_ruby/models/campaign_update_params.rbi +0 -15
  86. data/rbi/growsurf_ruby/models/commission_structure.rbi +8 -2
  87. data/rbi/growsurf_ruby/models/referral_flow_screenshots_response.rbi +94 -0
  88. data/rbi/growsurf_ruby/models.rbi +9 -0
  89. data/rbi/growsurf_ruby/resources/account.rbi +112 -0
  90. data/rbi/growsurf_ruby/resources/campaign/design.rbi +7 -5
  91. data/rbi/growsurf_ruby/resources/campaign/emails.rbi +7 -5
  92. data/rbi/growsurf_ruby/resources/campaign/installation.rbi +7 -4
  93. data/rbi/growsurf_ruby/resources/campaign/options.rbi +7 -5
  94. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +160 -0
  95. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +37 -21
  96. data/rbi/growsurf_ruby/resources/campaign/webhooks.rbi +123 -0
  97. data/rbi/growsurf_ruby/resources/campaign.rbi +33 -2
  98. data/sig/growsurf_ruby/client.rbs +2 -0
  99. data/sig/growsurf_ruby/models/account.rbs +67 -0
  100. data/sig/growsurf_ruby/models/account_create_params.rbs +42 -0
  101. data/sig/growsurf_ruby/models/account_create_response.rbs +47 -0
  102. data/sig/growsurf_ruby/models/account_resend_verification_email_response.rbs +35 -0
  103. data/sig/growsurf_ruby/models/account_rotate_api_key_response.rbs +13 -0
  104. data/sig/growsurf_ruby/models/account_update_params.rbs +42 -0
  105. data/sig/growsurf_ruby/models/campaign/participant_activity_logs_response.rbs +59 -0
  106. data/sig/growsurf_ruby/models/campaign/participant_analytics_response.rbs +407 -0
  107. data/sig/growsurf_ruby/models/campaign/participant_bulk_delete_params.rbs +30 -0
  108. data/sig/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbs +125 -0
  109. data/sig/growsurf_ruby/models/campaign/participant_email_params.rbs +61 -0
  110. data/sig/growsurf_ruby/models/campaign/participant_email_response.rbs +37 -0
  111. data/sig/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rbs +47 -0
  112. data/sig/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbs +90 -0
  113. data/sig/growsurf_ruby/models/campaign/participant_update_params.rbs +14 -0
  114. data/sig/growsurf_ruby/models/campaign/reward_create_params.rbs +0 -7
  115. data/sig/growsurf_ruby/models/campaign/reward_update_params.rbs +0 -7
  116. data/sig/growsurf_ruby/models/campaign/webhook.rbs +52 -0
  117. data/sig/growsurf_ruby/models/campaign/webhook_create_params.rbs +51 -0
  118. data/sig/growsurf_ruby/models/campaign/webhook_delete_params.rbs +30 -0
  119. data/sig/growsurf_ruby/models/campaign/webhook_delete_response.rbs +17 -0
  120. data/sig/growsurf_ruby/models/campaign/webhook_event.rbs +28 -0
  121. data/sig/growsurf_ruby/models/campaign/webhook_list_response.rbs +18 -0
  122. data/sig/growsurf_ruby/models/campaign/webhook_test_params.rbs +42 -0
  123. data/sig/growsurf_ruby/models/campaign/webhook_test_response.rbs +54 -0
  124. data/sig/growsurf_ruby/models/campaign/webhook_update_params.rbs +63 -0
  125. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_params.rbs +35 -1
  126. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_response.rbs +533 -3
  127. data/sig/growsurf_ruby/models/campaign_update_params.rbs +1 -4
  128. data/sig/growsurf_ruby/models/commission_structure.rbs +7 -2
  129. data/sig/growsurf_ruby/models/referral_flow_screenshots_response.rbs +54 -0
  130. data/sig/growsurf_ruby/models/reward_tax_valuation.rbs +4 -1
  131. data/sig/growsurf_ruby/models.rbs +8 -0
  132. data/sig/growsurf_ruby/resources/account.rbs +38 -0
  133. data/sig/growsurf_ruby/resources/campaign/participant.rbs +37 -0
  134. data/sig/growsurf_ruby/resources/campaign/rewards.rbs +0 -2
  135. data/sig/growsurf_ruby/resources/campaign/webhooks.rbs +46 -0
  136. data/sig/growsurf_ruby/resources/campaign.rbs +9 -0
  137. metadata +80 -2
@@ -0,0 +1,207 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ class ParticipantRetrieveAnalyticsParams < GrowsurfRuby::Internal::Type::BaseModel
7
+ extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
8
+ include GrowsurfRuby::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams,
14
+ GrowsurfRuby::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :id
20
+
21
+ sig { returns(String) }
22
+ attr_accessor :participant_id_or_email
23
+
24
+ # Last number of days to retrieve analytics for. Defaults to 365. Maximum 1825.
25
+ sig { returns(T.nilable(Integer)) }
26
+ attr_reader :days
27
+
28
+ sig { params(days: Integer).void }
29
+ attr_writer :days
30
+
31
+ # End date of the analytics timeframe as a Unix timestamp in milliseconds.
32
+ # Required if `days` is not set.
33
+ sig { returns(T.nilable(Integer)) }
34
+ attr_reader :end_date
35
+
36
+ sig { params(end_date: Integer).void }
37
+ attr_writer :end_date
38
+
39
+ # Set to `series` to also return this participant's own activity per period.
40
+ sig do
41
+ returns(
42
+ T.nilable(
43
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::OrSymbol
44
+ )
45
+ )
46
+ end
47
+ attr_reader :include
48
+
49
+ sig do
50
+ params(
51
+ include:
52
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::OrSymbol
53
+ ).void
54
+ end
55
+ attr_writer :include
56
+
57
+ # Bucket size for the `series` (only used with `include=series`). Defaults to `day`.
58
+ sig do
59
+ returns(
60
+ T.nilable(
61
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::OrSymbol
62
+ )
63
+ )
64
+ end
65
+ attr_reader :interval
66
+
67
+ sig do
68
+ params(
69
+ interval:
70
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::OrSymbol
71
+ ).void
72
+ end
73
+ attr_writer :interval
74
+
75
+ # Start date of the analytics timeframe as a Unix timestamp in milliseconds.
76
+ # Required if `days` is not set.
77
+ sig { returns(T.nilable(Integer)) }
78
+ attr_reader :start_date
79
+
80
+ sig { params(start_date: Integer).void }
81
+ attr_writer :start_date
82
+
83
+ sig do
84
+ params(
85
+ id: String,
86
+ participant_id_or_email: String,
87
+ days: Integer,
88
+ end_date: Integer,
89
+ include:
90
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::OrSymbol,
91
+ interval:
92
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::OrSymbol,
93
+ start_date: Integer,
94
+ request_options: GrowsurfRuby::RequestOptions::OrHash
95
+ ).returns(T.attached_class)
96
+ end
97
+ def self.new(
98
+ id:,
99
+ participant_id_or_email:,
100
+ # Last number of days to retrieve analytics for. Defaults to 365. Maximum 1825.
101
+ days: nil,
102
+ # End date of the analytics timeframe as a Unix timestamp in milliseconds.
103
+ # Required if `days` is not set.
104
+ end_date: nil,
105
+ # Set to `series` to also return this participant's own activity per period.
106
+ include: nil,
107
+ # Bucket size for the `series` (only used with `include=series`). Defaults to `day`.
108
+ interval: nil,
109
+ # Start date of the analytics timeframe as a Unix timestamp in milliseconds.
110
+ # Required if `days` is not set.
111
+ start_date: nil,
112
+ request_options: {}
113
+ )
114
+ end
115
+
116
+ sig do
117
+ override.returns(
118
+ {
119
+ id: String,
120
+ participant_id_or_email: String,
121
+ days: Integer,
122
+ end_date: Integer,
123
+ include:
124
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::OrSymbol,
125
+ interval:
126
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::OrSymbol,
127
+ start_date: Integer,
128
+ request_options: GrowsurfRuby::RequestOptions
129
+ }
130
+ )
131
+ end
132
+ def to_hash
133
+ end
134
+
135
+ # Set to `series` to also return this participant's own activity per period.
136
+ module Include
137
+ extend GrowsurfRuby::Internal::Type::Enum
138
+
139
+ TaggedSymbol =
140
+ T.type_alias do
141
+ T.all(
142
+ Symbol,
143
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include
144
+ )
145
+ end
146
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
147
+
148
+ SERIES =
149
+ T.let(
150
+ :series,
151
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::TaggedSymbol
152
+ )
153
+
154
+ sig do
155
+ override.returns(
156
+ T::Array[
157
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::TaggedSymbol
158
+ ]
159
+ )
160
+ end
161
+ def self.values
162
+ end
163
+ end
164
+
165
+ # Bucket size for the `series` (only used with `include=series`). Defaults to `day`.
166
+ module Interval
167
+ extend GrowsurfRuby::Internal::Type::Enum
168
+
169
+ TaggedSymbol =
170
+ T.type_alias do
171
+ T.all(
172
+ Symbol,
173
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval
174
+ )
175
+ end
176
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
177
+
178
+ DAY =
179
+ T.let(
180
+ :day,
181
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::TaggedSymbol
182
+ )
183
+ WEEK =
184
+ T.let(
185
+ :week,
186
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::TaggedSymbol
187
+ )
188
+ MONTH =
189
+ T.let(
190
+ :month,
191
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::TaggedSymbol
192
+ )
193
+
194
+ sig do
195
+ override.returns(
196
+ T::Array[
197
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::TaggedSymbol
198
+ ]
199
+ )
200
+ end
201
+ def self.values
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
207
+ end
@@ -46,6 +46,21 @@ module GrowsurfRuby
46
46
  sig { params(metadata: T::Hash[Symbol, T.anything]).void }
47
47
  attr_writer :metadata
48
48
 
49
+ # Freeform internal notes about the participant (internal only, never exposed to
50
+ # participants).
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :notes
53
+
54
+ sig { params(notes: String).void }
55
+ attr_writer :notes
56
+
57
+ # The participant's PayPal email address, used for affiliate payouts.
58
+ sig { returns(T.nilable(String)) }
59
+ attr_reader :paypal_email
60
+
61
+ sig { params(paypal_email: String).void }
62
+ attr_writer :paypal_email
63
+
49
64
  sig do
50
65
  returns(
51
66
  T.nilable(
@@ -89,6 +104,8 @@ module GrowsurfRuby
89
104
  first_name: String,
90
105
  last_name: String,
91
106
  metadata: T::Hash[Symbol, T.anything],
107
+ notes: String,
108
+ paypal_email: String,
92
109
  referral_status:
93
110
  GrowsurfRuby::Campaign::ParticipantUpdateParams::ReferralStatus::OrSymbol,
94
111
  referred_by: String,
@@ -105,6 +122,11 @@ module GrowsurfRuby
105
122
  last_name: nil,
106
123
  # Shallow custom metadata object.
107
124
  metadata: nil,
125
+ # Freeform internal notes about the participant (internal only, never exposed to
126
+ # participants).
127
+ notes: nil,
128
+ # The participant's PayPal email address, used for affiliate payouts.
129
+ paypal_email: nil,
108
130
  referral_status: nil,
109
131
  referred_by: nil,
110
132
  unsubscribed: nil,
@@ -122,6 +144,8 @@ module GrowsurfRuby
122
144
  first_name: String,
123
145
  last_name: String,
124
146
  metadata: T::Hash[Symbol, T.anything],
147
+ notes: String,
148
+ paypal_email: String,
125
149
  referral_status:
126
150
  GrowsurfRuby::Campaign::ParticipantUpdateParams::ReferralStatus::OrSymbol,
127
151
  referred_by: String,
@@ -41,6 +41,9 @@ module GrowsurfRuby
41
41
  sig { returns(T.nilable(Integer)) }
42
42
  attr_accessor :conversions_required
43
43
 
44
+ # Legacy static coupon code shown to the referrer in the reward-won email and
45
+ # webhook. Display text only; superseded by a connected billing integration's
46
+ # issued coupon when one exists.
44
47
  sig { returns(T.nilable(String)) }
45
48
  attr_accessor :coupon_code
46
49
 
@@ -63,19 +66,27 @@ module GrowsurfRuby
63
66
  end
64
67
  attr_accessor :limit_duration
65
68
 
69
+ # Text shown before a participant's referral count in milestone-progress copy.
70
+ # Applies to `MILESTONE` rewards.
66
71
  sig { returns(T.nilable(String)) }
67
72
  attr_accessor :next_milestone_prefix
68
73
 
74
+ # Text shown after a participant's referral count in milestone-progress copy.
75
+ # Applies to `MILESTONE` rewards.
69
76
  sig { returns(T.nilable(String)) }
70
77
  attr_accessor :next_milestone_suffix
71
78
 
79
+ # The number of winners (`LEADERBOARD` rewards only). With `limitDuration`
80
+ # `PER_MONTH` this many win each month, otherwise this many win in total.
72
81
  sig { returns(T.nilable(Integer)) }
73
82
  attr_accessor :number_of_winners
74
83
 
75
84
  sig { returns(T.nilable(Integer)) }
76
85
  attr_accessor :order
77
86
 
78
- # The coupon code delivered to the referred friend (double-sided rewards).
87
+ # Legacy static coupon code shown to the referred friend (double-sided rewards)
88
+ # in the reward-won email and webhook. Display text only; superseded by a
89
+ # connected billing integration's issued coupon when one exists.
79
90
  sig { returns(T.nilable(String)) }
80
91
  attr_accessor :referral_coupon_code
81
92
 
@@ -134,8 +145,7 @@ module GrowsurfRuby
134
145
  referral_coupon_code: T.nilable(String),
135
146
  referral_description: T.nilable(String),
136
147
  referred_reward_upfront: T::Boolean,
137
- referred_value:
138
- T.nilable(GrowsurfRuby::RewardTaxValuation::OrHash),
148
+ referred_value: T.nilable(GrowsurfRuby::RewardTaxValuation::OrHash),
139
149
  value: T.nilable(GrowsurfRuby::RewardTaxValuation::OrHash)
140
150
  ).returns(T.attached_class)
141
151
  end
@@ -147,17 +157,28 @@ module GrowsurfRuby
147
157
  type:,
148
158
  commission_structure: nil,
149
159
  conversions_required: nil,
160
+ # Legacy static coupon code shown to the referrer in the reward-won email and
161
+ # webhook. Display text only; superseded by a connected billing integration's
162
+ # issued coupon when one exists.
150
163
  coupon_code: nil,
151
164
  description: nil,
152
165
  image_url: nil,
153
166
  # `-1` represents an unlimited reward in REST responses.
154
167
  limit: nil,
155
168
  limit_duration: nil,
169
+ # Text shown before a participant's referral count in milestone-progress copy.
170
+ # Applies to `MILESTONE` rewards.
156
171
  next_milestone_prefix: nil,
172
+ # Text shown after a participant's referral count in milestone-progress copy.
173
+ # Applies to `MILESTONE` rewards.
157
174
  next_milestone_suffix: nil,
175
+ # The number of winners (`LEADERBOARD` rewards only). With `limitDuration`
176
+ # `PER_MONTH` this many win each month, otherwise this many win in total.
158
177
  number_of_winners: nil,
159
178
  order: nil,
160
- # The coupon code delivered to the referred friend (double-sided rewards).
179
+ # Legacy static coupon code shown to the referred friend (double-sided rewards)
180
+ # in the reward-won email and webhook. Display text only; superseded by a
181
+ # connected billing integration's issued coupon when one exists.
161
182
  referral_coupon_code: nil,
162
183
  referral_description: nil,
163
184
  referred_reward_upfront: nil,
@@ -38,6 +38,9 @@ module GrowsurfRuby
38
38
  sig { params(conversions_required: Integer).void }
39
39
  attr_writer :conversions_required
40
40
 
41
+ # Legacy static coupon code shown to the referrer in the reward-won email and
42
+ # webhook. Display text only; superseded by a connected billing integration's
43
+ # issued coupon when one exists.
41
44
  sig { returns(T.nilable(String)) }
42
45
  attr_reader :coupon_code
43
46
 
@@ -56,18 +59,16 @@ module GrowsurfRuby
56
59
  sig { params(image_url: String).void }
57
60
  attr_writer :image_url
58
61
 
59
- sig { returns(T.nilable(T::Boolean)) }
60
- attr_reader :is_active
61
-
62
- sig { params(is_active: T::Boolean).void }
63
- attr_writer :is_active
64
-
62
+ # Whether the reward can be earned an unlimited number of times. Defaults to
63
+ # `true`, except `MILESTONE` rewards, which can only be earned once.
65
64
  sig { returns(T.nilable(T::Boolean)) }
66
65
  attr_reader :is_unlimited
67
66
 
68
67
  sig { params(is_unlimited: T::Boolean).void }
69
68
  attr_writer :is_unlimited
70
69
 
70
+ # Whether the reward is enabled. When `false` the reward is disabled: hidden from
71
+ # participants and no longer awarded, including those who already earned it.
71
72
  sig { returns(T.nilable(T::Boolean)) }
72
73
  attr_reader :is_visible
73
74
 
@@ -104,18 +105,25 @@ module GrowsurfRuby
104
105
  sig { params(metadata: T::Hash[Symbol, T.anything]).void }
105
106
  attr_writer :metadata
106
107
 
108
+ # Text shown before a participant's referral count in milestone-progress copy.
109
+ # Applies to `MILESTONE` rewards.
107
110
  sig { returns(T.nilable(String)) }
108
111
  attr_reader :next_milestone_prefix
109
112
 
110
113
  sig { params(next_milestone_prefix: String).void }
111
114
  attr_writer :next_milestone_prefix
112
115
 
116
+ # Text shown after a participant's referral count in milestone-progress copy.
117
+ # Applies to `MILESTONE` rewards.
113
118
  sig { returns(T.nilable(String)) }
114
119
  attr_reader :next_milestone_suffix
115
120
 
116
121
  sig { params(next_milestone_suffix: String).void }
117
122
  attr_writer :next_milestone_suffix
118
123
 
124
+ # The number of winners (`LEADERBOARD` rewards only). With `limitDuration`
125
+ # `PER_MONTH` this many win each month, otherwise this many win in total;
126
+ # omitting it defaults to `3`.
119
127
  sig { returns(T.nilable(Integer)) }
120
128
  attr_reader :number_of_winners
121
129
 
@@ -128,6 +136,9 @@ module GrowsurfRuby
128
136
  sig { params(order: Integer).void }
129
137
  attr_writer :order
130
138
 
139
+ # Legacy static coupon code shown to the referred friend (double-sided rewards)
140
+ # in the reward-won email and webhook. Display text only; superseded by a
141
+ # connected billing integration's issued coupon when one exists.
131
142
  sig { returns(T.nilable(String)) }
132
143
  attr_reader :referral_coupon_code
133
144
 
@@ -179,7 +190,6 @@ module GrowsurfRuby
179
190
  coupon_code: String,
180
191
  description: String,
181
192
  image_url: String,
182
- is_active: T::Boolean,
183
193
  is_unlimited: T::Boolean,
184
194
  is_visible: T::Boolean,
185
195
  limit: Integer,
@@ -203,20 +213,36 @@ module GrowsurfRuby
203
213
  type:,
204
214
  commission_structure: nil,
205
215
  conversions_required: nil,
216
+ # Legacy static coupon code shown to the referrer in the reward-won email and
217
+ # webhook. Display text only; superseded by a connected billing integration's
218
+ # issued coupon when one exists.
206
219
  coupon_code: nil,
207
220
  description: nil,
208
221
  image_url: nil,
209
- is_active: nil,
222
+ # Whether the reward can be earned an unlimited number of times. Defaults to
223
+ # `true`, except `MILESTONE` rewards, which can only be earned once.
210
224
  is_unlimited: nil,
225
+ # Whether the reward is enabled. When `false` the reward is disabled: hidden from
226
+ # participants and no longer awarded, including those who already earned it.
211
227
  is_visible: nil,
212
228
  limit: nil,
213
229
  limit_duration: nil,
214
230
  # Custom key/value metadata (single-level; values are stored as strings).
215
231
  metadata: nil,
232
+ # Text shown before a participant's referral count in milestone-progress copy.
233
+ # Applies to `MILESTONE` rewards.
216
234
  next_milestone_prefix: nil,
235
+ # Text shown after a participant's referral count in milestone-progress copy.
236
+ # Applies to `MILESTONE` rewards.
217
237
  next_milestone_suffix: nil,
238
+ # The number of winners (`LEADERBOARD` rewards only). With `limitDuration`
239
+ # `PER_MONTH` this many win each month, otherwise this many win in total;
240
+ # omitting it defaults to `3`.
218
241
  number_of_winners: nil,
219
242
  order: nil,
243
+ # Legacy static coupon code shown to the referred friend (double-sided rewards)
244
+ # in the reward-won email and webhook. Display text only; superseded by a
245
+ # connected billing integration's issued coupon when one exists.
220
246
  referral_coupon_code: nil,
221
247
  referral_description: nil,
222
248
  referred_reward_upfront: nil,
@@ -241,7 +267,6 @@ module GrowsurfRuby
241
267
  coupon_code: String,
242
268
  description: String,
243
269
  image_url: String,
244
- is_active: T::Boolean,
245
270
  is_unlimited: T::Boolean,
246
271
  is_visible: T::Boolean,
247
272
  limit: Integer,
@@ -37,6 +37,9 @@ module GrowsurfRuby
37
37
  sig { params(conversions_required: Integer).void }
38
38
  attr_writer :conversions_required
39
39
 
40
+ # Legacy static coupon code shown to the referrer in the reward-won email and
41
+ # webhook. Display text only; superseded by a connected billing integration's
42
+ # issued coupon when one exists.
40
43
  sig { returns(T.nilable(String)) }
41
44
  attr_reader :coupon_code
42
45
 
@@ -55,18 +58,16 @@ module GrowsurfRuby
55
58
  sig { params(image_url: String).void }
56
59
  attr_writer :image_url
57
60
 
58
- sig { returns(T.nilable(T::Boolean)) }
59
- attr_reader :is_active
60
-
61
- sig { params(is_active: T::Boolean).void }
62
- attr_writer :is_active
63
-
61
+ # Whether the reward can be earned an unlimited number of times. Defaults to
62
+ # `true`, except `MILESTONE` rewards, which can only be earned once.
64
63
  sig { returns(T.nilable(T::Boolean)) }
65
64
  attr_reader :is_unlimited
66
65
 
67
66
  sig { params(is_unlimited: T::Boolean).void }
68
67
  attr_writer :is_unlimited
69
68
 
69
+ # Whether the reward is enabled. When `false` the reward is disabled: hidden from
70
+ # participants and no longer awarded, including those who already earned it.
70
71
  sig { returns(T.nilable(T::Boolean)) }
71
72
  attr_reader :is_visible
72
73
 
@@ -103,18 +104,25 @@ module GrowsurfRuby
103
104
  sig { params(metadata: T::Hash[Symbol, T.anything]).void }
104
105
  attr_writer :metadata
105
106
 
107
+ # Text shown before a participant's referral count in milestone-progress copy.
108
+ # Applies to `MILESTONE` rewards.
106
109
  sig { returns(T.nilable(String)) }
107
110
  attr_reader :next_milestone_prefix
108
111
 
109
112
  sig { params(next_milestone_prefix: String).void }
110
113
  attr_writer :next_milestone_prefix
111
114
 
115
+ # Text shown after a participant's referral count in milestone-progress copy.
116
+ # Applies to `MILESTONE` rewards.
112
117
  sig { returns(T.nilable(String)) }
113
118
  attr_reader :next_milestone_suffix
114
119
 
115
120
  sig { params(next_milestone_suffix: String).void }
116
121
  attr_writer :next_milestone_suffix
117
122
 
123
+ # The number of winners (`LEADERBOARD` rewards only). With `limitDuration`
124
+ # `PER_MONTH` this many win each month, otherwise this many win in total;
125
+ # omitting it defaults to `3`.
118
126
  sig { returns(T.nilable(Integer)) }
119
127
  attr_reader :number_of_winners
120
128
 
@@ -127,6 +135,9 @@ module GrowsurfRuby
127
135
  sig { params(order: Integer).void }
128
136
  attr_writer :order
129
137
 
138
+ # Legacy static coupon code shown to the referred friend (double-sided rewards)
139
+ # in the reward-won email and webhook. Display text only; superseded by a
140
+ # connected billing integration's issued coupon when one exists.
130
141
  sig { returns(T.nilable(String)) }
131
142
  attr_reader :referral_coupon_code
132
143
 
@@ -178,7 +189,6 @@ module GrowsurfRuby
178
189
  coupon_code: String,
179
190
  description: String,
180
191
  image_url: String,
181
- is_active: T::Boolean,
182
192
  is_unlimited: T::Boolean,
183
193
  is_visible: T::Boolean,
184
194
  limit: Integer,
@@ -203,20 +213,36 @@ module GrowsurfRuby
203
213
  campaign_reward_id:,
204
214
  commission_structure: nil,
205
215
  conversions_required: nil,
216
+ # Legacy static coupon code shown to the referrer in the reward-won email and
217
+ # webhook. Display text only; superseded by a connected billing integration's
218
+ # issued coupon when one exists.
206
219
  coupon_code: nil,
207
220
  description: nil,
208
221
  image_url: nil,
209
- is_active: nil,
222
+ # Whether the reward can be earned an unlimited number of times. Defaults to
223
+ # `true`, except `MILESTONE` rewards, which can only be earned once.
210
224
  is_unlimited: nil,
225
+ # Whether the reward is enabled. When `false` the reward is disabled: hidden from
226
+ # participants and no longer awarded, including those who already earned it.
211
227
  is_visible: nil,
212
228
  limit: nil,
213
229
  limit_duration: nil,
214
230
  # Custom key/value metadata (single-level; values are stored as strings).
215
231
  metadata: nil,
232
+ # Text shown before a participant's referral count in milestone-progress copy.
233
+ # Applies to `MILESTONE` rewards.
216
234
  next_milestone_prefix: nil,
235
+ # Text shown after a participant's referral count in milestone-progress copy.
236
+ # Applies to `MILESTONE` rewards.
217
237
  next_milestone_suffix: nil,
238
+ # The number of winners (`LEADERBOARD` rewards only). With `limitDuration`
239
+ # `PER_MONTH` this many win each month, otherwise this many win in total;
240
+ # omitting it defaults to `3`.
218
241
  number_of_winners: nil,
219
242
  order: nil,
243
+ # Legacy static coupon code shown to the referred friend (double-sided rewards)
244
+ # in the reward-won email and webhook. Display text only; superseded by a
245
+ # connected billing integration's issued coupon when one exists.
220
246
  referral_coupon_code: nil,
221
247
  referral_description: nil,
222
248
  referred_reward_upfront: nil,
@@ -241,7 +267,6 @@ module GrowsurfRuby
241
267
  coupon_code: String,
242
268
  description: String,
243
269
  image_url: String,
244
- is_active: T::Boolean,
245
270
  is_unlimited: T::Boolean,
246
271
  is_visible: T::Boolean,
247
272
  limit: Integer,
@@ -0,0 +1,93 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ class Webhook < GrowsurfRuby::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ GrowsurfRuby::Models::Campaign::Webhook,
11
+ GrowsurfRuby::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # Read-only. Whether GrowSurf auto-disabled this webhook after repeated delivery
16
+ # failures.
17
+ sig { returns(T::Boolean) }
18
+ attr_accessor :auto_disabled_due_to_failures
19
+
20
+ sig do
21
+ returns(T::Array[GrowsurfRuby::Campaign::WebhookEvent::TaggedSymbol])
22
+ end
23
+ attr_accessor :events
24
+
25
+ # Read-only. Consecutive delivery failures.
26
+ sig { returns(Integer) }
27
+ attr_accessor :failure_count
28
+
29
+ # The webhook id (`primary` for the program's primary webhook).
30
+ sig { returns(String) }
31
+ attr_accessor :id
32
+
33
+ sig { returns(T::Boolean) }
34
+ attr_accessor :is_enabled
35
+
36
+ # Read-only. When the last delivery failure occurred, as a Unix timestamp in
37
+ # milliseconds.
38
+ sig { returns(T.nilable(Integer)) }
39
+ attr_accessor :last_failure_at
40
+
41
+ # The URL that receives webhook deliveries.
42
+ sig { returns(T.nilable(String)) }
43
+ attr_accessor :payload_url
44
+
45
+ sig do
46
+ params(
47
+ auto_disabled_due_to_failures: T::Boolean,
48
+ events: T::Array[GrowsurfRuby::Campaign::WebhookEvent::OrSymbol],
49
+ failure_count: Integer,
50
+ id: String,
51
+ is_enabled: T::Boolean,
52
+ last_failure_at: T.nilable(Integer),
53
+ payload_url: T.nilable(String)
54
+ ).returns(T.attached_class)
55
+ end
56
+ def self.new(
57
+ # Read-only. Whether GrowSurf auto-disabled this webhook after repeated delivery
58
+ # failures.
59
+ auto_disabled_due_to_failures:,
60
+ events:,
61
+ # Read-only. Consecutive delivery failures.
62
+ failure_count:,
63
+ # The webhook id (`primary` for the program's primary webhook).
64
+ id:,
65
+ is_enabled:,
66
+ # Read-only. When the last delivery failure occurred, as a Unix timestamp in
67
+ # milliseconds.
68
+ last_failure_at: nil,
69
+ # The URL that receives webhook deliveries.
70
+ payload_url: nil
71
+ )
72
+ end
73
+
74
+ sig do
75
+ override.returns(
76
+ {
77
+ auto_disabled_due_to_failures: T::Boolean,
78
+ events:
79
+ T::Array[GrowsurfRuby::Campaign::WebhookEvent::TaggedSymbol],
80
+ failure_count: Integer,
81
+ id: String,
82
+ is_enabled: T::Boolean,
83
+ last_failure_at: T.nilable(Integer),
84
+ payload_url: T.nilable(String)
85
+ }
86
+ )
87
+ end
88
+ def to_hash
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end