surge_api 0.9.0 → 0.10.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +1 -1
  4. data/lib/surge_api/client.rb +4 -0
  5. data/lib/surge_api/internal/util.rb +1 -1
  6. data/lib/surge_api/models/campaign.rb +27 -1
  7. data/lib/surge_api/models/campaign_retrieve_params.rb +14 -0
  8. data/lib/surge_api/models/message.rb +2 -2
  9. data/lib/surge_api/models/recording_completed_webhook_event.rb +136 -0
  10. data/lib/surge_api/models/recording_get_file_params.rb +14 -0
  11. data/lib/surge_api/models/recording_get_file_response.rb +19 -0
  12. data/lib/surge_api/models/unwrap_webhook_event.rb +5 -1
  13. data/lib/surge_api/models/voicemail_received_webhook_event.rb +144 -0
  14. data/lib/surge_api/models.rb +8 -0
  15. data/lib/surge_api/resources/campaigns.rb +20 -0
  16. data/lib/surge_api/resources/recordings.rb +35 -0
  17. data/lib/surge_api/resources/webhooks.rb +1 -1
  18. data/lib/surge_api/version.rb +1 -1
  19. data/lib/surge_api.rb +6 -0
  20. data/rbi/surge_api/client.rbi +3 -0
  21. data/rbi/surge_api/internal/util.rbi +1 -1
  22. data/rbi/surge_api/models/campaign.rbi +32 -0
  23. data/rbi/surge_api/models/campaign_retrieve_params.rbi +27 -0
  24. data/rbi/surge_api/models/message.rbi +3 -6
  25. data/rbi/surge_api/models/recording_completed_webhook_event.rbi +277 -0
  26. data/rbi/surge_api/models/recording_get_file_params.rbi +27 -0
  27. data/rbi/surge_api/models/recording_get_file_response.rbi +34 -0
  28. data/rbi/surge_api/models/unwrap_webhook_event.rbi +3 -1
  29. data/rbi/surge_api/models/voicemail_received_webhook_event.rbi +283 -0
  30. data/rbi/surge_api/models.rbi +10 -0
  31. data/rbi/surge_api/resources/campaigns.rbi +14 -0
  32. data/rbi/surge_api/resources/recordings.rbi +27 -0
  33. data/rbi/surge_api/resources/webhooks.rbi +3 -1
  34. data/sig/surge_api/client.rbs +2 -0
  35. data/sig/surge_api/models/campaign.rbs +28 -0
  36. data/sig/surge_api/models/campaign_retrieve_params.rbs +15 -0
  37. data/sig/surge_api/models/message.rbs +4 -6
  38. data/sig/surge_api/models/recording_completed_webhook_event.rbs +126 -0
  39. data/sig/surge_api/models/recording_get_file_params.rbs +15 -0
  40. data/sig/surge_api/models/recording_get_file_response.rbs +13 -0
  41. data/sig/surge_api/models/unwrap_webhook_event.rbs +2 -0
  42. data/sig/surge_api/models/voicemail_received_webhook_event.rbs +131 -0
  43. data/sig/surge_api/models.rbs +8 -0
  44. data/sig/surge_api/resources/campaigns.rbs +5 -0
  45. data/sig/surge_api/resources/recordings.rbs +12 -0
  46. data/sig/surge_api/resources/webhooks.rbs +3 -1
  47. metadata +20 -2
@@ -50,6 +50,10 @@ module SurgeAPI
50
50
  sig { returns(String) }
51
51
  attr_accessor :privacy_policy_url
52
52
 
53
+ # The current status of the campaign.
54
+ sig { returns(SurgeAPI::Campaign::Status::TaggedSymbol) }
55
+ attr_accessor :status
56
+
53
57
  # A list containing 1-5 types of messages that will be sent with this campaign.
54
58
  #
55
59
  # The following use cases are typically available to all brands:
@@ -123,6 +127,7 @@ module SurgeAPI
123
127
  includes: T::Array[SurgeAPI::Campaign::Include::OrSymbol],
124
128
  message_samples: T::Array[String],
125
129
  privacy_policy_url: String,
130
+ status: SurgeAPI::Campaign::Status::OrSymbol,
126
131
  use_cases: T::Array[SurgeAPI::Campaign::UseCase::OrSymbol],
