surge_api 0.24.0 → 0.25.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +9 -9
  4. data/lib/surge_api/client.rb +4 -0
  5. data/lib/surge_api/internal/type/union.rb +2 -2
  6. data/lib/surge_api/models/call_ended_webhook_event.rb +8 -3
  7. data/lib/surge_api/models/campaign.rb +15 -7
  8. data/lib/surge_api/models/campaign_approved_webhook_event.rb +9 -1
  9. data/lib/surge_api/models/campaign_params.rb +6 -6
  10. data/lib/surge_api/models/campaign_rejected_webhook_event.rb +135 -0
  11. data/lib/surge_api/models/campaign_submitted_webhook_event.rb +74 -0
  12. data/lib/surge_api/models/campaign_update_params.rb +188 -1
  13. data/lib/surge_api/models/campaign_warning_webhook_event.rb +134 -0
  14. data/lib/surge_api/models/message.rb +18 -2
  15. data/lib/surge_api/models/message_delivered_webhook_event.rb +9 -1
  16. data/lib/surge_api/models/message_failed_webhook_event.rb +5 -4
  17. data/lib/surge_api/models/message_received_webhook_event.rb +9 -1
  18. data/lib/surge_api/models/message_sent_webhook_event.rb +9 -1
  19. data/lib/surge_api/models/phone_number.rb +9 -1
  20. data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +9 -1
  21. data/lib/surge_api/models/phone_number_imported_webhook_event.rb +9 -1
  22. data/lib/surge_api/models/phone_number_purchase_params.rb +9 -1
  23. data/lib/surge_api/models/phone_number_update_params.rb +9 -1
  24. data/lib/surge_api/models/toll_free_campaign.rb +132 -0
  25. data/lib/surge_api/models/toll_free_campaign_consent_flow.rb +176 -0
  26. data/lib/surge_api/models/toll_free_campaign_create_params.rb +22 -0
  27. data/lib/surge_api/models/toll_free_campaign_list_params.rb +42 -0
  28. data/lib/surge_api/models/toll_free_campaign_params.rb +286 -0
  29. data/lib/surge_api/models/toll_free_campaign_retrieve_params.rb +22 -0
  30. data/lib/surge_api/models/toll_free_campaign_update_params.rb +278 -0
  31. data/lib/surge_api/models/unwrap_webhook_event.rb +7 -1
  32. data/lib/surge_api/models/user_create_token_params.rb +15 -1
  33. data/lib/surge_api/models.rb +20 -0
  34. data/lib/surge_api/resources/accounts.rb +2 -2
  35. data/lib/surge_api/resources/campaigns.rb +26 -8
  36. data/lib/surge_api/resources/phone_numbers.rb +6 -2
  37. data/lib/surge_api/resources/toll_free_campaigns.rb +140 -0
  38. data/lib/surge_api/resources/users.rb +6 -1
  39. data/lib/surge_api/resources/webhooks.rb +1 -1
  40. data/lib/surge_api/version.rb +1 -1
  41. data/lib/surge_api.rb +11 -0
  42. data/rbi/surge_api/client.rbi +3 -0
  43. data/rbi/surge_api/models/call_ended_webhook_event.rbi +6 -3
  44. data/rbi/surge_api/models/campaign.rbi +17 -9
  45. data/rbi/surge_api/models/campaign_approved_webhook_event.rbi +8 -0
  46. data/rbi/surge_api/models/campaign_params.rbi +9 -9
  47. data/rbi/surge_api/models/campaign_rejected_webhook_event.rbi +269 -0
  48. data/rbi/surge_api/models/campaign_submitted_webhook_event.rbi +149 -0
  49. data/rbi/surge_api/models/campaign_update_params.rbi +378 -1
  50. data/rbi/surge_api/models/campaign_warning_webhook_event.rbi +259 -0
  51. data/rbi/surge_api/models/message.rbi +16 -0
  52. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +8 -0
  53. data/rbi/surge_api/models/message_failed_webhook_event.rbi +7 -5
  54. data/rbi/surge_api/models/message_received_webhook_event.rbi +8 -0
  55. data/rbi/surge_api/models/message_sent_webhook_event.rbi +8 -0
  56. data/rbi/surge_api/models/phone_number.rbi +8 -0
  57. data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +8 -0
  58. data/rbi/surge_api/models/phone_number_imported_webhook_event.rbi +8 -0
  59. data/rbi/surge_api/models/phone_number_purchase_params.rbi +11 -0
  60. data/rbi/surge_api/models/phone_number_update_params.rbi +11 -0
  61. data/rbi/surge_api/models/toll_free_campaign.rbi +230 -0
  62. data/rbi/surge_api/models/toll_free_campaign_consent_flow.rbi +476 -0
  63. data/rbi/surge_api/models/toll_free_campaign_create_params.rbi +43 -0
  64. data/rbi/surge_api/models/toll_free_campaign_list_params.rbi +70 -0
  65. data/rbi/surge_api/models/toll_free_campaign_params.rbi +711 -0
  66. data/rbi/surge_api/models/toll_free_campaign_retrieve_params.rbi +43 -0
  67. data/rbi/surge_api/models/toll_free_campaign_update_params.rbi +760 -0
  68. data/rbi/surge_api/models/unwrap_webhook_event.rbi +3 -0
  69. data/rbi/surge_api/models/user_create_token_params.rbi +17 -0
  70. data/rbi/surge_api/models.rbi +22 -0
  71. data/rbi/surge_api/resources/accounts.rbi +2 -2
  72. data/rbi/surge_api/resources/campaigns.rbi +94 -12
  73. data/rbi/surge_api/resources/phone_numbers.rbi +6 -0
  74. data/rbi/surge_api/resources/toll_free_campaigns.rbi +129 -0
  75. data/rbi/surge_api/resources/users.rbi +6 -0
  76. data/rbi/surge_api/resources/webhooks.rbi +3 -0
  77. data/sig/surge_api/client.rbs +2 -0
  78. data/sig/surge_api/models/campaign.rbs +5 -0
  79. data/sig/surge_api/models/campaign_approved_webhook_event.rbs +5 -0
  80. data/sig/surge_api/models/campaign_rejected_webhook_event.rbs +115 -0
  81. data/sig/surge_api/models/campaign_submitted_webhook_event.rbs +67 -0
  82. data/sig/surge_api/models/campaign_update_params.rbs +128 -2
  83. data/sig/surge_api/models/campaign_warning_webhook_event.rbs +114 -0
  84. data/sig/surge_api/models/message.rbs +10 -0
  85. data/sig/surge_api/models/message_delivered_webhook_event.rbs +5 -0
  86. data/sig/surge_api/models/message_failed_webhook_event.rbs +4 -4
  87. data/sig/surge_api/models/message_received_webhook_event.rbs +5 -0
  88. data/sig/surge_api/models/message_sent_webhook_event.rbs +5 -0
  89. data/sig/surge_api/models/phone_number.rbs +5 -0
  90. data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +5 -0
  91. data/sig/surge_api/models/phone_number_imported_webhook_event.rbs +5 -0
  92. data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
  93. data/sig/surge_api/models/phone_number_update_params.rbs +12 -1
  94. data/sig/surge_api/models/toll_free_campaign.rbs +126 -0
  95. data/sig/surge_api/models/toll_free_campaign_consent_flow.rbs +207 -0
  96. data/sig/surge_api/models/toll_free_campaign_create_params.rbs +25 -0
  97. data/sig/surge_api/models/toll_free_campaign_list_params.rbs +36 -0
  98. data/sig/surge_api/models/toll_free_campaign_params.rbs +321 -0
  99. data/sig/surge_api/models/toll_free_campaign_retrieve_params.rbs +23 -0
  100. data/sig/surge_api/models/toll_free_campaign_update_params.rbs +332 -0
  101. data/sig/surge_api/models/unwrap_webhook_event.rbs +3 -0
  102. data/sig/surge_api/models/user_create_token_params.rbs +7 -1
  103. data/sig/surge_api/models.rbs +20 -0
  104. data/sig/surge_api/resources/campaigns.rbs +9 -1
  105. data/sig/surge_api/resources/phone_numbers.rbs +2 -0
  106. data/sig/surge_api/resources/toll_free_campaigns.rbs +44 -0
  107. data/sig/surge_api/resources/users.rbs +1 -0
  108. data/sig/surge_api/resources/webhooks.rbs +3 -0
  109. metadata +50 -7
