trycourier 6.1.0 → 6.3.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/courier/models/journey_send_node.rb +38 -2
  5. data/lib/courier/models/journey_send_node_to_ms_teams.rb +81 -0
  6. data/lib/courier/models/journey_send_node_to_slack.rb +20 -0
  7. data/lib/courier/models/journey_send_node_to_slack_channel.rb +29 -0
  8. data/lib/courier/models/journey_send_node_to_slack_email.rb +30 -0
  9. data/lib/courier/models/journey_send_node_to_slack_user_id.rb +29 -0
  10. data/lib/courier/models/ms_teams.rb +6 -0
  11. data/lib/courier/models/ms_teams_base_properties.rb +10 -5
  12. data/lib/courier/models/ms_teams_recipient.rb +6 -1
  13. data/lib/courier/models/notification_get_metrics_params.rb +83 -0
  14. data/lib/courier/models/notification_metrics_response.rb +165 -0
  15. data/lib/courier/models/send_to_ms_teams_channel_id.rb +9 -5
  16. data/lib/courier/models/send_to_ms_teams_channel_name.rb +12 -9
  17. data/lib/courier/models/send_to_ms_teams_email.rb +8 -5
  18. data/lib/courier/models/send_to_ms_teams_user_id.rb +13 -10
  19. data/lib/courier/models/user_profile.rb +3 -1
  20. data/lib/courier/models.rb +14 -0
  21. data/lib/courier/resources/notifications.rb +53 -0
  22. data/lib/courier/version.rb +1 -1
  23. data/lib/courier.rb +7 -0
  24. data/rbi/courier/models/journey_send_node.rbi +78 -0
  25. data/rbi/courier/models/journey_send_node_to_ms_teams.rbi +124 -0
  26. data/rbi/courier/models/journey_send_node_to_slack.rbi +26 -0
  27. data/rbi/courier/models/journey_send_node_to_slack_channel.rbi +45 -0
  28. data/rbi/courier/models/journey_send_node_to_slack_email.rbi +47 -0
  29. data/rbi/courier/models/journey_send_node_to_slack_user_id.rbi +45 -0
  30. data/rbi/courier/models/ms_teams.rbi +2 -0
  31. data/rbi/courier/models/ms_teams_base_properties.rbi +15 -5
  32. data/rbi/courier/models/ms_teams_recipient.rbi +7 -1
  33. data/rbi/courier/models/notification_get_metrics_params.rbi +167 -0
  34. data/rbi/courier/models/notification_metrics_response.rbi +269 -0
  35. data/rbi/courier/models/send_to_ms_teams_channel_id.rbi +14 -5
  36. data/rbi/courier/models/send_to_ms_teams_channel_name.rbi +16 -8
  37. data/rbi/courier/models/send_to_ms_teams_email.rbi +13 -5
  38. data/rbi/courier/models/send_to_ms_teams_user_id.rbi +16 -8
  39. data/rbi/courier/models/user_profile.rbi +4 -0
  40. data/rbi/courier/models.rbi +14 -0
  41. data/rbi/courier/resources/notifications.rbi +57 -0
  42. data/sig/courier/models/journey_send_node.rbs +18 -0
  43. data/sig/courier/models/journey_send_node_to_ms_teams.rbs +64 -0
  44. data/sig/courier/models/journey_send_node_to_slack.rbs +14 -0
  45. data/sig/courier/models/journey_send_node_to_slack_channel.rbs +18 -0
  46. data/sig/courier/models/journey_send_node_to_slack_email.rbs +18 -0
  47. data/sig/courier/models/journey_send_node_to_slack_user_id.rbs +18 -0
  48. data/sig/courier/models/ms_teams_base_properties.rbs +7 -3
  49. data/sig/courier/models/notification_get_metrics_params.rbs +69 -0
  50. data/sig/courier/models/notification_metrics_response.rbs +127 -0
  51. data/sig/courier/models/send_to_ms_teams_channel_id.rbs +8 -4
  52. data/sig/courier/models/send_to_ms_teams_channel_name.rbs +11 -7
  53. data/sig/courier/models/send_to_ms_teams_email.rbs +8 -4
  54. data/sig/courier/models/send_to_ms_teams_user_id.rbs +13 -9
  55. data/sig/courier/models.rbs +14 -0
  56. data/sig/courier/resources/notifications.rbs +9 -0
  57. metadata +23 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62f640ccc5d992cd807b750192ee8ca02b3ffe5fa09537eeadf67ba086c518b3