127
132
  volume: SurgeAPI::Campaign::Volume::OrSymbol,
128
133
  link_sample: String,
@@ -162,6 +167,8 @@ module SurgeAPI
162
167
  # privacy policy if it's the policy that is displayed to end users when they opt
163
168
  # in to messaging.
164
169
  privacy_policy_url:,
170
+ # The current status of the campaign.
171
+ status:,
165
172
  # A list containing 1-5 types of messages that will be sent with this campaign.
166
173
  #
167
174
  # The following use cases are typically available to all brands:
@@ -223,6 +230,7 @@ module SurgeAPI
223
230
  includes: T::Array[SurgeAPI::Campaign::Include::TaggedSymbol],
224
231
  message_samples: T::Array[String],
225
232
  privacy_policy_url: String,
233
+ status: SurgeAPI::Campaign::Status::TaggedSymbol,
226
234
  use_cases: T::Array[SurgeAPI::Campaign::UseCase::TaggedSymbol],
227
235
  volume: SurgeAPI::Campaign::Volume::TaggedSymbol,
228
236
  link_sample: String,
@@ -254,6 +262,30 @@ module SurgeAPI
254
262
  end
255
263
  end
256
264
 
265
+ # The current status of the campaign.
266
+ module Status
267
+ extend SurgeAPI::Internal::Type::Enum
268
+
269
+ TaggedSymbol =
270
+ T.type_alias { T.all(Symbol, SurgeAPI::Campaign::Status) }
271
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
272
+
273
+ ACTIVE = T.let(:active, SurgeAPI::Campaign::Status::TaggedSymbol)
274
+ CANCELED = T.let(:canceled, SurgeAPI::Campaign::Status::TaggedSymbol)
275
+ CREATED = T.let(:created, SurgeAPI::Campaign::Status::TaggedSymbol)
276
+ DEACTIVATED =
277
+ T.let(:deactivated, SurgeAPI::Campaign::Status::TaggedSymbol)
278
+ IN_REVIEW = T.let(:in_review, SurgeAPI::Campaign::Status::TaggedSymbol)
279
+ PENDING = T.let(:pending, SurgeAPI::Campaign::Status::TaggedSymbol)
280
+ REJECTED = T.let(:rejected, SurgeAPI::Campaign::Status::TaggedSymbol)
281
+
282
+ sig do
283
+ override.returns(T::Array[SurgeAPI::Campaign::Status::TaggedSymbol])
284
+ end
285
+ def self.values
286
+ end
287
+ end
288
+
257
289
  module UseCase
258
290
  extend SurgeAPI::Internal::Type::Enum