@@ -10,6 +10,9 @@ module SurgeAPI
10
10
  T.any(
11
11
  SurgeAPI::CallEndedWebhookEvent,
12
12
  SurgeAPI::CampaignApprovedWebhookEvent,
13
+ SurgeAPI::CampaignRejectedWebhookEvent,
14
+ SurgeAPI::CampaignSubmittedWebhookEvent,
15
+ SurgeAPI::CampaignWarningWebhookEvent,
13
16
  SurgeAPI::ContactOptedInWebhookEvent,
14
17
  SurgeAPI::ContactOptedOutWebhookEvent,
15
18
  SurgeAPI::ConversationCreatedWebhookEvent,
@@ -22,10 +22,21 @@ module SurgeAPI
22
22
  sig { params(duration_seconds: Integer).void }
23
23
  attr_writer :duration_seconds
24
24
 
25
+ # Restrict the token to viewing embedded conversations and unread counts. Sending
26
+ # messages, changing read state, editing contacts, and calling are disabled.
27
+ # Defaults to false. Preserve this value when refreshing the token; changing
28
+ # access mode requires reloading the embed.
29
+ sig { returns(T.nilable(T::Boolean)) }
30
+ attr_reader :read_only
31
+
32
+ sig { params(read_only: T::Boolean).void }
33
+ attr_writer :read_only
34
+
25
35
  sig do
26
36
  params(
27
37
  user_id: String,
28
38
  duration_seconds: Integer,
39
+ read_only: T::Boolean,
29
40
  request_options: SurgeAPI::RequestOptions::OrHash
30
41
  ).returns(T.attached_class)
31
42
  end
@@ -34,6 +45,11 @@ module SurgeAPI
34
45
  user_id:,
35
46
  # For how many seconds the token should be accepted. Defaults to 15 minutes.
36
47
  duration_seconds: nil,
48
+ # Restrict the token to viewing embedded conversations and unread counts. Sending
49
+ # messages, changing read state, editing contacts, and calling are disabled.
50
+ # Defaults to false. Preserve this value when refreshing the token; changing
51
+ # access mode requires reloading the embed.
52
+ read_only: nil,
37
53
  request_options: {}
38
54
  )
