surge_api 0.16.0 → 0.18.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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +56 -21
  4. data/lib/surge_api/client.rb +22 -1
  5. data/lib/surge_api/internal/cursor.rb +2 -2
  6. data/lib/surge_api/internal/transport/base_client.rb +5 -0
  7. data/lib/surge_api/internal/util.rb +22 -7
  8. data/lib/surge_api/models/account_archive_params.rb +9 -1
  9. data/lib/surge_api/models/account_list_params.rb +34 -0
  10. data/lib/surge_api/models/account_retrieve_status_params.rb +9 -1
  11. data/lib/surge_api/models/account_update_params.rb +9 -1
  12. data/lib/surge_api/models/attachment_get_file_params.rb +9 -1
  13. data/lib/surge_api/models/audience_add_contact_params.rb +9 -1
  14. data/lib/surge_api/models/audience_create_params.rb +9 -1
  15. data/lib/surge_api/models/audience_list_contacts_params.rb +9 -1
  16. data/lib/surge_api/models/blast_create_params.rb +9 -1
  17. data/lib/surge_api/models/campaign_create_params.rb +6 -10
  18. data/lib/surge_api/models/campaign_list_params.rb +9 -1
  19. data/lib/surge_api/models/campaign_retrieve_params.rb +9 -1
  20. data/lib/surge_api/models/campaign_update_params.rb +6 -10
  21. data/lib/surge_api/models/contact_create_params.rb +9 -1
  22. data/lib/surge_api/models/contact_list_params.rb +9 -1
  23. data/lib/surge_api/models/contact_retrieve_params.rb +9 -1
  24. data/lib/surge_api/models/contact_update_params.rb +9 -1
  25. data/lib/surge_api/models/message.rb +1 -0
  26. data/lib/surge_api/models/message_create_params.rb +6 -11
  27. data/lib/surge_api/models/message_delivered_webhook_event.rb +1 -0
  28. data/lib/surge_api/models/message_failed_webhook_event.rb +1 -0
  29. data/lib/surge_api/models/message_list_params.rb +9 -1
  30. data/lib/surge_api/models/message_params.rb +74 -2
  31. data/lib/surge_api/models/message_received_webhook_event.rb +1 -0
  32. data/lib/surge_api/models/message_retrieve_params.rb +9 -1
  33. data/lib/surge_api/models/message_sent_webhook_event.rb +1 -0
  34. data/lib/surge_api/models/phone_number.rb +1 -1
  35. data/lib/surge_api/models/phone_number_list_params.rb +9 -1
  36. data/lib/surge_api/models/phone_number_purchase_params.rb +9 -1
  37. data/lib/surge_api/models/phone_number_release_params.rb +22 -0
  38. data/lib/surge_api/models/phone_number_update_params.rb +38 -0
  39. data/lib/surge_api/models/recording_delete_params.rb +9 -1
  40. data/lib/surge_api/models/recording_get_file_params.rb +9 -1
  41. data/lib/surge_api/models/recording_list_params.rb +9 -1
  42. data/lib/surge_api/models/recording_retrieve_params.rb +9 -1
  43. data/lib/surge_api/models/user_create_params.rb +9 -1
  44. data/lib/surge_api/models/user_create_token_params.rb +9 -1
  45. data/lib/surge_api/models/user_delete_params.rb +9 -1
  46. data/lib/surge_api/models/user_list_params.rb +9 -1
  47. data/lib/surge_api/models/user_retrieve_params.rb +9 -1
  48. data/lib/surge_api/models/user_update_params.rb +9 -1
  49. data/lib/surge_api/models/verification_check_params.rb +9 -1
  50. data/lib/surge_api/models/verification_create_params.rb +9 -1
  51. data/lib/surge_api/models.rb +6 -0
  52. data/lib/surge_api/resources/accounts.rb +29 -0
  53. data/lib/surge_api/resources/campaigns.rb +4 -14
  54. data/lib/surge_api/resources/messages.rb +6 -7
  55. data/lib/surge_api/resources/phone_numbers.rb +46 -0
  56. data/lib/surge_api/resources/verifications.rb +7 -4
  57. data/lib/surge_api/resources/webhooks.rb +11 -1
  58. data/lib/surge_api/version.rb +1 -1
  59. data/lib/surge_api.rb +4 -0
  60. data/rbi/surge_api/client.rbi +6 -0
  61. data/rbi/surge_api/internal/util.rbi +8 -0
  62. data/rbi/surge_api/models/account_archive_params.rbi +18 -5
  63. data/rbi/surge_api/models/account_list_params.rbi +59 -0
  64. data/rbi/surge_api/models/account_retrieve_status_params.rbi +8 -0
  65. data/rbi/surge_api/models/account_update_params.rbi +8 -0
  66. data/rbi/surge_api/models/attachment_get_file_params.rbi +18 -5
  67. data/rbi/surge_api/models/audience_add_contact_params.rbi +12 -1
  68. data/rbi/surge_api/models/audience_create_params.rbi +12 -1
  69. data/rbi/surge_api/models/audience_list_contacts_params.rbi +8 -0
  70. data/rbi/surge_api/models/blast_create_params.rbi +8 -0
  71. data/rbi/surge_api/models/campaign_create_params.rbi +7 -27
  72. data/rbi/surge_api/models/campaign_list_params.rbi +8 -0
  73. data/rbi/surge_api/models/campaign_retrieve_params.rbi +18 -5
  74. data/rbi/surge_api/models/campaign_update_params.rbi +7 -27
  75. data/rbi/surge_api/models/contact_create_params.rbi +8 -0
  76. data/rbi/surge_api/models/contact_list_params.rbi +8 -0
  77. data/rbi/surge_api/models/contact_retrieve_params.rbi +18 -5
  78. data/rbi/surge_api/models/contact_update_params.rbi +8 -0
  79. data/rbi/surge_api/models/message.rbi +2 -0
  80. data/rbi/surge_api/models/message_create_params.rbi +7 -29
  81. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +5 -0
  82. data/rbi/surge_api/models/message_failed_webhook_event.rbi +5 -0
  83. data/rbi/surge_api/models/message_list_params.rbi +8 -0
  84. data/rbi/surge_api/models/message_params.rbi +225 -6
  85. data/rbi/surge_api/models/message_received_webhook_event.rbi +5 -0
  86. data/rbi/surge_api/models/message_retrieve_params.rbi +18 -5
  87. data/rbi/surge_api/models/message_sent_webhook_event.rbi +5 -0
  88. data/rbi/surge_api/models/phone_number_list_params.rbi +8 -0
  89. data/rbi/surge_api/models/phone_number_purchase_params.rbi +8 -0
  90. data/rbi/surge_api/models/phone_number_release_params.rbi +40 -0
  91. data/rbi/surge_api/models/phone_number_update_params.rbi +65 -0
  92. data/rbi/surge_api/models/recording_delete_params.rbi +18 -5
  93. data/rbi/surge_api/models/recording_get_file_params.rbi +18 -5
  94. data/rbi/surge_api/models/recording_list_params.rbi +8 -0
  95. data/rbi/surge_api/models/recording_retrieve_params.rbi +18 -5
  96. data/rbi/surge_api/models/user_create_params.rbi +8 -0
  97. data/rbi/surge_api/models/user_create_token_params.rbi +8 -0
  98. data/rbi/surge_api/models/user_delete_params.rbi +18 -5
  99. data/rbi/surge_api/models/user_list_params.rbi +8 -0
  100. data/rbi/surge_api/models/user_retrieve_params.rbi +18 -5
  101. data/rbi/surge_api/models/user_update_params.rbi +8 -0
  102. data/rbi/surge_api/models/verification_check_params.rbi +12 -1
  103. data/rbi/surge_api/models/verification_create_params.rbi +12 -1
  104. data/rbi/surge_api/models.rbi +6 -0
  105. data/rbi/surge_api/resources/accounts.rbi +18 -0
  106. data/rbi/surge_api/resources/campaigns.rbi +10 -2
  107. data/rbi/surge_api/resources/messages.rbi +9 -1
  108. data/rbi/surge_api/resources/phone_numbers.rbi +34 -0
  109. data/rbi/surge_api/resources/verifications.rbi +5 -1
  110. data/rbi/surge_api/resources/webhooks.rbi +10 -2
  111. data/sig/surge_api/client.rbs +3 -0
  112. data/sig/surge_api/internal/util.rbs +4 -0
  113. data/sig/surge_api/models/account_archive_params.rbs +8 -3
  114. data/sig/surge_api/models/account_list_params.rbs +32 -0
  115. data/sig/surge_api/models/account_retrieve_status_params.rbs +5 -0
  116. data/sig/surge_api/models/account_update_params.rbs +5 -0
  117. data/sig/surge_api/models/attachment_get_file_params.rbs +11 -3
  118. data/sig/surge_api/models/audience_add_contact_params.rbs +10 -2
  119. data/sig/surge_api/models/audience_create_params.rbs +6 -1
  120. data/sig/surge_api/models/audience_list_contacts_params.rbs +5 -1
  121. data/sig/surge_api/models/blast_create_params.rbs +5 -0
  122. data/sig/surge_api/models/campaign_create_params.rbs +4 -9
  123. data/sig/surge_api/models/campaign_list_params.rbs +5 -1
  124. data/sig/surge_api/models/campaign_retrieve_params.rbs +8 -3
  125. data/sig/surge_api/models/campaign_update_params.rbs +4 -12
  126. data/sig/surge_api/models/contact_create_params.rbs +5 -0
  127. data/sig/surge_api/models/contact_list_params.rbs +5 -1
  128. data/sig/surge_api/models/contact_retrieve_params.rbs +8 -3
  129. data/sig/surge_api/models/contact_update_params.rbs +5 -0
  130. data/sig/surge_api/models/message.rbs +2 -1
  131. data/sig/surge_api/models/message_create_params.rbs +4 -9
  132. data/sig/surge_api/models/message_delivered_webhook_event.rbs +2 -1
  133. data/sig/surge_api/models/message_failed_webhook_event.rbs +2 -1
  134. data/sig/surge_api/models/message_list_params.rbs +5 -1
  135. data/sig/surge_api/models/message_params.rbs +88 -6
  136. data/sig/surge_api/models/message_received_webhook_event.rbs +2 -1
  137. data/sig/surge_api/models/message_retrieve_params.rbs +8 -3
  138. data/sig/surge_api/models/message_sent_webhook_event.rbs +2 -1
  139. data/sig/surge_api/models/phone_number_list_params.rbs +5 -1
  140. data/sig/surge_api/models/phone_number_purchase_params.rbs +5 -0
  141. data/sig/surge_api/models/phone_number_release_params.rbs +20 -0
  142. data/sig/surge_api/models/phone_number_update_params.rbs +36 -0
  143. data/sig/surge_api/models/recording_delete_params.rbs +8 -3
  144. data/sig/surge_api/models/recording_get_file_params.rbs +11 -3
  145. data/sig/surge_api/models/recording_list_params.rbs +5 -1
  146. data/sig/surge_api/models/recording_retrieve_params.rbs +8 -3
  147. data/sig/surge_api/models/user_create_params.rbs +5 -0
  148. data/sig/surge_api/models/user_create_token_params.rbs +5 -1
  149. data/sig/surge_api/models/user_delete_params.rbs +8 -3
  150. data/sig/surge_api/models/user_list_params.rbs +5 -1
  151. data/sig/surge_api/models/user_retrieve_params.rbs +8 -3
  152. data/sig/surge_api/models/user_update_params.rbs +5 -0
  153. data/sig/surge_api/models/verification_check_params.rbs +6 -1
  154. data/sig/surge_api/models/verification_create_params.rbs +6 -1
  155. data/sig/surge_api/models.rbs +6 -0
  156. data/sig/surge_api/resources/accounts.rbs +6 -0
  157. data/sig/surge_api/resources/campaigns.rbs +2 -2
  158. data/sig/surge_api/resources/messages.rbs +1 -1
  159. data/sig/surge_api/resources/phone_numbers.rbs +12 -0
  160. data/sig/surge_api/resources/verifications.rbs +1 -0
  161. data/sig/surge_api/resources/webhooks.rbs +3 -1
  162. metadata +25 -2
