surge_api 0.1.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 (212) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +28 -0
  4. data/README.md +286 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/surge_api/client.rb +106 -0
  7. data/lib/surge_api/errors.rb +228 -0
  8. data/lib/surge_api/file_part.rb +55 -0
  9. data/lib/surge_api/internal/transport/base_client.rb +567 -0
  10. data/lib/surge_api/internal/transport/pooled_net_requester.rb +201 -0
  11. data/lib/surge_api/internal/type/array_of.rb +168 -0
  12. data/lib/surge_api/internal/type/base_model.rb +531 -0
  13. data/lib/surge_api/internal/type/base_page.rb +55 -0
  14. data/lib/surge_api/internal/type/boolean.rb +77 -0
  15. data/lib/surge_api/internal/type/converter.rb +327 -0
  16. data/lib/surge_api/internal/type/enum.rb +131 -0
  17. data/lib/surge_api/internal/type/file_input.rb +108 -0
  18. data/lib/surge_api/internal/type/hash_of.rb +188 -0
  19. data/lib/surge_api/internal/type/request_parameters.rb +42 -0
  20. data/lib/surge_api/internal/type/union.rb +250 -0
  21. data/lib/surge_api/internal/type/unknown.rb +81 -0
  22. data/lib/surge_api/internal/util.rb +915 -0
  23. data/lib/surge_api/internal.rb +20 -0
  24. data/lib/surge_api/models/account.rb +60 -0
  25. data/lib/surge_api/models/account_create_params.rb +481 -0
  26. data/lib/surge_api/models/account_retrieve_status_params.rb +32 -0
  27. data/lib/surge_api/models/account_status.rb +104 -0
  28. data/lib/surge_api/models/account_update_params.rb +480 -0
  29. data/lib/surge_api/models/blast.rb +61 -0
  30. data/lib/surge_api/models/blast_create_params.rb +90 -0
  31. data/lib/surge_api/models/call_ended_webhook_event.rb +106 -0
  32. data/lib/surge_api/models/campaign.rb +208 -0
  33. data/lib/surge_api/models/campaign_approved_webhook_event.rb +74 -0
  34. data/lib/surge_api/models/campaign_create_params.rb +202 -0
  35. data/lib/surge_api/models/contact.rb +59 -0
  36. data/lib/surge_api/models/contact_create_params.rb +54 -0
  37. data/lib/surge_api/models/contact_retrieve_params.rb +14 -0
  38. data/lib/surge_api/models/contact_update_params.rb +54 -0
  39. data/lib/surge_api/models/conversation_created_webhook_event.rb +70 -0
  40. data/lib/surge_api/models/error.rb +34 -0
  41. data/lib/surge_api/models/message.rb +146 -0
  42. data/lib/surge_api/models/message_create_params.rb +153 -0
  43. data/lib/surge_api/models/message_delivered_webhook_event.rb +159 -0
  44. data/lib/surge_api/models/message_failed_webhook_event.rb +167 -0
  45. data/lib/surge_api/models/message_received_webhook_event.rb +159 -0
  46. data/lib/surge_api/models/message_sent_webhook_event.rb +159 -0
  47. data/lib/surge_api/models/organization.rb +419 -0
  48. data/lib/surge_api/models/phone_number.rb +48 -0
  49. data/lib/surge_api/models/phone_number_purchase_params.rb +65 -0
  50. data/lib/surge_api/models/unwrap_webhook_event.rb +26 -0
  51. data/lib/surge_api/models/user.rb +51 -0
  52. data/lib/surge_api/models/user_create_params.rb +46 -0
  53. data/lib/surge_api/models/user_create_token_params.rb +22 -0
  54. data/lib/surge_api/models/user_retrieve_params.rb +14 -0
  55. data/lib/surge_api/models/user_token_response.rb +19 -0
  56. data/lib/surge_api/models/user_update_params.rb +46 -0
  57. data/lib/surge_api/models/verification.rb +58 -0
  58. data/lib/surge_api/models/verification_check.rb +43 -0
  59. data/lib/surge_api/models/verification_check_params.rb +22 -0
  60. data/lib/surge_api/models/verification_create_params.rb +22 -0
  61. data/lib/surge_api/models/webhook_unwrap_params.rb +14 -0
  62. data/lib/surge_api/models.rb +117 -0
  63. data/lib/surge_api/request_options.rb +77 -0
  64. data/lib/surge_api/resources/accounts.rb +102 -0
  65. data/lib/surge_api/resources/blasts.rb +53 -0
  66. data/lib/surge_api/resources/campaigns.rb +57 -0
  67. data/lib/surge_api/resources/contacts.rb +99 -0
  68. data/lib/surge_api/resources/messages.rb +75 -0
  69. data/lib/surge_api/resources/phone_numbers.rb +48 -0
  70. data/lib/surge_api/resources/users.rb +119 -0
  71. data/lib/surge_api/resources/verifications.rb +60 -0
  72. data/lib/surge_api/resources/webhooks.rb +22 -0
  73. data/lib/surge_api/version.rb +5 -0
  74. data/lib/surge_api.rb +100 -0
  75. data/manifest.yaml +15 -0
  76. data/rbi/surge_api/client.rbi +73 -0
  77. data/rbi/surge_api/errors.rbi +205 -0
  78. data/rbi/surge_api/file_part.rbi +37 -0
  79. data/rbi/surge_api/internal/transport/base_client.rbi +292 -0
  80. data/rbi/surge_api/internal/transport/pooled_net_requester.rbi +79 -0
  81. data/rbi/surge_api/internal/type/array_of.rbi +104 -0
  82. data/rbi/surge_api/internal/type/base_model.rbi +302 -0
  83. data/rbi/surge_api/internal/type/base_page.rbi +42 -0
  84. data/rbi/surge_api/internal/type/boolean.rbi +58 -0
  85. data/rbi/surge_api/internal/type/converter.rbi +216 -0
  86. data/rbi/surge_api/internal/type/enum.rbi +82 -0
  87. data/rbi/surge_api/internal/type/file_input.rbi +59 -0
  88. data/rbi/surge_api/internal/type/hash_of.rbi +104 -0
  89. data/rbi/surge_api/internal/type/request_parameters.rbi +29 -0
  90. data/rbi/surge_api/internal/type/union.rbi +128 -0
  91. data/rbi/surge_api/internal/type/unknown.rbi +58 -0
  92. data/rbi/surge_api/internal/util.rbi +487 -0
  93. data/rbi/surge_api/internal.rbi +16 -0
  94. data/rbi/surge_api/models/account.rbi +83 -0
  95. data/rbi/surge_api/models/account_create_params.rbi +1104 -0
  96. data/rbi/surge_api/models/account_retrieve_status_params.rbi +96 -0
  97. data/rbi/surge_api/models/account_status.rbi +185 -0
  98. data/rbi/surge_api/models/account_update_params.rbi +1105 -0
  99. data/rbi/surge_api/models/blast.rbi +108 -0
  100. data/rbi/surge_api/models/blast_create_params.rbi +145 -0
  101. data/rbi/surge_api/models/call_ended_webhook_event.rbi +205 -0
  102. data/rbi/surge_api/models/campaign.rbi +331 -0
  103. data/rbi/surge_api/models/campaign_approved_webhook_event.rbi +149 -0
  104. data/rbi/surge_api/models/campaign_create_params.rbi +386 -0
  105. data/rbi/surge_api/models/contact.rbi +88 -0
  106. data/rbi/surge_api/models/contact_create_params.rbi +87 -0
  107. data/rbi/surge_api/models/contact_retrieve_params.rbi +27 -0
  108. data/rbi/surge_api/models/contact_update_params.rbi +87 -0
  109. data/rbi/surge_api/models/conversation_created_webhook_event.rbi +129 -0
  110. data/rbi/surge_api/models/error.rbi +51 -0
  111. data/rbi/surge_api/models/message.rbi +283 -0
  112. data/rbi/surge_api/models/message_create_params.rbi +281 -0
  113. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +331 -0
  114. data/rbi/surge_api/models/message_failed_webhook_event.rbi +335 -0
  115. data/rbi/surge_api/models/message_received_webhook_event.rbi +331 -0
  116. data/rbi/surge_api/models/message_sent_webhook_event.rbi +322 -0
  117. data/rbi/surge_api/models/organization.rbi +649 -0
  118. data/rbi/surge_api/models/phone_number.rbi +72 -0
  119. data/rbi/surge_api/models/phone_number_purchase_params.rbi +122 -0
  120. data/rbi/surge_api/models/unwrap_webhook_event.rbi +26 -0
  121. data/rbi/surge_api/models/user.rbi +80 -0
  122. data/rbi/surge_api/models/user_create_params.rbi +76 -0
  123. data/rbi/surge_api/models/user_create_token_params.rbi +46 -0
  124. data/rbi/surge_api/models/user_retrieve_params.rbi +27 -0
  125. data/rbi/surge_api/models/user_token_response.rbi +31 -0
  126. data/rbi/surge_api/models/user_update_params.rbi +76 -0
  127. data/rbi/surge_api/models/verification.rbi +86 -0
  128. data/rbi/surge_api/models/verification_check.rbi +84 -0
  129. data/rbi/surge_api/models/verification_check_params.rbi +40 -0
  130. data/rbi/surge_api/models/verification_create_params.rbi +40 -0
  131. data/rbi/surge_api/models/webhook_unwrap_params.rbi +27 -0
  132. data/rbi/surge_api/models.rbi +80 -0
  133. data/rbi/surge_api/request_options.rbi +59 -0
  134. data/rbi/surge_api/resources/accounts.rbi +94 -0
  135. data/rbi/surge_api/resources/blasts.rbi +48 -0
  136. data/rbi/surge_api/resources/campaigns.rbi +115 -0
  137. data/rbi/surge_api/resources/contacts.rbi +85 -0
  138. data/rbi/surge_api/resources/messages.rbi +72 -0
  139. data/rbi/surge_api/resources/phone_numbers.rbi +43 -0
  140. data/rbi/surge_api/resources/users.rbi +96 -0
  141. data/rbi/surge_api/resources/verifications.rbi +43 -0
  142. data/rbi/surge_api/resources/webhooks.rbi +31 -0
  143. data/rbi/surge_api/version.rbi +5 -0
  144. data/sig/surge_api/client.rbs +42 -0
  145. data/sig/surge_api/errors.rbs +117 -0
  146. data/sig/surge_api/file_part.rbs +21 -0
  147. data/sig/surge_api/internal/transport/base_client.rbs +131 -0
  148. data/sig/surge_api/internal/transport/pooled_net_requester.rbs +45 -0
  149. data/sig/surge_api/internal/type/array_of.rbs +48 -0
  150. data/sig/surge_api/internal/type/base_model.rbs +102 -0
  151. data/sig/surge_api/internal/type/base_page.rbs +24 -0
  152. data/sig/surge_api/internal/type/boolean.rbs +26 -0
  153. data/sig/surge_api/internal/type/converter.rbs +79 -0
  154. data/sig/surge_api/internal/type/enum.rbs +32 -0
  155. data/sig/surge_api/internal/type/file_input.rbs +25 -0
  156. data/sig/surge_api/internal/type/hash_of.rbs +48 -0
  157. data/sig/surge_api/internal/type/request_parameters.rbs +17 -0
  158. data/sig/surge_api/internal/type/union.rbs +52 -0
  159. data/sig/surge_api/internal/type/unknown.rbs +26 -0
  160. data/sig/surge_api/internal/util.rbs +185 -0
  161. data/sig/surge_api/internal.rbs +9 -0
  162. data/sig/surge_api/models/account.rbs +40 -0
  163. data/sig/surge_api/models/account_create_params.rbs +433 -0
  164. data/sig/surge_api/models/account_retrieve_status_params.rbs +40 -0
  165. data/sig/surge_api/models/account_status.rbs +71 -0
  166. data/sig/surge_api/models/account_update_params.rbs +435 -0
  167. data/sig/surge_api/models/blast.rbs +64 -0
  168. data/sig/surge_api/models/blast_create_params.rbs +82 -0
  169. data/sig/surge_api/models/call_ended_webhook_event.rbs +99 -0
  170. data/sig/surge_api/models/campaign.rbs +122 -0
  171. data/sig/surge_api/models/campaign_approved_webhook_event.rbs +67 -0
  172. data/sig/surge_api/models/campaign_create_params.rbs +127 -0
  173. data/sig/surge_api/models/contact.rbs +53 -0
  174. data/sig/surge_api/models/contact_create_params.rbs +54 -0
  175. data/sig/surge_api/models/contact_retrieve_params.rbs +15 -0
  176. data/sig/surge_api/models/contact_update_params.rbs +54 -0
  177. data/sig/surge_api/models/conversation_created_webhook_event.rbs +62 -0
  178. data/sig/surge_api/models/error.rbs +27 -0
  179. data/sig/surge_api/models/message.rbs +138 -0
  180. data/sig/surge_api/models/message_create_params.rbs +140 -0
  181. data/sig/surge_api/models/message_delivered_webhook_event.rbs +143 -0
  182. data/sig/surge_api/models/message_failed_webhook_event.rbs +148 -0
  183. data/sig/surge_api/models/message_received_webhook_event.rbs +143 -0
  184. data/sig/surge_api/models/message_sent_webhook_event.rbs +143 -0
  185. data/sig/surge_api/models/organization.rbs +385 -0
  186. data/sig/surge_api/models/phone_number.rbs +37 -0
  187. data/sig/surge_api/models/phone_number_purchase_params.rbs +62 -0
  188. data/sig/surge_api/models/unwrap_webhook_event.rbs +18 -0
  189. data/sig/surge_api/models/user.rbs +48 -0
  190. data/sig/surge_api/models/user_create_params.rbs +47 -0
  191. data/sig/surge_api/models/user_create_token_params.rbs +26 -0
  192. data/sig/surge_api/models/user_retrieve_params.rbs +15 -0
  193. data/sig/surge_api/models/user_token_response.rbs +15 -0
  194. data/sig/surge_api/models/user_update_params.rbs +47 -0
  195. data/sig/surge_api/models/verification.rbs +48 -0
  196. data/sig/surge_api/models/verification_check.rbs +45 -0
  197. data/sig/surge_api/models/verification_check_params.rbs +23 -0
  198. data/sig/surge_api/models/verification_create_params.rbs +23 -0
  199. data/sig/surge_api/models/webhook_unwrap_params.rbs +15 -0
  200. data/sig/surge_api/models.rbs +77 -0
  201. data/sig/surge_api/request_options.rbs +34 -0
  202. data/sig/surge_api/resources/accounts.rbs +30 -0
  203. data/sig/surge_api/resources/blasts.rbs +19 -0
  204. data/sig/surge_api/resources/campaigns.rbs +21 -0
  205. data/sig/surge_api/resources/contacts.rbs +32 -0
  206. data/sig/surge_api/resources/messages.rbs +18 -0
  207. data/sig/surge_api/resources/phone_numbers.rbs +16 -0
  208. data/sig/surge_api/resources/users.rbs +36 -0
  209. data/sig/surge_api/resources/verifications.rbs +18 -0
  210. data/sig/surge_api/resources/webhooks.rbs +17 -0
  211. data/sig/surge_api/version.rbs +3 -0
  212. metadata +269 -0
