sentdm 0.32.0 → 0.34.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/sentdm/client.rb +6 -0
  5. data/lib/sentdm/models/channel_event_payload.rb +154 -7
  6. data/lib/sentdm/models/contact_event.rb +15 -7
  7. data/lib/sentdm/models/contact_event_payload.rb +77 -16
  8. data/lib/sentdm/models/conversation_messages_list.rb +214 -6
  9. data/lib/sentdm/models/inbound_message_event_payload.rb +70 -3
  10. data/lib/sentdm/models/me_retrieve_response.rb +21 -1
  11. data/lib/sentdm/models/message_event_payload.rb +42 -1
  12. data/lib/sentdm/models/message_retrieve_activities_response.rb +42 -5
  13. data/lib/sentdm/models/message_retrieve_status_response.rb +222 -8
  14. data/lib/sentdm/models/message_send_params.rb +67 -3
  15. data/lib/sentdm/models/message_send_response.rb +13 -4
  16. data/lib/sentdm/models/template_body.rb +82 -1
  17. data/lib/sentdm/models/template_create_params.rb +11 -1
  18. data/lib/sentdm/models/template_header.rb +91 -3
  19. data/lib/sentdm/models/template_variable.rb +15 -1
  20. data/lib/sentdm/models/webhook_create_params.rb +31 -1
  21. data/lib/sentdm/models/webhook_list_events_response.rb +497 -9
  22. data/lib/sentdm/models/webhook_update_params.rb +31 -1
  23. data/lib/sentdm/resources/me.rb +5 -0
  24. data/lib/sentdm/resources/messages.rb +33 -5
  25. data/lib/sentdm/resources/templates.rb +3 -1
  26. data/lib/sentdm/resources/webhooks.rb +9 -3
  27. data/lib/sentdm/version.rb +1 -1
  28. data/lib/sentdm.rb +1 -1
  29. data/rbi/sentdm/client.rbi +6 -0
  30. data/rbi/sentdm/models/channel_event_payload.rbi +273 -10
  31. data/rbi/sentdm/models/contact_event.rbi +28 -12
  32. data/rbi/sentdm/models/contact_event_payload.rbi +118 -28
  33. data/rbi/sentdm/models/conversation_messages_list.rbi +308 -10
  34. data/rbi/sentdm/models/inbound_message_event_payload.rbi +110 -2
  35. data/rbi/sentdm/models/me_retrieve_response.rbi +35 -0
  36. data/rbi/sentdm/models/message_event_payload.rbi +50 -0
  37. data/rbi/sentdm/models/message_retrieve_activities_response.rbi +49 -5
  38. data/rbi/sentdm/models/message_retrieve_status_response.rbi +320 -12
  39. data/rbi/sentdm/models/message_send_params.rbi +100 -2
  40. data/rbi/sentdm/models/message_send_response.rbi +15 -5
  41. data/rbi/sentdm/models/template_body.rbi +133 -0
  42. data/rbi/sentdm/models/template_create_params.rbi +15 -0
  43. data/rbi/sentdm/models/template_header.rbi +143 -2
  44. data/rbi/sentdm/models/template_variable.rbi +10 -0
  45. data/rbi/sentdm/models/webhook_create_params.rbi +61 -0
  46. data/rbi/sentdm/models/webhook_list_events_response.rbi +747 -12
  47. data/rbi/sentdm/models/webhook_update_params.rbi +61 -0
  48. data/rbi/sentdm/resources/me.rbi +5 -0
  49. data/rbi/sentdm/resources/messages.rbi +58 -3
  50. data/rbi/sentdm/resources/templates.rbi +6 -0
  51. data/rbi/sentdm/resources/webhooks.rbi +15 -1
  52. data/sig/sentdm/models/channel_event_payload.rbs +62 -0
  53. data/sig/sentdm/models/contact_event_payload.rbs +24 -9
  54. data/sig/sentdm/models/conversation_messages_list.rbs +99 -6
  55. data/sig/sentdm/models/inbound_message_event_payload.rbs +37 -0
  56. data/sig/sentdm/models/me_retrieve_response.rbs +7 -0
  57. data/sig/sentdm/models/message_event_payload.rbs +20 -0
  58. data/sig/sentdm/models/message_retrieve_activities_response.rbs +15 -0
  59. data/sig/sentdm/models/message_retrieve_status_response.rbs +99 -6
  60. data/sig/sentdm/models/message_send_params.rbs +15 -0
  61. data/sig/sentdm/models/template_body.rbs +44 -0
  62. data/sig/sentdm/models/template_create_params.rbs +7 -0
  63. data/sig/sentdm/models/template_header.rbs +44 -0
  64. data/sig/sentdm/models/webhook_create_params.rbs +29 -0
  65. data/sig/sentdm/models/webhook_list_events_response.rbs +252 -0
  66. data/sig/sentdm/models/webhook_update_params.rbs +29 -0
  67. data/sig/sentdm/resources/messages.rbs +3 -0
  68. data/sig/sentdm/resources/templates.rbs +1 -0
  69. data/sig/sentdm/resources/webhooks.rbs +2 -0
  70. metadata +2 -2
