growsurf-ruby 0.8.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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -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 +43 -5
  23. data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +48 -15
  24. data/lib/growsurf_ruby/models/campaign/reward_delete_params.rb +4 -4
  25. data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +51 -18
  26. data/lib/growsurf_ruby/models/campaign/webhook.rb +72 -0
  27. data/lib/growsurf_ruby/models/campaign/webhook_create_params.rb +52 -0
  28. data/lib/growsurf_ruby/models/campaign/webhook_delete_params.rb +28 -0
  29. data/lib/growsurf_ruby/models/campaign/webhook_delete_response.rb +24 -0
  30. data/lib/growsurf_ruby/models/campaign/webhook_event.rb +23 -0
  31. data/lib/growsurf_ruby/models/campaign/webhook_list_response.rb +18 -0
  32. data/lib/growsurf_ruby/models/campaign/webhook_test_params.rb +42 -0
  33. data/lib/growsurf_ruby/models/campaign/webhook_test_response.rb +50 -0
  34. data/lib/growsurf_ruby/models/campaign/webhook_update_params.rb +59 -0
  35. data/lib/growsurf_ruby/models/campaign.rb +43 -5
  36. data/lib/growsurf_ruby/models/campaign_create_params.rb +1 -15
  37. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_params.rb +36 -1
  38. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_response.rb +538 -1
  39. data/lib/growsurf_ruby/models/campaign_update_params.rb +1 -53
  40. data/lib/growsurf_ruby/models/commission_structure.rb +8 -2
  41. data/lib/growsurf_ruby/models/referral_flow_screenshots_response.rb +72 -0
  42. data/lib/growsurf_ruby/models/reward_tax_valuation.rb +35 -0
  43. data/lib/growsurf_ruby/models.rb +10 -0
  44. data/lib/growsurf_ruby/resources/account.rb +159 -0
  45. data/lib/growsurf_ruby/resources/campaign/design.rb +68 -0
  46. data/lib/growsurf_ruby/resources/campaign/emails.rb +66 -0
  47. data/lib/growsurf_ruby/resources/campaign/installation.rb +67 -0
  48. data/lib/growsurf_ruby/resources/campaign/options.rb +66 -0
  49. data/lib/growsurf_ruby/resources/campaign/participant.rb +170 -2
  50. data/lib/growsurf_ruby/resources/campaign/rewards.rb +36 -32
  51. data/lib/growsurf_ruby/resources/campaign/webhooks.rb +157 -0
  52. data/lib/growsurf_ruby/resources/campaign.rb +62 -27
  53. data/lib/growsurf_ruby/version.rb +1 -1
  54. data/lib/growsurf_ruby.rb +31 -0
  55. data/rbi/growsurf_ruby/client.rbi +3 -0
  56. data/rbi/growsurf_ruby/models/account.rbi +125 -0
  57. data/rbi/growsurf_ruby/models/account_create_params.rbi +73 -0
  58. data/rbi/growsurf_ruby/models/account_create_response.rbi +115 -0
  59. data/rbi/growsurf_ruby/models/account_resend_verification_email_response.rbi +76 -0
  60. data/rbi/growsurf_ruby/models/account_rotate_api_key_response.rbi +30 -0
  61. data/rbi/growsurf_ruby/models/account_update_params.rbi +65 -0
  62. data/rbi/growsurf_ruby/models/campaign/campaign_reward_list_response.rbi +2 -2
  63. data/rbi/growsurf_ruby/models/campaign/create.rbi +8 -0
  64. data/rbi/growsurf_ruby/models/campaign/participant_activity_logs_response.rbi +111 -0
  65. data/rbi/growsurf_ruby/models/campaign/participant_analytics_response.rbi +630 -0
  66. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_params.rbi +56 -0
  67. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbi +285 -0
  68. data/rbi/growsurf_ruby/models/campaign/participant_email_params.rbi +118 -0
  69. data/rbi/growsurf_ruby/models/campaign/participant_email_response.rbi +84 -0
  70. data/rbi/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rbi +74 -0
  71. data/rbi/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbi +207 -0
  72. data/rbi/growsurf_ruby/models/campaign/participant_update_params.rbi +24 -0
  73. data/rbi/growsurf_ruby/models/campaign/reward.rbi +63 -3
  74. data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +62 -9
  75. data/rbi/growsurf_ruby/models/campaign/reward_delete_params.rbi +4 -4
  76. data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +66 -13
  77. data/rbi/growsurf_ruby/models/campaign/webhook.rbi +93 -0
  78. data/rbi/growsurf_ruby/models/campaign/webhook_create_params.rbi +91 -0
  79. data/rbi/growsurf_ruby/models/campaign/webhook_delete_params.rbi +48 -0
  80. data/rbi/growsurf_ruby/models/campaign/webhook_delete_response.rbi +33 -0
  81. data/rbi/growsurf_ruby/models/campaign/webhook_event.rbi +60 -0
  82. data/rbi/growsurf_ruby/models/campaign/webhook_list_response.rbi +36 -0
  83. data/rbi/growsurf_ruby/models/campaign/webhook_test_params.rbi +69 -0
  84. data/rbi/growsurf_ruby/models/campaign/webhook_test_response.rbi +102 -0
  85. data/rbi/growsurf_ruby/models/campaign/webhook_update_params.rbi +98 -0
  86. data/rbi/growsurf_ruby/models/campaign.rbi +63 -3
  87. data/rbi/growsurf_ruby/models/campaign_create_params.rbi +0 -18
  88. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_params.rbi +91 -0
  89. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_response.rbi +1011 -3
  90. data/rbi/growsurf_ruby/models/campaign_update_params.rbi +0 -78
  91. data/rbi/growsurf_ruby/models/commission_structure.rbi +8 -2
  92. data/rbi/growsurf_ruby/models/referral_flow_screenshots_response.rbi +94 -0
  93. data/rbi/growsurf_ruby/models/reward_tax_valuation.rbi +56 -0
  94. data/rbi/growsurf_ruby/models.rbi +11 -0
  95. data/rbi/growsurf_ruby/resources/account.rbi +112 -0
  96. data/rbi/growsurf_ruby/resources/campaign/design.rbi +52 -0
  97. data/rbi/growsurf_ruby/resources/campaign/emails.rbi +51 -0
  98. data/rbi/growsurf_ruby/resources/campaign/installation.rbi +53 -0
  99. data/rbi/growsurf_ruby/resources/campaign/options.rbi +51 -0
  100. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +160 -0
  101. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +61 -29
  102. data/rbi/growsurf_ruby/resources/campaign/webhooks.rbi +123 -0
  103. data/rbi/growsurf_ruby/resources/campaign.rbi +58 -32
  104. data/sig/growsurf_ruby/client.rbs +2 -0
  105. data/sig/growsurf_ruby/models/account.rbs +67 -0
  106. data/sig/growsurf_ruby/models/account_create_params.rbs +42 -0
  107. data/sig/growsurf_ruby/models/account_create_response.rbs +47 -0
  108. data/sig/growsurf_ruby/models/account_resend_verification_email_response.rbs +35 -0
  109. data/sig/growsurf_ruby/models/account_rotate_api_key_response.rbs +13 -0
  110. data/sig/growsurf_ruby/models/account_update_params.rbs +42 -0
  111. data/sig/growsurf_ruby/models/campaign/participant_activity_logs_response.rbs +59 -0
  112. data/sig/growsurf_ruby/models/campaign/participant_analytics_response.rbs +407 -0
  113. data/sig/growsurf_ruby/models/campaign/participant_bulk_delete_params.rbs +30 -0
  114. data/sig/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbs +125 -0
  115. data/sig/growsurf_ruby/models/campaign/participant_email_params.rbs +61 -0
  116. data/sig/growsurf_ruby/models/campaign/participant_email_response.rbs +37 -0
  117. data/sig/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rbs +47 -0
  118. data/sig/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbs +90 -0
  119. data/sig/growsurf_ruby/models/campaign/participant_update_params.rbs +14 -0
  120. data/sig/growsurf_ruby/models/campaign/reward.rbs +18 -3
  121. data/sig/growsurf_ruby/models/campaign/reward_create_params.rbs +19 -8
  122. data/sig/growsurf_ruby/models/campaign/reward_delete_params.rbs +4 -4
  123. data/sig/growsurf_ruby/models/campaign/reward_update_params.rbs +23 -12
  124. data/sig/growsurf_ruby/models/campaign/webhook.rbs +52 -0
  125. data/sig/growsurf_ruby/models/campaign/webhook_create_params.rbs +51 -0
  126. data/sig/growsurf_ruby/models/campaign/webhook_delete_params.rbs +30 -0
  127. data/sig/growsurf_ruby/models/campaign/webhook_delete_response.rbs +17 -0
  128. data/sig/growsurf_ruby/models/campaign/webhook_event.rbs +28 -0
  129. data/sig/growsurf_ruby/models/campaign/webhook_list_response.rbs +18 -0
  130. data/sig/growsurf_ruby/models/campaign/webhook_test_params.rbs +42 -0
  131. data/sig/growsurf_ruby/models/campaign/webhook_test_response.rbs +54 -0
  132. data/sig/growsurf_ruby/models/campaign/webhook_update_params.rbs +63 -0
  133. data/sig/growsurf_ruby/models/campaign.rbs +18 -3
  134. data/sig/growsurf_ruby/models/campaign_create_params.rbs +0 -14
  135. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_params.rbs +35 -1
  136. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_response.rbs +533 -3
  137. data/sig/growsurf_ruby/models/campaign_update_params.rbs +1 -53
  138. data/sig/growsurf_ruby/models/commission_structure.rbs +7 -2
  139. data/sig/growsurf_ruby/models/referral_flow_screenshots_response.rbs +54 -0
  140. data/sig/growsurf_ruby/models/reward_tax_valuation.rbs +22 -0
  141. data/sig/growsurf_ruby/models.rbs +10 -0
  142. data/sig/growsurf_ruby/resources/account.rbs +38 -0
  143. data/sig/growsurf_ruby/resources/campaign/design.rbs +20 -0
  144. data/sig/growsurf_ruby/resources/campaign/emails.rbs +20 -0
  145. data/sig/growsurf_ruby/resources/campaign/installation.rbs +20 -0
  146. data/sig/growsurf_ruby/resources/campaign/options.rbs +20 -0
  147. data/sig/growsurf_ruby/resources/campaign/participant.rbs +37 -0
  148. data/sig/growsurf_ruby/resources/campaign/rewards.rbs +6 -4
  149. data/sig/growsurf_ruby/resources/campaign/webhooks.rbs +46 -0
  150. data/sig/growsurf_ruby/resources/campaign.rbs +17 -9
  151. metadata +95 -2
