surge_api 0.7.0 → 0.9.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +29 -1
  4. data/lib/surge_api/internal/cursor.rb +112 -0
  5. data/lib/surge_api/internal/transport/pooled_net_requester.rb +1 -1
  6. data/lib/surge_api/models/blast.rb +2 -2
  7. data/lib/surge_api/models/blast_create_params.rb +15 -5
  8. data/lib/surge_api/models/contact_list_params.rb +34 -0
  9. data/lib/surge_api/models/message.rb +15 -3
  10. data/lib/surge_api/models/message_delivered_webhook_event.rb +16 -4
  11. data/lib/surge_api/models/message_failed_webhook_event.rb +16 -4
  12. data/lib/surge_api/models/message_list_params.rb +34 -0
  13. data/lib/surge_api/models/message_received_webhook_event.rb +16 -4
  14. data/lib/surge_api/models/message_sent_webhook_event.rb +16 -4
  15. data/lib/surge_api/models/phone_number.rb +2 -1
  16. data/lib/surge_api/models/phone_number_list_params.rb +34 -0
  17. data/lib/surge_api/models.rb +6 -0
  18. data/lib/surge_api/resources/blasts.rb +4 -2
  19. data/lib/surge_api/resources/contacts.rb +30 -0
  20. data/lib/surge_api/resources/messages.rb +30 -0
  21. data/lib/surge_api/resources/phone_numbers.rb +30 -0
  22. data/lib/surge_api/version.rb +1 -1
  23. data/lib/surge_api.rb +4 -0
  24. data/rbi/surge_api/internal/cursor.rbi +52 -0
  25. data/rbi/surge_api/models/blast.rbi +3 -6
  26. data/rbi/surge_api/models/blast_create_params.rbi +18 -6
  27. data/rbi/surge_api/models/contact_list_params.rbi +59 -0
  28. data/rbi/surge_api/models/message.rbi +16 -6
  29. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +19 -6
  30. data/rbi/surge_api/models/message_failed_webhook_event.rbi +19 -6
  31. data/rbi/surge_api/models/message_list_params.rbi +59 -0
  32. data/rbi/surge_api/models/message_received_webhook_event.rbi +19 -6
  33. data/rbi/surge_api/models/message_sent_webhook_event.rbi +19 -6
  34. data/rbi/surge_api/models/phone_number.rbi +2 -0
  35. data/rbi/surge_api/models/phone_number_list_params.rbi +59 -0
  36. data/rbi/surge_api/models.rbi +6 -0
  37. data/rbi/surge_api/resources/blasts.rbi +6 -1
  38. data/rbi/surge_api/resources/contacts.rbi +21 -0
  39. data/rbi/surge_api/resources/messages.rbi +21 -0
  40. data/rbi/surge_api/resources/phone_numbers.rbi +21 -0
  41. data/sig/surge_api/internal/cursor.rbs +28 -0
  42. data/sig/surge_api/models/blast.rbs +4 -6
  43. data/sig/surge_api/models/blast_create_params.rbs +11 -6
  44. data/sig/surge_api/models/contact_list_params.rbs +32 -0
  45. data/sig/surge_api/models/message.rbs +10 -5
  46. data/sig/surge_api/models/message_delivered_webhook_event.rbs +14 -7
  47. data/sig/surge_api/models/message_failed_webhook_event.rbs +14 -7
  48. data/sig/surge_api/models/message_list_params.rbs +32 -0
  49. data/sig/surge_api/models/message_received_webhook_event.rbs +14 -7
  50. data/sig/surge_api/models/message_sent_webhook_event.rbs +14 -7
  51. data/sig/surge_api/models/phone_number.rbs +2 -1
  52. data/sig/surge_api/models/phone_number_list_params.rbs +32 -0
  53. data/sig/surge_api/models.rbs +6 -0
  54. data/sig/surge_api/resources/blasts.rbs +2 -1
  55. data/sig/surge_api/resources/contacts.rbs +7 -0
  56. data/sig/surge_api/resources/messages.rbs +7 -0
  57. data/sig/surge_api/resources/phone_numbers.rbs +7 -0
  58. metadata +14 -2
@@ -8,16 +8,18 @@ module SurgeAPI
8
8
  #