@@ -39,9 +39,22 @@ module Sentdm
39
39
  attr_accessor :error_message
40
40
 
41
41
  # The exact event body that was delivered, or attempted, for this record. One of
42
- # the four webhook envelopes: a message status change, an inbound message, a
43
- # template status change, or a contact consent signal. Read field and event to
44
- # tell which, the same way your endpoint does.
42
+ # the six webhook envelopes:
43
+ #
44
+ # message — an outbound message changed status. message with event:
45
+ # message.received — someone replied to you. templates — a template was approved,
46
+ # rejected, paused or similar. channel — one of your markets moved in provisioning
47
+ # or compliance. contact — a consent signal: opt-in, opt-out or help. link — a
48
+ # tracked short link was clicked or a hosted file downloaded, or one expired or
49
+ # was revoked.
50
+ #
51
+ # Read field and event to tell which, the same way your endpoint does. The two
52
+ # message envelopes are the reason that is two fields and not one: they share a
53
+ # field and differ by event.
54
+ #
55
+ # Treat the list as open. It has grown twice — channel and then link — and a
56
+ # handler that rejects an envelope it does not recognise will break on the next
57
+ # addition rather than ignore it.
45
58
  sig do
46
59
  returns(
47
60
  T.nilable(
@@ -59,7 +72,9 @@ module Sentdm
59
72
  Sentdm::InboundMessageEvent::OrHash,
60
73
  Sentdm::TemplateEvent::OrHash,
61
74
  Sentdm::ChannelEvent::OrHash,
62
- Sentdm::ContactEvent::OrHash
75
+ Sentdm::ContactEvent::OrHash,
76
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::OrHash,
77
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::OrHash
63
78
  )
64
79
  ).void
65
80
  end
@@ -96,7 +111,9 @@ module Sentdm
96
111
  Sentdm::InboundMessageEvent::OrHash,
97
112
  Sentdm::TemplateEvent::OrHash,
98
113
  Sentdm::ChannelEvent::OrHash,
99
- Sentdm::ContactEvent::OrHash
114
+ Sentdm::ContactEvent::OrHash,
115
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::OrHash,
116
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::OrHash
100
117
  ),
101
118
  event_type: String,
102
119
  http_status_code: T.nilable(Integer),
@@ -112,9 +129,22 @@ module Sentdm
112
129
  delivery_status: nil,
113
130
  error_message: nil,
114
131
  # The exact event body that was delivered, or attempted, for this record. One of
115
- # the four webhook envelopes: a message status change, an inbound message, a
116
- # template status change, or a contact consent signal. Read field and event to
117
- # tell which, the same way your endpoint does.
132
+ # the six webhook envelopes:
133
+ #
134
+ # message — an outbound message changed status. message with event:
135
+ # message.received — someone replied to you. templates — a template was approved,
136
+ # rejected, paused or similar. channel — one of your markets moved in provisioning
137
+ # or compliance. contact — a consent signal: opt-in, opt-out or help. link — a
138
+ # tracked short link was clicked or a hosted file downloaded, or one expired or
139
+ # was revoked.
140
+ #
141
+ # Read field and event to tell which, the same way your endpoint does. The two
142
+ # message envelopes are the reason that is two fields and not one: they share a
143
+ # field and differ by event.
144
+ #
145
+ # Treat the list as open. It has grown twice — channel and then link — and a
146
+ # handler that rejects an envelope it does not recognise will break on the next
147
+ # addition rather than ignore it.
118
148
  event_data: nil,
119
149
  event_type: nil,
120
150
  http_status_code: nil,
@@ -146,9 +176,22 @@ module Sentdm
146
176
  end
147
177
 
148
178
  # The exact event body that was delivered, or attempted, for this record. One of
149
- # the four webhook envelopes: a message status change, an inbound message, a
150
- # template status change, or a contact consent signal. Read field and event to
151
- # tell which, the same way your endpoint does.
179
+ # the six webhook envelopes:
180
+ #
181
+ # message — an outbound message changed status. message with event:
182
+ # message.received — someone replied to you. templates — a template was approved,
183
+ # rejected, paused or similar. channel — one of your markets moved in provisioning
184
+ # or compliance. contact — a consent signal: opt-in, opt-out or help. link — a
185
+ # tracked short link was clicked or a hosted file downloaded, or one expired or
186
+ # was revoked.
187
+ #
188
+ # Read field and event to tell which, the same way your endpoint does. The two
189
+ # message envelopes are the reason that is two fields and not one: they share a
190
+ # field and differ by event.
191
+ #
192
+ # Treat the list as open. It has grown twice — channel and then link — and a
193
+ # handler that rejects an envelope it does not recognise will break on the next
194
+ # addition rather than ignore it.
152
195
  module EventData
