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,159 @@
1
+ # frozen_string_literal: true
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
+ #
21
+ # @overload create(email:, company: nil, first_name: nil, last_name: nil, request_options: {})
22
+ #
23
+ # @param email [String] The email address for the new account. Personal emails and disposable email addresses are not accepted.
24
+ #
25
+ # @param company [String]
26
+ #
27
+ # @param first_name [String]
28
+ #
29
+ # @param last_name [String]
30
+ #
31
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
32
+ #
33
+ # @return [GrowsurfRuby::Models::AccountCreateResponse]
34
+ #
35
+ # @see GrowsurfRuby::Models::AccountCreateParams
36
+ def create(params)
37
+ parsed, options = GrowsurfRuby::AccountCreateParams.dump_request(params)
38
+ @client.request(
39
+ method: :post,
40
+ path: "accounts",
41
+ body: parsed,
42
+ model: GrowsurfRuby::Models::AccountCreateResponse,
43
+ options: options
44
+ )
45
+ end
46
+
47
+ # Retrieves the account that owns the API key: profile and GrowSurf-team
48
+ # verification state.
49
+ # `verificationStatus` is `VERIFIED` once the GrowSurf team has verified the account
50
+ # — this is required before you can send participant emails from a program.
51
+ #
52
+ # @overload retrieve(request_options: {})
53
+ #
54
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
55
+ #
56
+ # @return [GrowsurfRuby::Models::Account]
57
+ def retrieve(params = {})
58
+ @client.request(
59
+ method: :get,
60
+ path: "account",
61
+ model: GrowsurfRuby::Account,
62
+ options: params[:request_options]
63
+ )
64
+ end
65
+
66
+ # Updates your own account profile (`firstName`, `lastName`, `company`). Any other
67
+ # property is rejected with a `400` — in particular, the account `email` cannot be
68
+ # changed via the API, and billing/subscription is not editable here.
69
+ #
70
+ # @overload update(company: nil, first_name: nil, last_name: nil, request_options: {})
71
+ #
72
+ # @param company [String]
73
+ #
74
+ # @param first_name [String]
75
+ #
76
+ # @param last_name [String]
77
+ #
78
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
79
+ #
80
+ # @return [GrowsurfRuby::Models::Account]
81
+ #
82
+ # @see GrowsurfRuby::Models::AccountUpdateParams
83
+ def update(params = {})
84
+ parsed, options = GrowsurfRuby::AccountUpdateParams.dump_request(params)
85
+ @client.request(
86
+ method: :patch,
87
+ path: "account",
88
+ body: parsed,
89
+ model: GrowsurfRuby::Account,
90
+ options: options
91
+ )
92
+ end
93
+
94
+ # Generates a new API key and immediately revokes the old one. The key used to make
95
+ # this request stops working as soon as the response is returned — update every
96
+ # integration that used the old key with the new one. The account owner is
97
+ # notified by email whenever the key is rotated.
98
+ #
99
+ # @overload rotate_api_key(request_options: {})
100
+ #
101
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
102
+ #
103
+ # @return [GrowsurfRuby::Models::AccountRotateAPIKeyResponse]
104
+ def rotate_api_key(params = {})
105
+ @client.request(
106
+ method: :post,
107
+ path: "account/api-key",
108
+ model: GrowsurfRuby::Models::AccountRotateAPIKeyResponse,
109
+ options: params[:request_options]
110
+ )
111
+ end
112
+
113
+ # Requests GrowSurf-team verification of your account (required before a program can
114
+ # email its participants). Idempotent — calling it again while a request is pending
115
+ # does not create a duplicate. Returns the account with its updated
116
+ # `verificationStatus`.
117
+ #
118
+ # @overload request_verification(request_options: {})
119
+ #
120
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
121
+ #
122
+ # @return [GrowsurfRuby::Models::Account]
123
+ def request_verification(params = {})
124
+ @client.request(
125
+ method: :post,
126
+ path: "account/verification-request",
127
+ model: GrowsurfRuby::Account,
128
+ options: params[:request_options]
129
+ )
130
+ end
131
+
132
+ # Resends the email-verification email to the account's email address. A `200`
133
+ # with `status: SENT` is only returned when an email was actually dispatched.
134
+ # Returns a `400` if the email is already verified, or a `429` if a verification
135
+ # email was sent too recently — wait a moment, then retry.
136
+ #
137
+ # @overload resend_verification_email(request_options: {})
138
+ #
139
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
140
+ #
141
+ # @return [GrowsurfRuby::Models::AccountResendVerificationEmailResponse]
142
+ def resend_verification_email(params = {})
143
+ @client.request(
144
+ method: :post,
145
+ path: "account/verification-email",
146
+ model: GrowsurfRuby::Models::AccountResendVerificationEmailResponse,
147
+ options: params[:request_options]
148
+ )
149
+ end
150
+
151
+ # @api private
152
+ #
153
+ # @param client [GrowsurfRuby::Client]
154
+ def initialize(client:)
155
+ @client = client
156
+ end
157
+ end
158
+ end
159
+ end
@@ -9,7 +9,8 @@ module GrowsurfRuby
9
9
  # form, portal/landing pages, theme styling, and summary/status sections).