39
55
  end
@@ -43,6 +59,7 @@ module SurgeAPI
43
59
  {
44
60
  user_id: String,
45
61
  duration_seconds: Integer,
62
+ read_only: T::Boolean,
46
63
  request_options: SurgeAPI::RequestOptions
47
64
  }
48
65
  )
@@ -41,13 +41,20 @@ module SurgeAPI
41
41
 
42
42
  CampaignParams = SurgeAPI::Models::CampaignParams
43
43
 
44
+ CampaignRejectedWebhookEvent = SurgeAPI::Models::CampaignRejectedWebhookEvent
45
+
44
46
  CampaignResendBrandVerificationMessageParams =
45
47
  SurgeAPI::Models::CampaignResendBrandVerificationMessageParams
46
48
 
47
49
  CampaignRetrieveParams = SurgeAPI::Models::CampaignRetrieveParams
48
50
 
51
+ CampaignSubmittedWebhookEvent =
52
+ SurgeAPI::Models::CampaignSubmittedWebhookEvent
53
+
49
54
  CampaignUpdateParams = SurgeAPI::Models::CampaignUpdateParams
50
55
 
56
+ CampaignWarningWebhookEvent = SurgeAPI::Models::CampaignWarningWebhookEvent
57
+
51
58
  Contact = SurgeAPI::Models::Contact
52
59
 
53
60
  ContactCreateParams = SurgeAPI::Models::ContactCreateParams
@@ -121,6 +128,21 @@ module SurgeAPI
121
128
 
122
129
  RecordingRetrieveParams = SurgeAPI::Models::RecordingRetrieveParams
123
130
 
131
+ TollFreeCampaign = SurgeAPI::Models::TollFreeCampaign
132
+
133
+ TollFreeCampaignConsentFlow = SurgeAPI::Models::TollFreeCampaignConsentFlow
134
+
135
+ TollFreeCampaignCreateParams = SurgeAPI::Models::TollFreeCampaignCreateParams
136
+
137
+ TollFreeCampaignListParams = SurgeAPI::Models::TollFreeCampaignListParams
138
+
139
+ TollFreeCampaignParams = SurgeAPI::Models::TollFreeCampaignParams
140
+
141
+ TollFreeCampaignRetrieveParams =
142
+ SurgeAPI::Models::TollFreeCampaignRetrieveParams
143
+
144
+ TollFreeCampaignUpdateParams = SurgeAPI::Models::TollFreeCampaignUpdateParams
145
+
124
146
  UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
125
147
 
126
148
  User = SurgeAPI::Models::User
@@ -3,7 +3,7 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class Accounts
6
- # Creates a new Account within the calling Platform.
6
+ # Creates a new Account.
7
7
  sig do
8
8
  params(
9
9
  name: String,
@@ -79,7 +79,7 @@ module SurgeAPI
79
79
  )
80
80
  end
81
81
 
82
- # List all accounts for the calling platform with cursor-based pagination.
82
+ # List all accounts with cursor-based pagination.
83
83
  sig do
84
84
  params(
85
85
  after: String,
@@ -39,27 +39,109 @@ module SurgeAPI
39
39
  )