9
9
  # Sends a Blast.
10
10
  #
11
- # @overload create(account_id, attachments: nil, body: nil, contacts: nil, name: nil, segments: nil, send_at: nil, to: nil, request_options: {})
11
+ # @overload create(account_id, attachments: nil, body: nil, contacts: nil, from: nil, name: nil, segments: nil, send_at: nil, to: nil, request_options: {})
12
12
  #
13
13
  # @param account_id [String] The account for which the blast should be sent.
14
14
  #
15
15
  # @param attachments [Array<SurgeAPI::Models::BlastCreateParams::Attachment>]
16
16
  #
17
- # @param body [String] The message body.
17
+ # @param body [String, nil] The message body.
18
18
  #
19
19
  # @param contacts [Array<String>] Deprecated. Use `to` instead.
20
20
  #
21
+ # @param from [String] The phone number from which to send the blast. This can be either the phone numb
22
+ #
21
23
  # @param name [String] Optional name for the blast.
22
24
  #
23
25
  # @param segments [Array<String>] Deprecated. Use `to` instead.
@@ -88,6 +88,36 @@ module SurgeAPI
88
88
  )
89
89
  end
90
90
 
91
+ # Some parameter documentations has been truncated, see
92
+ # {SurgeAPI::Models::ContactListParams} for more details.
93
+ #
94
+ # List all contacts for an account with cursor-based pagination.
95
+ #
96
+ # @overload list(account_id, after: nil, before: nil, request_options: {})
97
+ #
98
+ # @param account_id [String] The account ID to list contacts for.
99
+ #
100
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
101
+ #
102
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
103
+ #
104
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
105
+ #
106
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::Contact>]
107
+ #
108
+ # @see SurgeAPI::Models::ContactListParams
109
+ def list(account_id, params = {})
110
+ parsed, options = SurgeAPI::ContactListParams.dump_request(params)
111
+ @client.request(
112
+ method: :get,
113
+ path: ["accounts/%1$s/contacts", account_id],
114
+ query: parsed,
115
+ page: SurgeAPI::Internal::Cursor,
116
+ model: SurgeAPI::Contact,
117
+ options: options
118
+ )
119
+ end
120
+
91
121
  # @api private
92
122
  #
93
123
  # @param client [SurgeAPI::Client]
@@ -79,6 +79,36 @@ module SurgeAPI
79
79
  )
80
80
  end
81
81
 
82
+ # Some parameter documentations has been truncated, see
83
+ # {SurgeAPI::Models::MessageListParams} for more details.
84
+ #
85
+ # List all messages for an account with cursor-based pagination.
86
+ #
87
+ # @overload list(account_id, after: nil, before: nil, request_options: {})
88
+ #
89
+ # @param account_id [String] The account ID to list messages for.
90
+ #
91
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
92
+ #
93
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
94
+ #
95
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
96
+ #
97
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::Message>]
98
+ #
99
+ # @see SurgeAPI::Models::MessageListParams
100
+ def list(account_id, params = {})
101
+ parsed, options = SurgeAPI::MessageListParams.dump_request(params)
102
+ @client.request(
103
+ method: :get,
104
+ path: ["accounts/%1$s/messages", account_id],
105
+ query: parsed,
106
+ page: SurgeAPI::Internal::Cursor,
107
+ model: SurgeAPI::Message,
108
+ options: options
109
+ )
110
+ end
111
+
82
112
  # @api private
83
113
  #
84
114
  # @param client [SurgeAPI::Client]
@@ -3,6 +3,36 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class PhoneNumbers
6
+ # Some parameter documentations has been truncated, see
7
+ # {SurgeAPI::Models::PhoneNumberListParams} for more details.
8
+ #
9
+ # List all phone numbers for an account with cursor-based pagination.
10
+ #
11
+ # @overload list(account_id, after: nil, before: nil, request_options: {})
12
+ #
13
+ # @param account_id [String] The account ID to list phone numbers for.
14
+ #
15
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
16
+ #
17
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
18
+ #
19
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
20
+ #
21
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::PhoneNumber>]
22
+ #
23
+ # @see SurgeAPI::Models::PhoneNumberListParams
24
+ def list(account_id, params = {})
25
+ parsed, options = SurgeAPI::PhoneNumberListParams.dump_request(params)
26
+ @client.request(
27
+ method: :get,
28
+ path: ["accounts/%1$s/phone_numbers", account_id],
29
+ query: parsed,
30
+ page: SurgeAPI::Internal::Cursor,
31
+ model: SurgeAPI::PhoneNumber,
32
+ options: options
33
+ )
34
+ end
35
+
6
36
  # Some parameter documentations has been truncated, see