4
- data.tar.gz: bd638a13b9a78b54e849e76a30614bed55afbcb6e7fb7a1a2edf60a74cb1531b
3
+ metadata.gz: 93e2579390eb091bbda837c472c4554b06267a4e1dfb01b3b7cc63098f4a0d19
4
+ data.tar.gz: 2c0beb4dfe94f8d7cf39d222fd1ffb8cd9e3dc54e334e86546ac31d9919b286e
5
5
  SHA512:
6
- metadata.gz: ed8c416e8431f1a50aa7fff01b939ba42b03acabe3a42a5a9f14da078f9dcf11bfd8cfe6cb88f642d48444aa0131c3eb9a9164fdbd6fec8a6d80d07c2f360403
7
- data.tar.gz: 971c6a9a71bfdbc8faec0796d2b591d3635e55aece1ab1c208c6f68f3943a5fb39214c8a5944815b1f70f6e9912b8c77d8db2971d836116c543660a0951ef4a2
6
+ metadata.gz: 7a321f3202f3ca7858c453483d0fa0e537433a7c73afadd8cccc30d213fb18f6bb02f54db13a373a608e6f29595d0bf34bf3623b4086525da19773745e1c9a21
7
+ data.tar.gz: 33ef6a817cc05de26e64963c146c7ede6f8842ed1175949ba81ada5937261b0986ba9006522fd74e4dbf4cf5c0d5863021ab0e9e53ad5c3a839b35f7dc1f746f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.3.0](https://github.com/trycourier/courier-ruby/compare/v6.2.0...v6.3.0) (2026-08-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** document Slack and MS Teams on journey send nodes, and fix over-strict MsTeams tenant requirements [C-20302] ([#136](https://github.com/trycourier/courier-ruby/issues/136)) ([2d63cc0](https://github.com/trycourier/courier-ruby/commit/2d63cc0ab0e936625484ed6610e423e1ff04e8b5))
9
+
10
+ ## [6.2.0](https://github.com/trycourier/courier-ruby/compare/v6.1.0...v6.2.0) (2026-08-26)
11
+
12
+
13
+ ### Features
14
+
15
+ * **api:** document the template send metrics endpoint ([#134](https://github.com/trycourier/courier-ruby/issues/134)) ([cd882b5](https://github.com/trycourier/courier-ruby/commit/cd882b5a4e1b1dee40c24fd2bec65f07ed10db8a))
16
+
3
17
  ## [6.1.0](https://github.com/trycourier/courier-ruby/compare/v6.0.0...v6.1.0) (2026-08-19)
4
18
 
5
19
 
data/README.md CHANGED
@@ -9,7 +9,7 @@ Add the gem to your `Gemfile`:
9
9
  <!-- x-release-please-start-version -->
10
10
 
11
11
  ```ruby
12
- gem "trycourier", "~> 6.1.0"
12
+ gem "trycourier", "~> 6.3.0"
13
13
  ```
14
14
 
15
15
  <!-- x-release-please-end -->
@@ -79,6 +79,9 @@ module Courier
79
79
  optional :template, String
80
80
 
81
81
  # @!attribute to
82
+ # Recipient override for this send. Provide exactly one of `email_override`,
83
+ # `phone_number_override`, `user_id_override`, `slack`, or `ms_teams` — not a
84
+ # combination.
82
85
  #
83
86
  # @return [Courier::Models::JourneySendNode::Message::To, nil]
84
87
  optional :to, -> { Courier::JourneySendNode::Message::To }
@@ -95,7 +98,7 @@ module Courier
95
98
  #
96
99
  # @param template [String]
97
100
  #
98
- # @param to [Courier::Models::JourneySendNode::Message::To]
101
+ # @param to [Courier::Models::JourneySendNode::Message::To] Recipient override for this send. Provide exactly one of `email_override`, `phon
99
102
 
100
103
  # @see Courier::Models::JourneySendNode::Message#context
101
104
  class Context < Courier::Internal::Type::BaseModel
@@ -149,19 +152,52 @@ module Courier
149
152
  # @return [String, nil]
150
153
  optional :email_override, String
151
154
 
155
+ # @!attribute ms_teams
156
+ # Send to a Microsoft Teams address directly, bypassing the recipient's stored
157
+ # profile. Requires exactly one target: `channel_id`, `channel_name` (with
158
+ # `team_id`), `user_id`, or `email`. `channel_name`, `user_id`, and `email` also
159
+ # need at least one of `service_url` or `tenant_id` — if you provide both, they
160
+ # must agree. `channel_id` doesn't require tenant context to publish, but provide
161
+ # `service_url` or `tenant_id` anyway: sends without either have failed at
162
+ # delivery in testing. `conversation_id` and `reply_to_activity_id`, available on
163
+ # the send API's `MsTeams` profile, aren't supported here yet.
164
+ #
165
+ # @return [Courier::Models::JourneySendNodeToMsTeams, nil]
166
+ optional :ms_teams, -> { Courier::JourneySendNodeToMsTeams }
167
+
152
168
  # @!attribute phone_number_override
153
169
  #
154
170
  # @return [String, nil]
155
171
  optional :phone_number_override, String
156
172
 
173
+ # @!attribute slack
174
+ # Send to a Slack address directly, bypassing the recipient's stored profile.
175
+ # Requires exactly one of `channel`, `user_id`, or `email`.
176
+ #
177
+ # @return [Courier::Models::JourneySendNodeToSlackChannel, Courier::Models::JourneySendNodeToSlackUserID, Courier::Models::JourneySendNodeToSlackEmail, nil]
178
+ optional :slack, union: -> { Courier::JourneySendNodeToSlack }
179
+
157
180
  # @!attribute user_id_override
158
181
  #
159
182
  # @return [String, nil]
160
183
  optional :user_id_override, String
161
184
 
162
- # @!method initialize(email_override: nil, phone_number_override: nil, user_id_override: nil)
185
+ # @!method initialize(email_override: nil, ms_teams: nil, phone_number_override: nil, slack: nil, user_id_override: nil)
186
+ # Some parameter documentations has been truncated, see
187
+ # {Courier::Models::JourneySendNode::Message::To} for more details.
188
+ #
189
+ # Recipient override for this send. Provide exactly one of `email_override`,
190
+ # `phone_number_override`, `user_id_override`, `slack`, or `ms_teams` — not a
191
+ # combination.
192
+ #
163
193
  # @param email_override [String]
194
+ #
195
+ # @param ms_teams [Courier::Models::JourneySendNodeToMsTeams] Send to a Microsoft Teams address directly, bypassing the recipient's stored pro
196
+ #
164
197
  # @param phone_number_override [String]
198
+ #
199
+ # @param slack [Courier::Models::JourneySendNodeToSlackChannel, Courier::Models::JourneySendNodeToSlackUserID, Courier::Models::JourneySendNodeToSlackEmail] Send to a Slack address directly, bypassing the recipient's stored profile. Requ
200
+ #
165
201
  # @param user_id_override [String]
166
202
  end
167
203
  end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToMsTeams < Courier::Internal::Type::BaseModel
6
+ # @!attribute channel_id
7
+ # Bot Framework channel ID to send to.
8
+ #
9
+ # @return [String, nil]
10
+ optional :channel_id, String
11
+
12
+ # @!attribute channel_name
13
+ # Teams channel name to send to. Requires `team_id`.
14
+ #
15
+ # @return [String, nil]
16
+ optional :channel_name, String
17
+
18
+ # @!attribute email
19
+ # Email address of the Teams user to send to.
20
+ #
21
+ # @return [String, nil]
22
+ optional :email, String
23
+
24
+ # @!attribute service_url
25
+ # The regional Bot Framework host for this conversation, e.g.
26
+ # `https://smba.trafficmanager.net/amer`. A path segment naming the Microsoft
27
+ # tenant may follow it and is used to derive `tenant_id` when it is not supplied
28
+ # directly.
29
+ #
30
+ # @return [String, nil]
31
+ optional :service_url, String
32
+
33
+ # @!attribute team_id
34
+ # Microsoft Teams team ID. Required alongside `channel_name`.
35
+ #
36
+ # @return [String, nil]
37
+ optional :team_id, String
38
+
39
+ # @!attribute tenant_id
40
+ # The Microsoft (Azure AD) tenant this send targets or authenticates against.
41
+ # Unrelated to `message.context.tenant_id`, which is the Courier customer's own
42
+ # multi-tenant context.
43
+ #
44
+ # @return [String, nil]
45
+ optional :tenant_id, String
46
+
47
+ # @!attribute user_id
48
+ # Microsoft Teams user ID to send to.
49
+ #
50
+ # @return [String, nil]
51
+ optional :user_id, String
52
+
53
+ # @!method initialize(channel_id: nil, channel_name: nil, email: nil, service_url: nil, team_id: nil, tenant_id: nil, user_id: nil)
54
+ # Some parameter documentations has been truncated, see
55
+ # {Courier::Models::JourneySendNodeToMsTeams} for more details.
56
+ #
57
+ # Send to a Microsoft Teams address directly, bypassing the recipient's stored
58
+ # profile. Requires exactly one target: `channel_id`, `channel_name` (with
59
+ # `team_id`), `user_id`, or `email`. `channel_name`, `user_id`, and `email` also
60
+ # need at least one of `service_url` or `tenant_id` — if you provide both, they
61
+ # must agree. `channel_id` doesn't require tenant context to publish, but provide
62
+ # `service_url` or `tenant_id` anyway: sends without either have failed at
63
+ # delivery in testing. `conversation_id` and `reply_to_activity_id`, available on
64
+ # the send API's `MsTeams` profile, aren't supported here yet.
65
+ #
66
+ # @param channel_id [String] Bot Framework channel ID to send to.
67
+ #
68
+ # @param channel_name [String] Teams channel name to send to. Requires `team_id`.
69
+ #
70
+ # @param email [String] Email address of the Teams user to send to.
71
+ #
72
+ # @param service_url [String] The regional Bot Framework host for this conversation, e.g. `https://smba.traffi
73
+ #
74
+ # @param team_id [String] Microsoft Teams team ID. Required alongside `channel_name`.
75
+ #
76
+ # @param tenant_id [String] The Microsoft (Azure AD) tenant this send targets or authenticates against. Unre
77
+ #
78
+ # @param user_id [String] Microsoft Teams user ID to send to.
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # Send to a Slack address directly, bypassing the recipient's stored profile.
6
+ # Requires exactly one of `channel`, `user_id`, or `email`.
7
+ module JourneySendNodeToSlack
8
+ extend Courier::Internal::Type::Union
9
+
10
+ variant -> { Courier::JourneySendNodeToSlackChannel }
11
+
12
+ variant -> { Courier::JourneySendNodeToSlackUserID }
13
+
14
+ variant -> { Courier::JourneySendNodeToSlackEmail }
15
+
16
+ # @!method self.variants
17
+ # @return [Array(Courier::Models::JourneySendNodeToSlackChannel, Courier::Models::JourneySendNodeToSlackUserID, Courier::Models::JourneySendNodeToSlackEmail)]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToSlackChannel < Courier::Internal::Type::BaseModel
6
+ # @!attribute channel
7
+ # Slack channel to send to, by name or ID.
8
+ #
9
+ # @return [String]
10
+ required :channel, String
11
+
12
+ # @!attribute access_token
13
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
14
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
15
+ # them. Omit to use the token on the recipient's stored Slack profile.
16
+ #
17
+ # @return [String, nil]
18
+ optional :access_token, String
19
+
20
+ # @!method initialize(channel:, access_token: nil)
21
+ # Some parameter documentations has been truncated, see
22
+ # {Courier::Models::JourneySendNodeToSlackChannel} for more details.
23
+ #
24
+ # @param channel [String] Slack channel to send to, by name or ID.
25
+ #
26
+ # @param access_token [String] A runtime reference to a Slack access token, such as `{{data.slack_token}}`. Lit
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToSlackEmail < Courier::Internal::Type::BaseModel
6
+ # @!attribute email
7
+ # Email address of the Slack user to send to, resolved via the workspace
8
+ # directory.
9
+ #
10
+ # @return [String]
11
+ required :email, String
12
+
13
+ # @!attribute access_token
14
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
15
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
16
+ # them. Omit to use the token on the recipient's stored Slack profile.
17
+ #
18
+ # @return [String, nil]
19
+ optional :access_token, String
20
+
21
+ # @!method initialize(email:, access_token: nil)
22
+ # Some parameter documentations has been truncated, see
23
+ # {Courier::Models::JourneySendNodeToSlackEmail} for more details.
24
+ #
25
+ # @param email [String] Email address of the Slack user to send to, resolved via the workspace directory
26
+ #
27
+ # @param access_token [String] A runtime reference to a Slack access token, such as `{{data.slack_token}}`. Lit
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToSlackUserID < Courier::Internal::Type::BaseModel
6
+ # @!attribute user_id
7
+ # Slack user ID to send to.
8
+ #
9
+ # @return [String]
10
+ required :user_id, String
11
+
12
+ # @!attribute access_token
13
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
14
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
15
+ # them. Omit to use the token on the recipient's stored Slack profile.
16
+ #
17
+ # @return [String, nil]
18
+ optional :access_token, String
19
+
20
+ # @!method initialize(user_id:, access_token: nil)
21
+ # Some parameter documentations has been truncated, see
22
+ # {Courier::Models::JourneySendNodeToSlackUserID} for more details.
23
+ #
24
+ # @param user_id [String] Slack user ID to send to.
25
+ #
26
+ # @param access_token [String] A runtime reference to a Slack access token, such as `{{data.slack_token}}`. Lit
27
+ end
28
+ end
29
+ end
@@ -2,17 +2,23 @@
2
2
 
3
3
  module Courier
4
4
  module Models
5
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they
6
+ # must agree.
5
7
  module MsTeams
6
8
  extend Courier::Internal::Type::Union
7
9
 
10
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they must agree.
8
11
  variant -> { Courier::SendToMsTeamsUserID }
9
12
 
13
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they must agree.
10
14
  variant -> { Courier::SendToMsTeamsEmail }
11
15
 
16
+ # Sends directly to a Microsoft Teams channel by its Bot Framework ID. Still provide at least one of `tenant_id` or `service_url` — sends without either have failed Bot Framework authentication in testing.
12
17
  variant -> { Courier::SendToMsTeamsChannelID }
13
18
 
14
19
  variant -> { Courier::SendToMsTeamsConversationID }
15
20
 
21
+ # `team_id` is required alongside `channel_name`. Also provide at least one of `tenant_id` or `service_url`; if you provide both, they must agree.
16
22
  variant -> { Courier::SendToMsTeamsChannelName }
17
23
 
18
24
  # @!method self.variants
@@ -5,15 +5,20 @@ module Courier
5
5
  class MsTeamsBaseProperties < Courier::Internal::Type::BaseModel
6
6
  # @!attribute service_url
7
7
  #
8
- # @return [String]
9
- required :service_url, String
8
+ # @return [String, nil]
9
+ optional :service_url, String
10
10
 
11
11
  # @!attribute tenant_id
12
12
  #
13
- # @return [String]
14
- required :tenant_id, String
13
+ # @return [String, nil]
14
+ optional :tenant_id, String
15
15
 
16
- # @!method initialize(service_url:, tenant_id:)
16
+ # @!method initialize(service_url: nil, tenant_id: nil)
17
+ # Tenant context shared by every MS Teams send variant. Provide at least one of
18
+ # `tenant_id` or `service_url`. If you provide both, they must agree — a
19
+ # `service_url` pointing at a different Microsoft tenant than `tenant_id` is
20
+ # rejected.
21
+ #
17
22
  # @param service_url [String]
18
23
  # @param tenant_id [String]
19
24
  end
@@ -4,14 +4,19 @@ module Courier
4
4
  module Models
5
5
  class MsTeamsRecipient < Courier::Internal::Type::BaseModel
6
6
  # @!attribute ms_teams
7
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they
8
+ # must agree.
7
9
  #
8
10
  # @return [Courier::Models::SendToMsTeamsUserID, Courier::Models::SendToMsTeamsEmail, Courier::Models::SendToMsTeamsChannelID, Courier::Models::SendToMsTeamsConversationID, Courier::Models::SendToMsTeamsChannelName]
9
11
  required :ms_teams, union: -> { Courier::MsTeams }
10
12
 
11
13
  # @!method initialize(ms_teams:)
14
+ # Some parameter documentations has been truncated, see
15
+ # {Courier::Models::MsTeamsRecipient} for more details.
16
+ #
12
17
  # Send via Microsoft Teams
13
18
  #
14
- # @param ms_teams [Courier::Models::SendToMsTeamsUserID, Courier::Models::SendToMsTeamsEmail, Courier::Models::SendToMsTeamsChannelID, Courier::Models::SendToMsTeamsConversationID, Courier::Models::SendToMsTeamsChannelName]
19
+ # @param ms_teams [Courier::Models::SendToMsTeamsUserID, Courier::Models::SendToMsTeamsEmail, Courier::Models::SendToMsTeamsChannelID, Courier::Models::SendToMsTeamsConversationID, Courier::Models::SendToMsTeamsChannelName] Provide at least one of `tenant_id` or `service_url`. If you provide both, they
15
20
  end
16
21
  end
17
22
  end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Notifications#get_metrics
6
+ class NotificationGetMetricsParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute id
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!attribute end_
16
+ # The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
17
+ # together with `start`. An `end` in the future is accepted and not clamped — the
18
+ # trailing buckets come back empty.
19
+ #
20
+ # @return [Time, nil]
21
+ optional :end_, Time
22
+
23
+ # @!attribute granularity
24
+ # The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
25
+ # on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
26
+ # 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
27
+ # coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
28
+ # 1000-bucket limit on a single response.
29
+ #
30
+ # @return [Symbol, Courier::Models::NotificationGetMetricsParams::Granularity, nil]
31
+ optional :granularity, enum: -> { Courier::NotificationGetMetricsParams::Granularity }
32
+
33
+ # @!attribute lookback
34
+ # The length of the window, counted back from now, as an ISO 8601 duration
35
+ # (`P30D`, `P12W`, `PT12H`). Defaults to `P30D`, and is ignored when `start` and
36
+ # `end` are supplied. A malformed or non-positive duration returns `400`.
37
+ #
38
+ # @return [String, nil]
39
+ optional :lookback, String
40
+
41
+ # @!attribute start
42
+ # The inclusive start of the window, as an ISO 8601 timestamp with an offset
43
+ # (`2026-04-01T00:00:00Z`). Must be supplied together with `end` and be earlier
44
+ # than it; either one alone returns `400`.
45
+ #
46
+ # @return [Time, nil]
47
+ optional :start, Time
48
+
49
+ # @!method initialize(id:, end_: nil, granularity: nil, lookback: nil, start: nil, request_options: {})
50
+ # Some parameter documentations has been truncated, see
51
+ # {Courier::Models::NotificationGetMetricsParams} for more details.
52
+ #
53
+ # @param id [String]
54
+ #
55
+ # @param end_ [Time] The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
56
+ #
57
+ # @param granularity [Symbol, Courier::Models::NotificationGetMetricsParams::Granularity] The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start o
58
+ #
59
+ # @param lookback [String] The length of the window, counted back from now, as an ISO 8601 duration (`P30D`
60
+ #
61
+ # @param start [Time] The inclusive start of the window, as an ISO 8601 timestamp with an offset (`202
62
+ #
63
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
64
+
65
+ # The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
66
+ # on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
67
+ # 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
68
+ # coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
69
+ # 1000-bucket limit on a single response.
70
+ module Granularity
71
+ extend Courier::Internal::Type::Enum
72
+
73
+ HOUR = :HOUR
74
+ DAY = :DAY
75
+ WEEK = :WEEK
76
+ MONTH = :MONTH
77
+
78
+ # @!method self.values
79
+ # @return [Array<Symbol>]
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,165 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Notifications#get_metrics
6
+ class NotificationMetricsResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute end_
8
+ # End of the window actually queried, ceiled onto the granularity grid.
9
+ # Second-precision UTC.
10
+ #
11
+ # @return [Time]
12
+ required :end_, Time, api_name: :end
13
+
14
+ # @!attribute granularity
15
+ # Bucket size the series was built at.
16
+ #
17
+ # @return [Symbol, Courier::Models::NotificationMetricsResponse::Granularity]
18
+ required :granularity, enum: -> { Courier::NotificationMetricsResponse::Granularity }
19
+
20
+ # @!attribute notification_id
21
+ # The template the series describes, echoed from the request.
22
+ #
23
+ # @return [String]
24
+ required :notification_id, String, api_name: :notificationId
25
+
26
+ # @!attribute series
27
+ # One entry per bucket between `start` and `end`, oldest first, including buckets
28
+ # with no activity.
29
+ #
30
+ # @return [Array<Courier::Models::NotificationMetricsResponse::Series>]
31
+ required :series, -> { Courier::Internal::Type::ArrayOf[Courier::NotificationMetricsResponse::Series] }
32
+
33
+ # @!attribute start
34
+ # Inclusive start of the window actually queried, floored onto the granularity
35
+ # grid. Second-precision UTC.
36
+ #
37
+ # @return [Time]
38
+ required :start, Time
39
+
40
+ # @!method initialize(end_:, granularity:, notification_id:, series:, start:)
41
+ # Some parameter documentations has been truncated, see
42
+ # {Courier::Models::NotificationMetricsResponse} for more details.
43
+ #
44
+ # @param end_ [Time] End of the window actually queried, ceiled onto the granularity grid. Second-pre
45
+ #
46
+ # @param granularity [Symbol, Courier::Models::NotificationMetricsResponse::Granularity] Bucket size the series was built at.
47
+ #
48
+ # @param notification_id [String] The template the series describes, echoed from the request.
49
+ #
50
+ # @param series [Array<Courier::Models::NotificationMetricsResponse::Series>] One entry per bucket between `start` and `end`, oldest first, including buckets
51
+ #
52
+ # @param start [Time] Inclusive start of the window actually queried, floored onto the granularity gri
53
+
54
+ # Bucket size the series was built at.
55
+ #
56
+ # @see Courier::Models::NotificationMetricsResponse#granularity
57
+ module Granularity
58
+ extend Courier::Internal::Type::Enum
59
+
60
+ HOUR = :HOUR
61
+ DAY = :DAY
62
+ WEEK = :WEEK
63
+ MONTH = :MONTH
64
+
65
+ # @!method self.values
66
+ # @return [Array<Symbol>]
67
+ end
68
+
69
+ class Series < Courier::Internal::Type::BaseModel
70
+ # @!attribute data
71
+ # One entry per provider and channel that handled a message in this bucket. Empty
72
+ # when nothing was sent.
73
+ #
74
+ # @return [Array<Courier::Models::NotificationMetricsResponse::Series::Data>]
75
+ required :data,
76
+ -> { Courier::Internal::Type::ArrayOf[Courier::NotificationMetricsResponse::Series::Data] }
77
+
78
+ # @!attribute period
79
+ # Start of the bucket, second-precision UTC.
80
+ #
81
+ # @return [Time]
82
+ required :period, Time
83
+
84
+ # @!method initialize(data:, period:)
85
+ # Some parameter documentations has been truncated, see
86
+ # {Courier::Models::NotificationMetricsResponse::Series} for more details.
87
+ #
88
+ # @param data [Array<Courier::Models::NotificationMetricsResponse::Series::Data>] One entry per provider and channel that handled a message in this bucket. Empty
89
+ #
90
+ # @param period [Time] Start of the bucket, second-precision UTC.
91
+
92
+ class Data < Courier::Internal::Type::BaseModel
93
+ # @!attribute channel
94
+ # Channel the provider delivered on, e.g. `email`.
95
+ #
96
+ # @return [String]
97
+ required :channel, String
98
+
99
+ # @!attribute clicked
100
+ # Messages with at least one tracked link click.
101
+ #
102
+ # @return [Integer]
103
+ required :clicked, Integer
104
+
105
+ # @!attribute delivered
106
+ # Messages the provider confirmed as delivered.
107
+ #
108
+ # @return [Integer]
109
+ required :delivered, Integer
110
+
111
+ # @!attribute errors
112
+ # Messages the provider rejected or failed on, including ones a later provider
113
+ # then delivered.
114
+ #
115
+ # @return [Integer]
116
+ required :errors, Integer
117
+
118
+ # @!attribute opened
119
+ # Messages opened at least once. Always `0` on channels with no open tracking.
120
+ #
121
+ # @return [Integer]
122
+ required :opened, Integer
123
+
124
+ # @!attribute provider
125
+ # Provider that handled the messages, e.g. `sendgrid`.
126
+ #
127
+ # @return [String]
128
+ required :provider, String
129
+
130
+ # @!attribute sent
131
+ # Messages handed to the provider.
132
+ #
133
+ # @return [Integer]
134
+ required :sent, Integer
135
+
136
+ # @!attribute undeliverable
137
+ # Messages Courier could not deliver on any provider for the channel.
138
+ #
139
+ # @return [Integer]
140
+ required :undeliverable, Integer
141
+
142
+ # @!method initialize(channel:, clicked:, delivered:, errors:, opened:, provider:, sent:, undeliverable:)
143
+ # Some parameter documentations has been truncated, see
144
+ # {Courier::Models::NotificationMetricsResponse::Series::Data} for more details.
145
+ #
146
+ # @param channel [String] Channel the provider delivered on, e.g. `email`.
147
+ #
148
+ # @param clicked [Integer] Messages with at least one tracked link click.
149
+ #
150
+ # @param delivered [Integer] Messages the provider confirmed as delivered.
151
+ #
152
+ # @param errors [Integer] Messages the provider rejected or failed on, including ones a later provider the
153
+ #
154
+ # @param opened [Integer] Messages opened at least once. Always `0` on channels with no open tracking.
155
+ #
156
+ # @param provider [String] Provider that handled the messages, e.g. `sendgrid`.
157
+ #
158
+ # @param sent [Integer] Messages handed to the provider.
159
+ #
160
+ # @param undeliverable [Integer] Messages Courier could not deliver on any provider for the channel.
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
@@ -10,15 +10,19 @@ module Courier
10
10
 
11
11
  # @!attribute service_url
12
12
  #
13
- # @return [String]
14
- required :service_url, String
13
+ # @return [String, nil]
14
+ optional :service_url, String
15
15
 
16
16
  # @!attribute tenant_id
17
17
  #
18
- # @return [String]
19
- required :tenant_id, String
18
+ # @return [String, nil]
19
+ optional :tenant_id, String
20
20
 
21
- # @!method initialize(channel_id:, service_url:, tenant_id:)
21
+ # @!method initialize(channel_id:, service_url: nil, tenant_id: nil)
22
+ # Sends directly to a Microsoft Teams channel by its Bot Framework ID. Still
23
+ # provide at least one of `tenant_id` or `service_url` — sends without either have
24
+ # failed Bot Framework authentication in testing.
25
+ #
22
26
  # @param channel_id [String]
23
27
  # @param service_url [String]
24
28
  # @param tenant_id [String]