surge_api 0.18.0 → 0.20.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +7 -7
  4. data/lib/surge_api/models/call_ended_webhook_event.rb +25 -1
  5. data/lib/surge_api/models/phone_number.rb +55 -4
  6. data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +60 -3
  7. data/lib/surge_api/models/phone_number_list_available_numbers_params.rb +88 -0
  8. data/lib/surge_api/models/phone_number_list_available_numbers_response.rb +61 -0
  9. data/lib/surge_api/models/phone_number_purchase_params.rb +10 -1
  10. data/lib/surge_api/models/phone_number_retrieve_params.rb +22 -0
  11. data/lib/surge_api/models/recording_completed_webhook_event.rb +25 -1
  12. data/lib/surge_api/models/voicemail_received_webhook_event.rb +25 -1
  13. data/lib/surge_api/models.rb +4 -0
  14. data/lib/surge_api/resources/phone_numbers.rb +66 -3
  15. data/lib/surge_api/version.rb +1 -1
  16. data/lib/surge_api.rb +3 -0
  17. data/rbi/surge_api/models/call_ended_webhook_event.rbi +27 -3
  18. data/rbi/surge_api/models/phone_number.rbi +108 -2
  19. data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +129 -2
  20. data/rbi/surge_api/models/phone_number_list_available_numbers_params.rbi +183 -0
  21. data/rbi/surge_api/models/phone_number_list_available_numbers_response.rbi +139 -0
  22. data/rbi/surge_api/models/phone_number_purchase_params.rbi +13 -0
  23. data/rbi/surge_api/models/phone_number_retrieve_params.rbi +43 -0
  24. data/rbi/surge_api/models/recording_completed_webhook_event.rbi +27 -3
  25. data/rbi/surge_api/models/voicemail_received_webhook_event.rbi +27 -3
  26. data/rbi/surge_api/models.rbi +5 -0
  27. data/rbi/surge_api/resources/phone_numbers.rbi +59 -2
  28. data/sig/surge_api/models/call_ended_webhook_event.rbs +18 -3
  29. data/sig/surge_api/models/phone_number.rbs +41 -0
  30. data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +41 -0
  31. data/sig/surge_api/models/phone_number_list_available_numbers_params.rbs +83 -0
  32. data/sig/surge_api/models/phone_number_list_available_numbers_response.rbs +52 -0
  33. data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
  34. data/sig/surge_api/models/phone_number_retrieve_params.rbs +20 -0
  35. data/sig/surge_api/models/recording_completed_webhook_event.rbs +18 -3
  36. data/sig/surge_api/models/voicemail_received_webhook_event.rbs +18 -3
  37. data/sig/surge_api/models.rbs +4 -0
  38. data/sig/surge_api/resources/phone_numbers.rbs +16 -0
  39. metadata +11 -2
@@ -3,6 +3,26 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class PhoneNumbers
6
+ # Retrieves a PhoneNumber object.
7
+ #
8
+ # @overload retrieve(id, request_options: {})
9
+ #
10
+ # @param id [String] The ID of the phone number to retrieve.
11
+ #
12
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [SurgeAPI::Models::PhoneNumber]
15
+ #
16
+ # @see SurgeAPI::Models::PhoneNumberRetrieveParams
17
+ def retrieve(id, params = {})
18
+ @client.request(
19
+ method: :get,
20
+ path: ["phone_numbers/%1$s", id],
21
+ model: SurgeAPI::PhoneNumber,
22
+ options: params[:request_options]
23
+ )
24
+ end
25
+
6
26
  # Updates a phone number's details.
7
27
  #
8
28
  # @overload update(id, campaign_id: nil, name: nil, request_options: {})
@@ -60,13 +80,54 @@ module SurgeAPI
60
80
  )
61
81
  end
62
82
 