7
37
  # {SurgeAPI::Models::PhoneNumberPurchaseParams} for more details.
8
38
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.7.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -52,6 +52,7 @@ require_relative "surge_api/errors"
52
52
  require_relative "surge_api/internal/transport/base_client"
53
53
  require_relative "surge_api/internal/transport/pooled_net_requester"
54
54
  require_relative "surge_api/client"
55
+ require_relative "surge_api/internal/cursor"
55
56
  require_relative "surge_api/models/campaign_params"
56
57
  require_relative "surge_api/models/message_params"
57
58
  require_relative "surge_api/models/account"
@@ -68,6 +69,7 @@ require_relative "surge_api/models/campaign_approved_webhook_event"
68
69
  require_relative "surge_api/models/campaign_create_params"
69
70
  require_relative "surge_api/models/contact"
70
71
  require_relative "surge_api/models/contact_create_params"
72
+ require_relative "surge_api/models/contact_list_params"
71
73
  require_relative "surge_api/models/contact_opted_in_webhook_event"
72
74
  require_relative "surge_api/models/contact_opted_out_webhook_event"
73
75
  require_relative "surge_api/models/contact_retrieve_params"
@@ -79,11 +81,13 @@ require_relative "surge_api/models/message"
79
81
  require_relative "surge_api/models/message_create_params"
80
82
  require_relative "surge_api/models/message_delivered_webhook_event"
81
83
  require_relative "surge_api/models/message_failed_webhook_event"
84
+ require_relative "surge_api/models/message_list_params"
82
85
  require_relative "surge_api/models/message_received_webhook_event"
83
86
  require_relative "surge_api/models/message_retrieve_params"
84
87
  require_relative "surge_api/models/message_sent_webhook_event"
85
88
  require_relative "surge_api/models/organization"
86
89
  require_relative "surge_api/models/phone_number"
90
+ require_relative "surge_api/models/phone_number_list_params"
87
91
  require_relative "surge_api/models/phone_number_purchase_params"
88
92
  require_relative "surge_api/models/unwrap_webhook_event"
89
93
  require_relative "surge_api/models/user"
@@ -0,0 +1,52 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Internal
5
+ class Cursor
6
+ include SurgeAPI::Internal::Type::BasePage
7
+
8
+ Elem = type_member
9
+
10
+ sig { returns(T.nilable(T::Array[Elem])) }
11
+ attr_accessor :data
12
+
13
+ sig { returns(Pagination) }
14
+ attr_accessor :pagination
15
+
16
+ # @api private
17
+ sig { returns(String) }
18
+ def inspect
19
+ end
20
+
21
+ class Pagination < SurgeAPI::Internal::Type::BaseModel
22
+ OrHash = T.type_alias { T.any(Pagination, SurgeAPI::Internal::AnyHash) }
23
+
24
+ sig { returns(T.nilable(String)) }
25
+ attr_reader :next_cursor
26
+
27
+ sig { params(next_cursor: String).void }
28
+ attr_writer :next_cursor
29
+
30
+ sig { returns(T.nilable(String)) }
31
+ attr_reader :previous_cursor
32
+
33
+ sig { params(previous_cursor: String).void }
34
+ attr_writer :previous_cursor
35
+
36
+ sig do
37
+ params(next_cursor: String, previous_cursor: String).returns(
38
+ T.attached_class
39
+ )
40
+ end
41
+ def self.new(next_cursor: nil, previous_cursor: nil)
42
+ end
43
+
44
+ sig do
45
+ override.returns({ next_cursor: String, previous_cursor: String })
46
+ end
47
+ def to_hash
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -23,10 +23,7 @@ module SurgeAPI
23
23
 
24
24
  # The message body.