@@ -0,0 +1,335 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageFailedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SurgeAPI::MessageFailedWebhookEvent,
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::MessageFailedWebhookEvent::Data) }
20
+ attr_reader :data
21
+
22
+ sig do
23
+ params(data: SurgeAPI::MessageFailedWebhookEvent::Data::OrHash).void
24
+ end
25
+ attr_writer :data
26
+
27
+ # The timestamp when this event occurred, in ISO8601 format
28
+ sig { returns(Time) }
29
+ attr_accessor :timestamp
30
+
31
+ # The type of the event. Always `message.failed` for this event.
32
+ sig { returns(Symbol) }
33
+ attr_accessor :type
34
+
35
+ sig do
36
+ params(
37
+ account_id: String,
38
+ data: SurgeAPI::MessageFailedWebhookEvent::Data::OrHash,
39
+ timestamp: Time,
40
+ type: Symbol
41
+ ).returns(T.attached_class)
42
+ end
43
+ def self.new(
44
+ # The ID of the account in which this event occurred
45
+ account_id:,
46
+ # The data associated with the event
47
+ data:,
48
+ # The timestamp when this event occurred, in ISO8601 format
49
+ timestamp:,
50
+ # The type of the event. Always `message.failed` for this event.
51
+ type: :"message.failed"
52
+ )
53
+ end
54
+
55
+ sig do
56
+ override.returns(
57
+ {
58
+ account_id: String,
59
+ data: SurgeAPI::MessageFailedWebhookEvent::Data,
60
+ timestamp: Time,
61
+ type: Symbol
62
+ }
63
+ )
64
+ end
65
+ def to_hash
66
+ end
67
+
68
+ class Data < SurgeAPI::Internal::Type::BaseModel
69
+ OrHash =
70
+ T.type_alias do
71
+ T.any(
72
+ SurgeAPI::MessageFailedWebhookEvent::Data,
73
+ SurgeAPI::Internal::AnyHash
74
+ )
75
+ end
76
+
77
+ # The unique identifier for the message
78
+ sig { returns(String) }
79
+ attr_accessor :id
80
+
81
+ # The content of the message
82
+ sig { returns(String) }
83
+ attr_accessor :body
84
+
85
+ # The conversation this message belongs to
86
+ sig { returns(SurgeAPI::MessageFailedWebhookEvent::Data::Conversation) }
87
+ attr_reader :conversation
88
+
89
+ sig do
90
+ params(
91
+ conversation:
92
+ SurgeAPI::MessageFailedWebhookEvent::Data::Conversation::OrHash
93
+ ).void
94
+ end
95
+ attr_writer :conversation
96
+
97
+ # When the message failed
98
+ sig { returns(Time) }
99
+ attr_accessor :failed_at
100
+
101
+ # The reason the message failed to be delivered
102
+ sig { returns(String) }
103
+ attr_accessor :failure_reason
104
+
105
+ # Attachments included with the message
106
+ sig do
107
+ returns(
108
+ T.nilable(
109
+ T::Array[SurgeAPI::MessageFailedWebhookEvent::Data::Attachment]
110
+ )
111
+ )
112
+ end
113
+ attr_reader :attachments
114
+
115
+ sig do
116
+ params(
117
+ attachments:
118
+ T::Array[
119
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::OrHash
120
+ ]
121
+ ).void
122
+ end
123
+ attr_writer :attachments
124
+
125
+ # The data associated with the event
126
+ sig do
127
+ params(
128
+ id: String,
129
+ body: String,
130
+ conversation:
131
+ SurgeAPI::MessageFailedWebhookEvent::Data::Conversation::OrHash,
132
+ failed_at: Time,
133
+ failure_reason: String,
134
+ attachments:
135
+ T::Array[
136
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::OrHash
137
+ ]
138
+ ).returns(T.attached_class)
139
+ end
140
+ def self.new(
141
+ # The unique identifier for the message
142
+ id:,
143
+ # The content of the message
144
+ body:,
145
+ # The conversation this message belongs to
146
+ conversation:,
147
+ # When the message failed
148
+ failed_at:,
149
+ # The reason the message failed to be delivered
150
+ failure_reason:,
151
+ # Attachments included with the message
152
+ attachments: nil
153
+ )
154
+ end
155
+
156
+ sig do
157
+ override.returns(
158
+ {
159
+ id: String,
160
+ body: String,
161
+ conversation:
162
+ SurgeAPI::MessageFailedWebhookEvent::Data::Conversation,
163
+ failed_at: Time,
164
+ failure_reason: String,
165
+ attachments:
166
+ T::Array[SurgeAPI::MessageFailedWebhookEvent::Data::Attachment]
167
+ }
168
+ )
169
+ end
170
+ def to_hash
171
+ end
172
+
173
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
174
+ OrHash =
175
+ T.type_alias do
176
+ T.any(
177
+ SurgeAPI::MessageFailedWebhookEvent::Data::Conversation,
178
+ SurgeAPI::Internal::AnyHash
179
+ )
180
+ end
181
+
182
+ # The unique identifier for the conversation
183
+ sig { returns(String) }
184
+ attr_accessor :id
185
+
186
+ # A contact who has consented to receive messages
187
+ sig { returns(SurgeAPI::Contact) }
188
+ attr_reader :contact
189
+
190
+ sig { params(contact: SurgeAPI::Contact::OrHash).void }
191
+ attr_writer :contact
192
+
193
+ # A phone number that can be used to send and receive messages and calls
194
+ sig { returns(SurgeAPI::PhoneNumber) }
195
+ attr_reader :phone_number
196
+
197
+ sig { params(phone_number: SurgeAPI::PhoneNumber::OrHash).void }
198
+ attr_writer :phone_number
199
+
200
+ # The conversation this message belongs to
201
+ sig do
202
+ params(
203
+ id: String,
204
+ contact: SurgeAPI::Contact::OrHash,
205
+ phone_number: SurgeAPI::PhoneNumber::OrHash
206
+ ).returns(T.attached_class)
207
+ end
208
+ def self.new(
209
+ # The unique identifier for the conversation
210
+ id:,
211
+ # A contact who has consented to receive messages
212
+ contact:,
213
+ # A phone number that can be used to send and receive messages and calls
214
+ phone_number:
215
+ )
216
+ end
217
+
218
+ sig do
219
+ override.returns(
220
+ {
221
+ id: String,
222
+ contact: SurgeAPI::Contact,
223
+ phone_number: SurgeAPI::PhoneNumber
224
+ }
225
+ )
226
+ end
227
+ def to_hash
228
+ end
229
+ end
230
+
231
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
232
+ OrHash =
233
+ T.type_alias do
234
+ T.any(
235
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment,
236
+ SurgeAPI::Internal::AnyHash
237
+ )
238
+ end
239
+
240
+ # The unique identifier for the attachment
241
+ sig { returns(String) }
242
+ attr_accessor :id
243
+
244
+ # The type of attachment
245
+ sig do
246
+ returns(
247
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol
248
+ )
249
+ end
250
+ attr_accessor :type
251
+
252
+ # The URL to download the attachment
253
+ sig { returns(String) }
254
+ attr_accessor :url
255
+
256
+ sig do
257
+ params(
258
+ id: String,
259
+ type:
260
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::OrSymbol,
261
+ url: String
262
+ ).returns(T.attached_class)
263
+ end
264
+ def self.new(
265
+ # The unique identifier for the attachment
266
+ id:,
267
+ # The type of attachment
268
+ type:,
269
+ # The URL to download the attachment
270
+ url:
271
+ )
272
+ end
273
+
274
+ sig do
275
+ override.returns(
276
+ {
277
+ id: String,
278
+ type:
279
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol,
280
+ url: String
281
+ }
282
+ )
283
+ end
284
+ def to_hash
285
+ end
286
+
287
+ # The type of attachment
288
+ module Type
289
+ extend SurgeAPI::Internal::Type::Enum
290
+
291
+ TaggedSymbol =
292
+ T.type_alias do
293
+ T.all(
294
+ Symbol,
295
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type
296
+ )
297
+ end
298
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
299
+
300
+ FILE =
301
+ T.let(
302
+ :file,
303
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol
304
+ )
305
+ IMAGE =
306
+ T.let(
307
+ :image,
308
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol
309
+ )
310
+ LINK =
311
+ T.let(
312
+ :link,
313
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol
314
+ )
315
+ VIDEO =
316
+ T.let(
317
+ :video,
318
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol
319
+ )
320
+
321
+ sig do
322
+ override.returns(
323
+ T::Array[
324
+ SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type::TaggedSymbol
325
+ ]
326
+ )
327
+ end
328
+ def self.values
329
+ end
330
+ end
331
+ end
332
+ end
333
+ end
334
+ end
335
+ end
@@ -0,0 +1,331 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageReceivedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SurgeAPI::MessageReceivedWebhookEvent,
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::MessageReceivedWebhookEvent::Data) }
20
+ attr_reader :data
21
+
22
+ sig do
23
+ params(data: SurgeAPI::MessageReceivedWebhookEvent::Data::OrHash).void
24
+ end
25
+ attr_writer :data
26
+
27
+ # The timestamp when this event occurred, in ISO8601 format
28
+ sig { returns(Time) }
29
+ attr_accessor :timestamp
30
+
31
+ # The type of the event. Always `message.received` for this event.
32
+ sig { returns(Symbol) }
33
+ attr_accessor :type
34
+
35
+ sig do
36
+ params(
37
+ account_id: String,
38
+ data: SurgeAPI::MessageReceivedWebhookEvent::Data::OrHash,
39
+ timestamp: Time,
40
+ type: Symbol
41
+ ).returns(T.attached_class)
42
+ end
43
+ def self.new(
44
+ # The ID of the account in which this event occurred
45
+ account_id:,
46
+ # The data associated with the event
47
+ data:,
48
+ # The timestamp when this event occurred, in ISO8601 format
49
+ timestamp:,
50
+ # The type of the event. Always `message.received` for this event.
51
+ type: :"message.received"
52
+ )
53
+ end
54
+
55
+ sig do
56
+ override.returns(
57
+ {
58
+ account_id: String,
59
+ data: SurgeAPI::MessageReceivedWebhookEvent::Data,
60
+ timestamp: Time,
61
+ type: Symbol
62
+ }
63
+ )
64
+ end
65
+ def to_hash
66
+ end
67
+
68
+ class Data < SurgeAPI::Internal::Type::BaseModel
69
+ OrHash =
70
+ T.type_alias do
71
+ T.any(
72
+ SurgeAPI::MessageReceivedWebhookEvent::Data,
73
+ SurgeAPI::Internal::AnyHash
74
+ )
75
+ end
76
+
77
+ # The unique identifier for the message
78
+ sig { returns(String) }
79
+ attr_accessor :id
80
+
81
+ # The content of the message
82
+ sig { returns(String) }
83
+ attr_accessor :body
84
+
85
+ # The conversation this message belongs to
86
+ sig do
87
+ returns(SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation)
88
+ end
89
+ attr_reader :conversation
90
+
91
+ sig do
92
+ params(
93
+ conversation:
94
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation::OrHash
95
+ ).void
96
+ end
97
+ attr_writer :conversation
98
+
99
+ # When the message was received
100
+ sig { returns(Time) }
101
+ attr_accessor :received_at
102
+
103
+ # Attachments included with the message
104
+ sig do
105
+ returns(
106
+ T.nilable(
107
+ T::Array[SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment]
108
+ )
109
+ )
110
+ end
111
+ attr_reader :attachments
112
+
113
+ sig do
114
+ params(
115
+ attachments:
116
+ T::Array[
117
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::OrHash
118
+ ]
119
+ ).void
120
+ end
121
+ attr_writer :attachments
122
+
123
+ # The data associated with the event
124
+ sig do
125
+ params(
126
+ id: String,
127
+ body: String,
128
+ conversation:
129
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation::OrHash,
130
+ received_at: Time,
131
+ attachments:
132
+ T::Array[
133
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::OrHash
134
+ ]
135
+ ).returns(T.attached_class)
136
+ end
137
+ def self.new(
138
+ # The unique identifier for the message
139
+ id:,
140
+ # The content of the message
141
+ body:,
142
+ # The conversation this message belongs to
143
+ conversation:,
144
+ # When the message was received
145
+ received_at:,
146
+ # Attachments included with the message
147
+ attachments: nil
148
+ )
149
+ end
150
+
151
+ sig do
152
+ override.returns(
153
+ {
154
+ id: String,
155
+ body: String,
156
+ conversation:
157
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation,
158
+ received_at: Time,
159
+ attachments:
160
+ T::Array[
161
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment
162
+ ]
163
+ }
164
+ )
165
+ end
166
+ def to_hash
167
+ end
168
+
169
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
170
+ OrHash =
171
+ T.type_alias do
172
+ T.any(
173
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation,
174
+ SurgeAPI::Internal::AnyHash
175
+ )
176
+ end
177
+
178
+ # The unique identifier for the conversation
179
+ sig { returns(String) }
180
+ attr_accessor :id
181
+
182
+ # A contact who has consented to receive messages
183
+ sig { returns(SurgeAPI::Contact) }
184
+ attr_reader :contact
185
+
186
+ sig { params(contact: SurgeAPI::Contact::OrHash).void }
187
+ attr_writer :contact
188
+
189
+ # A phone number that can be used to send and receive messages and calls
190
+ sig { returns(SurgeAPI::PhoneNumber) }
191
+ attr_reader :phone_number
192
+
193
+ sig { params(phone_number: SurgeAPI::PhoneNumber::OrHash).void }
194
+ attr_writer :phone_number
195
+
196
+ # The conversation this message belongs to
197
+ sig do
198
+ params(
199
+ id: String,
200
+ contact: SurgeAPI::Contact::OrHash,
201
+ phone_number: SurgeAPI::PhoneNumber::OrHash
202
+ ).returns(T.attached_class)
203
+ end
204
+ def self.new(
205
+ # The unique identifier for the conversation
206
+ id:,
207
+ # A contact who has consented to receive messages
208
+ contact:,
209
+ # A phone number that can be used to send and receive messages and calls
210
+ phone_number:
211
+ )
212
+ end
213
+
214
+ sig do
215
+ override.returns(
216
+ {
217
+ id: String,
218
+ contact: SurgeAPI::Contact,
219
+ phone_number: SurgeAPI::PhoneNumber
220
+ }
221
+ )
222
+ end
223
+ def to_hash
224
+ end
225
+ end
226
+
227
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
228
+ OrHash =
229
+ T.type_alias do
230
+ T.any(
231
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment,
232
+ SurgeAPI::Internal::AnyHash
233
+ )
234
+ end
235
+
236
+ # The unique identifier for the attachment
237
+ sig { returns(String) }
238
+ attr_accessor :id
239
+
240
+ # The type of attachment
241
+ sig do
242
+ returns(
243
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol
244
+ )
245
+ end
246
+ attr_accessor :type
247
+
248
+ # The URL to download the attachment
249
+ sig { returns(String) }
250
+ attr_accessor :url
251
+
252
+ sig do
253
+ params(
254
+ id: String,
255
+ type:
256
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::OrSymbol,
257
+ url: String
258
+ ).returns(T.attached_class)
259
+ end
260
+ def self.new(
261
+ # The unique identifier for the attachment
262
+ id:,
263
+ # The type of attachment
264
+ type:,
265
+ # The URL to download the attachment
266
+ url:
267
+ )
268
+ end
269
+
270
+ sig do
271
+ override.returns(
272
+ {
273
+ id: String,
274
+ type:
275
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol,
276
+ url: String
277
+ }
278
+ )
279
+ end
280
+ def to_hash
281
+ end
282
+
283
+ # The type of attachment
284
+ module Type
285
+ extend SurgeAPI::Internal::Type::Enum
286
+
287
+ TaggedSymbol =
288
+ T.type_alias do
289
+ T.all(
290
+ Symbol,
291
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type
292
+ )
293
+ end
294
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
295
+
296
+ FILE =
297
+ T.let(
298
+ :file,
299
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol
300
+ )
301
+ IMAGE =
302
+ T.let(
303
+ :image,
304
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol
305
+ )
306
+ LINK =
307
+ T.let(
308
+ :link,
309
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol
310
+ )
311
+ VIDEO =
312
+ T.let(
313
+ :video,
314
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol
315
+ )
316
+
317
+ sig do
318
+ override.returns(
319
+ T::Array[
320
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type::TaggedSymbol
321
+ ]
322
+ )
323
+ end
324
+ def self.values
325
+ end
326
+ end
327
+ end
328
+ end
329
+ end
330
+ end
331
+ end