83
+ # Some parameter documentations has been truncated, see
84
+ # {SurgeAPI::Models::PhoneNumberListAvailableNumbersParams} for more details.
85
+ #
86
+ # Browse purchasable phone numbers from Surge inventory before buying.
87
+ #
88
+ # Pagination cursors are always null for now.
89
+ #
90
+ # @overload list_available_numbers(account_id, type:, after: nil, area_code: nil, before: nil, country: nil, request_options: {})
91
+ #
92
+ # @param account_id [String] The account ID to list available phone numbers for.
93
+ #
94
+ # @param type [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Type] Whether to search for local or toll-free numbers.
95
+ #
96
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
97
+ #
98
+ # @param area_code [String] Filter by 3-digit area code.
99
+ #
100
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
101
+ #
102
+ # @param country [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Country] ISO country code to search in.
103
+ #
104
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
105
+ #
106
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse>]
107
+ #
108
+ # @see SurgeAPI::Models::PhoneNumberListAvailableNumbersParams
109
+ def list_available_numbers(account_id, params)
110
+ parsed, options = SurgeAPI::PhoneNumberListAvailableNumbersParams.dump_request(params)
111
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
112
+ @client.request(
113
+ method: :get,
114
+ path: ["accounts/%1$s/available_phone_numbers", account_id],
115
+ query: query,
116
+ page: SurgeAPI::Internal::Cursor,
117
+ model: SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse,
118
+ options: options
119
+ )
120
+ end
121
+
63
122
  # Some parameter documentations has been truncated, see
64
123
  # {SurgeAPI::Models::PhoneNumberPurchaseParams} for more details.
65
124
  #
66
- # Purchase a new phone number for the account. You can specify search criteria or
67
- # let the system select a random number.
125
+ # Purchase a new phone number for the account. You can specify an exact phone
126
+ # number, search criteria, or let the system select a random number.
68
127
  #
69
- # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
128
+ # When `phone_number` is provided, all other search parameters are ignored.
129
+ #
130
+ # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, phone_number: nil, type: nil, request_options: {})
70
131
  #
71
132
  # @param account_id [String] The account for which the phone number should be created.
72
133
  #
@@ -78,6 +139,8 @@ module SurgeAPI
78
139
  #
79
140
  # @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
80
141
  #
142
+ # @param phone_number [String] The exact phone number to purchase in E.164 format. When provided, all other sea
143
+ #
81
144
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
82
145
  #
83
146
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.18.0"
4
+ VERSION = "0.20.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -99,9 +99,12 @@ require_relative "surge_api/models/message_sent_webhook_event"
99
99
  require_relative "surge_api/models/organization"
100
100
  require_relative "surge_api/models/phone_number"
101
101
  require_relative "surge_api/models/phone_number_attached_to_campaign_webhook_event"
102
+ require_relative "surge_api/models/phone_number_list_available_numbers_params"
103
+ require_relative "surge_api/models/phone_number_list_available_numbers_response"
102
104
  require_relative "surge_api/models/phone_number_list_params"
103
105
  require_relative "surge_api/models/phone_number_purchase_params"
104
106
  require_relative "surge_api/models/phone_number_release_params"
107
+ require_relative "surge_api/models/phone_number_retrieve_params"
105
108
  require_relative "surge_api/models/phone_number_update_params"
106
109
  require_relative "surge_api/models/recording_completed_webhook_event"
107
110
  require_relative "surge_api/models/recording_delete_params"
@@ -94,6 +94,18 @@ module SurgeAPI
94
94
  end
95
95
  attr_accessor :status
96
96
 
97
+ # The E.164 phone number of the caller
98
+ sig { returns(T.nilable(String)) }
99
+ attr_accessor :from
100
+
101
+ # The Surge phone number ID (e.g. pn\_...)
102
+ sig { returns(T.nilable(String)) }
103
+ attr_accessor :phone_number_id
104
+
105
+ # The E.164 phone number of the callee
106
+ sig { returns(T.nilable(String)) }
107
+ attr_accessor :to
108
+
97
109
  # The data associated with the event