25
25
  sig { returns(T.nilable(String)) }
26
- attr_reader :body
27
-
28
- sig { params(body: String).void }
29
- attr_writer :body
26
+ attr_accessor :body
30
27
 
31
28
  # Optional name for the blast.
32
29
  sig { returns(T.nilable(String)) }
@@ -47,7 +44,7 @@ module SurgeAPI
47
44
  params(
48
45
  id: String,
49
46
  attachments: T::Array[SurgeAPI::Blast::Attachment::OrHash],
50
- body: String,
47
+ body: T.nilable(String),
51
48
  name: String,
52
49
  send_at: Time
53
50
  ).returns(T.attached_class)
@@ -70,7 +67,7 @@ module SurgeAPI
70
67
  {
71
68
  id: String,
72
69
  attachments: T::Array[SurgeAPI::Blast::Attachment],
73
- body: String,
70
+ body: T.nilable(String),
74
71
  name: String,
75
72
  send_at: Time
76
73
  }
@@ -25,10 +25,7 @@ module SurgeAPI
25
25
 
26
26
  # The message body.
27
27
  sig { returns(T.nilable(String)) }
28
- attr_reader :body
29
-
30
- sig { params(body: String).void }
31
- attr_writer :body
28
+ attr_accessor :body
32
29
 
33
30
  # Deprecated. Use `to` instead.
34
31
  sig { returns(T.nilable(T::Array[String])) }
@@ -37,6 +34,15 @@ module SurgeAPI
37
34
  sig { params(contacts: T::Array[String]).void }
38
35
  attr_writer :contacts
39
36
 
37
+ # The phone number from which to send the blast. This can be either the phone
38
+ # number in E.164 format or a Surge phone number id. If not provided, the
39
+ # account's default phone number is used.
40
+ sig { returns(T.nilable(String)) }
41
+ attr_reader :from
42
+
43
+ sig { params(from: String).void }
44
+ attr_writer :from
45
+
40
46
  # Optional name for the blast.
41
47
  sig { returns(T.nilable(String)) }
42
48
  attr_reader :name