@@ -11,6 +11,10 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::UserCreateParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The account for which the user should be created.
15
+ sig { returns(String) }
16
+ attr_accessor :account_id
17
+
14
18
  # The user's first name.
15
19
  sig { returns(String) }
16
20
  attr_accessor :first_name
@@ -38,6 +42,7 @@ module SurgeAPI
38
42
 
39
43
  sig do
40
44
  params(
45
+ account_id: String,
41
46
  first_name: String,
42
47
  last_name: String,
43
48
  metadata: T::Hash[Symbol, String],
@@ -46,6 +51,8 @@ module SurgeAPI
46
51
  ).returns(T.attached_class)
47
52
  end
48
53
  def self.new(
54
+ # The account for which the user should be created.
55
+ account_id:,
49
56
  # The user's first name.
50
57
  first_name:,
51
58
  # The user's last name.
@@ -61,6 +68,7 @@ module SurgeAPI
61
68
  sig do
62
69
  override.returns(
63
70
  {
71
+ account_id: String,
64
72
  first_name: String,
65
73
  last_name: String,
66
74
  metadata: T::Hash[Symbol, String],
@@ -11,6 +11,10 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::UserCreateTokenParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The user for which the token represents authentication.
15
+ sig { returns(String) }
16
+ attr_accessor :user_id
17
+
14
18
  # For how many seconds the token should be accepted. Defaults to 15 minutes.
15
19
  sig { returns(T.nilable(Integer)) }
16
20
  attr_reader :duration_seconds
@@ -20,11 +24,14 @@ module SurgeAPI
20
24
 
21
25
  sig do
22
26
  params(
27
+ user_id: String,
23
28
  duration_seconds: Integer,
24
29
  request_options: SurgeAPI::RequestOptions::OrHash
25
30
  ).returns(T.attached_class)
26
31
  end
27
32
  def self.new(
33
+ # The user for which the token represents authentication.
34
+ user_id:,
28
35
  # For how many seconds the token should be accepted. Defaults to 15 minutes.
29
36
  duration_seconds: nil,
30
37
  request_options: {}
@@ -34,6 +41,7 @@ module SurgeAPI
34
41
  sig do
35
42
  override.returns(
36
43
  {
44
+ user_id: String,
37
45
  duration_seconds: Integer,
38
46
  request_options: SurgeAPI::RequestOptions
39
47
  }
@@ -11,15 +11,28 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::UserDeleteParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The ID of the user to delete.
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
14
18
  sig do
15
- params(request_options: SurgeAPI::RequestOptions::OrHash).returns(
16
- T.attached_class
17
- )
19
+ params(
20
+ id: String,
21
+ request_options: SurgeAPI::RequestOptions::OrHash
22
+ ).returns(T.attached_class)
18
23
  end
19
- def self.new(request_options: {})
24
+ def self.new(
25
+ # The ID of the user to delete.
26
+ id:,
27
+ request_options: {}
28
+ )
20
29
  end
21
30
 
22
- sig { override.returns({ request_options: SurgeAPI::RequestOptions }) }
31
+ sig do
32
+ override.returns(
33
+ { id: String, request_options: SurgeAPI::RequestOptions }
34
+ )
35
+ end
23
36
  def to_hash
24
37
  end
25
38
  end
@@ -11,6 +11,10 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::UserListParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The account ID to list users for.
15
+ sig { returns(String) }
16
+ attr_accessor :account_id
17
+
14
18
  # Cursor for forward pagination. Use the next_cursor from a previous response.
15
19
  sig { returns(T.nilable(String)) }
16
20
  attr_reader :after
@@ -28,12 +32,15 @@ module SurgeAPI
28
32
 
29
33
  sig do
30
34
  params(
35
+ account_id: String,
31
36
  after: String,
32
37
  before: String,
33
38
  request_options: SurgeAPI::RequestOptions::OrHash
34
39
  ).returns(T.attached_class)
35
40
  end
36
41
  def self.new(
42
+ # The account ID to list users for.
43
+ account_id:,
37
44
  # Cursor for forward pagination. Use the next_cursor from a previous response.
38
45
  after: nil,
39
46
  # Cursor for backward pagination. Use the previous_cursor from a previous
@@ -46,6 +53,7 @@ module SurgeAPI
46
53
  sig do
47
54
  override.returns(
48
55
  {
56
+ account_id: String,
49
57
  after: String,
50
58
  before: String,
51
59
  request_options: SurgeAPI::RequestOptions
@@ -11,15 +11,28 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::UserRetrieveParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The ID of the user to retrieve.
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
14
18
  sig do
15
- params(request_options: SurgeAPI::RequestOptions::OrHash).returns(
16
- T.attached_class
17
- )
19
+ params(
20
+ id: String,
21
+ request_options: SurgeAPI::RequestOptions::OrHash
22
+ ).returns(T.attached_class)
18
23
  end
19
- def self.new(request_options: {})
24
+ def self.new(
25
+ # The ID of the user to retrieve.
26
+ id:,
27
+ request_options: {}
28
+ )
20
29
  end
21
30
 
22
- sig { override.returns({ request_options: SurgeAPI::RequestOptions }) }
31
+ sig do
32
+ override.returns(
33
+ { id: String, request_options: SurgeAPI::RequestOptions }
34
+ )
35
+ end
23
36
  def to_hash
24
37
  end
25
38
  end
@@ -11,6 +11,10 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::UserUpdateParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The ID of the user to update.
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
14
18
  # The user's first name.
15
19
  sig { returns(String) }
16
20
  attr_accessor :first_name
@@ -38,6 +42,7 @@ module SurgeAPI
38
42
 
39
43
  sig do
40
44
  params(
45
+ id: String,
41
46
  first_name: String,
42
47
  last_name: String,
43
48
  metadata: T::Hash[Symbol, String],
@@ -46,6 +51,8 @@ module SurgeAPI
46
51
  ).returns(T.attached_class)
47
52
  end
48
53
  def self.new(
54
+ # The ID of the user to update.
55
+ id:,
49
56
  # The user's first name.
50
57
  first_name:,
51
58
  # The user's last name.
@@ -61,6 +68,7 @@ module SurgeAPI
61
68
  sig do
62
69
  override.returns(
63
70
  {
71
+ id: String,
64
72
  first_name: String,
65
73
  last_name: String,
66
74
  metadata: T::Hash[Symbol, String],
@@ -11,17 +11,24 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::VerificationCheckParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The ID of the verification to check against.
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
14
18
  # The Verification code that was received.
15
19
  sig { returns(String) }
16
20
  attr_accessor :code
17
21
 
18
22
  sig do
19
23
  params(
24
+ id: String,
20
25
  code: String,
21
26
  request_options: SurgeAPI::RequestOptions::OrHash
22
27
  ).returns(T.attached_class)
23
28
  end
24
29
  def self.new(
30
+ # The ID of the verification to check against.
31
+ id:,
25
32
  # The Verification code that was received.
26
33
  code:,
27
34
  request_options: {}
@@ -30,7 +37,11 @@ module SurgeAPI
30
37
 
31
38
  sig do
32
39
  override.returns(
33
- { code: String, request_options: SurgeAPI::RequestOptions }
40
+ {
41
+ id: String,
42
+ code: String,
43
+ request_options: SurgeAPI::RequestOptions
44
+ }
34
45
  )
35
46
  end
36
47
  def to_hash
@@ -11,17 +11,24 @@ module SurgeAPI
11
11
  T.any(SurgeAPI::VerificationCreateParams, SurgeAPI::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # The account to associate with the verification.
15
+ sig { returns(String) }
16
+ attr_accessor :account_id
17
+
14
18
  # The phone number to be verified. In E.164 format.
15
19
  sig { returns(String) }
16
20
  attr_accessor :phone_number
17
21
 
18
22
  sig do
19
23
  params(
24
+ account_id: String,
20
25
  phone_number: String,
21
26
  request_options: SurgeAPI::RequestOptions::OrHash
22
27
  ).returns(T.attached_class)
23
28
  end
24
29
  def self.new(
30
+ # The account to associate with the verification.
31
+ account_id:,
25
32
  # The phone number to be verified. In E.164 format.
26
33
  phone_number:,
27
34
  request_options: {}
@@ -30,7 +37,11 @@ module SurgeAPI
30
37
 
31
38
  sig do
32
39
  override.returns(
33
- { phone_number: String, request_options: SurgeAPI::RequestOptions }
40
+ {
41
+ account_id: String,
42
+ phone_number: String,
43
+ request_options: SurgeAPI::RequestOptions
44
+ }
34
45
  )
35
46
  end
36
47
  def to_hash
@@ -7,6 +7,8 @@ module SurgeAPI
7
7
 
8
8
  AccountCreateParams = SurgeAPI::Models::AccountCreateParams
9
9
 
10
+ AccountListParams = SurgeAPI::Models::AccountListParams
11
+
10
12
  AccountRetrieveStatusParams = SurgeAPI::Models::AccountRetrieveStatusParams
11
13
 
12
14
  AccountStatus = SurgeAPI::Models::AccountStatus
@@ -91,6 +93,10 @@ module SurgeAPI
91
93
 
92
94
  PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
93
95
 
96
+ PhoneNumberReleaseParams = SurgeAPI::Models::PhoneNumberReleaseParams
97
+
98
+ PhoneNumberUpdateParams = SurgeAPI::Models::PhoneNumberUpdateParams
99
+
94
100
  RecordingCompletedWebhookEvent =
95
101
  SurgeAPI::Models::RecordingCompletedWebhookEvent
96
102
 
@@ -65,6 +65,24 @@ module SurgeAPI
65
65
  )
66
66
  end
67
67
 
68
+ # List all accounts for the calling platform with cursor-based pagination.
69
+ sig do
70
+ params(
71
+ after: String,
72
+ before: String,
73
+ request_options: SurgeAPI::RequestOptions::OrHash
74
+ ).returns(SurgeAPI::Internal::Cursor[SurgeAPI::Account])
75
+ end
76
+ def list(
77
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
78
+ after: nil,
79
+ # Cursor for backward pagination. Use the previous_cursor from a previous
80
+ # response.
81
+ before: nil,
82
+ request_options: {}
83
+ )
84
+ end
85
+
68
86
  # Archives an account and releases all associated resources.
69
87
  #
70
88
  # **Warning**: This action will:
@@ -7,7 +7,11 @@ module SurgeAPI
7
7
  sig do
8
8
  params(
9
9
  account_id: String,
10
- campaign_params: SurgeAPI::CampaignParams,
10
+ campaign_params:
11
+ T.any(
12
+ SurgeAPI::CampaignParams::StandardCampaignParams::OrHash,
13
+ SurgeAPI::CampaignParams::ExternalCampaignParams::OrHash
14
+ ),
11
15
  request_options: SurgeAPI::RequestOptions::OrHash
12
16
  ).returns(SurgeAPI::Campaign)
13
17
  end
@@ -42,7 +46,11 @@ module SurgeAPI
42
46
  sig do
43
47
  params(
44
48
  id: String,
45
- campaign_params: SurgeAPI::CampaignParams,
49
+ campaign_params:
50
+ T.any(
51
+ SurgeAPI::CampaignParams::StandardCampaignParams::OrHash,
52
+ SurgeAPI::CampaignParams::ExternalCampaignParams::OrHash
53
+ ),
46
54
  request_options: SurgeAPI::RequestOptions::OrHash
47
55
  ).returns(SurgeAPI::Campaign)
48
56
  end
@@ -28,10 +28,18 @@ module SurgeAPI
28
28
  # are provided. Similarly the `from` field cannot be used together with the
29
29
  # `conversation` field, and `conversation.phone_number` should be specified
30
30
  # instead.
31
+ #
32
+ # Optionally, you can pass a `settings` object to override account-level settings
33
+ # for this message. Currently the only supported setting is `link_shortening`,
34
+ # which accepts `"enabled"` or `"disabled"`.
31
35
  sig do
32
36
  params(
33
37
  account_id: String,
34
- message_params: SurgeAPI::MessageParams,
38
+ message_params:
39
+ T.any(
40
+ SurgeAPI::MessageParams::MessageParamsWithConversation::OrHash,
41
+ SurgeAPI::MessageParams::SimpleMessageParams::OrHash
42
+ ),
35
43
  request_options: SurgeAPI::RequestOptions::OrHash
36
44
  ).returns(SurgeAPI::Message)
37
45
  end
@@ -3,6 +3,26 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class PhoneNumbers
6
+ # Updates a phone number's details.
7
+ sig do
8
+ params(
9
+ id: String,
10
+ campaign_id: String,
11
+ name: String,
12
+ request_options: SurgeAPI::RequestOptions::OrHash
13
+ ).returns(SurgeAPI::PhoneNumber)
14
+ end
15
+ def update(
16
+ # The ID of the phone number to update.
17
+ id,
18
+ # Campaign ID to attach this number to (`cpn_...`).
19
+ campaign_id: nil,
20
+ # A human-readable name for the phone number.
21
+ name: nil,
22
+ request_options: {}
23
+ )
24
+ end
25
+
6
26
  # List all phone numbers for an account with cursor-based pagination.
7
27
  sig do
8
28
  params(
@@ -59,6 +79,20 @@ module SurgeAPI
59
79
  )
60
80
  end
61
81
 
82
+ # Releases a phone number from the account.
83
+ sig do
84
+ params(
85
+ id: String,
86
+ request_options: SurgeAPI::RequestOptions::OrHash
87
+ ).returns(SurgeAPI::PhoneNumber)
88
+ end
89
+ def release(
90
+ # The ID of the phone number to release.
91
+ id,
92
+ request_options: {}
93
+ )
94
+ end
95
+
62
96
  # @api private
63
97
  sig { params(client: SurgeAPI::Client).returns(T.attached_class) }
64
98
  def self.new(client:)
@@ -3,14 +3,18 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class Verifications
6
- # Creates a new Verification and sends the code to the given phone number.
6
+ # Creates a new Verification for an account and sends the code to the given phone
7
+ # number.
7
8
  sig do
8
9
  params(
10
+ account_id: String,
9
11
  phone_number: String,
10
12
  request_options: SurgeAPI::RequestOptions::OrHash
11
13
  ).returns(SurgeAPI::Verification)
12
14
  end
13
15
  def create(
16
+ # The account to associate with the verification.
17
+ account_id,
14
18
  # The phone number to be verified. In E.164 format.
15
19
  phone_number:,
16
20
  request_options: {}
@@ -4,7 +4,11 @@ module SurgeAPI
4
4
  module Resources
5
5
  class Webhooks
6
6
  sig do
7
- params(payload: String).returns(
7
+ params(
8
+ payload: String,
9
+ headers: T::Hash[String, String],
10
+ key: T.nilable(String)
11
+ ).returns(
8
12
  T.any(
9
13
  SurgeAPI::CallEndedWebhookEvent,
10
14
  SurgeAPI::CampaignApprovedWebhookEvent,
@@ -24,7 +28,11 @@ module SurgeAPI
24
28
  end
25
29
  def unwrap(
26
30
  # The raw webhook payload as a string
27
- payload
31
+ payload,
32
+ # The raw HTTP headers that came with the payload
33
+ headers:,
34
+ # The webhook signing key
35
+ key: @client.webhook_signing_secret
28
36
  )
29
37
  end
30
38
 
@@ -10,6 +10,8 @@ module SurgeAPI
10
10
 
11
11
  attr_reader api_key: String
12
12
 
13
+ attr_reader webhook_signing_secret: String?
14
+
13
15
  attr_reader accounts: SurgeAPI::Resources::Accounts
14
16
 
15
17
  attr_reader attachments: SurgeAPI::Resources::Attachments
@@ -38,6 +40,7 @@ module SurgeAPI
38
40
 
39
41
  def initialize: (
40
42
  ?api_key: String?,
43
+ ?webhook_signing_secret: String?,
41
44
  ?base_url: String?,
42
45
  ?max_retries: Integer,
43
46
  ?timeout: Float,
@@ -45,8 +45,12 @@ module SurgeAPI
45
45
  -> top?
46
46
  } -> top?
47
47
 
48
+ RFC_3986_NOT_PCHARS: Regexp
49
+
48
50
  def self?.uri_origin: (URI::Generic uri) -> String
49
51
 
52
+ def self?.encode_path: (String | Integer path) -> String
53
+
50
54
  def self?.interpolate_path: (String | ::Array[String] path) -> String
51
55
 
52
56
  def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
@@ -1,15 +1,20 @@
1
1
  module SurgeAPI
2
2
  module Models
3
3
  type account_archive_params =
4
- { } & SurgeAPI::Internal::Type::request_parameters
4
+ { id: String } & SurgeAPI::Internal::Type::request_parameters
5
5
 
6
6
  class AccountArchiveParams < SurgeAPI::Internal::Type::BaseModel
7
7
  extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
8
  include SurgeAPI::Internal::Type::RequestParameters
9
9
 
10
- def initialize: (?request_options: SurgeAPI::request_opts) -> void
10
+ attr_accessor id: String
11
11
 
12
- def to_hash: -> { request_options: SurgeAPI::RequestOptions }
12
+ def initialize: (
13
+ id: String,
14
+ ?request_options: SurgeAPI::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> { id: String, request_options: SurgeAPI::RequestOptions }
13
18
  end
14
19
  end
15
20
  end
@@ -0,0 +1,32 @@
1
+ module SurgeAPI
2
+ module Models
3
+ type account_list_params =
4
+ { after: String, before: String }
5
+ & SurgeAPI::Internal::Type::request_parameters
6
+
7
+ class AccountListParams < SurgeAPI::Internal::Type::BaseModel
8
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
9
+ include SurgeAPI::Internal::Type::RequestParameters
10
+
11
+ attr_reader after: String?
12
+
13
+ def after=: (String) -> String
14
+
15
+ attr_reader before: String?
16
+
17
+ def before=: (String) -> String
18
+
19
+ def initialize: (
20
+ ?after: String,
21
+ ?before: String,
22
+ ?request_options: SurgeAPI::request_opts
23
+ ) -> void
24
+
25
+ def to_hash: -> {
26
+ after: String,
27
+ before: String,
28
+ request_options: SurgeAPI::RequestOptions
29
+ }
30
+ end
31
+ end
32
+ end
@@ -2,6 +2,7 @@ module SurgeAPI
2
2
  module Models
3
3
  type account_retrieve_status_params =
4
4
  {
5
+ account_id: String,
5
6
  capabilities: ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability]
6
7
  }
7
8
  & SurgeAPI::Internal::Type::request_parameters
@@ -10,6 +11,8 @@ module SurgeAPI
10
11
  extend SurgeAPI::Internal::Type::RequestParameters::Converter
11
12
  include SurgeAPI::Internal::Type::RequestParameters
12
13
 
14
+ attr_accessor account_id: String
15
+
13
16
  attr_reader capabilities: ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability]?
14
17
 
15
18
  def capabilities=: (
@@ -17,11 +20,13 @@ module SurgeAPI
17
20
  ) -> ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability]
18
21
 
19
22
  def initialize: (
23
+ account_id: String,
20
24
  ?capabilities: ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability],
21
25
  ?request_options: SurgeAPI::request_opts
22
26
  ) -> void
23
27
 
24
28
  def to_hash: -> {
29
+ account_id: String,
25
30
  capabilities: ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability],
26
31
  request_options: SurgeAPI::RequestOptions
27
32
  }
@@ -2,6 +2,7 @@ module SurgeAPI
2
2
  module Models
3
3
  type account_update_params =
4
4
  {
5
+ id: String,
5
6
  brand_name: String,
6
7
  name: String,
7
8
  organization: SurgeAPI::AccountUpdateParams::Organization,
@@ -13,6 +14,8 @@ module SurgeAPI
13
14
  extend SurgeAPI::Internal::Type::RequestParameters::Converter
14
15
  include SurgeAPI::Internal::Type::RequestParameters
15
16
 
17
+ attr_accessor id: String
18
+
16
19
  attr_reader brand_name: String?
17
20
 
18
21
  def brand_name=: (String) -> String
@@ -30,6 +33,7 @@ module SurgeAPI
30
33
  attr_accessor time_zone: String?
31
34
 
32
35
  def initialize: (
36
+ id: String,
33
37
  ?brand_name: String,
34
38
  ?name: String,
35
39
  ?organization: SurgeAPI::AccountUpdateParams::Organization,
@@ -38,6 +42,7 @@ module SurgeAPI
38
42
  ) -> void
39
43
 
40
44
  def to_hash: -> {
45
+ id: String,
41
46
  brand_name: String,
42
47
  name: String,
43
48
  organization: SurgeAPI::AccountUpdateParams::Organization,
@@ -1,15 +1,23 @@
1
1
  module SurgeAPI
2
2
  module Models
3
3
  type attachment_get_file_params =
4
- { } & SurgeAPI::Internal::Type::request_parameters
4
+ { attachment_id: String } & SurgeAPI::Internal::Type::request_parameters
5
5
 
6
6
  class AttachmentGetFileParams < SurgeAPI::Internal::Type::BaseModel
7
7
  extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
8
  include SurgeAPI::Internal::Type::RequestParameters
9
9
 
10
- def initialize: (?request_options: SurgeAPI::request_opts) -> void
10
+ attr_accessor attachment_id: String
11
11
 
12
- def to_hash: -> { request_options: SurgeAPI::RequestOptions }
12
+ def initialize: (
13
+ attachment_id: String,
14
+ ?request_options: SurgeAPI::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> {
18
+ attachment_id: String,
19
+ request_options: SurgeAPI::RequestOptions
20
+ }
13
21
  end
14
22
  end
15
23
  end
@@ -1,20 +1,28 @@
1
1
  module SurgeAPI
2
2
  module Models
3
3
  type audience_add_contact_params =
4
- { id: String } & SurgeAPI::Internal::Type::request_parameters
4
+ { audience_id: String, id: String }
5
+ & SurgeAPI::Internal::Type::request_parameters
5
6
 
6
7
  class AudienceAddContactParams < SurgeAPI::Internal::Type::BaseModel
7
8
  extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
9
  include SurgeAPI::Internal::Type::RequestParameters
9
10
 
11
+ attr_accessor audience_id: String
12
+
10
13
  attr_accessor id: String
11
14
 
12
15
  def initialize: (
16
+ audience_id: String,
13
17
  id: String,
14
18
  ?request_options: SurgeAPI::request_opts
15
19
  ) -> void
16
20
 
17
- def to_hash: -> { id: String, request_options: SurgeAPI::RequestOptions }
21
+ def to_hash: -> {
22
+ audience_id: String,
23
+ id: String,
24
+ request_options: SurgeAPI::RequestOptions
25
+ }
18
26
  end
19
27
  end
20
28
  end