@@ -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:)
@@ -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
  sig do
9
9
  params(
10
10
  id: String,
@@ -30,7 +30,6 @@ module GrowsurfRuby
30
30
  coupon_code: String,
31
31
  description: String,
32
32
  image_url: String,
33
- is_active: T::Boolean,
34
33
  is_unlimited: T::Boolean,
35
34
  is_visible: T::Boolean,
36
35
  limit: Integer,
@@ -44,7 +43,9 @@ module GrowsurfRuby
44
43
  referral_coupon_code: String,
45
44
  referral_description: String,
46
45
  referred_reward_upfront: T::Boolean,
46
+ referred_value: GrowsurfRuby::RewardTaxValuation::OrHash,
47
47
  title: String,
48
+ value: GrowsurfRuby::RewardTaxValuation::OrHash,
48
49
  request_options: GrowsurfRuby::RequestOptions::OrHash
49
50
  ).returns(GrowsurfRuby::Models::Campaign::Reward)
50
51
  end
@@ -57,17 +58,20 @@ module GrowsurfRuby
57
58
  commission_structure: nil,
58
59
  # Body param
59
60
  conversions_required: nil,
60
- # Body param
61
+ # Body param: Legacy static coupon code shown to the referrer in the reward-won
62
+ # email and webhook. Display text only; superseded by a connected billing
63
+ # integration's issued coupon when one exists.
61
64
  coupon_code: nil,
