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
@@ -91,16 +91,6 @@ module GrowsurfRuby
91
91
  end
92
92
  OrSymbol = T.type_alias { T.any(Symbol, String) }
93
93
 
94
- DRAFT =
95
- T.let(
96
- :DRAFT,
97
- GrowsurfRuby::CampaignUpdateParams::Status::TaggedSymbol
98
- )
99
- PENDING =
100
- T.let(
101
- :PENDING,
102
- GrowsurfRuby::CampaignUpdateParams::Status::TaggedSymbol
103
- )
104
94
  IN_PROGRESS =
105
95
  T.let(
106
96
  :IN_PROGRESS,
@@ -111,11 +101,6 @@ module GrowsurfRuby
111
101
  :COMPLETE,
112
102
  GrowsurfRuby::CampaignUpdateParams::Status::TaggedSymbol
113
103
  )
114
- CANCELLED =
115
- T.let(
116
- :CANCELLED,
117
- GrowsurfRuby::CampaignUpdateParams::Status::TaggedSymbol
118
- )
119
104
 
120
105
  sig do
121
106
  override.returns(
@@ -14,6 +14,9 @@ module GrowsurfRuby
14
14
  sig { returns(T.nilable(Integer)) }
15
15
  attr_accessor :amount
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_accessor :amount_iso
19
+
17
20
  sig { returns(T.nilable(T::Boolean)) }
18
21
  attr_accessor :approval_required
19
22
 
@@ -75,6 +78,7 @@ module GrowsurfRuby
75
78
  sig do
76
79
  params(
77
80
  amount: T.nilable(Integer),
81
+ amount_iso: T.nilable(String),
78
82
  approval_required: T.nilable(T::Boolean),
79
83
  duration: T.nilable(String),
80
84
  duration_in_months: T.nilable(Integer),
@@ -97,6 +101,7 @@ module GrowsurfRuby
97
101
  end
98
102
  def self.new(
99
103
  amount: nil,
104
+ amount_iso: nil,
100
105
  approval_required: nil,
101
106
  duration: nil,
102
107
  duration_in_months: nil,
@@ -122,6 +127,7 @@ module GrowsurfRuby
122
127
  override.returns(
123
128
  {
124
129
  amount: T.nilable(Integer),
130
+ amount_iso: T.nilable(String),
125
131
  approval_required: T.nilable(T::Boolean),
126
132
  duration: T.nilable(String),
127
133
  duration_in_months: T.nilable(Integer),
@@ -158,8 +164,8 @@ module GrowsurfRuby
158
164
 
159
165
  PERCENT =
160
166
  T.let(:PERCENT, GrowsurfRuby::CommissionStructure::Type::TaggedSymbol)
161
- AMOUNT =
162
- T.let(:AMOUNT, GrowsurfRuby::CommissionStructure::Type::TaggedSymbol)
167
+ FIXED =
168
+ T.let(:FIXED, GrowsurfRuby::CommissionStructure::Type::TaggedSymbol)
163
169
 
164
170
  sig do
165
171
  override.returns(
@@ -0,0 +1,94 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ class ReferralFlowScreenshotsResponse < GrowsurfRuby::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ GrowsurfRuby::Models::ReferralFlowScreenshotsResponse,
10
+ GrowsurfRuby::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot) }
15
+ attr_reader :referrer
16
+
17
+ sig do
18
+ params(
19
+ referrer: GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot::OrHash
20
+ ).void
21
+ end
22
+ attr_writer :referrer
23
+
24
+ sig { returns(GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot) }
25
+ attr_reader :referred_friend
26
+
27
+ sig do
28
+ params(
29
+ referred_friend: GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot::OrHash
30
+ ).void
31
+ end
32
+ attr_writer :referred_friend
33
+
34
+ sig { returns(Integer) }
35
+ attr_accessor :generated_at
36
+
37
+ sig do
38
+ params(
39
+ referrer: GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot::OrHash,
40
+ referred_friend: GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot::OrHash,
41
+ generated_at: Integer
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(referrer:, referred_friend:, generated_at:)
45
+ end
46
+
47
+ sig do
48
+ override.returns(
49
+ {
50
+ referrer: GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot,
51
+ referred_friend: GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot,
52
+ generated_at: Integer
53
+ }
54
+ )
55
+ end
56
+ def to_hash
57
+ end
58
+
59
+ class ReferralFlowScreenshot < GrowsurfRuby::Internal::Type::BaseModel
60
+ OrHash =
61
+ T.type_alias do
62
+ T.any(
63
+ GrowsurfRuby::Models::ReferralFlowScreenshotsResponse::ReferralFlowScreenshot,
64
+ GrowsurfRuby::Internal::AnyHash
65
+ )
66
+ end
67
+
68
+ sig { returns(String) }
69
+ attr_accessor :view
70
+
71
+ sig { returns(String) }
72
+ attr_accessor :url
73
+
74
+ sig { returns(Integer) }
75
+ attr_accessor :width
76
+
77
+ sig { returns(Integer) }
78
+ attr_accessor :height
79
+
80
+ sig do
81
+ params(view: String, url: String, width: Integer, height: Integer).returns(T.attached_class)
82
+ end
83
+ def self.new(view:, url:, width:, height:)
84
+ end
85
+
86
+ sig do
87
+ override.returns({view: String, url: String, width: Integer, height: Integer})
88
+ end
89
+ def to_hash
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -1,6 +1,12 @@
1
1
  # typed: strong
2
2
 
3
3
  module GrowsurfRuby
4
+ Account = GrowsurfRuby::Models::Account
5
+
6
+ AccountCreateParams = GrowsurfRuby::Models::AccountCreateParams
7
+
8
+ AccountUpdateParams = GrowsurfRuby::Models::AccountUpdateParams
9
+
4
10
  Campaign = GrowsurfRuby::Models::Campaign
5
11
 
6
12
  CampaignAPI = GrowsurfRuby::Models::CampaignAPI
@@ -43,5 +49,8 @@ module GrowsurfRuby
43
49
 
44
50
  ReferralList = GrowsurfRuby::Models::ReferralList
45
51
 
52
+ ReferralFlowScreenshotsResponse =
53
+ GrowsurfRuby::Models::ReferralFlowScreenshotsResponse
54
+
46
55
  RewardTaxValuation = GrowsurfRuby::Models::RewardTaxValuation
47
56
  end
@@ -0,0 +1,112 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Resources
5
+ class Account
6
+ # Creates a new GrowSurf account. This is the only endpoint that does not require
7
+ # an API key. The response includes an API key for the new account, but the key is
8
+ # locked until the account's email address is verified: authenticated endpoints
9
+ # outside the `Accounts` group return a `403` with error code
10
+ # `EMAIL_NOT_VERIFIED_ERROR` until then (resend the email via `POST
11
+ # /account/verification-email`, then retry). A welcome email is sent to the
12
+ # address with the verification link and a set-password link for dashboard
13
+ # access. Accounts whose email is never verified are deleted automatically after
14
+ # 7 days. For security, the API key is rotated the first time the account owner
15
+ # signs in to the GrowSurf dashboard. Some actions (such as emailing
16
+ # participants) additionally require the GrowSurf team to verify the account
17
+ # first. By creating an account you agree, on behalf of the account holder, to
18
+ # GrowSurf's [Terms of Service](https://growsurf.com/terms) and
19
+ # [Privacy Policy](https://growsurf.com/privacy).
20
+ sig do
21
+ params(
22
+ email: String,
23
+ company: String,
24
+ first_name: String,
25
+ last_name: String,
26
+ request_options: GrowsurfRuby::RequestOptions::OrHash
27
+ ).returns(GrowsurfRuby::Models::AccountCreateResponse)
28
+ end
29
+ def create(
30
+ # The email address for the new account. Personal emails and disposable email addresses are not accepted.
31
+ email:,
32
+ company: nil,
33
+ first_name: nil,
34
+ last_name: nil,
35
+ request_options: {}
36
+ )
37
+ end
38
+
39
+ # Retrieves the account that owns the API key: profile and GrowSurf-team
40
+ # verification state.
41
+ # `verificationStatus` is `VERIFIED` once the GrowSurf team has verified the account
42
+ # — this is required before you can send participant emails from a program.
43
+ sig do
44
+ params(request_options: GrowsurfRuby::RequestOptions::OrHash).returns(
45
+ GrowsurfRuby::Account
46
+ )
47
+ end
48
+ def retrieve(request_options: {})
49
+ end
50
+
51
+ # Updates your own account profile (`firstName`, `lastName`, `company`). Any other
52
+ # property is rejected with a `400` — in particular, the account `email` cannot be
53
+ # changed via the API, and billing/subscription is not editable here.
54
+ sig do
55
+ params(
56
+ company: String,
57
+ first_name: String,
58
+ last_name: String,
59
+ request_options: GrowsurfRuby::RequestOptions::OrHash
60
+ ).returns(GrowsurfRuby::Account)
61
+ end
62
+ def update(
63
+ company: nil,
64
+ first_name: nil,
65
+ last_name: nil,
66
+ request_options: {}
67
+ )
68
+ end
69
+
70
+ # Generates a new API key and immediately revokes the old one. The key used to make
71
+ # this request stops working as soon as the response is returned — update every
72
+ # integration that used the old key with the new one. The account owner is
73
+ # notified by email whenever the key is rotated.
74
+ sig do
75
+ params(request_options: GrowsurfRuby::RequestOptions::OrHash).returns(
76
+ GrowsurfRuby::Models::AccountRotateAPIKeyResponse
77
+ )
78
+ end
79
+ def rotate_api_key(request_options: {})
80
+ end
81
+
82
+ # Requests GrowSurf-team verification of your account (required before a program can
83
+ # email its participants). Idempotent — calling it again while a request is pending
84
+ # does not create a duplicate. Returns the account with its updated
85
+ # `verificationStatus`.
86
+ sig do
87
+ params(request_options: GrowsurfRuby::RequestOptions::OrHash).returns(
88
+ GrowsurfRuby::Account
89
+ )
90
+ end
91
+ def request_verification(request_options: {})
92
+ end
93
+
94
+ # Resends the email-verification email to the account's email address. A `200`
95
+ # with `status: SENT` is only returned when an email was actually dispatched.
96
+ # Returns a `400` if the email is already verified, or a `429` if a verification
97
+ # email was sent too recently — wait a moment, then retry.
98
+ sig do
99
+ params(request_options: GrowsurfRuby::RequestOptions::OrHash).returns(
100
+ GrowsurfRuby::Models::AccountResendVerificationEmailResponse
101
+ )
102
+ end
103
+ def resend_verification_email(request_options: {})
104
+ end
105
+
106
+ # @api private
107
+ sig { params(client: GrowsurfRuby::Client).returns(T.attached_class) }
108
+ def self.new(client:)
109
+ end
110
+ end
111
+ end
112
+ end
@@ -6,8 +6,8 @@ module GrowsurfRuby
6
6
  class Design
7
7
  # Retrieves a program's design configuration — the same surface as the dashboard
8
8
  # Program Editor's **Design** tab. This is a large, deeply nested object whose
9
- # available fields depend on the program type. See the API reference for the full
10
- # field list.
9
+ # available fields depend on the program type; the response includes every field
10
+ # and its current value, which is the same shape you send back on update.
11
11
  sig do
12
12
  params(
13
13
  id: String,
@@ -21,9 +21,11 @@ module GrowsurfRuby
21
21
  )
22
22
  end
23
23
 
24
- # Updates a program's design configuration. Only the fields you send are changed.
25
- # The request body is a partial design object see the API reference for the full
26
- # field list.
24
+ # Updates a program's design configuration. Only the fields you send are changed;
25
+ # anything you leave out is untouched (arrays such as `signup.fields` replace
26
+ # wholesale). The request body is a partial design object. To see the full object
27
+ # with every field and its current value, `GET` this resource, then `PATCH` back
28
+ # only the fields you want to change.
27
29
  sig do
28
30
  params(
29
31
  id: String,
@@ -5,8 +5,9 @@ module GrowsurfRuby
5
5
  class Campaign
6
6
  class Emails
7
7
  # Retrieves a program's email configuration — the same surface as the dashboard
8
- # Program Editor's **Emails** tab. This is a large, nested object. See the API
9
- # reference for the full field list.
8
+ # Program Editor's **Emails** tab. To see the full object with every field and its
9
+ # current value, `GET` this resource, then `PATCH` back only the fields you want to
10
+ # change.
10
11
  sig do
11
12
  params(
12
13
  id: String,
@@ -20,9 +21,10 @@ module GrowsurfRuby
20
21
  )
21
22
  end
22
23
 
23
- # Updates a program's email configuration. Only the fields you send are changed.
24
- # The request body is a partial email configuration object — see the API reference
25
- # for the full field list.
24
+ # Updates a program's email configuration. Only the fields you send are changed;
25
+ # anything you leave out is untouched. The request body is a partial email
26
+ # configuration object. To see the full object with every field and its current
27
+ # value, `GET` this resource, then `PATCH` back only the fields you want to change.
26
28
  sig do
27
29
  params(
28
30
  id: String,
@@ -6,8 +6,9 @@ module GrowsurfRuby
6
6
  class Installation
7
7
  # Retrieves a program's installation configuration — the same surface as the
8
8
  # dashboard Program Editor's **Installation** tab. This is a nested object whose
9
- # available fields depend on the program type. See the API reference for the full
10
- # field list.
9
+ # available fields depend on the program type. To see the full object with every
10
+ # field and its current value, `GET` this resource, then `PATCH` back only the
11
+ # fields you want to change.
11
12
  sig do
12
13
  params(
13
14
  id: String,
@@ -22,8 +23,10 @@ module GrowsurfRuby
22
23
  end
23
24
 
24
25
  # Updates a program's installation configuration. Only the fields you send are
25
- # changed. The request body is a partial installation configuration object — see
26
- # the API reference for the full field list.
26
+ # changed; anything you leave out is untouched. The request body is a partial
27
+ # installation configuration object. To see the full object with every field and
28
+ # its current value, `GET` this resource, then `PATCH` back only the fields you
29
+ # want to change.
27
30
  sig do
28
31
  params(
29
32
  id: String,
@@ -5,8 +5,9 @@ module GrowsurfRuby
5
5
  class Campaign
6
6
  class Options
7
7
  # Retrieves a program's options configuration — the same surface as the dashboard
8
- # Program Editor's **Options** tab. This is a large, nested object. See the API
9
- # reference for the full field list.
8
+ # Program Editor's **Options** tab. To see the full object with every field and its
9
+ # current value, `GET` this resource, then `PATCH` back only the fields you want to
10
+ # change.
10
11
  sig do
11
12
  params(
12
13
  id: String,
@@ -20,9 +21,10 @@ module GrowsurfRuby
20
21
  )
21
22
  end
22
23
 
23
- # Updates a program's options configuration. Only the fields you send are changed.
24
- # The request body is a partial options configuration object — see the API
25
- # reference for the full field list.
24
+ # Updates a program's options configuration. Only the fields you send are changed;
25
+ # anything you leave out is untouched. The request body is a partial options
26
+ # configuration object. To see the full object with every field and its current
27
+ # value, `GET` this resource, then `PATCH` back only the fields you want to change.
26
28
  sig do
27
29
  params(
28
30
  id: String,
@@ -30,6 +30,8 @@ module GrowsurfRuby
30
30
  first_name: String,
31
31
  last_name: String,
32
32
  metadata: T::Hash[Symbol, T.anything],
33
+ notes: String,
34
+ paypal_email: String,
33
35
  referral_status:
34
36
  GrowsurfRuby::Campaign::ParticipantUpdateParams::ReferralStatus::OrSymbol,
35
37
  referred_by: String,
@@ -51,6 +53,11 @@ module GrowsurfRuby
51
53
  last_name: nil,
52
54
  # Body param: Shallow custom metadata object.
53
55
  metadata: nil,
56
+ # Body param: Freeform internal notes about the participant (internal only, never
57
+ # exposed to participants).
58
+ notes: nil,
59
+ # Body param: The participant's PayPal email address, used for affiliate payouts.
60
+ paypal_email: nil,
54
61
  # Body param
55
62
  referral_status: nil,
56
63
  # Body param
@@ -80,6 +87,32 @@ module GrowsurfRuby
80
87
  )
81
88
  end
82
89
 
90
+ # Deletes a list of participants from a program in one request. Each entry in
91
+ # `participants` is a GrowSurf participant ID or an email address (mixed lists
92
+ # are allowed). Up to `200` entries per request — chunk larger lists across
93
+ # multiple calls. The response reports a per-row `status` for every submitted
94
+ # entry, so a `200` can include rows that were `NOT_FOUND` or failed. Deletion
95
+ # is permanent and removes the participants' referrals, rewards, commissions,
96
+ # and payout records.
97
+ sig do
98
+ params(
99
+ id: String,
100
+ participants: T::Array[String],
101
+ request_options: GrowsurfRuby::RequestOptions::OrHash
102
+ ).returns(
103
+ GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse
104
+ )
105
+ end
106
+ def bulk_delete(
107
+ # GrowSurf program ID.
108
+ id,
109
+ # GrowSurf participant IDs and/or email addresses to delete. Mixed entries are
110
+ # allowed.
111
+ participants:,
112
+ request_options: {}
113
+ )
114
+ end
115
+
83
116
  # Adds a new participant to the program. If the email already exists, the existing
84
117
  # participant is returned.
85
118
  sig do
@@ -112,6 +145,10 @@ module GrowsurfRuby
112
145
  # for mobile participant creation and mobile participant token flows. The official
113
146
  # mobile SDKs generate this as a lowercase UUID.
114
147
  mobile_instance_id: nil,
148
+ # The referral credit status; only meaningful when `referred_by` resolves to a
149
+ # referrer. When omitted it is derived from the program's referral trigger
150
+ # (`CREDIT_AWARDED`, `CREDIT_PENDING`, or `CREDIT_EXPIRED`); left unset when no
151
+ # referrer resolves.
115
152
  referral_status: nil,
116
153
  # Referrer participant ID or email address.
117
154
  referred_by: nil,
@@ -245,6 +282,13 @@ module GrowsurfRuby
245
282
 
246
283
  # Records a sale made by a referred customer and generates affiliate commissions
247
284
  # for their referrer when applicable.
285
+ #
286
+ # At least one transaction identifier is required: one of +external_id+,
287
+ # +transaction_id+, +order_id+, +payment_id+, +invoice_id+, +payment_intent_id+,
288
+ # or +charge_id+. +customer_id+ and +subscription_id+ do not count, since they
289
+ # identify the customer or subscription rather than the specific transaction.
290
+ # Without an identifier, resending the same sale creates a duplicate commission
291
+ # and double-pays the referrer; the server rejects such requests with HTTP 400.
248
292
  sig do
249
293
  params(
250
294
  participant_id_or_email: String,
@@ -400,6 +444,8 @@ module GrowsurfRuby
400
444
  end
401
445
 
402
446
  # Sends email invites on behalf of a participant to a list of email addresses.
447
+ # Sending invites via the API requires a verified custom email domain on the
448
+ # program; the request fails until one is verified.
403
449
  sig do
404
450
  params(
405
451
  participant_id_or_email: String,
@@ -474,6 +520,120 @@ module GrowsurfRuby
474
520
  )
475
521
  end
476
522
 
523
+ # Sends an email to a participant. Provide EITHER `email_type` to trigger one of the
524
+ # program's configured email templates, OR `subject` + `body` for a free-form email.
525
+ # Free-form emails are sent with the same compliance handling (company name,
526
+ # postal address, and an unsubscribe link are added automatically, and unsubscribed
527
+ # participants are suppressed). Sending requires the account to be verified by the
528
+ # GrowSurf team. Requires a verified custom email domain on the program (set up
529
+ # in Campaign Editor > 3. Emails > Email Settings). Returns `400` until one is
530
+ # verified.
531
+ # The email is accepted for delivery.
532
+ sig do
533
+ params(
534
+ participant_id_or_email: String,
535
+ id: String,
536
+ body: String,
537
+ email_type: String,
538
+ preheader: String,
539
+ subject: String,
540
+ request_options: GrowsurfRuby::RequestOptions::OrHash
541
+ ).returns(GrowsurfRuby::Models::Campaign::ParticipantEmailResponse)
542
+ end
543
+ def email(
544
+ # Path param: GrowSurf participant ID or URL-encoded participant email address.
545
+ participant_id_or_email,
546
+ # Path param: GrowSurf program ID.
547
+ id:,
548
+ # Body param: HTML body for a free-form email. You can personalize it with
549
+ # dynamic text, inserting `{{...}}` tokens like `{{firstName}}` or `{{shareUrl}}`.
550
+ # See [Guide to using dynamic text in GrowSurf emails](https://support.growsurf.com/article/213-guide-to-using-dynamic-text-in-growsurf-emails).
551
+ body: nil,
552
+ # Body param: The program email template to send (template mode). Send the
553
+ # camelCase key. The valid types depend on the program type; `isEnabled` only
554
+ # controls automatic sends. Referral programs: `welcomeNonReferred`,
555
+ # `referralLinkViewedFirstTime`, `referralLinkUsed`, `referredSignup`,
556
+ # `welcomeReferred`, `goalAchieved`, `campaignEndedWinners`,
557
+ # `campaignEndedNonWinners`, `progressUpdateMonthly`. Affiliate programs:
558
+ # `welcomeNonReferred`, `referralLinkViewedFirstTime`, `referredSignup`,
559
+ # `commissionGenerated`, `commissionAdjusted`, `payoutPending`,
560
+ # `payoutSentSuccess`, `progressUpdateMonthly`. System/transactional types (login
561
+ # link, PayPal confirmation, tax) and the invite email cannot be sent.
562
+ email_type: nil,
563
+ # Body param: Optional preheader text for a free-form email.
564
+ preheader: nil,
565
+ # Body param: Subject line for a free-form email. Supports dynamic text
566
+ # (`{{...}}` tokens), the same as the body.
567
+ subject: nil,
568
+ request_options: {}
569
+ )
570
+ end
571
+
572
+ # Returns a participant's activity logs, most recent first (offset/limit paginated).
573
+ sig do
574
+ params(
575
+ participant_id_or_email: String,
576
+ id: String,
577
+ limit: Integer,
578
+ offset: Integer,
579
+ request_options: GrowsurfRuby::RequestOptions::OrHash
580
+ ).returns(
581
+ GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse
582
+ )
583
+ end
584
+ def list_activity_logs(
585
+ # Path param: GrowSurf participant ID or URL-encoded participant email address.
586
+ participant_id_or_email,
587
+ # Path param: GrowSurf program ID.
588
+ id:,
589
+ # Query param: Number of logs to return (1–100, default 20).
590
+ limit: nil,
591
+ # Query param: Number of logs to skip.
592
+ offset: nil,
593
+ request_options: {}
594
+ )
595
+ end
596
+
597
+ # Retrieves analytics for a single participant — all-time engagement counters,
598
+ # leaderboard ranks, and per-channel share counts (plus affiliate money metrics for
599
+ # affiliate programs). Useful for segmenting and re-engaging participants.
600
+ sig do
601
+ params(
602
+ participant_id_or_email: String,
603
+ id: String,
604
+ days: Integer,
605
+ end_date: Integer,
606
+ include:
607
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Include::OrSymbol,
608
+ interval:
609
+ GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams::Interval::OrSymbol,
610
+ start_date: Integer,
611
+ request_options: GrowsurfRuby::RequestOptions::OrHash
612
+ ).returns(
613
+ GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse
614
+ )
615
+ end
616
+ def retrieve_analytics(
617
+ # GrowSurf participant ID or URL-encoded participant email address.
618
+ participant_id_or_email,
619
+ # GrowSurf program ID.
620
+ id:,
621
+ # Last number of days to retrieve analytics for. Defaults to 365. Maximum 1825.
622
+ days: nil,
623
+ # End date of the analytics timeframe as a Unix timestamp in milliseconds.
624
+ # Required if `days` is not set.
625
+ end_date: nil,
626
+ # Set to `series` to also return this participant's own activity per period.
627
+ include: nil,
628
+ # Bucket size for the `series` (only used with `include=series`). Defaults to `day`.
629
+ interval: nil,
630
+ # Start date of the analytics timeframe as a Unix timestamp in milliseconds.
631
+ # Required if `days` is not set.
632
+ start_date: nil,
633
+ request_options: {}
634
+ )
635
+ end
636
+
477
637
  # @api private
478
638
  sig { params(client: GrowsurfRuby::Client).returns(T.attached_class) }
479
639
  def self.new(client:)