40
40
  end
41
41
 
42
- # Updates a campaign that has not yet been approved. This can be used to fix
43
- # issues flagged during review and resubmit the campaign. Returns an error if the
44
- # campaign is currently in review, has already been approved, or has been
45
- # deactivated.
42
+ # Updates supplied fields on a campaign and submits it for review. Omitted fields
43
+ # retain their stored values. An empty object or empty request body resubmits the
44
+ # existing campaign without changing its registration details. Supplied arrays
45
+ # replace their stored values; an empty includes array clears all inclusion flags.
46
+ # Returns an error if the resulting campaign is incomplete or invalid, or the
47
+ # campaign is not editable.
46
48
  sig do
47
49
  params(
48
50
  id: String,
49
- campaign_params:
50
- T.any(
51
- SurgeAPI::CampaignParams::StandardCampaignParams::OrHash,
52
- SurgeAPI::CampaignParams::ExternalCampaignParams::OrHash
53
- ),
51
+ consent_flow: String,
52
+ description: String,
53
+ includes: T::Array[SurgeAPI::CampaignUpdateParams::Include::OrSymbol],
54
+ link_sample: T.nilable(String),
55
+ message_samples: T::Array[String],
56
+ privacy_policy_url: String,
57
+ terms_and_conditions_url: String,
58
+ use_cases:
59
+ T::Array[SurgeAPI::CampaignUpdateParams::UseCase::OrSymbol],
60
+ volume: SurgeAPI::CampaignUpdateParams::Volume::OrSymbol,
54
61
  request_options: SurgeAPI::RequestOptions::OrHash
55
62
  ).returns(SurgeAPI::Campaign)
56
63
  end
57
64
  def update(
58
65
  # The ID of the campaign to update.
59
66
  id,
60
- # Parameters for creating a new campaign. Either provide full campaign details or
61
- # import using a TCR ID.
62
- campaign_params:,
67
+ # A string explaining the method through which end users will opt in to receive
68
+ # messages from the brand. Typically this should include URLs for opt-in forms or
69
+ # screenshots that might be helpful in explaining the flow to someone unfamiliar
70
+ # with the organization's purpose.
71
+ consent_flow: nil,
72
+ # An explanation of the organization's purpose and how it will be using text
73
+ # messaging to accomplish that purpose.
74
+ description: nil,
75
+ # A list of properties that this campaign should include. These properties can be
76
+ # any of the following values:
77
+ #
78
+ # - `links` - whether the campaign might send links in messages
79
+ # - `phone_numbers` - whether the campaign might send phone numbers in messages
80
+ # - `age_gated` - whether the campaign contains age gated content (controlled
81
+ # substances or adult content)
82
+ # - `direct_lending` - whether the campaign contains content related to direct
83
+ # lending or other loan arrangements
84
+ includes: nil,
85
+ # A sample link that might be sent by this campaign. This is required when
86
+ # `includes` contains `links`. Provide the same URL or domain that the campaign
87
+ # will use in production. If links from other domains are sent through this
88
+ # campaign, they are much more likely to be filtered by the carriers.
89
+ link_sample: nil,
90
+ # An array of 2-5 strings with examples of the messages that will be sent from
91
+ # this campaign. Typically the first sample should be a compliance message like
92
+ # `You are now opted in to messages from {brand name}. Frequency varies. Msg&data rates apply. Reply STOP to opt out.`
93
+ # These samples don't necessarily need to be the only templates that will be used
94
+ # for the campaign, but they should reflect the purpose of the messages that will
95
+ # be sent. Any variable content can be reflected by wrapping it in square brackets
96
+ # like `[customer name]`.
97
+ message_samples: nil,
98
+ # The URL of the privacy policy for the brand in question. This may be a shared
99
+ # privacy policy if it's the policy that is displayed to end users when they opt
100
+ # in to messaging.
101
+ privacy_policy_url: nil,
102
+ # The URL of the terms and conditions presented to end users when they opt in to
103
+ # messaging. These terms and conditions may be shared among all of a platform's
104
+ # customers if they're the terms that are presented to end users when they opt in
105
+ # to messaging.
106
+ terms_and_conditions_url: nil,
107
+ # A list containing 1-5 types of messages that will be sent with this campaign.
108
+ #
109
+ # The following use cases are typically available to all brands:
110
+ #
111
+ # - `account_notification` - For sending reminders, alerts, and general
112
+ # account-related notifications like booking confirmations or appointment
113
+ # reminders.
114
+ # - `customer_care` - For account support, troubleshooting, and general customer
115
+ # service communication.
116
+ # - `delivery_notification` - For notifying customers about the status of product
117
+ # or service deliveries.
118
+ # - `fraud_alert` - For warning customers about suspicious or potentially
119
+ # fraudulent activity.
120
+ # - `higher_education` - For messaging related to colleges, universities, and
121
+ # school districts outside of K–12.
122
+ # - `marketing` - For promotional or advertising messages intended to market
123
+ # products or services.
124
+ # - `polling_voting` - For conducting surveys, polls, or voting-related messaging.
125
+ # - `public_service_announcement` - For raising awareness about social issues or
126
+ # important public information.
127
+ # - `security_alert` - For alerts related to potential security breaches or
128
+ # compromised systems requiring user action.
129
+ # - `two_factor_authentication` - For sending one-time passwords or verification
130
+ # codes for login or password reset.
131
+ #
132
+ # For access to special use cases not shown here, reach out to support@surge.app.
133
+ use_cases: nil,
134
+ # This will be one of the following:
135
+ #
136
+ # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
137
+ # T-Mobile customers each day. In this case your project will be charged for the
138
+ # setup fee for a low volume number upon receipt of the API request.
139
+ # - `high` - The campaign will be allowed to send up to 200k SMS segments to
140
+ # T-Mobile customers each day, depending on the trust score assigned by The
141
+ # Campaign Registry. Your project will be charged for the setup fee for a high
142
+ # volume number upon receipt of the API request, and phone numbers will be
143
+ # charged as high volume numbers going forward.
144
+ volume: nil,
63
145
  request_options: {}
64
146
  )