62
65
  # Body param
63
66
  description: nil,
64
67
  # Body param
65
68
  image_url: nil,
66
- # Body param
67
- is_active: nil,
68
- # Body param
69
+ # Body param: Whether the reward can be earned an unlimited number of times.
70
+ # Defaults to `true`, except `MILESTONE` rewards, which can only be earned once.
69
71
  is_unlimited: nil,
70
- # Body param
72
+ # Body param: Whether the reward is enabled. When `false` the reward is disabled:
73
+ # hidden from participants and no longer awarded, including those who already
74
+ # earned it.
71
75
  is_visible: nil,
72
76
  # Body param
73
77
  limit: nil,
@@ -76,38 +80,49 @@ module GrowsurfRuby
76
80
  # Body param: Custom key/value metadata (single-level; values are stored as
77
81
  # strings).
78
82
  metadata: nil,
79
- # Body param
83
+ # Body param: Text shown before a participant's referral count in
84
+ # milestone-progress copy. Applies to `MILESTONE` rewards.
80
85
  next_milestone_prefix: nil,
81
- # Body param
86
+ # Body param: Text shown after a participant's referral count in
87
+ # milestone-progress copy. Applies to `MILESTONE` rewards.
82
88
  next_milestone_suffix: nil,
83
- # Body param
89
+ # Body param: The number of winners (`LEADERBOARD` rewards only). With
90
+ # `limitDuration` `PER_MONTH` this many win each month, otherwise this many win
91
+ # in total; omitting it defaults to `3`.
84
92
  number_of_winners: nil,