@@ -70,8 +76,9 @@ module SurgeAPI
70
76
  params(
71
77
  attachments:
72
78
  T::Array[SurgeAPI::BlastCreateParams::Attachment::OrHash],
73
- body: String,
79
+ body: T.nilable(String),
74
80
  contacts: T::Array[String],
81
+ from: String,
75
82
  name: String,
76
83
  segments: T::Array[String],
77
84
  send_at: Time,
@@ -85,6 +92,10 @@ module SurgeAPI
85
92
  body: nil,
86
93
  # Deprecated. Use `to` instead.
87
94
  contacts: nil,
95
+ # The phone number from which to send the blast. This can be either the phone
96
+ # number in E.164 format or a Surge phone number id. If not provided, the
97
+ # account's default phone number is used.
98
+ from: nil,
88
99
  # Optional name for the blast.
89
100
  name: nil,
90
101
  # Deprecated. Use `to` instead.
@@ -102,8 +113,9 @@ module SurgeAPI
102
113
  override.returns(
103
114
  {
104
115
  attachments: T::Array[SurgeAPI::BlastCreateParams::Attachment],
105
- body: String,
116
+ body: T.nilable(String),
106
117
  contacts: T::Array[String],
118
+ from: String,
107
119
  name: String,
108
120
  segments: T::Array[String],
109
121
  send_at: Time,
@@ -0,0 +1,59 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class ContactListParams < 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::ContactListParams, SurgeAPI::Internal::AnyHash)
12
+ end
13
+
14
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
15
+ sig { returns(T.nilable(String)) }
16
+ attr_reader :after
17
+
18
+ sig { params(after: String).void }
19
+ attr_writer :after
20
+
21
+ # Cursor for backward pagination. Use the previous_cursor from a previous
22
+ # response.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :before
25
+
26
+ sig { params(before: String).void }
27
+ attr_writer :before
28
+
29
+ sig do
30
+ params(
31
+ after: String,
32
+ before: String,
33
+ request_options: SurgeAPI::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
35
+ end
36
+ def self.new(
37
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
38
+ after: nil,
39
+ # Cursor for backward pagination. Use the previous_cursor from a previous
40
+ # response.
41
+ before: nil,
42
+ request_options: {}
43
+ )
44
+ end
45
+
46
+ sig do
47
+ override.returns(
48
+ {
49
+ after: String,
50
+ before: String,
51
+ request_options: SurgeAPI::RequestOptions
52
+ }
53
+ )
54
+ end
55
+ def to_hash
56
+ end
57
+ end
58
+ end
59
+ end
@@ -23,12 +23,17 @@ module SurgeAPI
23
23
  end
24
24
  attr_writer :attachments
25
25
 
26
- # The message body.
26
+ # The ID of the blast this message belongs to, if any. This can be used to
27
+ # attribute messages back to a specific blast.
27
28
  sig { returns(T.nilable(String)) }
28
- attr_reader :body
29
+ attr_reader :blast_id
30
+
31
+ sig { params(blast_id: String).void }
32
+ attr_writer :blast_id
29
33
 
30
- sig { params(body: String).void }
31
- attr_writer :body
34
+ # The message body.
35
+ sig { returns(T.nilable(String)) }
36
+ attr_accessor :body
32
37
 
33
38
  # A conversation with a Contact
34
39
  sig { returns(T.nilable(SurgeAPI::Message::Conversation)) }
@@ -49,7 +54,8 @@ module SurgeAPI
49
54
  params(
50
55
  id: String,
51
56
  attachments: T::Array[SurgeAPI::Message::Attachment::OrHash],
52
- body: String,
57
+ blast_id: String,
58
+ body: T.nilable(String),
53
59
  conversation: SurgeAPI::Message::Conversation::OrHash,
54
60
  metadata: T::Hash[Symbol, String]
55
61
  ).returns(T.attached_class)
@@ -58,6 +64,9 @@ module SurgeAPI
58
64
  # Unique identifier for the object.
59
65
  id: nil,
60
66
  attachments: nil,
67
+ # The ID of the blast this message belongs to, if any. This can be used to
68
+ # attribute messages back to a specific blast.
69
+ blast_id: nil,
61
70
  # The message body.
62
71
  body: nil,
63
72
  # A conversation with a Contact
@@ -72,7 +81,8 @@ module SurgeAPI
72
81
  {
73
82
  id: String,
74
83
  attachments: T::Array[SurgeAPI::Message::Attachment],
75
- body: String,
84
+ blast_id: String,
85
+ body: T.nilable(String),
76
86
  conversation: SurgeAPI::Message::Conversation,
77
87
  metadata: T::Hash[Symbol, String]
78
88
  }
@@ -79,7 +79,7 @@ module SurgeAPI
79
79
  attr_accessor :id
80
80
 
81
81
  # The content of the message
82
- sig { returns(String) }
82
+ sig { returns(T.nilable(String)) }
83
83
  attr_accessor :body
84
84
 
85
85
  # The conversation this message belongs to
@@ -120,18 +120,27 @@ module SurgeAPI
120
120
  end
121
121
  attr_writer :attachments
122
122
 
123
+ # The ID of the blast this message belongs to, if any. This can be used to
124
+ # attribute messages back to a specific blast.
125
+ sig { returns(T.nilable(String)) }
126
+ attr_reader :blast_id
127
+
128
+ sig { params(blast_id: String).void }
129
+ attr_writer :blast_id
130
+
123
131
  # The data associated with the event
124
132
  sig do
125
133
  params(
126
134
  id: String,
127
- body: String,
135
+ body: T.nilable(String),
128
136
  conversation:
129
137
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation::OrHash,
130
138
  delivered_at: Time,
131
139
  attachments:
132
140
  T::Array[
133
141
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment::OrHash
134
- ]
142
+ ],
143
+ blast_id: String
135
144
  ).returns(T.attached_class)
136
145
  end
137
146
  def self.new(
@@ -144,7 +153,10 @@ module SurgeAPI
144
153
  # When the message was delivered
145
154
  delivered_at:,
146
155
  # Attachments included with the message
147
- attachments: nil
156
+ attachments: nil,
157
+ # The ID of the blast this message belongs to, if any. This can be used to
158
+ # attribute messages back to a specific blast.
159
+ blast_id: nil
148
160
  )
149
161
  end
150
162
 
@@ -152,14 +164,15 @@ module SurgeAPI
152
164
  override.returns(
153
165
  {
154
166
  id: String,
155
- body: String,
167
+ body: T.nilable(String),
156
168
  conversation:
157
169
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation,
158
170
  delivered_at: Time,
159
171
  attachments:
160
172
  T::Array[
161
173
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment
162
- ]
174
+ ],
175
+ blast_id: String
163
176
  }
164
177
  )
165
178
  end
@@ -79,7 +79,7 @@ module SurgeAPI
79
79
  attr_accessor :id
80
80
 
81
81
  # The content of the message
82
- sig { returns(String) }
82
+ sig { returns(T.nilable(String)) }
83
83
  attr_accessor :body
84
84
 
85
85
  # The conversation this message belongs to
@@ -122,11 +122,19 @@ module SurgeAPI
122
122
  end
123
123
  attr_writer :attachments
124
124
 
125
+ # The ID of the blast this message belongs to, if any. This can be used to
126
+ # attribute messages back to a specific blast.
127
+ sig { returns(T.nilable(String)) }
128
+ attr_reader :blast_id
129
+
130
+ sig { params(blast_id: String).void }
131
+ attr_writer :blast_id
132
+
125
133
  # The data associated with the event
126
134
  sig do
127
135
  params(
128
136
  id: String,
129
- body: String,
137
+ body: T.nilable(String),
130
138
  conversation:
131
139
  SurgeAPI::MessageFailedWebhookEvent::Data::Conversation::OrHash,
132
140
  failed_at: Time,
@@ -134,7 +142,8 @@ module SurgeAPI
134
142
  attachments:
135
143
  T::Array[
136
144
  SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::OrHash
137
- ]
145
+ ],
146
+ blast_id: String
138
147
  ).returns(T.attached_class)