10
10
  #
11
11
  # This is a large, deeply nested object whose available fields depend on the
12
- # program type. See the API reference for the full field list.
12
+ # program type; the response includes every field and its current value, which
13
+ # is the same shape you send back on update.
13
14
  #
14
15
  # @overload retrieve(id, request_options: {})
15
16
  #
@@ -27,13 +28,14 @@ module GrowsurfRuby
27
28
  )
28
29
  end
29
30
 
30
- # Updates a program's design configuration. Only the fields you send are changed (a
31
- # surgical merge; arrays such as `signup.fields` replace wholesale). Unknown
32
- # fields, fields not available for the program type, and invalid values return a
33
- # `400`.
31
+ # Updates a program's design configuration. Only the fields you send are changed;
32
+ # anything you leave out is untouched (arrays such as `signup.fields` replace
33
+ # wholesale). Unknown fields, fields not available for the program type, and
34
+ # invalid values return a `400`.
34
35
  #
35
- # The request body is a partial {CampaignDesign} object see the API reference for
36
- # the full field list.
36
+ # The request body is a partial {CampaignDesign} object. To see the full object
37
+ # with every field and its current value, `GET` this resource, then `PATCH` back
38
+ # only the fields you want to change.
37
39
  #
38
40
  # @overload update(id, body, request_options: {})
39
41
  #
@@ -8,7 +8,8 @@ module GrowsurfRuby
8
8
  # Program Editor's **Emails** tab (per-email templates plus sender, contact, and
9
9
  # design settings).
10
10
  #
11
- # This is a large, nested object. See the API reference for the full field list.
11
+ # To see the full object with every field and its current value, `GET` this
12
+ # resource, then `PATCH` back only the fields you want to change.
12
13
  #
13
14
  # @overload retrieve(id, request_options: {})
14
15
  #
@@ -26,11 +27,13 @@ module GrowsurfRuby
26
27
  )
27
28
  end
28
29
 
29
- # Updates a program's email configuration. Only the fields you send are changed.
30
- # Unknown fields and invalid values return a `400`.
30
+ # Updates a program's email configuration. Only the fields you send are changed;
31
+ # anything you leave out is untouched. Unknown fields and invalid values return a
32
+ # `400`.
31
33
  #
32
- # The request body is a partial {CampaignEmails} object see the API reference for
33
- # the full field list.
34
+ # The request body is a partial {CampaignEmails} object. To see the full object
35
+ # with every field and its current value, `GET` this resource, then `PATCH` back
36
+ # only the fields you want to change.
34
37
  #
35
38
  # @overload update(id, body, request_options: {})
36
39
  #
@@ -8,8 +8,9 @@ module GrowsurfRuby
8
8
  # dashboard Program Editor's **Installation** tab (signup and mobile SDK
9
9
  # installation settings).
10
10
  #
11
- # This is a nested object whose available fields depend on the program type. See
12
- # the API reference for the full field list.
11
+ # This is a nested object whose available fields depend on the program type. To
12
+ # see the full object with every field and its current value, `GET` this
13
+ # resource, then `PATCH` back only the fields you want to change.
13
14
  #
14
15
  # @overload retrieve(id, request_options: {})
15
16
  #
@@ -28,11 +29,12 @@ module GrowsurfRuby
28
29
  end
29
30
 
30
31
  # Updates a program's installation configuration. Only the fields you send are
31
- # changed. Unknown fields, fields not available for the program type, and invalid
32
- # values return a `400`.
32
+ # changed; anything you leave out is untouched. Unknown fields, fields not
33
+ # available for the program type, and invalid values return a `400`.
33
34
  #
34
- # The request body is a partial {CampaignInstallation} object see the API
35
- # reference for the full field list.
35
+ # The request body is a partial {CampaignInstallation} object. To see the full
36
+ # object with every field and its current value, `GET` this resource, then
37
+ # `PATCH` back only the fields you want to change.
36
38
  #