153
196
  extend Sentdm::Internal::Type::Union
154
197
 
@@ -159,10 +202,702 @@ module Sentdm
159
202
  Sentdm::InboundMessageEvent,
160
203
  Sentdm::TemplateEvent,
161
204
  Sentdm::ChannelEvent,
162
- Sentdm::ContactEvent
205
+ Sentdm::ContactEvent,
206
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload,
207
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload
163
208
  )
164
209
  end
165
210
 
211
+ class SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload < Sentdm::Internal::Type::BaseModel
212
+ OrHash =
213
+ T.type_alias do
214
+ T.any(
215
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload,
216
+ Sentdm::Internal::AnyHash
217
+ )
218
+ end
219
+
220
+ # The specific event within the family, for example message.delivered,
221
+ # message.received or contact.opt_out. Absent on events that have no subtype, so
222
+ # treat it as optional.
223
+ sig { returns(T.nilable(String)) }
224
+ attr_accessor :event
225
+
226
+ # The event family, for example message, templates or contact. Route on this
227
+ # first, then on event for the specific change.
228
+ sig { returns(T.nilable(String)) }
229
+ attr_reader :field
230
+
231
+ sig { params(field: String).void }
232
+ attr_writer :field
233
+
234
+ # Body of a link event: something happened to a tracked link Sent published on the
235
+ # customer's behalf. A link points either at a URL the customer supplied or at a
236
+ # file Sent hosts for them; LinkKind says which. Delivered when an eligible
237
+ # request is served, or when a published link reaches the end of its life.
238
+ #
239
+ # A click is a request, not a read receipt. link.clicked means the redirect was
240
+ # served; link.downloaded means bytes went out. Neither proves a person saw
241
+ # anything — messaging providers and link scanners fetch URLs on their own, which
242
+ # is what TrafficClass exists to tell apart. Filter on it before reporting a
243
+ # click-through rate; treat likely_human as a hint, never as delivery
244
+ # confirmation.
245
+ #
246
+ # RecordId identifies the link; the X-Webhook-Event-ID header identifies the
247
+ # delivery. One link is hit many times, so those are the two keys a subscriber
248
+ # needs: group by the first, deduplicate on the second — exactly as on every other
249
+ # family. The payload carries no event identifier of its own, for the same reason
250
+ # none of the others do.
251
+ #
252
+ # Nothing here identifies the visitor. No IP address and no visitor token crosses
253
+ # this boundary. Country, Device and Browser are coarse buckets derived at the
254
+ # edge and are absent whenever the request did not supply enough to derive them.
255
+ sig do
256
+ returns(
257
+ T.nilable(
258
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::Payload
259
+ )
260
+ )
261
+ end
262
+ attr_reader :payload
263
+
264
+ sig do
265
+ params(
266
+ payload:
267
+ T.nilable(
268
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::Payload::OrHash
269
+ )
270
+ ).void
271
+ end
272
+ attr_writer :payload
273
+
274
+ # The event-specific body.
275
+ sig { returns(T.nilable(String)) }
276
+ attr_accessor :request_id
277
+
278
+ # When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
279
+ # time, not the time the underlying change happened. Use the timestamp inside the
280
+ # payload for the latter.
281
+ sig { returns(T.nilable(String)) }
282
+ attr_reader :timestamp
283
+
284
+ sig { params(timestamp: String).void }
285
+ attr_writer :timestamp
286
+
287
+ # The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
288
+ # this shape and varies only in Payload.
289
+ sig do
290
+ params(
291
+ event: T.nilable(String),
292
+ field: String,
293
+ payload:
294
+ T.nilable(
295
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::Payload::OrHash
296
+ ),
297
+ request_id: T.nilable(String),
298
+ timestamp: String
299
+ ).returns(T.attached_class)
300
+ end
301
+ def self.new(
302
+ # The specific event within the family, for example message.delivered,
303
+ # message.received or contact.opt_out. Absent on events that have no subtype, so
304
+ # treat it as optional.
305
+ event: nil,
306
+ # The event family, for example message, templates or contact. Route on this
307
+ # first, then on event for the specific change.
308
+ field: nil,
309
+ # Body of a link event: something happened to a tracked link Sent published on the
310
+ # customer's behalf. A link points either at a URL the customer supplied or at a
311
+ # file Sent hosts for them; LinkKind says which. Delivered when an eligible
312
+ # request is served, or when a published link reaches the end of its life.
313
+ #
314
+ # A click is a request, not a read receipt. link.clicked means the redirect was
315
+ # served; link.downloaded means bytes went out. Neither proves a person saw
316
+ # anything — messaging providers and link scanners fetch URLs on their own, which
317
+ # is what TrafficClass exists to tell apart. Filter on it before reporting a
318
+ # click-through rate; treat likely_human as a hint, never as delivery
319
+ # confirmation.
320
+ #
321
+ # RecordId identifies the link; the X-Webhook-Event-ID header identifies the
322
+ # delivery. One link is hit many times, so those are the two keys a subscriber
323
+ # needs: group by the first, deduplicate on the second — exactly as on every other
324
+ # family. The payload carries no event identifier of its own, for the same reason
325
+ # none of the others do.
326
+ #
327
+ # Nothing here identifies the visitor. No IP address and no visitor token crosses
328
+ # this boundary. Country, Device and Browser are coarse buckets derived at the
329
+ # edge and are absent whenever the request did not supply enough to derive them.
330
+ payload: nil,
331
+ # The event-specific body.
332
+ request_id: nil,
333
+ # When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
334
+ # time, not the time the underlying change happened. Use the timestamp inside the
335
+ # payload for the latter.
336
+ timestamp: nil
337
+ )
338
+ end
339
+
340
+ sig do
341
+ override.returns(
342
+ {
343
+ event: T.nilable(String),
344
+ field: String,
345
+ payload:
346
+ T.nilable(
347
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::Payload
348
+ ),
349
+ request_id: T.nilable(String),
350
+ timestamp: String
351
+ }
352
+ )
353
+ end
354
+ def to_hash
355
+ end
356
+
357
+ class Payload < Sentdm::Internal::Type::BaseModel
358
+ OrHash =
359
+ T.type_alias do
360
+ T.any(
361
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload::Payload,
362
+ Sentdm::Internal::AnyHash
363
+ )
364
+ end
365
+
366
+ # The link's public identifier — the eight-character code in the short URL, for
367
+ # example A78B2BU0. Unique across both kinds, and never reused, so it is the
368
+ # stable key to group one link's events by.
369
+ sig { returns(String) }
370
+ attr_accessor :record_id
371
+
372
+ # Where the request appeared to come from, as an ISO 3166-1 alpha-2 code. Named
373
+ # separately from the country on a channel event, which is a destination market
374
+ # the customer registered for — this one is a property of a single visitor and is
375
+ # absent when the edge could not resolve it.
376
+ sig { returns(T.nilable(String)) }
377
+ attr_accessor :access_country
378
+
379
+ # How the request was served, when the edge recorded it. Free text describing the
380
+ # outcome — show it to a human rather than branching on it.
381
+ sig { returns(T.nilable(String)) }
382
+ attr_accessor :access_outcome
383
+
384
+ # The requesting browser family, for example chrome or safari, or unknown. Derived
385
+ # from the user agent.
386
+ sig { returns(T.nilable(String)) }
387
+ attr_accessor :browser
388
+
389
+ # How many bytes were served, for a file access. A ranged request reports the
390
+ # bytes in that range, not the size of the file, so several accesses of one file
391
+ # can each report a part.
392
+ sig { returns(T.nilable(Integer)) }
393
+ attr_accessor :bytes_served
394
+
395
+ # The channel the message carrying this link went out on: sms, whatsapp, or rcs.
396
+ sig { returns(T.nilable(String)) }
397
+ attr_accessor :channel
398
+
399
+ # The organization the link belongs to. Always the parent account, never a sender
400
+ # profile — read SenderProfileId for that.
401
+ #
402
+ # This family publishes the owner as an explicit pair rather than the single
403
+ # account_id the other families use. The pair says which organization and which
404
+ # profile without the subscriber deriving either, which is the trade: one more key
405
+ # against not having to know that account_id silently becomes the profile when one
406
+ # exists.
407
+ sig { returns(T.nilable(String)) }
408
+ attr_reader :customer_id
409
+
410
+ sig { params(customer_id: String).void }
411
+ attr_writer :customer_id
412
+
413
+ # The requesting device class: mobile, tablet, desktop or unknown. Derived from
414
+ # the user agent.
415
+ sig { returns(T.nilable(String)) }
416
+ attr_accessor :device
417
+
418
+ # What the link points at: url for a destination the customer supplied, file for
419
+ # media Sent hosts. Always present, and implied by the event — link.clicked is
420
+ # always url and link.downloaded always file — but published as its own field so a
421
+ # subscriber can branch on the kind without parsing the event name, the same
422
+ # separation the channel family keeps between its event and its status.
423
+ sig { returns(T.nilable(String)) }
424
+ attr_reader :link_kind
425
+
426
+ sig { params(link_kind: String).void }
427
+ attr_writer :link_kind
428
+
429
+ # The message the link was published in.
430
+ #
431
+ # The event can arrive before the message is readable through GET /v3/messages: a
432
+ # provider may fetch a link within milliseconds of the send, and nothing here
433
+ # waits for the message row. Retry the read rather than treating an unknown id as
434
+ # an error.
435
+ sig { returns(T.nilable(String)) }
436
+ attr_accessor :message_id
437
+
438
+ # When the access or lifecycle change actually happened, in UTC
439
+ # (yyyy-MM-ddTHH:mm:ssZ). The envelope's timestamp is when Sent emitted the event;
440
+ # this is when the thing occurred, and the two differ by the ingest delay.
441
+ sig { returns(T.nilable(String)) }
442
+ attr_reader :occurred_at
443
+
444
+ sig { params(occurred_at: String).void }
445
+ attr_writer :occurred_at
446
+
447
+ # The caller-supplied label tying this link back to a position in the message, for
448
+ # example body:0 for the first link in the body. Present when the link was created
449
+ # with one.
450
+ sig { returns(T.nilable(String)) }
451
+ attr_accessor :reference_key
452
+
453
+ # The host of the page that linked here, when the request supplied one. The host
454
+ # only — never a full referring URL.
455
+ sig { returns(T.nilable(String)) }
456
+ attr_accessor :referrer_host
457
+
458
+ # The HTTP method of the request that was served, for an access event. Omitted on
459
+ # link.expired and link.revoked, which describe no request.
460
+ sig { returns(T.nilable(String)) }
461
+ attr_accessor :request_method
462
+
463
+ # The sender profile that owns the link, or null when the organization owns it
464
+ # directly. Always on the wire so a handler reads one shape rather than branching
465
+ # on whether the key arrived.
466
+ #
467
+ # sender_profile_id, not profile_id: the API already publishes
468
+ # messaging_profile_id and sending_phone_number_profile_id for provider-side
469
+ # profiles, which are a different thing entirely. The unqualified name would read
470
+ # as one of those.
471
+ sig { returns(T.nilable(String)) }
472
+ attr_accessor :sender_profile_id
473
+
474
+ # The HTTP status Sent answered the request with: 302 for a link, 200 or 206 for a
475
+ # file. Omitted on lifecycle events.
476
+ sig { returns(T.nilable(Integer)) }
477
+ attr_accessor :status_code
478
+
479
+ # A coarse guess at what made the request: likely_human, provider (a messaging
480
+ # platform prefetching the link), bot, or unknown. Derived from the user agent, so
481
+ # it is a hint for filtering noise rather than a fact to bill or report on.
482
+ sig { returns(T.nilable(String)) }
483
+ attr_accessor :traffic_class
484
+
485
+ # Body of a link event: something happened to a tracked link Sent published on the
486
+ # customer's behalf. A link points either at a URL the customer supplied or at a
487
+ # file Sent hosts for them; LinkKind says which. Delivered when an eligible
488
+ # request is served, or when a published link reaches the end of its life.
489
+ #
490
+ # A click is a request, not a read receipt. link.clicked means the redirect was
491
+ # served; link.downloaded means bytes went out. Neither proves a person saw
492
+ # anything — messaging providers and link scanners fetch URLs on their own, which
493
+ # is what TrafficClass exists to tell apart. Filter on it before reporting a
494
+ # click-through rate; treat likely_human as a hint, never as delivery
495
+ # confirmation.
496
+ #
497
+ # RecordId identifies the link; the X-Webhook-Event-ID header identifies the
498
+ # delivery. One link is hit many times, so those are the two keys a subscriber
499
+ # needs: group by the first, deduplicate on the second — exactly as on every other
500
+ # family. The payload carries no event identifier of its own, for the same reason
501
+ # none of the others do.
502
+ #
503
+ # Nothing here identifies the visitor. No IP address and no visitor token crosses
504
+ # this boundary. Country, Device and Browser are coarse buckets derived at the
505
+ # edge and are absent whenever the request did not supply enough to derive them.
506
+ sig do
507
+ params(
508
+ record_id: String,
509
+ access_country: T.nilable(String),
510
+ access_outcome: T.nilable(String),
511
+ browser: T.nilable(String),
512
+ bytes_served: T.nilable(Integer),
513
+ channel: T.nilable(String),
514
+ customer_id: String,
515
+ device: T.nilable(String),
516
+ link_kind: String,
517
+ message_id: T.nilable(String),
518
+ occurred_at: String,
519
+ reference_key: T.nilable(String),
520
+ referrer_host: T.nilable(String),
521
+ request_method: T.nilable(String),
522
+ sender_profile_id: T.nilable(String),
523
+ status_code: T.nilable(Integer),
524
+ traffic_class: T.nilable(String)
525
+ ).returns(T.attached_class)
526
+ end
527
+ def self.new(
528
+ # The link's public identifier — the eight-character code in the short URL, for
529
+ # example A78B2BU0. Unique across both kinds, and never reused, so it is the
530
+ # stable key to group one link's events by.
531
+ record_id:,
532
+ # Where the request appeared to come from, as an ISO 3166-1 alpha-2 code. Named
533
+ # separately from the country on a channel event, which is a destination market
534
+ # the customer registered for — this one is a property of a single visitor and is
535
+ # absent when the edge could not resolve it.
536
+ access_country: nil,
537
+ # How the request was served, when the edge recorded it. Free text describing the
538
+ # outcome — show it to a human rather than branching on it.
539
+ access_outcome: nil,
540
+ # The requesting browser family, for example chrome or safari, or unknown. Derived
541
+ # from the user agent.
542
+ browser: nil,
543
+ # How many bytes were served, for a file access. A ranged request reports the
544
+ # bytes in that range, not the size of the file, so several accesses of one file
545
+ # can each report a part.
546
+ bytes_served: nil,
547
+ # The channel the message carrying this link went out on: sms, whatsapp, or rcs.
548
+ channel: nil,
549
+ # The organization the link belongs to. Always the parent account, never a sender
550
+ # profile — read SenderProfileId for that.
551
+ #
552
+ # This family publishes the owner as an explicit pair rather than the single
553
+ # account_id the other families use. The pair says which organization and which
554
+ # profile without the subscriber deriving either, which is the trade: one more key
555
+ # against not having to know that account_id silently becomes the profile when one
556
+ # exists.
557
+ customer_id: nil,
558
+ # The requesting device class: mobile, tablet, desktop or unknown. Derived from
559
+ # the user agent.
560
+ device: nil,
561
+ # What the link points at: url for a destination the customer supplied, file for
562
+ # media Sent hosts. Always present, and implied by the event — link.clicked is
563
+ # always url and link.downloaded always file — but published as its own field so a
564
+ # subscriber can branch on the kind without parsing the event name, the same
565
+ # separation the channel family keeps between its event and its status.
566
+ link_kind: nil,
567
+ # The message the link was published in.
568
+ #
569
+ # The event can arrive before the message is readable through GET /v3/messages: a
570
+ # provider may fetch a link within milliseconds of the send, and nothing here
571
+ # waits for the message row. Retry the read rather than treating an unknown id as
572
+ # an error.
573
+ message_id: nil,
574
+ # When the access or lifecycle change actually happened, in UTC
575
+ # (yyyy-MM-ddTHH:mm:ssZ). The envelope's timestamp is when Sent emitted the event;
576
+ # this is when the thing occurred, and the two differ by the ingest delay.
577
+ occurred_at: nil,
578
+ # The caller-supplied label tying this link back to a position in the message, for
579
+ # example body:0 for the first link in the body. Present when the link was created
580
+ # with one.
581
+ reference_key: nil,
582
+ # The host of the page that linked here, when the request supplied one. The host
583
+ # only — never a full referring URL.
584
+ referrer_host: nil,
585
+ # The HTTP method of the request that was served, for an access event. Omitted on
586
+ # link.expired and link.revoked, which describe no request.
587
+ request_method: nil,
588
+ # The sender profile that owns the link, or null when the organization owns it
589
+ # directly. Always on the wire so a handler reads one shape rather than branching
590
+ # on whether the key arrived.
591
+ #
592
+ # sender_profile_id, not profile_id: the API already publishes
593
+ # messaging_profile_id and sending_phone_number_profile_id for provider-side
594
+ # profiles, which are a different thing entirely. The unqualified name would read
595
+ # as one of those.
596
+ sender_profile_id: nil,
597
+ # The HTTP status Sent answered the request with: 302 for a link, 200 or 206 for a
598
+ # file. Omitted on lifecycle events.
599
+ status_code: nil,
600
+ # A coarse guess at what made the request: likely_human, provider (a messaging
601
+ # platform prefetching the link), bot, or unknown. Derived from the user agent, so
602
+ # it is a hint for filtering noise rather than a fact to bill or report on.
603
+ traffic_class: nil
604
+ )
605
+ end
606
+
607
+ sig do
608
+ override.returns(
609
+ {
610
+ record_id: String,
611
+ access_country: T.nilable(String),
612
+ access_outcome: T.nilable(String),
613
+ browser: T.nilable(String),
614
+ bytes_served: T.nilable(Integer),
615
+ channel: T.nilable(String),
616
+ customer_id: String,
617
+ device: T.nilable(String),
618
+ link_kind: String,
619
+ message_id: T.nilable(String),
620
+ occurred_at: String,
621
+ reference_key: T.nilable(String),
622
+ referrer_host: T.nilable(String),
623
+ request_method: T.nilable(String),
624
+ sender_profile_id: T.nilable(String),
625
+ status_code: T.nilable(Integer),
626
+ traffic_class: T.nilable(String)
627
+ }
628
+ )
629
+ end
630
+ def to_hash
631
+ end
632
+ end
633
+ end
634
+
635
+ class SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload < Sentdm::Internal::Type::BaseModel
636
+ OrHash =
637
+ T.type_alias do
638
+ T.any(
639
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload,
640
+ Sentdm::Internal::AnyHash
641
+ )
642
+ end
643
+
644
+ # The specific event within the family, for example message.delivered,
645
+ # message.received or contact.opt_out. Absent on events that have no subtype, so
646
+ # treat it as optional.
647
+ sig { returns(T.nilable(String)) }
648
+ attr_accessor :event
649
+
650
+ # The event family, for example message, templates or contact. Route on this
651
+ # first, then on event for the specific change.
652
+ sig { returns(T.nilable(String)) }
653
+ attr_reader :field
654
+
655
+ sig { params(field: String).void }
656
+ attr_writer :field
657
+
658
+ # Body of a call.initiated, call.answered, call.completed, call.failed or
659
+ # call.recording_ready event. Which of them occurred is the envelope's event.
660
+ #
661
+ # Shaped like the message, inbound, template and channel payloads: account_id
662
+ # names the account the event is about, channel names the channel, and updated_at
663
+ # is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
664
+ # duration_seconds and price are added on call.completed, reason on call.failed
665
+ # and recording_id on call.recording_ready; each is omitted rather than sent as
666
+ # null when it does not apply.
667
+ #
668
+ # Casing is snake_case because these ride the same webhook stream customers
669
+ # already parse message_id from; the question/answer contract is a separate
670
+ # surface and stays camelCase. Nothing here is provider-shaped: no provider call
671
+ # id, no namespaced identity.
672
+ sig do
673
+ returns(
674
+ T.nilable(
675
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::Payload
676
+ )
677
+ )
678
+ end
679
+ attr_reader :payload
680
+
681
+ sig do
682
+ params(
683
+ payload:
684
+ T.nilable(
685
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::Payload::OrHash
686
+ )
687
+ ).void
688
+ end
689
+ attr_writer :payload
690
+
691
+ # The event-specific body.
692
+ sig { returns(T.nilable(String)) }
693
+ attr_accessor :request_id
694
+
695
+ # When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
696
+ # time, not the time the underlying change happened. Use the timestamp inside the
697
+ # payload for the latter.
698
+ sig { returns(T.nilable(String)) }
699
+ attr_reader :timestamp
700
+
701
+ sig { params(timestamp: String).void }
702
+ attr_writer :timestamp
703
+
704
+ # The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
705
+ # this shape and varies only in Payload.
706
+ sig do
707
+ params(
708
+ event: T.nilable(String),
709
+ field: String,
710
+ payload:
711
+ T.nilable(
712
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::Payload::OrHash
713
+ ),
714
+ request_id: T.nilable(String),
715
+ timestamp: String
716
+ ).returns(T.attached_class)
717
+ end
718
+ def self.new(
719
+ # The specific event within the family, for example message.delivered,
720
+ # message.received or contact.opt_out. Absent on events that have no subtype, so
721
+ # treat it as optional.
722
+ event: nil,
723
+ # The event family, for example message, templates or contact. Route on this
724
+ # first, then on event for the specific change.
725
+ field: nil,
726
+ # Body of a call.initiated, call.answered, call.completed, call.failed or
727
+ # call.recording_ready event. Which of them occurred is the envelope's event.
728
+ #
729
+ # Shaped like the message, inbound, template and channel payloads: account_id
730
+ # names the account the event is about, channel names the channel, and updated_at
731
+ # is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
732
+ # duration_seconds and price are added on call.completed, reason on call.failed
733
+ # and recording_id on call.recording_ready; each is omitted rather than sent as
734
+ # null when it does not apply.
735
+ #
736
+ # Casing is snake_case because these ride the same webhook stream customers
737
+ # already parse message_id from; the question/answer contract is a separate
738
+ # surface and stays camelCase. Nothing here is provider-shaped: no provider call
739
+ # id, no namespaced identity.
740
+ payload: nil,
741
+ # The event-specific body.
742
+ request_id: nil,
743
+ # When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
744
+ # time, not the time the underlying change happened. Use the timestamp inside the
745
+ # payload for the latter.
746
+ timestamp: nil
747
+ )
748
+ end
749
+
750
+ sig do
751
+ override.returns(
752
+ {
753
+ event: T.nilable(String),
754
+ field: String,
755
+ payload:
756
+ T.nilable(
757
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::Payload
758
+ ),
759
+ request_id: T.nilable(String),
760
+ timestamp: String
761
+ }
762
+ )
763
+ end
764
+ def to_hash
765
+ end
766
+
767
+ class Payload < Sentdm::Internal::Type::BaseModel
768
+ OrHash =
769
+ T.type_alias do
770
+ T.any(
771
+ Sentdm::Models::WebhookListEventsResponse::EventData::SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload::Payload,
772
+ Sentdm::Internal::AnyHash
773
+ )
774
+ end
775
+
776
+ # Sent's call id, the same one the customer saw on the first question.
777
+ sig { returns(String) }
778
+ attr_accessor :call_id
779
+
780
+ # The account the call belongs to: the key's own customer, or the sender profile
781
+ # it acted as.
782
+ sig { returns(T.nilable(String)) }
783
+ attr_reader :account_id
784
+
785
+ sig { params(account_id: String).void }
786
+ attr_writer :account_id
787
+
788
+ # Always voice.
789
+ sig { returns(T.nilable(String)) }
790
+ attr_reader :channel
791
+
792
+ sig { params(channel: String).void }
793
+ attr_writer :channel
794
+
795
+ # How long the call lasted. Only on call.completed.
796
+ sig { returns(T.nilable(Integer)) }
797
+ attr_accessor :duration_seconds
798
+
799
+ # The customer number that owns the call, in E.164 format.
800
+ sig { returns(T.nilable(String)) }
801
+ attr_reader :number
802
+
803
+ sig { params(number: String).void }
804
+ attr_writer :number
805
+
806
+ # What the call was charged. Only on call.completed, and omitted there until
807
+ # billing has recorded the charge.
808
+ sig { returns(T.nilable(Float)) }
809
+ attr_accessor :price
810
+
811
+ # The machine-readable reason the call did not complete. Only on call.failed, and
812
+ # omitted when no reason was recorded.
813
+ sig { returns(T.nilable(String)) }
814
+ attr_accessor :reason
815
+
816
+ # The recording that became available, the same id GET /v3/calls/{id}/recordings
817
+ # lists it under. Only on call.recording_ready, which is sent once per recording.
818
+ sig { returns(T.nilable(String)) }
819
+ attr_accessor :recording_id
820
+
821
+ # When the change happened on the call, as opposed to when the event was emitted.
822
+ sig { returns(T.nilable(String)) }
823
+ attr_reader :updated_at
824
+
825
+ sig { params(updated_at: String).void }
826
+ attr_writer :updated_at
827
+
828
+ # Body of a call.initiated, call.answered, call.completed, call.failed or
829
+ # call.recording_ready event. Which of them occurred is the envelope's event.
830
+ #
831
+ # Shaped like the message, inbound, template and channel payloads: account_id
832
+ # names the account the event is about, channel names the channel, and updated_at
833
+ # is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
834
+ # duration_seconds and price are added on call.completed, reason on call.failed
835
+ # and recording_id on call.recording_ready; each is omitted rather than sent as
836
+ # null when it does not apply.
837
+ #
838
+ # Casing is snake_case because these ride the same webhook stream customers
839
+ # already parse message_id from; the question/answer contract is a separate
840
+ # surface and stays camelCase. Nothing here is provider-shaped: no provider call
841
+ # id, no namespaced identity.
842
+ sig do
843
+ params(
844
+ call_id: String,
845
+ account_id: String,
846
+ channel: String,
847
+ duration_seconds: T.nilable(Integer),
848
+ number: String,
849
+ price: T.nilable(Float),
850
+ reason: T.nilable(String),
851
+ recording_id: T.nilable(String),
852
+ updated_at: String
853
+ ).returns(T.attached_class)
854
+ end
855
+ def self.new(
856
+ # Sent's call id, the same one the customer saw on the first question.
857
+ call_id:,
858
+ # The account the call belongs to: the key's own customer, or the sender profile
859
+ # it acted as.
860
+ account_id: nil,
861
+ # Always voice.
862
+ channel: nil,
863
+ # How long the call lasted. Only on call.completed.
864
+ duration_seconds: nil,
865
+ # The customer number that owns the call, in E.164 format.
866
+ number: nil,
867
+ # What the call was charged. Only on call.completed, and omitted there until
868
+ # billing has recorded the charge.
869
+ price: nil,
870
+ # The machine-readable reason the call did not complete. Only on call.failed, and
871
+ # omitted when no reason was recorded.
872
+ reason: nil,
873
+ # The recording that became available, the same id GET /v3/calls/{id}/recordings
874
+ # lists it under. Only on call.recording_ready, which is sent once per recording.
875
+ recording_id: nil,
876
+ # When the change happened on the call, as opposed to when the event was emitted.
877
+ updated_at: nil
878
+ )
879
+ end
880
+
881
+ sig do
882
+ override.returns(
883
+ {
884
+ call_id: String,
885
+ account_id: String,
886
+ channel: String,
887
+ duration_seconds: T.nilable(Integer),
888
+ number: String,
889
+ price: T.nilable(Float),
890
+ reason: T.nilable(String),
891
+ recording_id: T.nilable(String),
892
+ updated_at: String
893
+ }
894
+ )
895
+ end
896
+ def to_hash
897
+ end
898
+ end
899
+ end
900
+
166
901
  sig do
167
902
  override.returns(
168
903
  T::Array[