65
147
  end
@@ -22,6 +22,7 @@ module SurgeAPI
22
22
  params(
23
23
  id: String,
24
24
  campaign_id: String,
25
+ metadata: T::Hash[Symbol, String],
25
26
  name: String,
26
27
  request_options: SurgeAPI::RequestOptions::OrHash
27
28
  ).returns(SurgeAPI::PhoneNumber)
@@ -31,6 +32,8 @@ module SurgeAPI
31
32
  id,
32
33
  # Campaign ID to attach this number to (`cpn_...`).
33
34
  campaign_id: nil,
35
+ # Set of key-value pairs that will be stored with the object.
36
+ metadata: nil,
34
37
  # A human-readable name for the phone number.
35
38
  name: nil,
36
39
  request_options: {}
@@ -105,6 +108,7 @@ module SurgeAPI
105
108
  area_code: String,
106
109
  latitude: Float,
107
110
  longitude: Float,
111
+ metadata: T::Hash[Symbol, String],
108
112
  name: String,
109
113
  phone_number: String,
110
114
  type: SurgeAPI::PhoneNumberPurchaseParams::Type::OrSymbol,
@@ -123,6 +127,8 @@ module SurgeAPI
123
127
  # Longitude to search for nearby phone numbers. Must be used with latitude. If
124
128
  # provided without type, type will be inferred as 'local'.
125
129
  longitude: nil,
130
+ # Set of key-value pairs that will be stored with the object.
131
+ metadata: nil,
126
132
  # A human-readable name for the phone number. If not provided, defaults to the
127
133
  # formatted phone number.
128
134
  name: nil,