37
39
  # @overload update(id, body, request_options: {})
38
40
  #
@@ -8,7 +8,8 @@ module GrowsurfRuby
8
8
  # Program Editor's **Options** tab (fraud/reCAPTCHA, tax documentation,
9
9
  # notification emails, and other program settings).
10
10
  #
11
- # This is a large, nested object. See the API reference for the full field list.
11
+ # To see the full object with every field and its current value, `GET` this
12
+ # resource, then `PATCH` back only the fields you want to change.
12
13
  #
13
14
  # @overload retrieve(id, request_options: {})
14
15
  #
@@ -26,11 +27,13 @@ module GrowsurfRuby
26
27
  )
27
28
  end
28
29
 
29
- # Updates a program's options configuration. Only the fields you send are changed.
30
- # Unknown fields and invalid values return a `400`.
30
+ # Updates a program's options configuration. Only the fields you send are changed;
31
+ # anything you leave out is untouched. Unknown fields and invalid values return a
32
+ # `400`.
31
33
  #
32
- # The request body is a partial {CampaignOptions} object see the API reference
33
- # for the full field list.
34
+ # The request body is a partial {CampaignOptions} object. To see the full object
35
+ # with every field and its current value, `GET` this resource, then `PATCH` back
36
+ # only the fields you want to change.
34
37
  #
35
38
  # @overload update(id, body, request_options: {})
36
39
  #
@@ -33,7 +33,7 @@ module GrowsurfRuby
33
33
 
34
34
  # Updates a participant by GrowSurf participant ID or email address.
35
35
  #
36
- # @overload update(participant_id_or_email, id:, email: nil, first_name: nil, last_name: nil, metadata: nil, referral_status: nil, referred_by: nil, unsubscribed: nil, vanity_keys: nil, request_options: {})
36
+ # @overload update(participant_id_or_email, id:, email: nil, first_name: nil, last_name: nil, metadata: nil, notes: nil, paypal_email: nil, referral_status: nil, referred_by: nil, unsubscribed: nil, vanity_keys: nil, request_options: {})
37
37
  #
38
38
  # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
39
39
  #
@@ -47,6 +47,10 @@ module GrowsurfRuby
47
47
  #
48
48
  # @param metadata [Hash{Symbol=>Object}] Body param: Shallow custom metadata object.
49
49
  #
50
+ # @param notes [String] Body param: Freeform internal notes about the participant (internal only, never ex
51
+ #
52
+ # @param paypal_email [String] Body param: The participant's PayPal email address, used for affiliate payouts.
53
+ #
50
54
  # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::ParticipantUpdateParams::ReferralStatus] Body param
51
55
  #
52
56
  # @param referred_by [String] Body param
@@ -102,6 +106,39 @@ module GrowsurfRuby
102
106
  )
103
107
  end
104
108
 
109
+ # Some parameter documentations has been truncated, see
110
+ # {GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteParams} for more details.
111
+ #
112
+ # Deletes a list of participants from a program in one request. Each entry in
113
+ # `participants` is a GrowSurf participant ID or an email address (mixed lists
114
+ # are allowed). Up to `200` entries per request — chunk larger lists across
115
+ # multiple calls. The response reports a per-row `status` for every submitted
116
+ # entry, so a `200` can include rows that were `NOT_FOUND` or failed. Deletion
117
+ # is permanent and removes the participants' referrals, rewards, commissions,
118
+ # and payout records.
119
+ #
120
+ # @overload bulk_delete(id, participants:, request_options: {})
121
+ #
122
+ # @param id [String] GrowSurf program ID.
123
+ #
124
+ # @param participants [Array<String>] GrowSurf participant IDs and/or email addresses to delete. Mixed entries are al
125
+ #
126
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
127
+ #
128
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse]
129
+ #
130
+ # @see GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteParams
131
+ def bulk_delete(id, params)
132
+ parsed, options = GrowsurfRuby::Campaign::ParticipantBulkDeleteParams.dump_request(params)
133
+ @client.request(
134
+ method: :post,
135
+ path: ["campaign/%1$s/participants/bulk-delete", id],
136
+ body: parsed,
137
+ model: GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse,
138
+ options: options
139
+ )
140
+ end
141
+
105
142
  # Some parameter documentations has been truncated, see
106
143
  # {GrowsurfRuby::Models::Campaign::ParticipantAddParams} for more details.
107
144
  #