85
93
  # Body param
86
94
  order: nil,
87
- # Body param
95
+ # Body param: Legacy static coupon code shown to the referred friend
96
+ # (double-sided rewards) in the reward-won email and webhook. Display text only;
97
+ # superseded by a connected billing integration's issued coupon when one exists.
88
98
  referral_coupon_code: nil,
89
99
  # Body param
90
100
  referral_description: nil,
91
101
  # Body param
92
102
  referred_reward_upfront: nil,
103
+ # Body param: Tax valuation for the referred friend's side of a double-sided
104
+ # reward. Defaults to not tax-reportable (a purchase rebate).
105
+ referred_value: nil,
93
106
  # Body param
94
107
  title: nil,
108
+ # Body param: Tax valuation for the reward (the referrer's side of a
109
+ # double-sided reward). Used by tax documentation / 1099 reporting.
110
+ value: nil,
95
111
  request_options: {}
96
112
  )
97
113
  end
98
114
 
99
- # Updates an existing program reward. Only the fields you send are changed; `type`
115
+ # Updates an existing campaign reward. Only the fields you send are changed; `type`
100
116
  # is immutable and must not be supplied.
101
117
  sig do
102
118
  params(
103
- reward_id: String,
119
+ campaign_reward_id: String,
104
120
  id: String,
105
121
  commission_structure: GrowsurfRuby::CommissionStructure::OrHash,
106
122
  conversions_required: Integer,
107
123
  coupon_code: String,
108
124
  description: String,
109
125
  image_url: String,
110
- is_active: T::Boolean,
111
126
  is_unlimited: T::Boolean,
112
127
  is_visible: T::Boolean,
113
128
  limit: Integer,
@@ -121,30 +136,35 @@ module GrowsurfRuby
121
136
  referral_coupon_code: String,
122
137
  referral_description: String,
123
138
  referred_reward_upfront: T::Boolean,
139
+ referred_value: GrowsurfRuby::RewardTaxValuation::OrHash,
124
140
  title: String,
141
+ value: GrowsurfRuby::RewardTaxValuation::OrHash,
125
142
  request_options: GrowsurfRuby::RequestOptions::OrHash
126
143
  ).returns(GrowsurfRuby::Models::Campaign::Reward)