@@ -0,0 +1,129 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Resources
5
+ class TollFreeCampaigns
6
+ # Creates a toll-free campaign and submits it for Surge review.
7
+ sig do
8
+ params(
9
+ account_id: String,
10
+ consent_flows:
11
+ T::Array[
12
+ T.any(
13
+ SurgeAPI::TollFreeCampaignParams::ConsentFlow::UnionMember0::OrHash,
14
+ SurgeAPI::TollFreeCampaignParams::ConsentFlow::UnionMember1::OrHash,
15
+ SurgeAPI::TollFreeCampaignParams::ConsentFlow::UnionMember2::OrHash,
16
+ SurgeAPI::TollFreeCampaignParams::ConsentFlow::UnionMember3::OrHash
17
+ )
18
+ ],
19
+ description: String,
20
+ message_samples: T::Array[String],
21
+ phone_number_id: String,
22
+ privacy_policy_url: String,
23
+ terms_and_conditions_url: String,
24
+ use_cases:
25
+ T::Array[SurgeAPI::TollFreeCampaignParams::UseCase::OrSymbol],
26
+ includes:
27
+ T::Array[SurgeAPI::TollFreeCampaignParams::Include::OrSymbol],
28
+ request_options: SurgeAPI::RequestOptions::OrHash
29
+ ).returns(SurgeAPI::TollFreeCampaign)
30
+ end
31
+ def create(
32
+ # The account for which the toll-free campaign should be created.
33
+ account_id,
34
+ consent_flows:,
35
+ # An explanation of how the toll-free number will be used.
36
+ description:,
37
+ message_samples:,
38
+ # The toll-free phone number to register.
39
+ phone_number_id:,
40
+ privacy_policy_url:,
41
+ terms_and_conditions_url:,
42
+ use_cases:,
43
+ includes: nil,
44
+ request_options: {}
45
+ )
46
+ end
47
+
48
+ # Retrieves a toll-free campaign object.
49
+ sig do
50
+ params(
51
+ campaign_id: String,
52
+ request_options: SurgeAPI::RequestOptions::OrHash
53
+ ).returns(SurgeAPI::TollFreeCampaign)
54
+ end
55
+ def retrieve(
56
+ # The ID of the toll-free campaign to retrieve.
57
+ campaign_id,
58
+ request_options: {}
59
+ )
60
+ end
61
+
62
+ # Updates a toll-free campaign awaiting customer fixes and re-submits it for Surge
63
+ # review. Returns 409 if the campaign is not in an updatable status.
64
+ sig do
65
+ params(
66
+ campaign_id: String,
67
+ consent_flows:
68
+ T::Array[
69
+ T.any(
70
+ SurgeAPI::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember0::OrHash,
71
+ SurgeAPI::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember1::OrHash,
72
+ SurgeAPI::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember2::OrHash,
73
+ SurgeAPI::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember3::OrHash
74
+ )
75
+ ],
76
+ description: String,
77
+ includes:
78
+ T::Array[SurgeAPI::TollFreeCampaignUpdateParams::Include::OrSymbol],
79
+ message_samples: T::Array[String],
80
+ privacy_policy_url: String,
81
+ terms_and_conditions_url: String,
82
+ use_cases:
83
+ T::Array[SurgeAPI::TollFreeCampaignUpdateParams::UseCase::OrSymbol],
84
+ request_options: SurgeAPI::RequestOptions::OrHash
85
+ ).returns(SurgeAPI::TollFreeCampaign)
86
+ end
87
+ def update(
88
+ # The toll-free campaign ID to update.
89
+ campaign_id,
90
+ consent_flows: nil,
91
+ # An explanation of how the toll-free number will be used.
92
+ description: nil,
93
+ includes: nil,
94
+ message_samples: nil,
95
+ privacy_policy_url: nil,
96
+ terms_and_conditions_url: nil,
97
+ use_cases: nil,
98
+ request_options: {}
99
+ )
100
+ end
101
+
102
+ # List all toll-free campaigns for an account with cursor-based pagination.
103
+ sig do
104
+ params(
105
+ account_id: String,
106
+ after: String,
107
+ before: String,
108
+ request_options: SurgeAPI::RequestOptions::OrHash
109
+ ).returns(SurgeAPI::Internal::Cursor[SurgeAPI::TollFreeCampaign])
110
+ end
111
+ def list(
112
+ # The account ID to list toll-free campaigns for.
113
+ account_id,
114
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
115
+ after: nil,
116
+ # Cursor for backward pagination. Use the previous_cursor from a previous
117
+ # response.
118
+ before: nil,
119
+ request_options: {}
120
+ )
121
+ end
122
+
123
+ # @api private
124
+ sig { params(client: SurgeAPI::Client).returns(T.attached_class) }
125
+ def self.new(client:)
126
+ end
127
+ end
128
+ end
129
+ end
@@ -114,6 +114,7 @@ module SurgeAPI
114
114
  params(
115
115
  user_id: String,
116
116
  duration_seconds: Integer,
117
+ read_only: T::Boolean,
117
118
  request_options: SurgeAPI::RequestOptions::OrHash
118
119
  ).returns(SurgeAPI::UserTokenResponse)
119
120
  end
@@ -122,6 +123,11 @@ module SurgeAPI
122
123
  user_id,
123
124
  # For how many seconds the token should be accepted. Defaults to 15 minutes.
124
125
  duration_seconds: nil,
126
+ # Restrict the token to viewing embedded conversations and unread counts. Sending
127
+ # messages, changing read state, editing contacts, and calling are disabled.
128
+ # Defaults to false. Preserve this value when refreshing the token; changing
129
+ # access mode requires reloading the embed.
130
+ read_only: nil,
125
131
  request_options: {}
126
132
  )
127
133
  end