@@ -126,7 +163,7 @@ module GrowsurfRuby
126
163
  #
127
164
  # @param mobile_instance_id [String] Optional app-install scoped identifier for native mobile anti-fraud. Recommended
128
165
  #
129
- # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::Create::ReferralStatus]
166
+ # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::Create::ReferralStatus] The referral credit status; only meaningful when `referred_by` resolves to a ref
130
167
  #
131
168
  # @param referred_by [String] Referrer participant ID or email address.
132
169
  #
@@ -305,6 +342,13 @@ module GrowsurfRuby
305
342
  # Records a sale made by a referred customer and generates affiliate commissions
306
343
  # for their referrer when applicable.
307
344
  #
345
+ # At least one transaction identifier is required: one of +external_id+,
346
+ # +transaction_id+, +order_id+, +payment_id+, +invoice_id+, +payment_intent_id+,
347
+ # or +charge_id+. +customer_id+ and +subscription_id+ do not count, since they
348
+ # identify the customer or subscription rather than the specific transaction.
349
+ # Without an identifier, resending the same sale creates a duplicate commission
350
+ # and double-pays the referrer; the server rejects such requests with HTTP 400.
351
+ #
308
352
  # @overload record_transaction(participant_id_or_email, id:, currency:, gross_amount:, amount_cash_net: nil, amount_paid: nil, charge_id: nil, customer_id: nil, description: nil, external_id: nil, invoice_id: nil, invoice_subtotal_excluding_tax: nil, invoice_total: nil, invoice_total_excluding_tax: nil, net_amount: nil, order_id: nil, paid_at: nil, payment_id: nil, payment_intent_id: nil, subscription_id: nil, tax_amount: nil, total_tax_amount: nil, total_tax_amounts: nil, total_taxes: nil, transaction_id: nil, request_options: {})
309
353
  #
310
354
  # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
@@ -438,6 +482,8 @@ module GrowsurfRuby
438
482
  end
439
483
 
440
484
  # Sends email invites on behalf of a participant to a list of email addresses.
485
+ # Sending invites via the API requires a verified custom email domain on the
486
+ # program; the request fails until one is verified.
441
487
  #
442
488
  # @overload send_invites(participant_id_or_email, id:, email_addresses:, message_text:, subject_text:, request_options: {})
443
489
  #
@@ -534,6 +580,128 @@ module GrowsurfRuby
534
580
  )
535
581
  end
536
582
 
