surge_api 0.23.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/README.md +9 -9
- data/lib/surge_api/client.rb +4 -0
- data/lib/surge_api/internal/type/union.rb +2 -2
- data/lib/surge_api/models/account_retrieve_status_params.rb +1 -0
- data/lib/surge_api/models/call_ended_webhook_event.rb +8 -3
- data/lib/surge_api/models/campaign.rb +21 -13
- data/lib/surge_api/models/campaign_approved_webhook_event.rb +9 -1
- data/lib/surge_api/models/campaign_params.rb +11 -12
- data/lib/surge_api/models/campaign_rejected_webhook_event.rb +135 -0
- data/lib/surge_api/models/campaign_submitted_webhook_event.rb +74 -0
- data/lib/surge_api/models/campaign_update_params.rb +188 -1
- data/lib/surge_api/models/campaign_warning_webhook_event.rb +134 -0
- data/lib/surge_api/models/message.rb +42 -2
- data/lib/surge_api/models/message_delivered_webhook_event.rb +29 -1
- data/lib/surge_api/models/message_failed_webhook_event.rb +26 -5
- data/lib/surge_api/models/message_received_webhook_event.rb +29 -1
- data/lib/surge_api/models/message_sent_webhook_event.rb +29 -1
- data/lib/surge_api/models/phone_number.rb +9 -1
- data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +9 -1
- data/lib/surge_api/models/phone_number_imported_webhook_event.rb +160 -0
- data/lib/surge_api/models/phone_number_purchase_params.rb +9 -1
- data/lib/surge_api/models/phone_number_update_params.rb +9 -1
- data/lib/surge_api/models/toll_free_campaign.rb +132 -0
- data/lib/surge_api/models/toll_free_campaign_consent_flow.rb +176 -0
- data/lib/surge_api/models/toll_free_campaign_create_params.rb +22 -0
- data/lib/surge_api/models/toll_free_campaign_list_params.rb +42 -0
- data/lib/surge_api/models/toll_free_campaign_params.rb +286 -0
- data/lib/surge_api/models/toll_free_campaign_retrieve_params.rb +22 -0
- data/lib/surge_api/models/toll_free_campaign_update_params.rb +278 -0
- data/lib/surge_api/models/unwrap_webhook_event.rb +9 -1
- data/lib/surge_api/models/user_create_token_params.rb +15 -1
- data/lib/surge_api/models.rb +22 -0
- data/lib/surge_api/resources/accounts.rb +2 -2
- data/lib/surge_api/resources/campaigns.rb +26 -8
- data/lib/surge_api/resources/phone_numbers.rb +6 -2
- data/lib/surge_api/resources/toll_free_campaigns.rb +140 -0
- data/lib/surge_api/resources/users.rb +6 -1
- data/lib/surge_api/resources/webhooks.rb +1 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +12 -0
- data/rbi/surge_api/client.rbi +3 -0
- data/rbi/surge_api/models/account_retrieve_status_params.rbi +5 -0
- data/rbi/surge_api/models/call_ended_webhook_event.rbi +6 -3
- data/rbi/surge_api/models/campaign.rbi +26 -19
- data/rbi/surge_api/models/campaign_approved_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/campaign_params.rbi +17 -19
- data/rbi/surge_api/models/campaign_rejected_webhook_event.rbi +269 -0
- data/rbi/surge_api/models/campaign_submitted_webhook_event.rbi +149 -0
- data/rbi/surge_api/models/campaign_update_params.rbi +378 -1
- data/rbi/surge_api/models/campaign_warning_webhook_event.rbi +259 -0
- data/rbi/surge_api/models/message.rbi +50 -3
- data/rbi/surge_api/models/message_delivered_webhook_event.rbi +52 -0
- data/rbi/surge_api/models/message_failed_webhook_event.rbi +47 -5
- data/rbi/surge_api/models/message_received_webhook_event.rbi +49 -0
- data/rbi/surge_api/models/message_sent_webhook_event.rbi +46 -0
- data/rbi/surge_api/models/phone_number.rbi +8 -0
- data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/phone_number_imported_webhook_event.rbi +318 -0
- data/rbi/surge_api/models/phone_number_purchase_params.rbi +11 -0
- data/rbi/surge_api/models/phone_number_update_params.rbi +11 -0
- data/rbi/surge_api/models/toll_free_campaign.rbi +230 -0
- data/rbi/surge_api/models/toll_free_campaign_consent_flow.rbi +476 -0
- data/rbi/surge_api/models/toll_free_campaign_create_params.rbi +43 -0
- data/rbi/surge_api/models/toll_free_campaign_list_params.rbi +70 -0
- data/rbi/surge_api/models/toll_free_campaign_params.rbi +711 -0
- data/rbi/surge_api/models/toll_free_campaign_retrieve_params.rbi +43 -0
- data/rbi/surge_api/models/toll_free_campaign_update_params.rbi +760 -0
- data/rbi/surge_api/models/unwrap_webhook_event.rbi +4 -0
- data/rbi/surge_api/models/user_create_token_params.rbi +17 -0
- data/rbi/surge_api/models.rbi +25 -0
- data/rbi/surge_api/resources/accounts.rbi +2 -2
- data/rbi/surge_api/resources/campaigns.rbi +94 -12
- data/rbi/surge_api/resources/phone_numbers.rbi +6 -0
- data/rbi/surge_api/resources/toll_free_campaigns.rbi +129 -0
- data/rbi/surge_api/resources/users.rbi +6 -0
- data/rbi/surge_api/resources/webhooks.rbi +4 -0
- data/sig/surge_api/client.rbs +2 -0
- data/sig/surge_api/models/account_retrieve_status_params.rbs +2 -1
- data/sig/surge_api/models/campaign.rbs +8 -1
- data/sig/surge_api/models/campaign_approved_webhook_event.rbs +5 -0
- data/sig/surge_api/models/campaign_rejected_webhook_event.rbs +115 -0
- data/sig/surge_api/models/campaign_submitted_webhook_event.rbs +67 -0
- data/sig/surge_api/models/campaign_update_params.rbs +128 -2
- data/sig/surge_api/models/campaign_warning_webhook_event.rbs +114 -0
- data/sig/surge_api/models/message.rbs +36 -3
- data/sig/surge_api/models/message_delivered_webhook_event.rbs +20 -0
- data/sig/surge_api/models/message_failed_webhook_event.rbs +19 -4
- data/sig/surge_api/models/message_received_webhook_event.rbs +20 -0
- data/sig/surge_api/models/message_sent_webhook_event.rbs +20 -0
- data/sig/surge_api/models/phone_number.rbs +5 -0
- data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +5 -0
- data/sig/surge_api/models/phone_number_imported_webhook_event.rbs +130 -0
- data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
- data/sig/surge_api/models/phone_number_update_params.rbs +12 -1
- data/sig/surge_api/models/toll_free_campaign.rbs +126 -0
- data/sig/surge_api/models/toll_free_campaign_consent_flow.rbs +207 -0
- data/sig/surge_api/models/toll_free_campaign_create_params.rbs +25 -0
- data/sig/surge_api/models/toll_free_campaign_list_params.rbs +36 -0
- data/sig/surge_api/models/toll_free_campaign_params.rbs +321 -0
- data/sig/surge_api/models/toll_free_campaign_retrieve_params.rbs +23 -0
- data/sig/surge_api/models/toll_free_campaign_update_params.rbs +332 -0
- data/sig/surge_api/models/unwrap_webhook_event.rbs +4 -0
- data/sig/surge_api/models/user_create_token_params.rbs +7 -1
- data/sig/surge_api/models.rbs +22 -0
- data/sig/surge_api/resources/campaigns.rbs +9 -1
- data/sig/surge_api/resources/phone_numbers.rbs +2 -0
- data/sig/surge_api/resources/toll_free_campaigns.rbs +44 -0
- data/sig/surge_api/resources/users.rbs +1 -0
- data/sig/surge_api/resources/webhooks.rbs +4 -0
- metadata +53 -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,
|
|
@@ -19,6 +22,7 @@ module SurgeAPI
|
|
|
19
22
|
SurgeAPI::MessageReceivedWebhookEvent,
|
|
20
23
|
SurgeAPI::MessageSentWebhookEvent,
|
|
21
24
|
SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent,
|
|
25
|
+
SurgeAPI::PhoneNumberImportedWebhookEvent,
|
|
22
26
|
SurgeAPI::RecordingCompletedWebhookEvent,
|
|
23
27
|
SurgeAPI::VoicemailReceivedWebhookEvent
|
|
24
28
|
)
|
|
@@ -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
|
)
|
data/rbi/surge_api/models.rbi
CHANGED
|
@@ -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
|
|
@@ -94,6 +101,9 @@ module SurgeAPI
|
|
|
94
101
|
PhoneNumberAttachedToCampaignWebhookEvent =
|
|
95
102
|
SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
|
|
96
103
|
|
|
104
|
+
PhoneNumberImportedWebhookEvent =
|
|
105
|
+
SurgeAPI::Models::PhoneNumberImportedWebhookEvent
|
|
106
|
+
|
|
97
107
|
PhoneNumberListAvailableNumbersParams =
|
|
98
108
|
SurgeAPI::Models::PhoneNumberListAvailableNumbersParams
|
|
99
109
|
|
|
@@ -118,6 +128,21 @@ module SurgeAPI
|
|
|
118
128
|
|
|
119
129
|
RecordingRetrieveParams = SurgeAPI::Models::RecordingRetrieveParams
|
|
120
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
|
+
|
|
121
146
|
UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
|
|
122
147
|
|
|
123
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
|
|
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
|
|
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
|
|
43
|
-
#
|
|
44
|
-
# campaign
|
|
45
|
-
#
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
#
|
|
61
|
-
#
|
|
62
|
-
|
|
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,
|
|
@@ -21,6 +24,7 @@ module SurgeAPI
|
|
|
21
24
|
SurgeAPI::MessageReceivedWebhookEvent,
|
|
22
25
|
SurgeAPI::MessageSentWebhookEvent,
|
|
23
26
|
SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent,
|
|
27
|
+
SurgeAPI::PhoneNumberImportedWebhookEvent,
|
|
24
28
|
SurgeAPI::RecordingCompletedWebhookEvent,
|
|
25
29
|
SurgeAPI::VoicemailReceivedWebhookEvent
|
|
26
30
|
)
|
data/sig/surge_api/client.rbs
CHANGED
|
@@ -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
|
|
@@ -31,12 +31,13 @@ module SurgeAPI
|
|
|
31
31
|
request_options: SurgeAPI::RequestOptions
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
type capability = :local_messaging
|
|
34
|
+
type capability = :local_messaging | :toll_free_messaging
|
|
35
35
|
|
|
36
36
|
module Capability
|
|
37
37
|
extend SurgeAPI::Internal::Type::Enum
|
|
38
38
|
|
|
39
39
|
LOCAL_MESSAGING: :local_messaging
|
|
40
|
+
TOLL_FREE_MESSAGING: :toll_free_messaging
|
|
40
41
|
|
|
41
42
|
def self?.values: -> ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability]
|
|
42
43
|
end
|
|
@@ -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_],
|
|
@@ -83,13 +88,15 @@ module SurgeAPI
|
|
|
83
88
|
def self?.values: -> ::Array[SurgeAPI::Models::Campaign::include_]
|
|
84
89
|
end
|
|
85
90
|
|
|
86
|
-
type status =
|
|
91
|
+
type status =
|
|
92
|
+
:active | :canceled | :rejected | :created | :deactivated | :in_review
|
|
87
93
|
|
|
88
94
|
module Status
|
|
89
95
|
extend SurgeAPI::Internal::Type::Enum
|
|
90
96
|
|
|
91
97
|
ACTIVE: :active
|
|
92
98
|
CANCELED: :canceled
|
|
99
|
+
REJECTED: :rejected
|
|
93
100
|
CREATED: :created
|
|
94
101
|
DEACTIVATED: :deactivated
|
|
95
102
|
IN_REVIEW: :in_review
|
|
@@ -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
|