sentdm 0.31.0 → 0.33.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 (79) 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.rb +78 -0
  6. data/lib/sentdm/models/channel_event_payload.rb +265 -0
  7. data/lib/sentdm/models/contact_event.rb +77 -0
  8. data/lib/sentdm/models/contact_event_payload.rb +172 -0
  9. data/lib/sentdm/models/conversation_messages_list.rb +125 -4
  10. data/lib/sentdm/models/inbound_message_event.rb +16 -8
  11. data/lib/sentdm/models/message_event.rb +16 -8
  12. data/lib/sentdm/models/message_event_payload.rb +30 -1
  13. data/lib/sentdm/models/message_retrieve_activities_response.rb +20 -5
  14. data/lib/sentdm/models/message_retrieve_status_response.rb +133 -6
  15. data/lib/sentdm/models/message_send_params.rb +67 -3
  16. data/lib/sentdm/models/message_send_response.rb +13 -4
  17. data/lib/sentdm/models/template.rb +36 -5
  18. data/lib/sentdm/models/template_body.rb +102 -12
  19. data/lib/sentdm/models/template_body_content.rb +35 -3
  20. data/lib/sentdm/models/template_button.rb +8 -2
  21. data/lib/sentdm/models/template_button_props.rb +12 -1
  22. data/lib/sentdm/models/template_definition.rb +14 -2
  23. data/lib/sentdm/models/template_event.rb +16 -8
  24. data/lib/sentdm/models/template_event_payload.rb +31 -4
  25. data/lib/sentdm/models/template_header.rb +91 -3
  26. data/lib/sentdm/models/template_variable.rb +35 -4
  27. data/lib/sentdm/models/webhook_list_events_response.rb +332 -9
  28. data/lib/sentdm/models.rb +8 -0
  29. data/lib/sentdm/resources/messages.rb +33 -5
  30. data/lib/sentdm/resources/templates.rb +28 -2
  31. data/lib/sentdm/version.rb +1 -1
  32. data/lib/sentdm.rb +5 -1
  33. data/rbi/sentdm/client.rbi +6 -0
  34. data/rbi/sentdm/models/channel_event.rbi +128 -0
  35. data/rbi/sentdm/models/channel_event_payload.rbi +440 -0
  36. data/rbi/sentdm/models/contact_event.rbi +126 -0
  37. data/rbi/sentdm/models/contact_event_payload.rbi +254 -0
  38. data/rbi/sentdm/models/conversation_messages_list.rbi +202 -7
  39. data/rbi/sentdm/models/inbound_message_event.rbi +18 -10
  40. data/rbi/sentdm/models/message_event.rbi +18 -10
  41. data/rbi/sentdm/models/message_event_payload.rbi +34 -0
  42. data/rbi/sentdm/models/message_retrieve_activities_response.rbi +23 -5
  43. data/rbi/sentdm/models/message_retrieve_status_response.rbi +214 -9
  44. data/rbi/sentdm/models/message_send_params.rbi +100 -2
  45. data/rbi/sentdm/models/message_send_response.rbi +15 -5
  46. data/rbi/sentdm/models/template.rbi +58 -4
  47. data/rbi/sentdm/models/template_body.rbi +155 -13
  48. data/rbi/sentdm/models/template_body_content.rbi +59 -1
  49. data/rbi/sentdm/models/template_button.rbi +14 -2
  50. data/rbi/sentdm/models/template_button_props.rbi +22 -0
  51. data/rbi/sentdm/models/template_definition.rbi +20 -2
  52. data/rbi/sentdm/models/template_event.rbi +18 -10
  53. data/rbi/sentdm/models/template_event_payload.rbi +51 -8
  54. data/rbi/sentdm/models/template_header.rbi +143 -2
  55. data/rbi/sentdm/models/template_variable.rbi +38 -1
  56. data/rbi/sentdm/models/webhook_list_events_response.rbi +484 -12
  57. data/rbi/sentdm/models.rbi +8 -0
  58. data/rbi/sentdm/resources/messages.rbi +58 -3
  59. data/rbi/sentdm/resources/templates.rbi +28 -2
  60. data/sig/sentdm/models/channel_event.rbs +44 -0
  61. data/sig/sentdm/models/channel_event_payload.rbs +120 -0
  62. data/sig/sentdm/models/contact_event.rbs +44 -0
  63. data/sig/sentdm/models/contact_event_payload.rbs +78 -0
  64. data/sig/sentdm/models/conversation_messages_list.rbs +48 -3
  65. data/sig/sentdm/models/inbound_message_event.rbs +5 -0
  66. data/sig/sentdm/models/message_event.rbs +5 -0
  67. data/sig/sentdm/models/message_event_payload.rbs +15 -0
  68. data/sig/sentdm/models/message_retrieve_activities_response.rbs +5 -0
  69. data/sig/sentdm/models/message_retrieve_status_response.rbs +48 -3
  70. data/sig/sentdm/models/message_send_params.rbs +15 -0
  71. data/sig/sentdm/models/template.rbs +5 -0
  72. data/sig/sentdm/models/template_body.rbs +44 -0
  73. data/sig/sentdm/models/template_event.rbs +5 -0
  74. data/sig/sentdm/models/template_event_payload.rbs +9 -6
  75. data/sig/sentdm/models/template_header.rbs +44 -0
  76. data/sig/sentdm/models/webhook_list_events_response.rbs +147 -0
  77. data/sig/sentdm/models.rbs +8 -0
  78. data/sig/sentdm/resources/messages.rbs +3 -0
  79. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc53282fa9d44937f4eca7cd2519066c9230dd80c07e757976aaf19ed84bc4cd