583
+ # Sends an email to a participant. Provide EITHER `email_type` to trigger one of the
584
+ # program's configured email templates, OR `subject` + `body` for a free-form email.
585
+ # Free-form emails are sent with the same compliance handling (company name,
586
+ # postal address, and an unsubscribe link are added automatically, and unsubscribed
587
+ # participants are suppressed). Sending requires the account to be verified by the
588
+ # GrowSurf team. Requires a verified custom email domain on the program (set up
589
+ # in Campaign Editor > 3. Emails > Email Settings). Returns `400` until one is
590
+ # verified.
591
+ # The email is accepted for delivery.
592
+ #
593
+ # @overload email(participant_id_or_email, id:, body: nil, email_type: nil, preheader: nil, subject: nil, request_options: {})
594
+ #
595
+ # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
596
+ #
597
+ # @param id [String] Path param: GrowSurf program ID.
598
+ #
599
+ # @param body [String] Body param: HTML body for a free-form email. You can personalize it with dynamic text, inserting `{{...}}` tokens like `{{firstName}}` or `{{shareUrl}}`. See [Guide to using dynamic text in GrowSurf emails](https://support.growsurf.com/article/213-guide-to-using-dynamic-text-in-growsurf-emails).
600
+ #
601
+ # @param email_type [String] Body param: The program email template to send (template mode). Send the camelCase
602
+ #
603
+ # @param preheader [String] Body param: Optional preheader text for a free-form email.
604
+ #
605
+ # @param subject [String] Body param: Subject line for a free-form email. Supports dynamic text (`{{...}}` tokens), the same as the body.
606
+ #
607
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
608
+ #
609
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantEmailResponse]
610
+ #
611
+ # @see GrowsurfRuby::Models::Campaign::ParticipantEmailParams
612
+ def email(participant_id_or_email, params)
613
+ parsed, options = GrowsurfRuby::Campaign::ParticipantEmailParams.dump_request(params)
614
+ id =
615
+ parsed.delete(:id) do
616
+ raise ArgumentError.new("missing required path argument #{_1}")
617
+ end
618
+ @client.request(
619
+ method: :post,
620
+ path: ["campaign/%1$s/participant/%2$s/email", id, participant_id_or_email],
621
+ body: parsed,
622
+ model: GrowsurfRuby::Models::Campaign::ParticipantEmailResponse,
623
+ options: options
624
+ )
625
+ end
626
+
627
+ # Returns a participant's activity logs, most recent first (offset/limit paginated).
628
+ #
629
+ # @overload list_activity_logs(participant_id_or_email, id:, limit: nil, offset: nil, request_options: {})
630
+ #
631
+ # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
632
+ #
633
+ # @param id [String] Path param: GrowSurf program ID.
634
+ #
635
+ # @param limit [Integer] Query param: Number of logs to return (1–100, default 20).
636
+ #
637
+ # @param offset [Integer] Query param: Number of logs to skip.
638
+ #
639
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
640
+ #
641
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse]
642
+ #
643
+ # @see GrowsurfRuby::Models::Campaign::ParticipantListActivityLogsParams
644
+ def list_activity_logs(participant_id_or_email, params)
645
+ parsed, options = GrowsurfRuby::Campaign::ParticipantListActivityLogsParams.dump_request(params)
646
+ query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
647
+ id =
648
+ parsed.delete(:id) do
649
+ raise ArgumentError.new("missing required path argument #{_1}")
650
+ end
651
+ @client.request(
652
+ method: :get,
653
+ path: ["campaign/%1$s/participant/%2$s/activity-logs", id, participant_id_or_email],
654
+ query: query,
655
+ model: GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse,
656
+ options: options
657
+ )
658
+ end
659
+
660
+ # Some parameter documentations has been truncated, see
661
+ # {GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams} for more
662
+ # details.
663
+ #
664
+ # Retrieves analytics for a single participant — all-time engagement counters,
665
+ # leaderboard ranks, and per-channel share counts (plus affiliate money metrics for
666
+ # affiliate programs). Useful for segmenting and re-engaging participants.
667
+ #
668
+ # @overload retrieve_analytics(participant_id_or_email, id:, days: nil, end_date: nil, include: nil, interval: nil, start_date: nil, request_options: {})
669
+ #
670
+ # @param participant_id_or_email [String] GrowSurf participant ID or URL-encoded participant email address.
671
+ #
672
+ # @param id [String] GrowSurf program ID.
673
+ #
674
+ # @param days [Integer] Last number of days to retrieve analytics for. Defaults to 365. Maximum 1825.
675
+ #
676
+ # @param end_date [Integer] End date of the analytics timeframe as a Unix timestamp in milliseconds. Require
677
+ #
678
+ # @param include [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams::Include] Set to `series` to also return this participant's own activity per period.
679
+ #
680
+ # @param interval [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams::Interval] Bucket size for the `series` (only used with `include=series`). Defaults to `day`.
681
+ #
682
+ # @param start_date [Integer] Start date of the analytics timeframe as a Unix timestamp in milliseconds. Requi
683
+ #
684
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
685
+ #
686
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse]
687
+ #
688
+ # @see GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams
689
+ def retrieve_analytics(participant_id_or_email, params)
690
+ parsed, options = GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams.dump_request(params)
691
+ id =
692
+ parsed.delete(:id) do
693
+ raise ArgumentError.new("missing required path argument #{_1}")
694
+ end
695
+ query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
696
+ @client.request(
697
+ method: :get,
698
+ path: ["campaign/%1$s/participant/%2$s/analytics", id, participant_id_or_email],
699
+ query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
700
+ model: GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse,
701
+ options: options
702
+ )
703
+ end
704
+
537
705
  # @api private
538
706
  #
539
707
  # @param client [GrowsurfRuby::Client]
@@ -4,7 +4,7 @@ module GrowsurfRuby
4
4
  module Resources
5
5
  class Campaign
6
6
  class Rewards
7
- # Retrieves the active, visible, and enabled rewards configured for a program.
7
+ # Retrieves the rewards configured for a program.
8
8
  #
9
9
  # @overload list(id, request_options: {})
10
10
  #
@@ -25,7 +25,7 @@ module GrowsurfRuby
25
25
  # Creates a reward for a program. The reward `type` must be compatible with the
26
26
  # program type.
27
27
  #
28
- # @overload create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, referred_value: nil, title: nil, value: nil, request_options: {})
28
+ # @overload create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, referred_value: nil, title: nil, value: nil, request_options: {})
29
29
  #