98
110
  sig do
99
111
  params(
@@ -101,7 +113,10 @@ module SurgeAPI
101
113
  contact: SurgeAPI::Contact::OrHash,
102
114
  duration: Integer,
103
115
  initiated_at: Time,
104
- status: SurgeAPI::CallEndedWebhookEvent::Data::Status::OrSymbol
116
+ status: SurgeAPI::CallEndedWebhookEvent::Data::Status::OrSymbol,
117
+ from: T.nilable(String),
118
+ phone_number_id: T.nilable(String),
119
+ to: T.nilable(String)
105
120
  ).returns(T.attached_class)
106
121
  end
107
122
  def self.new(
@@ -114,7 +129,13 @@ module SurgeAPI
114
129
  # When the call was initiated
115
130
  initiated_at:,
116
131
  # The status of the call
117
- status:
132
+ status:,
133
+ # The E.164 phone number of the caller
134
+ from: nil,
135
+ # The Surge phone number ID (e.g. pn\_...)
136
+ phone_number_id: nil,
137
+ # The E.164 phone number of the callee
138
+ to: nil
118
139
  )
119
140
  end
120
141
 
@@ -126,7 +147,10 @@ module SurgeAPI
126
147
  duration: Integer,
127
148
  initiated_at: Time,
128
149
  status:
129
- SurgeAPI::CallEndedWebhookEvent::Data::Status::TaggedSymbol
150
+ SurgeAPI::CallEndedWebhookEvent::Data::Status::TaggedSymbol,
151
+ from: T.nilable(String),
152
+ phone_number_id: T.nilable(String),
153
+ to: T.nilable(String)
130
154
  }
131
155
  )
132
156
  end
@@ -12,7 +12,19 @@ module SurgeAPI
12
12
  sig { returns(String) }
13
13
  attr_accessor :id
14
14
 
15
- # The unique identifier of the campaign this phone number is attached to, if any
15
+ # Campaign attachment details for a domestic local phone number
16
+ sig { returns(T.nilable(SurgeAPI::PhoneNumber::Campaign)) }
17
+ attr_reader :campaign
18
+
19
+ sig do
20
+ params(
21
+ campaign: T.nilable(SurgeAPI::PhoneNumber::Campaign::OrHash)
22
+ ).void
23
+ end
24
+ attr_writer :campaign
25
+
26
+ # Deprecated. The unique identifier of the campaign this phone number is attached
27
+ # to, if any
16
28
  sig { returns(T.nilable(String)) }
17
29
  attr_accessor :campaign_id
18
30
 
@@ -32,6 +44,7 @@ module SurgeAPI
32
44
  sig do