4
- data.tar.gz: ae37ec96f9bbd5415b93931e5f5b45f86bf2cfd9aa5496c3e48a4e4cf55c601c
3
+ metadata.gz: 88e9bb540faf8a7261b5e38bb2b040df80d8f02124ae52f313d7d0019fe84042
4
+ data.tar.gz: 52b07edc509cd9c60d586cffede3b951ba9e8f8de1b34776c1b9d86655dd2dfc
5
5
  SHA512:
6
- metadata.gz: ad4d72570b0f014b5c0ae8ed154c6eda9cbf18fe6b765bd2159ac2468474c85dfba17e0d662f38c987ea0330eceb7e77d33137ebbb7df2591c65bae1f5415342
7
- data.tar.gz: 6c941c5ce504b94a154865c6d1fa3ddcfcf90f58889e0514c0f74c89c324eb0c3312b55cd8ad4f5a32274b8ac28e8d65805496be73ad757621fd1a5a19e30c2e
6
+ metadata.gz: 83049b88e719812408bf187ebb7d8723c45368fc89ff7d21dce6cdd2cdd2c74f892da306081d5b9af50df59668a69160b91a11bd6796d978560738bbfd3a0fc5
7
+ data.tar.gz: 95eb98fb732c34e1ce224cfdfec45193477bd8aae18e5daf6d5da3bee50a3018c712304da29fbf146b2f92c330d512d617a82fbeb77dd4f1a25f4752c2566929
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.33.0](https://github.com/sentdm/sent-dm-ruby/compare/v0.32.0...v0.33.0) (2026-09-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** sync generated SDKs from the committed spec ([c68607e](https://github.com/sentdm/sent-dm-ruby/commit/c68607ed78d4a03f1c3c03d36440985cd5eedceb))
9
+ * **api:** sync OpenAPI spec from production ([ceb47d9](https://github.com/sentdm/sent-dm-ruby/commit/ceb47d9ddc2d46144e5f81b0ef4bc7693b1f435f))
10
+ * **api:** sync OpenAPI spec from production ([8c92eb5](https://github.com/sentdm/sent-dm-ruby/commit/8c92eb52bff195424d14d09eff8f131edc640918))
11
+
12
+ ## [0.32.0](https://github.com/sentdm/sent-dm-ruby/compare/v0.31.0...v0.32.0) (2026-09-18)
13
+
14
+
15
+ ### Features
16
+
17
+ * **api:** sync OpenAPI spec from production ([d1e2524](https://github.com/sentdm/sent-dm-ruby/commit/d1e2524bd0002641b5466b2eaf1ba189c9d80acf))
18
+
3
19
  ## [0.31.0](https://github.com/sentdm/sent-dm-ruby/compare/v0.30.0...v0.31.0) (2026-09-10)
4
20
 
5
21
 
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "sentdm", "~> 0.31.0"
20
+ gem "sentdm", "~> 0.33.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
data/lib/sentdm/client.rb CHANGED
@@ -83,6 +83,12 @@ module Sentdm
83
83
  # **A message needs a sender.** What you can send, where, and at what cost is
84
84
  # decided by the markets under **Channels** — so a recipient in a country you hold
85
85
  # no sender for is refused here rather than queued.
86
+ #
87
+ # **A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a
88
+ # finished message — typically one BLOCKED for insufficient balance — back through
89
+ # the send pipeline. It is a new attempt, not a free retry: every policy runs
90
+ # again, the message is billed again, and its status webhooks fire again. A
91
+ # FILTERED message is never resendable.
86
92
  # @return [Sentdm::Resources::Messages]
87
93
  attr_reader :messages
88
94
 
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Models
5
+ class ChannelEvent < Sentdm::Internal::Type::BaseModel
6
+ # @!attribute event
7
+ # The specific event within the family, for example message.delivered,
8
+ # message.received or contact.opt_out. Absent on events that have no subtype, so
9
+ # treat it as optional.
10
+ #
11
+ # @return [String, nil]
12
+ optional :event, String, nil?: true
13
+
14
+ # @!attribute field
15
+ # The event family, for example message, templates or contact. Route on this
16
+ # first, then on event for the specific change.
17
+ #
18
+ # @return [String, nil]
19
+ optional :field, String
20
+
21
+ # @!attribute payload
22
+ # Body of a channel event: where one of the customer's channels stands in
23
+ # provisioning and compliance. Delivered when a milestone moves — a registration
24
+ # filed, a verdict returned, a resubmission asked for, a sender gone live — so a
25
+ # customer's own onboarding UI does not have to poll GET /v3/channels.
26
+ #
27
+ # The subject is one item, never the account. A customer's "SMS channel" has no
28
+ # status; a market does. Country, NumberType and SenderValue name which one, so a
29
+ # customer terminating only to Kosovo never receives an event about US 10DLC.
30
+ #
31
+ # Status is the stable half of the contract. It is the same four-value set GET
32
+ # /v3/channels publishes, computed through the same code, so an event and a read
33
+ # of the same market cannot disagree. A subscriber that reads nothing but the
34
+ # status and the subject fields is a correct subscriber. The sub-type on the
35
+ # envelope names the specific milestone and is additive — that vocabulary comes
36
+ # from registries and carriers, which are parties Sent does not control.
37
+ #
38
+ # Status means provisioning and compliance are complete, not that a send will
39
+ # succeed right now. An account can be suspended, or a destination blocked by a
40
+ # routing rule, without either showing up here. Those are separate surfaces and
41
+ # deliberately not modelled on this payload.
42
+ #
43
+ # @return [Sentdm::Models::ChannelEventPayload, nil]
44
+ optional :payload, -> { Sentdm::ChannelEventPayload }, nil?: true
45
+
46
+ # @!attribute request_id
47
+ # The event-specific body.
48
+ #
49
+ # @return [String, nil]
50
+ optional :request_id, String, nil?: true
51
+
52
+ # @!attribute timestamp
53
+ # When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
54
+ # time, not the time the underlying change happened. Use the timestamp inside the
55
+ # payload for the latter.
56
+ #
57
+ # @return [String, nil]
58
+ optional :timestamp, String
59
+
60
+ # @!method initialize(event: nil, field: nil, payload: nil, request_id: nil, timestamp: nil)
61
+ # Some parameter documentations has been truncated, see
62
+ # {Sentdm::Models::ChannelEvent} for more details.
63
+ #
64
+ # The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
65
+ # this shape and varies only in Payload.
66
+ #
67
+ # @param event [String, nil] The specific event within the family, for example message.delivered,
68
+ #
69
+ # @param field [String] The event family, for example message, templates or contact. Route on
70
+ #
71
+ # @param payload [Sentdm::Models::ChannelEventPayload, nil] Body of a channel event: where one of the customer's channels stands in provisio
72
+ #
73
+ # @param request_id [String, nil] The event-specific body.
74
+ #
75
+ # @param timestamp [String] When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,265 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Models
5
+ class ChannelEventPayload < Sentdm::Internal::Type::BaseModel
6
+ # @!attribute country
7
+ # The market's destination country as an ISO 3166-1 alpha-2 code, for example XK.
8
+ # Always present, and the property that identifies this payload among the
9
+ # delivered envelopes — see DeliveredWebhookEvents. Every event in this family
10
+ # reports one market, and a market has a country.
11
+ #
12
+ # @return [String]
13
+ required :country, String
14
+
15
+ # @!attribute account_id
16
+ # The account whose market this is, named as on every other family. When an
17
+ # organization receives an event for one of its sender profiles this is the
18
+ # profile, so a reseller compares it with its own id and anything different is one
19
+ # of its profiles. Matches customer_id on GET /v3/channels and the sender
20
+ # profile's id. Together with channel, country, and number_type, it identifies the
21
+ # market.
22
+ #
23
+ # @return [String, nil]
24
+ optional :account_id, String
25
+
26
+ # @!attribute channel
27
+ # The channel this market belongs to: sms, whatsapp, or rcs. Never sent — that
28
+ # value belongs to message events, where it names the smart-routing brand rather
29
+ # than a channel that can be provisioned.
30
+ #
31
+ # @return [String, nil]
32
+ optional :channel, String
33
+
34
+ # @!attribute compliance
35
+ # What a market has been given: the identity it registers under, its programme,
36
+ # and any documents attached.
37
+ #
38
+ # What it does not carry is what the market asks for. That is the subject of GET
39
+ # /v3/compliance/requirements, and it is the same answer for every caller — a
40
+ # description of what a compliance regime wants, not a record of one customer's
41
+ # progress through it. It was reported here as well for a while, which put the
42
+ # same array in six response shapes and left a caller deciding which of two
43
+ # sources to believe.
44
+ #
45
+ # Present on a list read for markets that register (carrying brand and campaign),
46
+ # but with documents absent — documents are not fetched for a list, because a
47
+ # catalog lookup and a document read per market would multiply across a page.
48
+ # Absent documents is distinct from an empty list: absent says they were not
49
+ # fetched; empty says the market has been given none. The parent object is null
50
+ # only when the market registers with nobody and compliance was not computed —
51
+ # nothing to show at all.
52
+ #
53
+ # @return [Sentdm::Models::ChannelEventPayload::Compliance, nil]
54
+ optional :compliance, -> { Sentdm::ChannelEventPayload::Compliance }, nil?: true
55
+
56
+ # @!attribute number_type
57
+ # The kind of sender the market uses, for example TEN_DLC, LOCAL, or ALPHANUMERIC.
58
+ # Omitted when the subject has no sender type of its own.
59
+ #
60
+ # @return [String, nil]
61
+ optional :number_type, String, nil?: true
62
+
63
+ # @!attribute reason
64
+ # Why the market reached this state, when a reason was given — a correction
65
+ # explained, or a campaign lapse. Free text, passed through from the registry or
66
+ # carrier that wrote it, so treat it as a message to show a human rather than a
67
+ # value to branch on.
68
+ #
69
+ # @return [String, nil]
70
+ optional :reason, String, nil?: true
71
+
72
+ # @!attribute sender_value
73
+ # The sender itself — a number in E.164, or an alphanumeric sender ID.
74
+ #
75
+ # Always present, and null until a sender exists. The key is on every delivery so
76
+ # a subscriber reads one shape rather than branching on whether the field arrived
77
+ # — the same choice template_id makes on the message payload.
78
+ #
79
+ # It can carry a value at any point in the lifecycle, not only once the market is
80
+ # live: a number ordered and not yet active at the carrier is already known during
81
+ # PROVISIONING, and an alphanumeric sender the customer chose themselves is known
82
+ # before anything is filed. It is null while the market is still waiting on a
83
+ # number, which for a US 10DLC registration is every event up to
84
+ # channel.activated.
85
+ #
86
+ # @return [String, nil]
87
+ optional :sender_value, String, nil?: true
88
+
89
+ # @!attribute status
90
+ # Where the market stands: PENDING_REVIEW, ACTION_NEEDED, PROVISIONING, ACTIVE or
91
+ # INACTIVE. PENDING_REVIEW means a registry or a carrier holds it and the wait is
92
+ # theirs; ACTION_NEEDED means it is yours; PROVISIONING means the verdict is in
93
+ # and Sent is acquiring the sender; INACTIVE means it had a working sender and no
94
+ # longer does.
95
+ #
96
+ # Each event name is the transition into one of these, but the two are separate
97
+ # fields and may legitimately differ. A resubmission filed against a market whose
98
+ # sender is already live is channel.submitted carrying ACTIVE: a correction is
99
+ # with the registry and the sender keeps working. Read both.
100
+ #
101
+ # @return [String, nil]
102
+ optional :status, String
103
+
104
+ # @!attribute updated_at
105
+ # When the transition happened, in UTC (yyyy-MM-ddTHH:mm:ssZ).
106
+ #
107
+ # @return [String, nil]
108
+ optional :updated_at, String
109
+
110
+ # @!method initialize(country:, account_id: nil, channel: nil, compliance: nil, number_type: nil, reason: nil, sender_value: nil, status: nil, updated_at: nil)
111
+ # Some parameter documentations has been truncated, see
112
+ # {Sentdm::Models::ChannelEventPayload} for more details.
113
+ #
114
+ # Body of a channel event: where one of the customer's channels stands in
115
+ # provisioning and compliance. Delivered when a milestone moves — a registration
116
+ # filed, a verdict returned, a resubmission asked for, a sender gone live — so a
117
+ # customer's own onboarding UI does not have to poll GET /v3/channels.
118
+ #
119
+ # The subject is one item, never the account. A customer's "SMS channel" has no
120
+ # status; a market does. Country, NumberType and SenderValue name which one, so a
121
+ # customer terminating only to Kosovo never receives an event about US 10DLC.
122
+ #
123
+ # Status is the stable half of the contract. It is the same four-value set GET
124
+ # /v3/channels publishes, computed through the same code, so an event and a read
125
+ # of the same market cannot disagree. A subscriber that reads nothing but the
126
+ # status and the subject fields is a correct subscriber. The sub-type on the
127
+ # envelope names the specific milestone and is additive — that vocabulary comes
128
+ # from registries and carriers, which are parties Sent does not control.
129
+ #
130
+ # Status means provisioning and compliance are complete, not that a send will
131
+ # succeed right now. An account can be suspended, or a destination blocked by a
132
+ # routing rule, without either showing up here. Those are separate surfaces and
133
+ # deliberately not modelled on this payload.
134
+ #
135
+ # @param country [String] The market's destination country as an ISO 3166-1 alpha-2 code, for example XK.
136
+ #
137
+ # @param account_id [String] The account whose market this is, named as on every other family. When an organi
138
+ #
139
+ # @param channel [String] The channel this market belongs to: sms, whatsapp, or rcs. Never
140
+ #
141
+ # @param compliance [Sentdm::Models::ChannelEventPayload::Compliance, nil] What a market has been given: the identity it registers under, its programme, an
142
+ #
143
+ # @param number_type [String, nil] The kind of sender the market uses, for example TEN_DLC, LOCAL, or
144
+ #
145
+ # @param reason [String, nil] Why the market reached this state, when a reason was given — a correction explai
146
+ #
147
+ # @param sender_value [String, nil] The sender itself — a number in E.164, or an alphanumeric sender ID.
148
+ #
149
+ # @param status [String] Where the market stands: PENDING_REVIEW, ACTION_NEEDED, PROVISIONING,
150
+ #
151
+ # @param updated_at [String] When the transition happened, in UTC (yyyy-MM-ddTHH:mm:ssZ).
152
+
153
+ # @see Sentdm::Models::ChannelEventPayload#compliance
154
+ class Compliance < Sentdm::Internal::Type::BaseModel
155
+ # @!attribute brand
156
+ # The identity this market registers under, with inherit saying whose it is.
157
+ #
158
+ # Reported here rather than on the profile because it belongs to the registration
159
+ # this market files, and only one market files one. It was a top-level block for a
160
+ # while, which put a per-registration value beside a list of markets and left a
161
+ # caller to work out which market it belonged to.
162
+ #
163
+ # Absent for a market that registers with nobody — such a market asks for no
164
+ # identity, so there is none to report. Absent and null mean different things:
165
+ # absent says this market does not ask, null would say it asks and nothing was
166
+ # supplied.
167
+ #
168
+ # Untyped, like the request side, because its members are declared by the market's
169
+ # own schema rather than by a C# class. A typed pair here would be a second
170
+ # definition of what a market wants, free to drift from the one that validates.
171
+ #
172
+ # @return [Hash{Symbol=>Object}, nil]
173
+ optional :brand, Sentdm::Internal::Type::HashOf[Sentdm::Internal::Type::Unknown], nil?: true
174
+
175
+ # @!attribute campaign
176
+ # The programme this market registers, with inherit saying whose it is.
177
+ #
178
+ # One, not a list. TcrCampaigns permits several and an account built on the admin
179
+ # side may hold them, but this surface offers one — which is what lets the
180
+ # market's PATCH be an upsert rather than a collection with an addressable create
181
+ # behind it. An account holding several is reported as its first and refused on
182
+ # write, rather than half-edited.
183
+ #
184
+ # Carries no id. Nothing addresses a campaign, and an undeclared key would be
185
+ # refused if the caller sent this object back — which it is meant to be able to
186
+ # do.
187
+ #
188
+ # @return [Hash{Symbol=>Object}, nil]
189
+ optional :campaign, Sentdm::Internal::Type::HashOf[Sentdm::Internal::Type::Unknown], nil?: true
190
+
191
+ # @!attribute documents
192
+ # What has been supplied for this market.
193
+ #
194
+ # Files, not values — the declared halves above carry the values. A document
195
+ # cannot be a JSON value, so it is sent as multipart on the channel call and
196
+ # reported here as a reference.
197
+ #
198
+ # Absent on a list read, which fetches identity but does not compute compliance
199
+ # documents per market. Absent and empty mean different things: absent says the
200
+ # documents were not fetched; empty says the market has been given none.
201
+ #
202
+ # @return [Array<Sentdm::Models::ChannelEventPayload::Compliance::Document>, nil]
203
+ optional :documents,
204
+ -> { Sentdm::Internal::Type::ArrayOf[Sentdm::ChannelEventPayload::Compliance::Document] },
205
+ nil?: true
206
+
207
+ # @!method initialize(brand: nil, campaign: nil, documents: nil)
208
+ # Some parameter documentations has been truncated, see
209
+ # {Sentdm::Models::ChannelEventPayload::Compliance} for more details.
210
+ #
211
+ # What a market has been given: the identity it registers under, its programme,
212
+ # and any documents attached.
213
+ #
214
+ # What it does not carry is what the market asks for. That is the subject of GET
215
+ # /v3/compliance/requirements, and it is the same answer for every caller — a
216
+ # description of what a compliance regime wants, not a record of one customer's
217
+ # progress through it. It was reported here as well for a while, which put the
218
+ # same array in six response shapes and left a caller deciding which of two
219
+ # sources to believe.
220
+ #
221
+ # Present on a list read for markets that register (carrying brand and campaign),
222
+ # but with documents absent — documents are not fetched for a list, because a
223
+ # catalog lookup and a document read per market would multiply across a page.
224
+ # Absent documents is distinct from an empty list: absent says they were not
225
+ # fetched; empty says the market has been given none. The parent object is null
226
+ # only when the market registers with nobody and compliance was not computed —
227
+ # nothing to show at all.
228
+ #
229
+ # @param brand [Hash{Symbol=>Object}, nil] The identity this market registers under, with inherit saying whose it is.
230
+ #
231
+ # @param campaign [Hash{Symbol=>Object}, nil] The programme this market registers, with inherit saying whose it is.
232
+ #
233
+ # @param documents [Array<Sentdm::Models::ChannelEventPayload::Compliance::Document>, nil] What has been supplied for this market.
234
+
235
+ class Document < Sentdm::Internal::Type::BaseModel
236
+ # @!attribute document_id
237
+ # Identifier of the upload, for fetching it back through the documents endpoints.
238
+ #
239
+ # @return [String, nil]
240
+ optional :document_id, String, nil?: true
241
+
242
+ # @!attribute file_name
243
+ #
244
+ # @return [String, nil]
245
+ optional :file_name, String, nil?: true
246
+
247
+ # @!attribute key
248
+ # The catalog's name for this document, matching the requirement it satisfies.
249
+ #
250
+ # @return [String, nil]
251
+ optional :key, String
252
+
253
+ # @!method initialize(document_id: nil, file_name: nil, key: nil)
254
+ # A document a market asked for and has been given.
255
+ #
256
+ # @param document_id [String, nil] Identifier of the upload, for fetching it back through the documents endpoints.
257
+ #
258
+ # @param file_name [String, nil]
259
+ #
260
+ # @param key [String] The catalog's name for this document, matching the requirement it satisfies.
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Models
5
+ class ContactEvent < Sentdm::Internal::Type::BaseModel
6
+ # @!attribute event
7
+ # The specific event within the family, for example message.delivered,
8
+ # message.received or contact.opt_out. Absent on events that have no subtype, so
9
+ # treat it as optional.
10
+ #
11
+ # @return [String, nil]
12
+ optional :event, String, nil?: true
13
+
14
+ # @!attribute field
15
+ # The event family, for example message, templates or contact. Route on this
16
+ # first, then on event for the specific change.
17
+ #
18
+ # @return [String, nil]
19
+ optional :field, String
20
+
21
+ # @!attribute payload
22
+ # Body of a contact.opt_in, contact.opt_out, contact.help or
23
+ # contact.custom_keyword event. Delivered when a contact signals a consent change,
24
+ # asks for help, or sends one of your own auto-reply keywords.
25
+ #
26
+ # These events state the signal outright, so you do not have to recognise keywords
27
+ # in the text of a message.received event. They also cover cases that produce no
28
+ # inbound message at all, such as a network handling an opt-out on your behalf.
29
+ #
30
+ # Two of the four change consent and two do not: contact.help and
31
+ # contact.custom_keyword report the state the contact already had. Read opt_out
32
+ # for the state and the envelope's event for what happened, rather than inferring
33
+ # one from the other.
34
+ #
35
+ # Fields are ordered identity → resulting state → provenance → join keys. The two
36
+ # parties are from and to. Note that the message family has not moved to those
37
+ # names yet — message.received still calls the same two parties inbound_number and
38
+ # outbound_number. Nothing here restates the envelope: which signal occurred is
39
+ # the envelope's event, and when it was emitted is its timestamp. Retries carry
40
+ # the same X-Webhook-Event-ID header, which is what to deduplicate on.
41
+ #
42
+ # @return [Sentdm::Models::ContactEventPayload, nil]
43
+ optional :payload, -> { Sentdm::ContactEventPayload }, nil?: true
44
+
45
+ # @!attribute request_id
46
+ # The event-specific body.
47
+ #
48
+ # @return [String, nil]
49
+ optional :request_id, String, nil?: true
50
+
51
+ # @!attribute timestamp
52
+ # When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
53
+ # time, not the time the underlying change happened. Use the timestamp inside the
54
+ # payload for the latter.
55
+ #
56
+ # @return [String, nil]
57
+ optional :timestamp, String
58
+
59
+ # @!method initialize(event: nil, field: nil, payload: nil, request_id: nil, timestamp: nil)
60
+ # Some parameter documentations has been truncated, see
61
+ # {Sentdm::Models::ContactEvent} for more details.
62
+ #
63
+ # The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
64
+ # this shape and varies only in Payload.
65
+ #
66
+ # @param event [String, nil] The specific event within the family, for example message.delivered,
67
+ #
68
+ # @param field [String] The event family, for example message, templates or contact. Route on
69
+ #
70
+ # @param payload [Sentdm::Models::ContactEventPayload, nil] Body of a contact.opt_in, contact.opt_out, contact.help or
71
+ #
72
+ # @param request_id [String, nil] The event-specific body.
73
+ #
74
+ # @param timestamp [String] When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,172 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Models
5
+ class ContactEventPayload < Sentdm::Internal::Type::BaseModel
6
+ # @!attribute opt_out
7
+ # Whether the contact is opted out after this signal — the state to write to your
8
+ # own record. Same meaning as opt_out on the contact resource. On contact.help and
9
+ # contact.custom_keyword this reports the contact's existing state, which neither
10
+ # changes.
11
+ #
12
+ # Two signals from the same contact can arrive out of order, because each one is
13
+ # queued on its own rather than against the contact. Compare the envelope's
14
+ # timestamp before you overwrite a newer state with an older one. That timestamp
15
+ # is second-precision, so treat two signals stamped in the same second as
16
+ # unordered and read the contact resource to settle them.
17
+ #
18
+ # @return [Boolean]
19
+ required :opt_out, Sentdm::Internal::Type::Boolean
20
+
21
+ # @!attribute source
22
+ # How the signal reached us. INBOUND_KEYWORD means the contact sent a message
23
+ # whose text matched one of the keywords; PROVIDER_SIGNAL means the network
24
+ # reported it. A provider signal usually carries no message_id or text, so read
25
+ # both for null rather than inferring them from this field.
26
+ #
27
+ # @return [String]
28
+ required :source, String
29
+
30
+ # @!attribute account_id
31
+ # The account the contact belongs to. Present so one endpoint can serve several
32
+ # accounts.
33
+ #
34
+ # @return [String, nil]
35
+ optional :account_id, String
36
+
37
+ # @!attribute agent_id
38
+ # The RCS agent the signal reached, when it reached one.
39
+ #
40
+ # Omitted entirely on channels that have no agent, rather than sent as null — an
41
+ # SMS or WhatsApp payload does not carry this key at all. On RCS it is the
42
+ # counterpart to To: a contact reaches an agent rather than a number, so exactly
43
+ # one of the two is populated and never both. If you run more than one agent, this
44
+ # is what tells you which of them the contact acted on.
45
+ #
46
+ # @return [String, nil]
47
+ optional :agent_id, String, nil?: true
48
+
49
+ # @!attribute channel
50
+ # The channel the signal arrived on, for example sms or whatsapp.
51
+ #
52
+ # @return [String, nil]
53
+ optional :channel, String
54
+
55
+ # @!attribute contact_id
56
+ # The contact who raised the signal. Always populated, including for contact.help
57
+ # or contact.custom_keyword from a number you have not messaged before — the
58
+ # contact is created if it does not exist yet, so this identifier is always
59
+ # resolvable against the contacts API.
60
+ #
61
+ # @return [String, nil]
62
+ optional :contact_id, String
63
+
64
+ # @!attribute from
65
+ # The contact's number, in E.164 format with the leading + — who raised the
66
+ # signal. The same party message.received publishes as inbound_number.
67
+ #
68
+ # @return [String, nil]
69
+ optional :from, String
70
+
71
+ # @!attribute message_id
72
+ # The inbound message that carried the signal, matching message_id on the
73
+ # corresponding message.received event so the two can be joined.
74
+ #
75
+ # Sent as null when the signal did not arrive as a message — for example when a
76
+ # network processed an opt-out on your behalf — and also when the message belongs
77
+ # to a different account than this event, which can happen on a shared WhatsApp
78
+ # number. The field is always present, so read it and check for null rather than
79
+ # checking whether the key exists.
80
+ #
81
+ # @return [String, nil]
82
+ optional :message_id, String, nil?: true
83
+
84
+ # @!attribute template_id
85
+ # The auto-reply template whose keyword the contact matched, joinable against the
86
+ # templates API.
87
+ #
88
+ # This is what identifies which signal arrived on contact.custom_keyword: every
89
+ # custom template reports the same event name, so the event alone cannot tell your
90
+ # booking keyword from your opening-hours one. One template holds as many keywords
91
+ # as you configured, so this is steadier to switch on than text.
92
+ #
93
+ # Populated on the compliance sub-types too, where it names the template that
94
+ # replied. Sent as null when no template was involved — a network-reported opt-out
95
+ # matches no keyword. The field is always present, so read it and check for null.
96
+ #
97
+ # @return [String, nil]
98
+ optional :template_id, String, nil?: true
99
+
100
+ # @!attribute text
101
+ # The text the contact sent, for example STOP or UNSUBSCRIBE. Sent as null when
102
+ # the signal did not arrive as text. The field is always present, so read it and
103
+ # check for null rather than checking whether the key exists.
104
+ #
105
+ # @return [String, nil]
106
+ optional :text, String, nil?: true
107
+
108
+ # @!attribute to
109
+ # The number of yours that received the signal, in E.164 format with the leading
110
+ # +. Tells a multi-number account which of its senders the contact acted on, which
111
+ # nothing else on this payload answers.
112
+ #
113
+ # This is your number, not the contact's. That is the opposite of what to means on
114
+ # POST /v3/messages, where it is the list of recipients you are sending to. Reply
115
+ # to From, not to this field, or the message goes back to yourself.
116
+ #
117
+ # Sent as null when the signal did not arrive at a number of yours — an RCS signal
118
+ # terminates at an agent rather than a number, and a provider-reported opt-out may
119
+ # name no receiving number at all. The field is always present, so read it and
120
+ # check for null rather than checking whether the key exists.
121
+ #
122
+ # @return [String, nil]
123
+ optional :to, String, nil?: true
124
+
125
+ # @!method initialize(opt_out:, source:, account_id: nil, agent_id: nil, channel: nil, contact_id: nil, from: nil, message_id: nil, template_id: nil, text: nil, to: nil)
126
+ # Some parameter documentations has been truncated, see
127
+ # {Sentdm::Models::ContactEventPayload} for more details.
128
+ #
129
+ # Body of a contact.opt_in, contact.opt_out, contact.help or
130
+ # contact.custom_keyword event. Delivered when a contact signals a consent change,
131
+ # asks for help, or sends one of your own auto-reply keywords.
132
+ #
133
+ # These events state the signal outright, so you do not have to recognise keywords
134
+ # in the text of a message.received event. They also cover cases that produce no
135
+ # inbound message at all, such as a network handling an opt-out on your behalf.
136
+ #
137
+ # Two of the four change consent and two do not: contact.help and
138
+ # contact.custom_keyword report the state the contact already had. Read opt_out
139
+ # for the state and the envelope's event for what happened, rather than inferring
140
+ # one from the other.
141
+ #
142
+ # Fields are ordered identity → resulting state → provenance → join keys. The two
143
+ # parties are from and to. Note that the message family has not moved to those
144
+ # names yet — message.received still calls the same two parties inbound_number and
145
+ # outbound_number. Nothing here restates the envelope: which signal occurred is
146
+ # the envelope's event, and when it was emitted is its timestamp. Retries carry
147
+ # the same X-Webhook-Event-ID header, which is what to deduplicate on.
148
+ #
149
+ # @param opt_out [Boolean] Whether the contact is opted out after this signal — the state to write to your
150
+ #
151
+ # @param source [String] How the signal reached us. INBOUND_KEYWORD means the contact sent a message whos
152
+ #
153
+ # @param account_id [String] The account the contact belongs to. Present so one endpoint can serve several ac
154
+ #
155
+ # @param agent_id [String, nil] The RCS agent the signal reached, when it reached one.
156
+ #
157
+ # @param channel [String] The channel the signal arrived on, for example sms or whatsapp.
158
+ #
159
+ # @param contact_id [String] The contact who raised the signal. Always populated, including for contact.help
160
+ #
161
+ # @param from [String] The contact's number, in E.164 format with the leading + — who raised the signal
162
+ #
163
+ # @param message_id [String, nil] The inbound message that carried the signal, matching message_id on the
164
+ #
165
+ # @param template_id [String, nil] The auto-reply template whose keyword the contact matched, joinable against the
166
+ #
167
+ # @param text [String, nil] The text the contact sent, for example STOP or UNSUBSCRIBE. Sent as
168
+ #
169
+ # @param to [String, nil] The number of yours that received the signal, in E.164 format with the leading +
170
+ end
171
+ end
172
+ end