259
291
 
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class CampaignRetrieveParams < 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(SurgeAPI::CampaignRetrieveParams, SurgeAPI::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: SurgeAPI::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: SurgeAPI::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -26,10 +26,7 @@ module SurgeAPI
26
26
  # The ID of the blast this message belongs to, if any. This can be used to
27
27
  # attribute messages back to a specific blast.
28
28
  sig { returns(T.nilable(String)) }
29
- attr_reader :blast_id
30
-
31
- sig { params(blast_id: String).void }
32
- attr_writer :blast_id
29
+ attr_accessor :blast_id
33
30
 
34
31
  # The message body.
35
32
  sig { returns(T.nilable(String)) }
@@ -54,7 +51,7 @@ module SurgeAPI
54
51
  params(
55
52
  id: String,
56
53
  attachments: T::Array[SurgeAPI::Message::Attachment::OrHash],
57
- blast_id: String,
54
+ blast_id: T.nilable(String),
58
55
  body: T.nilable(String),
59
56
  conversation: SurgeAPI::Message::Conversation::OrHash,
60
57
  metadata: T::Hash[Symbol, String]
@@ -81,7 +78,7 @@ module SurgeAPI
81
78
  {
82
79
  id: String,
83
80
  attachments: T::Array[SurgeAPI::Message::Attachment],
84
- blast_id: String,
81
+ blast_id: T.nilable(String),
85
82
  body: T.nilable(String),
86
83
  conversation: SurgeAPI::Message::Conversation,
87
84
  metadata: T::Hash[Symbol, String]
@@ -0,0 +1,277 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class RecordingCompletedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SurgeAPI::RecordingCompletedWebhookEvent,
10
+ SurgeAPI::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The ID of the account in which this event occurred
15
+ sig { returns(String) }
16
+ attr_accessor :account_id
17
+
18
+ # The data associated with the event
19
+ sig { returns(SurgeAPI::RecordingCompletedWebhookEvent::Data) }
20
+ attr_reader :data
21
+
22
+ sig do
23
+ params(
24
+ data: SurgeAPI::RecordingCompletedWebhookEvent::Data::OrHash
25
+ ).void
26
+ end
27
+ attr_writer :data
28
+
29
+ # The timestamp when this event occurred, in ISO8601 format
30
+ sig { returns(Time) }
31
+ attr_accessor :timestamp
32
+
33
+ # The type of the event. Always `recording.completed` for this event.
34
+ sig { returns(Symbol) }
35
+ attr_accessor :type
36
+
37
+ sig do
38
+ params(
39
+ account_id: String,
40
+ data: SurgeAPI::RecordingCompletedWebhookEvent::Data::OrHash,
41
+ timestamp: Time,
42
+ type: Symbol
43
+ ).returns(T.attached_class)
44
+ end
45
+ def self.new(
46
+ # The ID of the account in which this event occurred
47
+ account_id:,
48
+ # The data associated with the event
49
+ data:,
50
+ # The timestamp when this event occurred, in ISO8601 format
51
+ timestamp:,
52
+ # The type of the event. Always `recording.completed` for this event.
53
+ type: :"recording.completed"
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ account_id: String,
61
+ data: SurgeAPI::RecordingCompletedWebhookEvent::Data,
62
+ timestamp: Time,
63
+ type: Symbol
64
+ }
65
+ )
66
+ end
67
+ def to_hash
68
+ end
69
+
70
+ class Data < SurgeAPI::Internal::Type::BaseModel
71
+ OrHash =
72
+ T.type_alias do
73
+ T.any(
74
+ SurgeAPI::RecordingCompletedWebhookEvent::Data,
75
+ SurgeAPI::Internal::AnyHash
76
+ )
77
+ end
78
+
79
+ # The unique identifier for the recording
80
+ sig { returns(String) }
81
+ attr_accessor :id
82
+
83
+ # The call that produced this recording
84
+ sig { returns(SurgeAPI::RecordingCompletedWebhookEvent::Data::Call) }
85
+ attr_reader :call
86
+
87
+ sig do
88
+ params(
89
+ call: SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::OrHash
90
+ ).void
91
+ end
92
+ attr_writer :call
93
+
94
+ # The duration of the recording in seconds
95
+ sig { returns(Integer) }
96
+ attr_accessor :duration
97
+
98
+ # The data associated with the event
99
+ sig do
100
+ params(
101
+ id: String,
102
+ call: SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::OrHash,
103
+ duration: Integer
104
+ ).returns(T.attached_class)
105
+ end
106
+ def self.new(
107
+ # The unique identifier for the recording
108
+ id:,
109
+ # The call that produced this recording
110
+ call:,
111
+ # The duration of the recording in seconds
112
+ duration:
113
+ )
114
+ end
115
+
116
+ sig do
117
+ override.returns(
118
+ {
119
+ id: String,
120
+ call: SurgeAPI::RecordingCompletedWebhookEvent::Data::Call,
121
+ duration: Integer
122
+ }
123
+ )
124
+ end
125
+ def to_hash
126
+ end
127
+
128
+ class Call < SurgeAPI::Internal::Type::BaseModel
129
+ OrHash =
130
+ T.type_alias do
131
+ T.any(
132
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call,
133
+ SurgeAPI::Internal::AnyHash
134
+ )
135
+ end
136
+
137
+ # The unique identifier for the call
138
+ sig { returns(String) }
139
+ attr_accessor :id
140
+
141
+ # A contact who has consented to receive messages
142
+ sig { returns(SurgeAPI::Contact) }
143
+ attr_reader :contact
144
+
145
+ sig { params(contact: SurgeAPI::Contact::OrHash).void }
146
+ attr_writer :contact
147
+
148
+ # The duration of the call in seconds
149
+ sig { returns(Integer) }
150
+ attr_accessor :duration
151
+
152
+ # When the call was initiated
153
+ sig { returns(Time) }
154
+ attr_accessor :initiated_at
155
+
156
+ # The status of the call
157
+ sig do
158
+ returns(
159
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
160
+ )
161
+ end
162
+ attr_accessor :status
163
+
164
+ # The call that produced this recording
165
+ sig do
166
+ params(
167
+ id: String,
168
+ contact: SurgeAPI::Contact::OrHash,
169
+ duration: Integer,
170
+ initiated_at: Time,
171
+ status:
172
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::OrSymbol
173
+ ).returns(T.attached_class)
174
+ end
175
+ def self.new(
176
+ # The unique identifier for the call
177
+ id:,
178
+ # A contact who has consented to receive messages
179
+ contact:,
180
+ # The duration of the call in seconds
181
+ duration:,
182
+ # When the call was initiated
183
+ initiated_at:,
184
+ # The status of the call
185
+ status:
186
+ )
187
+ end
188
+
189
+ sig do
190
+ override.returns(
191
+ {
192
+ id: String,
193
+ contact: SurgeAPI::Contact,
194
+ duration: Integer,
195
+ initiated_at: Time,
196
+ status:
197
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
198
+ }
199
+ )
200
+ end
201
+ def to_hash
202
+ end
203
+
204
+ # The status of the call
205
+ module Status
206
+ extend SurgeAPI::Internal::Type::Enum
207
+
208
+ TaggedSymbol =
209
+ T.type_alias do
210
+ T.all(
211
+ Symbol,
212
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status
213
+ )
214
+ end
215
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
216
+
217
+ BUSY =
218
+ T.let(
219
+ :busy,
220
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
221
+ )
222
+ CANCELED =
223
+ T.let(
224
+ :canceled,
225
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
226
+ )
227
+ COMPLETED =
228
+ T.let(
229
+ :completed,
230
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
231
+ )
232
+ FAILED =
233
+ T.let(
234
+ :failed,
235
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
236
+ )
237
+ IN_PROGRESS =
238
+ T.let(
239
+ :in_progress,
240
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
241
+ )
242
+ MISSED =
243
+ T.let(
244
+ :missed,
245
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
246
+ )
247
+ NO_ANSWER =
248
+ T.let(
249
+ :no_answer,
250
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
251
+ )
252
+ QUEUED =
253
+ T.let(
254
+ :queued,
255
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
256
+ )
257
+ RINGING =
258
+ T.let(
259
+ :ringing,
260
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
261
+ )
262
+
263
+ sig do
264
+ override.returns(
265
+ T::Array[
266
+ SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status::TaggedSymbol
267
+ ]
268
+ )
269
+ end
270
+ def self.values
271
+ end
272
+ end
273
+ end
274
+ end
275
+ end
276
+ end
277
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class RecordingGetFileParams < 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(SurgeAPI::RecordingGetFileParams, SurgeAPI::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: SurgeAPI::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: SurgeAPI::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class RecordingGetFileResponse < SurgeAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SurgeAPI::Models::RecordingGetFileResponse,
10
+ SurgeAPI::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # An error response
15
+ sig { returns(SurgeAPI::Error) }
16
+ attr_reader :error
17
+
18
+ sig { params(error: SurgeAPI::Error::OrHash).void }
19
+ attr_writer :error
20
+
21
+ # An error response
22
+ sig { params(error: SurgeAPI::Error::OrHash).returns(T.attached_class) }
23
+ def self.new(
24
+ # An error response
25
+ error:
26
+ )
27
+ end
28
+
29
+ sig { override.returns({ error: SurgeAPI::Error }) }
30
+ def to_hash
31
+ end
32
+ end
33
+ end
34
+ end
@@ -17,7 +17,9 @@ module SurgeAPI
17
17
  SurgeAPI::MessageDeliveredWebhookEvent,
18
18
  SurgeAPI::MessageFailedWebhookEvent,
19
19
  SurgeAPI::MessageReceivedWebhookEvent,
20
- SurgeAPI::MessageSentWebhookEvent
20
+ SurgeAPI::MessageSentWebhookEvent,
21
+ SurgeAPI::RecordingCompletedWebhookEvent,
22
+ SurgeAPI::VoicemailReceivedWebhookEvent
21
23
  )
22
24
  end
23
25