@@ -12,6 +12,9 @@ module SurgeAPI
12
12
  T.any(
13
13
  SurgeAPI::CallEndedWebhookEvent,
14
14
  SurgeAPI::CampaignApprovedWebhookEvent,
15
+ SurgeAPI::CampaignRejectedWebhookEvent,
16
+ SurgeAPI::CampaignSubmittedWebhookEvent,
17
+ SurgeAPI::CampaignWarningWebhookEvent,
15
18
  SurgeAPI::ContactOptedInWebhookEvent,
16
19
  SurgeAPI::ContactOptedOutWebhookEvent,
17
20
  SurgeAPI::ConversationCreatedWebhookEvent,
@@ -30,6 +30,8 @@ module SurgeAPI
30
30
 
31
31
  attr_reader recordings: SurgeAPI::Resources::Recordings
32
32
 
33
+ attr_reader toll_free_campaigns: SurgeAPI::Resources::TollFreeCampaigns
34
+
33
35
  attr_reader users: SurgeAPI::Resources::Users
34
36
 
35
37
  attr_reader verifications: SurgeAPI::Resources::Verifications
@@ -3,6 +3,7 @@ module SurgeAPI
3
3
  type campaign =
4
4
  {
5
5
  id: String,
6
+ account_id: String,
6
7
  consent_flow: String,
7
8
  description: String,
8
9
  includes: ::Array[SurgeAPI::Models::Campaign::include_],
@@ -18,6 +19,8 @@ module SurgeAPI
18
19
  class Campaign < SurgeAPI::Internal::Type::BaseModel
19
20
  attr_accessor id: String
20
21
 
22
+ attr_accessor account_id: String
23
+
21
24
  attr_accessor consent_flow: String
22
25
 
23
26
  attr_accessor description: String
@@ -44,6 +47,7 @@ module SurgeAPI
44
47
 
45
48
  def initialize: (
46
49
  id: String,
50
+ account_id: String,
47
51
  consent_flow: String,
48
52
  description: String,
49
53
  includes: ::Array[SurgeAPI::Models::Campaign::include_],
@@ -58,6 +62,7 @@ module SurgeAPI
58
62
 
59
63
  def to_hash: -> {
60
64
  id: String,
65
+ account_id: String,
61
66
  consent_flow: String,
62
67
  description: String,
63
68
  includes: ::Array[SurgeAPI::Models::Campaign::include_],
@@ -34,21 +34,26 @@ module SurgeAPI
34
34
  type data =
35
35
  {
36
36
  id: String,
37
+ account_id: String,
37
38
  status: SurgeAPI::Models::CampaignApprovedWebhookEvent::Data::status
38
39
  }
39
40
 
40
41
  class Data < SurgeAPI::Internal::Type::BaseModel
41
42
  attr_accessor id: String
42
43
 
44
+ attr_accessor account_id: String
45
+
43
46
  attr_accessor status: SurgeAPI::Models::CampaignApprovedWebhookEvent::Data::status
44
47
 
45
48
  def initialize: (
46
49
  id: String,
50
+ account_id: String,
47
51
  status: SurgeAPI::Models::CampaignApprovedWebhookEvent::Data::status
48
52
  ) -> void
49
53
 
50
54
  def to_hash: -> {
51
55
  id: String,
56
+ account_id: String,
52
57
  status: SurgeAPI::Models::CampaignApprovedWebhookEvent::Data::status
53
58
  }
54
59
 
@@ -0,0 +1,115 @@
1
+ module SurgeAPI
2
+ module Models
3
+ type campaign_rejected_webhook_event =
4
+ {
5
+ account_id: String,
6
+ data: SurgeAPI::CampaignRejectedWebhookEvent::Data,
7
+ timestamp: Time,
8
+ type: :"campaign.rejected"
9
+ }
10
+
11
+ class CampaignRejectedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
12
+ attr_accessor account_id: String
13
+
14
+ attr_accessor data: SurgeAPI::CampaignRejectedWebhookEvent::Data
15
+
16
+ attr_accessor timestamp: Time
17
+
18
+ attr_accessor type: :"campaign.rejected"
19
+
20
+ def initialize: (
21
+ account_id: String,
22
+ data: SurgeAPI::CampaignRejectedWebhookEvent::Data,
23
+ timestamp: Time,
24
+ ?type: :"campaign.rejected"
25
+ ) -> void
26
+
27
+ def to_hash: -> {
28
+ account_id: String,
29
+ data: SurgeAPI::CampaignRejectedWebhookEvent::Data,
30
+ timestamp: Time,
31
+ type: :"campaign.rejected"
32
+ }
33
+
34
+ type data =
35
+ {
36
+ id: String,
37
+ feedback: ::Array[SurgeAPI::CampaignRejectedWebhookEvent::Data::Feedback],
38
+ status: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::status
39
+ }
40
+
41
+ class Data < SurgeAPI::Internal::Type::BaseModel
42
+ attr_accessor id: String
43
+
44
+ attr_accessor feedback: ::Array[SurgeAPI::CampaignRejectedWebhookEvent::Data::Feedback]
45
+
46
+ attr_accessor status: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::status
47
+
48
+ def initialize: (
49
+ id: String,
50
+ feedback: ::Array[SurgeAPI::CampaignRejectedWebhookEvent::Data::Feedback],
51
+ status: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::status
52
+ ) -> void
53
+
54
+ def to_hash: -> {
55
+ id: String,
56
+ feedback: ::Array[SurgeAPI::CampaignRejectedWebhookEvent::Data::Feedback],
57
+ status: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::status
58
+ }
59
+
60
+ type feedback =
61
+ {
62
+ field: String,
63
+ message: String,
64
+ outcome: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::Feedback::outcome,
65
+ suggested_value: String?
66
+ }
67
+
68
+ class Feedback < SurgeAPI::Internal::Type::BaseModel
69
+ attr_accessor field: String
70
+
71
+ attr_accessor message: String
72
+
73
+ attr_accessor outcome: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::Feedback::outcome
74
+
75
+ attr_accessor suggested_value: String?
76
+
77
+ def initialize: (
78
+ field: String,
79
+ message: String,
80
+ outcome: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::Feedback::outcome,
81
+ suggested_value: String?
82
+ ) -> void
83
+
84
+ def to_hash: -> {
85
+ field: String,
86
+ message: String,
87
+ outcome: SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::Feedback::outcome,
88
+ suggested_value: String?
89
+ }
90
+
91
+ type outcome = :changes_needed | :warning
92
+
93
+ module Outcome
94
+ extend SurgeAPI::Internal::Type::Enum
95
+
96
+ CHANGES_NEEDED: :changes_needed
97
+ WARNING: :warning
98
+
99
+ def self?.values: -> ::Array[SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::Feedback::outcome]
100
+ end
101
+ end
102
+
103
+ type status = :rejected
104
+
105
+ module Status
106
+ extend SurgeAPI::Internal::Type::Enum
107
+
108
+ REJECTED: :rejected
109
+
110
+ def self?.values: -> ::Array[SurgeAPI::Models::CampaignRejectedWebhookEvent::Data::status]
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,67 @@
1
+ module SurgeAPI
2
+ module Models
3
+ type campaign_submitted_webhook_event =
4
+ {
5
+ account_id: String,
6
+ data: SurgeAPI::CampaignSubmittedWebhookEvent::Data,
7
+ timestamp: Time,
8
+ type: :"campaign.submitted"
9
+ }
10
+
11
+ class CampaignSubmittedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
12
+ attr_accessor account_id: String
13
+
14
+ attr_accessor data: SurgeAPI::CampaignSubmittedWebhookEvent::Data
15
+
16
+ attr_accessor timestamp: Time
17
+
18
+ attr_accessor type: :"campaign.submitted"
19
+
20
+ def initialize: (
21
+ account_id: String,
22
+ data: SurgeAPI::CampaignSubmittedWebhookEvent::Data,
23
+ timestamp: Time,
24
+ ?type: :"campaign.submitted"
25
+ ) -> void
26
+
27
+ def to_hash: -> {
28
+ account_id: String,
29
+ data: SurgeAPI::CampaignSubmittedWebhookEvent::Data,
30
+ timestamp: Time,
31
+ type: :"campaign.submitted"
32
+ }
33
+
34
+ type data =
35
+ {
36
+ id: String,
37
+ status: SurgeAPI::Models::CampaignSubmittedWebhookEvent::Data::status
38
+ }
39
+
40
+ class Data < SurgeAPI::Internal::Type::BaseModel
41
+ attr_accessor id: String
42
+
43
+ attr_accessor status: SurgeAPI::Models::CampaignSubmittedWebhookEvent::Data::status
44
+
45
+ def initialize: (
46
+ id: String,
47
+ status: SurgeAPI::Models::CampaignSubmittedWebhookEvent::Data::status
48
+ ) -> void
49
+
50
+ def to_hash: -> {
51
+ id: String,
52
+ status: SurgeAPI::Models::CampaignSubmittedWebhookEvent::Data::status
53
+ }
54
+
55
+ type status = :in_review
56
+
57
+ module Status
58
+ extend SurgeAPI::Internal::Type::Enum
59
+
60
+ IN_REVIEW: :in_review
61
+
62
+ def self?.values: -> ::Array[SurgeAPI::Models::CampaignSubmittedWebhookEvent::Data::status]
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end