127
144
  end
128
145
  def update(
129
- # Path param: Program reward ID.
130
- reward_id,
146
+ # Path param: Campaign reward ID.
147
+ campaign_reward_id,
131
148
  # Path param: GrowSurf program ID.
132
149
  id:,
133
150
  # Body param
134
151
  commission_structure: nil,
135
152
  # Body param
136
153
  conversions_required: nil,
137
- # Body param
154
+ # Body param: Legacy static coupon code shown to the referrer in the reward-won
155
+ # email and webhook. Display text only; superseded by a connected billing
156
+ # integration's issued coupon when one exists.
138
157
  coupon_code: nil,
139
158
  # Body param
140
159
  description: nil,
141
160
  # Body param
142
161
  image_url: nil,
143
- # Body param
144
- is_active: nil,
145
- # Body param
162
+ # Body param: Whether the reward can be earned an unlimited number of times.
163
+ # Defaults to `true`, except `MILESTONE` rewards, which can only be earned once.
146
164
  is_unlimited: nil,
147
- # Body param
165
+ # Body param: Whether the reward is enabled. When `false` the reward is disabled:
166
+ # hidden from participants and no longer awarded, including those who already
167
+ # earned it.
148
168
  is_visible: nil,
149
169
  # Body param
150
170
  limit: nil,
@@ -153,37 +173,49 @@ module GrowsurfRuby
153
173
  # Body param: Custom key/value metadata (single-level; values are stored as
154
174
  # strings).
155
175
  metadata: nil,
156
- # Body param
176
+ # Body param: Text shown before a participant's referral count in
177
+ # milestone-progress copy. Applies to `MILESTONE` rewards.
157
178
  next_milestone_prefix: nil,
158
- # Body param
179
+ # Body param: Text shown after a participant's referral count in
180
+ # milestone-progress copy. Applies to `MILESTONE` rewards.
159
181
  next_milestone_suffix: nil,
160
- # Body param
182
+ # Body param: The number of winners (`LEADERBOARD` rewards only). With
183
+ # `limitDuration` `PER_MONTH` this many win each month, otherwise this many win
184
+ # in total; omitting it defaults to `3`.
161
185
  number_of_winners: nil,
162
186
  # Body param
163
187
  order: nil,
164
- # Body param
188
+ # Body param: Legacy static coupon code shown to the referred friend
189
+ # (double-sided rewards) in the reward-won email and webhook. Display text only;
190
+ # superseded by a connected billing integration's issued coupon when one exists.
165
191
  referral_coupon_code: nil,
166
192
  # Body param
167
193
  referral_description: nil,
168
194
  # Body param
169
195
  referred_reward_upfront: nil,
196
+ # Body param: Tax valuation for the referred friend's side of a double-sided
197
+ # reward. Defaults to not tax-reportable (a purchase rebate).
198
+ referred_value: nil,
170
199
  # Body param
171
200
  title: nil,
201
+ # Body param: Tax valuation for the reward (the referrer's side of a
202
+ # double-sided reward). Used by tax documentation / 1099 reporting.
203
+ value: nil,
172
204
  request_options: {}
173
205
  )
174
206
  end
175
207
 
176
- # Deletes a program reward.
208
+ # Deletes a campaign reward.
177
209
  sig do
178
210
  params(
179
- reward_id: String,
211
+ campaign_reward_id: String,
180
212
  id: String,
181
213
  request_options: GrowsurfRuby::RequestOptions::OrHash
182
214
  ).returns(GrowsurfRuby::Models::Campaign::DeleteRewardResponse)
183
215
  end