139
148
  end
140
149
  def self.new(
@@ -149,7 +158,10 @@ module SurgeAPI
149
158
  # The reason the message failed to be delivered
150
159
  failure_reason:,
151
160
  # Attachments included with the message
152
- attachments: nil
161
+ attachments: nil,
162
+ # The ID of the blast this message belongs to, if any. This can be used to
163
+ # attribute messages back to a specific blast.
164
+ blast_id: nil
153
165
  )
154
166
  end
155
167
 
@@ -157,13 +169,14 @@ module SurgeAPI
157
169
  override.returns(
158
170
  {
159
171
  id: String,
160
- body: String,
172
+ body: T.nilable(String),
161
173
  conversation:
162
174
  SurgeAPI::MessageFailedWebhookEvent::Data::Conversation,
163
175
  failed_at: Time,
164
176
  failure_reason: String,
165
177
  attachments:
166
- T::Array[SurgeAPI::MessageFailedWebhookEvent::Data::Attachment]
178
+ T::Array[SurgeAPI::MessageFailedWebhookEvent::Data::Attachment],
179
+ blast_id: String
167
180
  }
168
181
  )
169
182
  end
@@ -0,0 +1,59 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageListParams < 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::MessageListParams, SurgeAPI::Internal::AnyHash)
12
+ end
13
+
14
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
15
+ sig { returns(T.nilable(String)) }
16
+ attr_reader :after
17
+
18
+ sig { params(after: String).void }
19
+ attr_writer :after
20
+
21
+ # Cursor for backward pagination. Use the previous_cursor from a previous
22
+ # response.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :before
25
+
26
+ sig { params(before: String).void }
27
+ attr_writer :before
28
+
29
+ sig do
30
+ params(
31
+ after: String,
32
+ before: String,
33
+ request_options: SurgeAPI::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
35
+ end
36
+ def self.new(
37
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
38
+ after: nil,
39
+ # Cursor for backward pagination. Use the previous_cursor from a previous
40
+ # response.
41
+ before: nil,
42
+ request_options: {}
43
+ )
44
+ end
45
+
46
+ sig do
47
+ override.returns(
48
+ {
49
+ after: String,
50
+ before: String,
51
+ request_options: SurgeAPI::RequestOptions
52
+ }
53
+ )
54
+ end
55
+ def to_hash
56
+ end
57
+ end
58
+ end
59
+ end