30
30
  # @param id [String] Path param: GrowSurf program ID.
31
31
  #
@@ -35,17 +35,15 @@ module GrowsurfRuby
35
35
  #
36
36
  # @param conversions_required [Integer] Body param
37
37
  #
38
- # @param coupon_code [String] Body param
38
+ # @param coupon_code [String] Body param: Legacy static coupon code shown to the referrer in the reward-won emai
39
39
  #
40
40
  # @param description [String] Body param
41
41
  #
42
42
  # @param image_url [String] Body param
43
43
  #
44
- # @param is_active [Boolean] Body param
44
+ # @param is_unlimited [Boolean] Body param: Whether the reward can be earned an unlimited number of times. Defaul
45
45
  #
46
- # @param is_unlimited [Boolean] Body param
47
- #
48
- # @param is_visible [Boolean] Body param
46
+ # @param is_visible [Boolean] Body param: Whether the reward is enabled. When `false` the reward is disabled: hi
49
47
  #
50
48
  # @param limit [Integer] Body param
51
49
  #
@@ -53,15 +51,15 @@ module GrowsurfRuby
53
51
  #
54
52
  # @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
55
53
  #
56
- # @param next_milestone_prefix [String] Body param
54
+ # @param next_milestone_prefix [String] Body param: Text shown before a participant's referral count in milestone-prog
57
55
  #
58
- # @param next_milestone_suffix [String] Body param
56
+ # @param next_milestone_suffix [String] Body param: Text shown after a participant's referral count in milestone-progr
59
57
  #
60
- # @param number_of_winners [Integer] Body param
58
+ # @param number_of_winners [Integer] Body param: The number of winners (`LEADERBOARD` rewards only). With `limitDur
61
59
  #
62
60
  # @param order [Integer] Body param
63
61
  #
64
- # @param referral_coupon_code [String] Body param
62
+ # @param referral_coupon_code [String] Body param: Legacy static coupon code shown to the referred friend (double-si
65
63
  #
66
64
  # @param referral_description [String] Body param
67
65
  #
@@ -92,7 +90,7 @@ module GrowsurfRuby
92
90
  # Updates an existing campaign reward. Only the fields you send are changed;
93
91
  # `type` is immutable and must not be supplied.
94
92
  #
95
- # @overload update(campaign_reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, referred_value: nil, title: nil, value: nil, request_options: {})
93
+ # @overload update(campaign_reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, referred_value: nil, title: nil, value: nil, request_options: {})
96
94
  #
97
95
  # @param campaign_reward_id [String] Path param: Campaign reward ID.
98
96
  #
@@ -102,17 +100,15 @@ module GrowsurfRuby
102
100
  #
103
101
  # @param conversions_required [Integer] Body param
104
102
  #
105
- # @param coupon_code [String] Body param
103
+ # @param coupon_code [String] Body param: Legacy static coupon code shown to the referrer in the reward-won emai
106
104
  #
107
105
  # @param description [String] Body param
108
106
  #
109
107
  # @param image_url [String] Body param
110
108
  #
111
- # @param is_active [Boolean] Body param
112
- #
113
- # @param is_unlimited [Boolean] Body param
109
+ # @param is_unlimited [Boolean] Body param: Whether the reward can be earned an unlimited number of times. Defaul
114
110
  #
115
- # @param is_visible [Boolean] Body param
111
+ # @param is_visible [Boolean] Body param: Whether the reward is enabled. When `false` the reward is disabled: hi
116
112
  #
117
113
  # @param limit [Integer] Body param
118
114
  #
@@ -120,15 +116,15 @@ module GrowsurfRuby
120
116
  #
121
117
  # @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
122
118
  #
123
- # @param next_milestone_prefix [String] Body param
119
+ # @param next_milestone_prefix [String] Body param: Text shown before a participant's referral count in milestone-prog
124
120
  #
125
- # @param next_milestone_suffix [String] Body param
121
+ # @param next_milestone_suffix [String] Body param: Text shown after a participant's referral count in milestone-progr
126
122
  #
127
- # @param number_of_winners [Integer] Body param
123
+ # @param number_of_winners [Integer] Body param: The number of winners (`LEADERBOARD` rewards only). With `limitDur
128
124
  #
129
125
  # @param order [Integer] Body param
130
126
  #
131
- # @param referral_coupon_code [String] Body param
127
+ # @param referral_coupon_code [String] Body param: Legacy static coupon code shown to the referred friend (double-si
132
128
  #
133
129
  # @param referral_description [String] Body param
134
130
  #