184
216
  def delete(
185
- # Program reward ID.
186
- reward_id,
217
+ # Campaign reward ID.
218
+ campaign_reward_id,
187
219
  # GrowSurf program ID.
188
220
  id:,
189
221
  request_options: {}
@@ -0,0 +1,123 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Resources
5
+ class Campaign
6
+ class Webhooks
7
+ # Lists a program's webhooks (secrets are never returned).
8
+ sig do
9
+ params(
10
+ id: String,
11
+ request_options: GrowsurfRuby::RequestOptions::OrHash
12
+ ).returns(GrowsurfRuby::Models::Campaign::WebhookListResponse)
13
+ end
14
+ def list(
15
+ # GrowSurf program ID.
16
+ id,
17
+ request_options: {}
18
+ )
19
+ end
20
+
21
+ # Adds a webhook to the program.
22
+ sig do
23
+ params(
24
+ id: String,
25
+ payload_url: String,
26
+ events: T::Array[GrowsurfRuby::Campaign::WebhookEvent::OrSymbol],
27
+ is_enabled: T::Boolean,
28
+ secret: String,
29
+ request_options: GrowsurfRuby::RequestOptions::OrHash
30
+ ).returns(GrowsurfRuby::Models::Campaign::Webhook)
31
+ end
32
+ def create(
33
+ # Path param: GrowSurf program ID.
34
+ id,
35
+ # Body param: The URL that receives webhook deliveries.
36
+ payload_url:,
37
+ # Body param: The events this webhook is subscribed to. When omitted, it is
38
+ # subscribed to no events.
39
+ events: nil,
40
+ # Body param
41
+ is_enabled: nil,
42
+ # Body param: Write-only. Used to sign deliveries (the `GrowSurf-Signature` HMAC
43
+ # header). Never returned.
44
+ secret: nil,
45
+ request_options: {}
46
+ )
47
+ end
48
+
49
+ # Updates a webhook by id.
50
+ sig do
51
+ params(
52
+ webhook_id: String,
53
+ id: String,
54
+ events: T::Array[GrowsurfRuby::Campaign::WebhookEvent::OrSymbol],
55
+ is_enabled: T::Boolean,
56
+ payload_url: String,
57
+ secret: String,
58
+ request_options: GrowsurfRuby::RequestOptions::OrHash
59
+ ).returns(GrowsurfRuby::Models::Campaign::Webhook)
60
+ end
61
+ def update(
62
+ # Path param: The webhook id (`primary` for the program's primary webhook).
63
+ webhook_id,
64
+ # Path param: GrowSurf program ID.
65
+ id:,
66
+ # Body param
67
+ events: nil,
68
+ # Body param
69
+ is_enabled: nil,
70
+ # Body param
71
+ payload_url: nil,
72
+ # Body param: Write-only.
73
+ secret: nil,
74
+ request_options: {}
75
+ )
76
+ end
77
+
78
+ # Removes a webhook by id.
79
+ sig do
80
+ params(
81
+ webhook_id: String,
82
+ id: String,
83
+ request_options: GrowsurfRuby::RequestOptions::OrHash
84
+ ).returns(GrowsurfRuby::Models::Campaign::WebhookDeleteResponse)
85
+ end
86
+ def delete(
87
+ # The webhook id (`primary` for the program's primary webhook).
88
+ webhook_id,
89
+ # GrowSurf program ID.
90
+ id:,
91
+ request_options: {}
92
+ )
93
+ end
94
+
95
+ # Sends a live test event to a webhook using its stored URL and secret.
96
+ sig do
97
+ params(
98
+ webhook_id: String,
99
+ id: String,
100
+ event: GrowsurfRuby::Campaign::WebhookEvent::OrSymbol,
101
+ request_options: GrowsurfRuby::RequestOptions::OrHash
102
+ ).returns(GrowsurfRuby::Models::Campaign::WebhookTestResponse)
103
+ end
104
+ def test(
105
+ # Path param: The webhook id (`primary` for the program's primary webhook).
106
+ webhook_id,
107
+ # Path param: GrowSurf program ID.
108
+ id:,
109
+ # Body param: The event to simulate. When omitted, the webhook's first enabled
110
+ # event is used (returns `400` if it has no enabled events).
111
+ event: nil,
112
+ request_options: {}
113
+ )
114
+ end
115
+
116
+ # @api private
117
+ sig { params(client: GrowsurfRuby::Client).returns(T.attached_class) }
118
+ def self.new(client:)
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end