33
45
  params(
34
46
  id: String,
47
+ campaign: T.nilable(SurgeAPI::PhoneNumber::Campaign::OrHash),
35
48
  campaign_id: T.nilable(String),
36
49
  name: T.nilable(String),
37
50
  number: String,
@@ -41,7 +54,10 @@ module SurgeAPI
41
54
  def self.new(
42
55
  # Unique identifier for the phone number
43
56
  id:,
44
- # The unique identifier of the campaign this phone number is attached to, if any
57
+ # Campaign attachment details for a domestic local phone number
58
+ campaign:,
59
+ # Deprecated. The unique identifier of the campaign this phone number is attached
60
+ # to, if any
45
61
  campaign_id:,
46
62
  # A human-readable name for the phone number
47
63
  name:,
@@ -56,6 +72,7 @@ module SurgeAPI
56
72
  override.returns(
57
73
  {
58
74
  id: String,
75
+ campaign: T.nilable(SurgeAPI::PhoneNumber::Campaign),
59
76
  campaign_id: T.nilable(String),
60
77
  name: T.nilable(String),
61
78
  number: String,
@@ -66,6 +83,95 @@ module SurgeAPI
66
83
  def to_hash
67
84
  end
68
85
 
86
+ class Campaign < SurgeAPI::Internal::Type::BaseModel
87
+ OrHash =
88
+ T.type_alias do
89
+ T.any(SurgeAPI::PhoneNumber::Campaign, SurgeAPI::Internal::AnyHash)
90
+ end
91
+
92
+ # The unique identifier of the campaign this phone number is attached to
93
+ sig { returns(String) }
94
+ attr_accessor :id
95
+
96
+ # The current campaign attachment status for this phone number.
97
+ sig do
98
+ returns(
99
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
100
+ )
101
+ end
102
+ attr_accessor :attachment_status
103
+
104
+ # Campaign attachment details for a domestic local phone number
105
+ sig do
106
+ params(
107
+ id: String,
108
+ attachment_status:
109
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::OrSymbol
110
+ ).returns(T.attached_class)
111
+ end
112
+ def self.new(
113
+ # The unique identifier of the campaign this phone number is attached to
114
+ id:,
115
+ # The current campaign attachment status for this phone number.
116
+ attachment_status:
117
+ )
118
+ end
119
+
120
+ sig do
121
+ override.returns(
122
+ {
123
+ id: String,
124
+ attachment_status:
125
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
126
+ }
127
+ )
128
+ end
129
+ def to_hash
130
+ end
131
+
132
+ # The current campaign attachment status for this phone number.
133
+ module AttachmentStatus
134
+ extend SurgeAPI::Internal::Type::Enum
135
+
136
+ TaggedSymbol =
137
+ T.type_alias do
138
+ T.all(Symbol, SurgeAPI::PhoneNumber::Campaign::AttachmentStatus)
139
+ end
140
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
141
+
142
+ ATTACHED =
143
+ T.let(
144
+ :attached,
145
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
146
+ )
147
+ ATTACHMENT_PENDING =
148
+ T.let(
149
+ :attachment_pending,
150
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
151
+ )
152
+ DETACHED =
153
+ T.let(
154
+ :detached,
155
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
156
+ )
157
+ DETACHMENT_PENDING =
158
+ T.let(
159
+ :detachment_pending,
160
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
161
+ )
162
+
163
+ sig do
164
+ override.returns(
165
+ T::Array[
166
+ SurgeAPI::PhoneNumber::Campaign::AttachmentStatus::TaggedSymbol
167
+ ]
168
+ )
169
+ end
170
+ def self.values
171
+ end
172
+ end
173
+ end
174
+
69
175
  # Whether the phone number is local, toll-free, or short code
70
176
  module Type
71
177
  extend SurgeAPI::Internal::Type::Enum
@@ -84,7 +84,28 @@ module SurgeAPI
84
84
  sig { returns(String) }
85
85
  attr_accessor :id
86
86
 
87
- # The unique identifier of the campaign this phone number is attached to
87
+ # Campaign attachment details for a domestic local phone number
88
+ sig do
89
+ returns(
90
+ T.nilable(
91
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign
92
+ )
93
+ )
94
+ end
95
+ attr_reader :campaign
96
+
97
+ sig do
98
+ params(
99
+ campaign:
100
+ T.nilable(
101
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::OrHash
102
+ )
103
+ ).void
104
+ end
105
+ attr_writer :campaign
106
+
107
+ # Deprecated. The unique identifier of the campaign this phone number is attached
108
+ # to
88
109
  sig { returns(String) }
89
110
  attr_accessor :campaign_id
90
111
 
@@ -108,6 +129,10 @@ module SurgeAPI
108
129
  sig do
109
130
  params(
110
131
  id: String,
132
+ campaign:
133
+ T.nilable(
134
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::OrHash
135
+ ),
111
136
  campaign_id: String,
112
137
  name: T.nilable(String),
113
138
  number: String,
@@ -118,7 +143,10 @@ module SurgeAPI
118
143
  def self.new(
119
144
  # The unique identifier for the phone number
120
145
  id:,
121
- # The unique identifier of the campaign this phone number is attached to
146
+ # Campaign attachment details for a domestic local phone number
147
+ campaign:,
148
+ # Deprecated. The unique identifier of the campaign this phone number is attached
149
+ # to
122
150
  campaign_id:,
123
151
  # A human-readable name for the phone number
124
152
  name:,
@@ -133,6 +161,10 @@ module SurgeAPI
133
161
  override.returns(
134
162
  {
135
163
  id: String,
164
+ campaign:
165
+ T.nilable(
166
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign
167
+ ),
136
168
  campaign_id: String,
137
169
  name: T.nilable(String),
138
170
  number: String,
@@ -144,6 +176,101 @@ module SurgeAPI
144
176
  def to_hash
145
177
  end
146
178
 
179
+ class Campaign < SurgeAPI::Internal::Type::BaseModel
180
+ OrHash =
181
+ T.type_alias do
182
+ T.any(
183
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign,
184
+ SurgeAPI::Internal::AnyHash
185
+ )
186
+ end
187
+
188
+ # The unique identifier of the campaign this phone number is attached to
189
+ sig { returns(String) }
190
+ attr_accessor :id
191
+
192
+ # The current campaign attachment status for this phone number.
193
+ sig do
194
+ returns(
195
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
196
+ )
197
+ end
198
+ attr_accessor :attachment_status
199
+
200
+ # Campaign attachment details for a domestic local phone number
201
+ sig do
202
+ params(
203
+ id: String,
204
+ attachment_status:
205
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::OrSymbol
206
+ ).returns(T.attached_class)
207
+ end
208
+ def self.new(
209
+ # The unique identifier of the campaign this phone number is attached to
210
+ id:,
211
+ # The current campaign attachment status for this phone number.
212
+ attachment_status:
213
+ )
214
+ end
215
+
216
+ sig do
217
+ override.returns(
218
+ {
219
+ id: String,
220
+ attachment_status:
221
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
222
+ }
223
+ )
224
+ end
225
+ def to_hash
226
+ end
227
+
228
+ # The current campaign attachment status for this phone number.
229
+ module AttachmentStatus
230
+ extend SurgeAPI::Internal::Type::Enum
231
+
232
+ TaggedSymbol =
233
+ T.type_alias do
234
+ T.all(
235
+ Symbol,
236
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus
237
+ )
238
+ end
239
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
240
+
241
+ ATTACHED =
242
+ T.let(
243
+ :attached,
244
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
245
+ )
246
+ ATTACHMENT_PENDING =
247
+ T.let(
248
+ :attachment_pending,
249
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
250
+ )
251
+ DETACHED =
252
+ T.let(
253
+ :detached,
254
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
255
+ )
256
+ DETACHMENT_PENDING =
257
+ T.let(
258
+ :detachment_pending,
259
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
260
+ )
261
+
262
+ sig do
263
+ override.returns(
264
+ T::Array[
265
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus::TaggedSymbol
266
+ ]
267
+ )
268
+ end
269
+ def self.values
270
+ end
271
+ end
272
+ end
273
+
147
274
  # Whether the phone number is local, toll-free, or short code
148
275
  module Type
149
276
  extend SurgeAPI::Internal::Type::Enum
@@ -0,0 +1,183 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class PhoneNumberListAvailableNumbersParams < SurgeAPI::Internal::Type::BaseModel
6
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
7
+ include SurgeAPI::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ SurgeAPI::PhoneNumberListAvailableNumbersParams,
13
+ SurgeAPI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The account ID to list available phone numbers for.
18
+ sig { returns(String) }
19
+ attr_accessor :account_id
20
+
21
+ # Whether to search for local or toll-free numbers.
22
+ sig do
23
+ returns(SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::OrSymbol)
24
+ end
25
+ attr_accessor :type
26
+
27
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
28
+ sig { returns(T.nilable(String)) }
29
+ attr_reader :after
30
+
31
+ sig { params(after: String).void }
32
+ attr_writer :after
33
+
34
+ # Filter by 3-digit area code.
35
+ sig { returns(T.nilable(String)) }
36
+ attr_reader :area_code
37
+
38
+ sig { params(area_code: String).void }
39
+ attr_writer :area_code
40
+
41
+ # Cursor for backward pagination. Use the previous_cursor from a previous
42
+ # response.
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :before
45
+
46
+ sig { params(before: String).void }
47
+ attr_writer :before
48
+
49
+ # ISO country code to search in.
50
+ sig do
51
+ returns(
52
+ T.nilable(
53
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::OrSymbol
54
+ )
55
+ )
56
+ end
57
+ attr_reader :country
58
+
59
+ sig do
60
+ params(
61
+ country:
62
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::OrSymbol
63
+ ).void
64
+ end
65
+ attr_writer :country
66
+
67
+ sig do
68
+ params(
69
+ account_id: String,
70
+ type: SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::OrSymbol,
71
+ after: String,
72
+ area_code: String,
73
+ before: String,
74
+ country:
75
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::OrSymbol,
76
+ request_options: SurgeAPI::RequestOptions::OrHash
77
+ ).returns(T.attached_class)
78
+ end
79
+ def self.new(
80
+ # The account ID to list available phone numbers for.
81
+ account_id:,
82
+ # Whether to search for local or toll-free numbers.
83
+ type:,
84
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
85
+ after: nil,
86
+ # Filter by 3-digit area code.
87
+ area_code: nil,
88
+ # Cursor for backward pagination. Use the previous_cursor from a previous
89
+ # response.
90
+ before: nil,
91
+ # ISO country code to search in.
92
+ country: nil,
93
+ request_options: {}
94
+ )
95
+ end
96
+
97
+ sig do
98
+ override.returns(
99
+ {
100
+ account_id: String,
101
+ type:
102
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::OrSymbol,
103
+ after: String,
104
+ area_code: String,
105
+ before: String,
106
+ country:
107
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::OrSymbol,
108
+ request_options: SurgeAPI::RequestOptions
109
+ }
110
+ )
111
+ end
112
+ def to_hash
113
+ end
114
+
115
+ # Whether to search for local or toll-free numbers.
116
+ module Type
117
+ extend SurgeAPI::Internal::Type::Enum
118
+
119
+ TaggedSymbol =
120
+ T.type_alias do
121
+ T.all(Symbol, SurgeAPI::PhoneNumberListAvailableNumbersParams::Type)
122
+ end
123
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
124
+
125
+ LOCAL =
126
+ T.let(
127
+ :local,
128
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::TaggedSymbol
129
+ )
130
+ TOLL_FREE =
131
+ T.let(
132
+ :toll_free,
133
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::TaggedSymbol
134
+ )
135
+
136
+ sig do
137
+ override.returns(
138
+ T::Array[
139
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::TaggedSymbol
140
+ ]
141
+ )
142
+ end
143
+ def self.values
144
+ end
145
+ end
146
+
147
+ # ISO country code to search in.
148
+ module Country
149
+ extend SurgeAPI::Internal::Type::Enum
150
+
151
+ TaggedSymbol =
152
+ T.type_alias do
153
+ T.all(
154
+ Symbol,
155
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country
156
+ )
157
+ end
158
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
159
+
160
+ US =
161
+ T.let(
162
+ :US,
163
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::TaggedSymbol
164
+ )
165
+ CA =
166
+ T.let(
167
+ :CA,
168
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::TaggedSymbol
169
+ )
170
+
171
+ sig do
172
+ override.returns(
173
+ T::Array[
174
+ SurgeAPI::PhoneNumberListAvailableNumbersParams::Country::TaggedSymbol
175
+ ]
176
+ )
177
+ end
178
+ def self.values
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end