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
@@ -8,25 +8,28 @@ module Courier
8
8
  # @return [String]
9
9
  required :channel_name, String
10
10
 
11
- # @!attribute service_url
12
- #
13
- # @return [String]
14
- required :service_url, String
15
-
16
11
  # @!attribute team_id
17
12
  #
18
13
  # @return [String]
19
14
  required :team_id, String
20
15
 
16
+ # @!attribute service_url
17
+ #
18
+ # @return [String, nil]
19
+ optional :service_url, String
20
+
21
21
  # @!attribute tenant_id
22
22
  #
23
- # @return [String]
24
- required :tenant_id, String
23
+ # @return [String, nil]
24
+ optional :tenant_id, String
25
25
 
26
- # @!method initialize(channel_name:, service_url:, team_id:, tenant_id:)
26
+ # @!method initialize(channel_name:, team_id:, service_url: nil, tenant_id: nil)
27
+ # `team_id` is required alongside `channel_name`. Also provide at least one of
28
+ # `tenant_id` or `service_url`; if you provide both, they must agree.
29
+ #
27
30
  # @param channel_name [String]
28
- # @param service_url [String]
29
31
  # @param team_id [String]
32
+ # @param service_url [String]
30
33
  # @param tenant_id [String]
31
34
  end
32
35
  end
@@ -10,15 +10,18 @@ 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(email:, service_url:, tenant_id:)
21
+ # @!method initialize(email:, service_url: nil, tenant_id: nil)
22
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they
23
+ # must agree.
24
+ #
22
25
  # @param email [String]
23
26
  # @param service_url [String]
24
27
  # @param tenant_id [String]
@@ -3,25 +3,28 @@
3
3
  module Courier
4
4
  module Models
5
5
  class SendToMsTeamsUserID < Courier::Internal::Type::BaseModel
6
- # @!attribute service_url
6
+ # @!attribute user_id
7
7
  #
8
8
  # @return [String]
9
- required :service_url, String
9
+ required :user_id, String
10
10
 
11
- # @!attribute tenant_id
11
+ # @!attribute service_url
12
12
  #
13
- # @return [String]
14
- required :tenant_id, String
13
+ # @return [String, nil]
14
+ optional :service_url, String
15
15
 
16
- # @!attribute user_id
16
+ # @!attribute tenant_id
17
17
  #
18
- # @return [String]
19
- required :user_id, String
18
+ # @return [String, nil]
19
+ optional :tenant_id, String
20
20
 
21
- # @!method initialize(service_url:, tenant_id:, user_id:)
21
+ # @!method initialize(user_id:, service_url: nil, tenant_id: nil)
22
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they
23
+ # must agree.
24
+ #
25
+ # @param user_id [String]
22
26
  # @param service_url [String]
23
27
  # @param tenant_id [String]
24
- # @param user_id [String]
25
28
  end
26
29
  end
27
30
  end
@@ -106,6 +106,8 @@ module Courier
106
106
  optional :middle_name, String, nil?: true
107
107
 
108
108
  # @!attribute ms_teams
109
+ # Provide at least one of `tenant_id` or `service_url`. If you provide both, they
110
+ # must agree.
109
111
  #
110
112
  # @return [Courier::Models::SendToMsTeamsUserID, Courier::Models::SendToMsTeamsEmail, Courier::Models::SendToMsTeamsChannelID, Courier::Models::SendToMsTeamsConversationID, Courier::Models::SendToMsTeamsChannelName, nil]
111
113
  optional :ms_teams, union: -> { Courier::MsTeams }, nil?: true
@@ -210,7 +212,7 @@ module Courier
210
212
  #
211
213
  # @param middle_name [String, nil]
212
214
  #
213
- # @param ms_teams [Courier::Models::SendToMsTeamsUserID, Courier::Models::SendToMsTeamsEmail, Courier::Models::SendToMsTeamsChannelID, Courier::Models::SendToMsTeamsConversationID, Courier::Models::SendToMsTeamsChannelName, nil]
215
+ # @param ms_teams [Courier::Models::SendToMsTeamsUserID, Courier::Models::SendToMsTeamsEmail, Courier::Models::SendToMsTeamsChannelID, Courier::Models::SendToMsTeamsConversationID, Courier::Models::SendToMsTeamsChannelName, nil] Provide at least one of `tenant_id` or `service_url`. If you provide both, they
214
216
  #
215
217
  # @param name [String, nil]
216
218
  #
@@ -320,6 +320,16 @@ module Courier
320
320
 
321
321
  JourneySendNode = Courier::Models::JourneySendNode
322
322
 
323
+ JourneySendNodeToMsTeams = Courier::Models::JourneySendNodeToMsTeams
324
+
325
+ JourneySendNodeToSlack = Courier::Models::JourneySendNodeToSlack
326
+
327
+ JourneySendNodeToSlackChannel = Courier::Models::JourneySendNodeToSlackChannel
328
+
329
+ JourneySendNodeToSlackEmail = Courier::Models::JourneySendNodeToSlackEmail
330
+
331
+ JourneySendNodeToSlackUserID = Courier::Models::JourneySendNodeToSlackUserID
332
+
323
333
  JourneysInvokeRequest = Courier::Models::JourneysInvokeRequest
324
334
 
325
335
  JourneysInvokeResponse = Courier::Models::JourneysInvokeResponse
@@ -422,12 +432,16 @@ module Courier
422
432
 
423
433
  NotificationGetContent = Courier::Models::NotificationGetContent
424
434
 
435
+ NotificationGetMetricsParams = Courier::Models::NotificationGetMetricsParams
436
+
425
437
  NotificationListParams = Courier::Models::NotificationListParams
426
438
 
427
439
  NotificationListVersionsParams = Courier::Models::NotificationListVersionsParams
428
440
 
429
441
  NotificationLocalePutRequest = Courier::Models::NotificationLocalePutRequest
430
442
 
443
+ NotificationMetricsResponse = Courier::Models::NotificationMetricsResponse
444
+
431
445
  NotificationPreferenceDetails = Courier::Models::NotificationPreferenceDetails
432
446
 
433
447
  NotificationPublishParams = Courier::Models::NotificationPublishParams
@@ -123,6 +123,59 @@ module Courier
123
123
  )
124
124
  end
125
125
 
126
+ # Some parameter documentations has been truncated, see
127
+ # {Courier::Models::NotificationGetMetricsParams} for more details.
128
+ #
129
+ # Fetch the delivery funnel for one Notification Template as a time series — sent,
130
+ # delivered, opened, clicked, errors, and undeliverable — broken out per provider
131
+ # and channel inside each bucket. Sum the entries in a bucket for its totals;
132
+ # there is no bucket-level total.
133
+ #
134
+ # Choose the window absolutely with `start` and `end`, or relatively with
135
+ # `lookback` (an ISO 8601 duration). `start` and `end` take precedence when both
136
+ # are supplied, and a request carrying neither defaults to `lookback=P30D`. The
137
+ # window is snapped outwards onto the `granularity` grid so every bucket it
138
+ # overlaps is returned whole, and the snapped boundaries come back as `start` and
139
+ # `end` — align a chart on those rather than on what was requested. Every boundary
140
+ # is UTC; there is no timezone support.
141
+ #
142
+ # Every bucket in the window is returned, including the quiet ones, whose `data`
143
+ # array is empty, so a series is directly plottable with no gap filling
144
+ # client-side. An unknown template id returns `200` with an all-empty series
145
+ # rather than `404`, and messages sent without a Notification Template never
146
+ # appear here.
147
+ #
148
+ # Available in the US region only.
149
+ #
150
+ # @overload get_metrics(id, end_: nil, granularity: nil, lookback: nil, start: nil, request_options: {})
151
+ #
152
+ # @param id [String] The Notification Template to report on — its ID (`nt_` prefix) or an alias. Must
153
+ #
154
+ # @param end_ [Time] The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
155
+ #
156
+ # @param granularity [Symbol, Courier::Models::NotificationGetMetricsParams::Granularity] The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start o
157
+ #
158
+ # @param lookback [String] The length of the window, counted back from now, as an ISO 8601 duration (`P30D`
159
+ #
160
+ # @param start [Time] The inclusive start of the window, as an ISO 8601 timestamp with an offset (`202
161
+ #
162
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
163
+ #
164
+ # @return [Courier::Models::NotificationMetricsResponse]
165
+ #
166
+ # @see Courier::Models::NotificationGetMetricsParams
167
+ def get_metrics(id, params = {})
168
+ parsed, options = Courier::NotificationGetMetricsParams.dump_request(params)
169
+ query = Courier::Internal::Util.encode_query_params(parsed)
170
+ @client.request(
171
+ method: :get,
172
+ path: ["notifications/%1$s/metrics", id],
173
+ query: query.transform_keys(end_: "end"),
174
+ model: Courier::NotificationMetricsResponse,
175
+ options: options
176
+ )
177
+ end
178
+
126
179
  # Returns a notification template's published versions, most recent first, for
127
180
  # comparison or rollback. Paged.
128
181
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Courier
4
- VERSION = "6.1.0"
4
+ VERSION = "6.3.0"
5
5
  end
data/lib/courier.rb CHANGED
@@ -244,6 +244,11 @@ require_relative "courier/models/journeys/template_retrieve_content_params"
244
244
  require_relative "courier/models/journeys/template_retrieve_params"
245
245
  require_relative "courier/models/journey_segment_trigger_node"
246
246
  require_relative "courier/models/journey_send_node"
247
+ require_relative "courier/models/journey_send_node_to_ms_teams"
248
+ require_relative "courier/models/journey_send_node_to_slack"
249
+ require_relative "courier/models/journey_send_node_to_slack_channel"
250
+ require_relative "courier/models/journey_send_node_to_slack_email"
251
+ require_relative "courier/models/journey_send_node_to_slack_user_id"
247
252
  require_relative "courier/models/journeys_invoke_response"
248
253
  require_relative "courier/models/journeys_list_response"
249
254
  require_relative "courier/models/journey_state"
@@ -298,9 +303,11 @@ require_relative "courier/models/notification_content_get_response"
298
303
  require_relative "courier/models/notification_content_mutation_response"
299
304
  require_relative "courier/models/notification_create_params"
300
305
  require_relative "courier/models/notification_get_content"
306
+ require_relative "courier/models/notification_get_metrics_params"
301
307
  require_relative "courier/models/notification_list_params"
302
308
  require_relative "courier/models/notification_list_response"
303
309
  require_relative "courier/models/notification_list_versions_params"
310
+ require_relative "courier/models/notification_metrics_response"
304
311
  require_relative "courier/models/notification_preference_details"
305
312
  require_relative "courier/models/notification_publish_params"
306
313
  require_relative "courier/models/notification_put_content_params"
@@ -151,6 +151,9 @@ module Courier
151
151
  sig { params(template: String).void }
152
152
  attr_writer :template
153
153
 
154
+ # Recipient override for this send. Provide exactly one of `email_override`,
155
+ # `phone_number_override`, `user_id_override`, `slack`, or `ms_teams` — not a
156
+ # combination.
154
157
  sig { returns(T.nilable(Courier::JourneySendNode::Message::To)) }
155
158
  attr_reader :to
156
159
 
@@ -173,6 +176,9 @@ module Courier
173
176
  data: nil,
174
177
  delay: nil,
175
178
  template: nil,
179
+ # Recipient override for this send. Provide exactly one of `email_override`,
180
+ # `phone_number_override`, `user_id_override`, `slack`, or `ms_teams` — not a
181
+ # combination.
176
182
  to: nil
177
183
  )
178
184
  end
@@ -282,28 +288,93 @@ module Courier
282
288
  sig { params(email_override: String).void }
283
289
  attr_writer :email_override
284
290
 
291
+ # Send to a Microsoft Teams address directly, bypassing the recipient's stored
292
+ # profile. Requires exactly one target: `channel_id`, `channel_name` (with
293
+ # `team_id`), `user_id`, or `email`. `channel_name`, `user_id`, and `email` also
294
+ # need at least one of `service_url` or `tenant_id` — if you provide both, they
295
+ # must agree. `channel_id` doesn't require tenant context to publish, but provide
296
+ # `service_url` or `tenant_id` anyway: sends without either have failed at
297
+ # delivery in testing. `conversation_id` and `reply_to_activity_id`, available on
298
+ # the send API's `MsTeams` profile, aren't supported here yet.
299
+ sig { returns(T.nilable(Courier::JourneySendNodeToMsTeams)) }
300
+ attr_reader :ms_teams
301
+
302
+ sig do
303
+ params(ms_teams: Courier::JourneySendNodeToMsTeams::OrHash).void
304
+ end
305
+ attr_writer :ms_teams
306
+
285
307
  sig { returns(T.nilable(String)) }
286
308
  attr_reader :phone_number_override
287
309
 
288
310
  sig { params(phone_number_override: String).void }
289
311
  attr_writer :phone_number_override
290
312
 
313
+ # Send to a Slack address directly, bypassing the recipient's stored profile.
314
+ # Requires exactly one of `channel`, `user_id`, or `email`.
315
+ sig do
316
+ returns(
317
+ T.nilable(
318
+ T.any(
319
+ Courier::JourneySendNodeToSlackChannel,
320
+ Courier::JourneySendNodeToSlackUserID,
321
+ Courier::JourneySendNodeToSlackEmail
322
+ )
323
+ )
324
+ )
325
+ end
326
+ attr_reader :slack
327
+
328
+ sig do
329
+ params(
330
+ slack:
331
+ T.any(
332
+ Courier::JourneySendNodeToSlackChannel::OrHash,
333
+ Courier::JourneySendNodeToSlackUserID::OrHash,
334
+ Courier::JourneySendNodeToSlackEmail::OrHash
335
+ )
336
+ ).void
337
+ end
338
+ attr_writer :slack
339
+
291
340
  sig { returns(T.nilable(String)) }
292
341
  attr_reader :user_id_override
293
342
 
294
343
  sig { params(user_id_override: String).void }
295
344
  attr_writer :user_id_override
296
345
 
346
+ # Recipient override for this send. Provide exactly one of `email_override`,
347
+ # `phone_number_override`, `user_id_override`, `slack`, or `ms_teams` — not a
348
+ # combination.
297
349
  sig do
298
350
  params(
299
351
  email_override: String,
352
+ ms_teams: Courier::JourneySendNodeToMsTeams::OrHash,
300
353
  phone_number_override: String,
354
+ slack:
355
+ T.any(
356
+ Courier::JourneySendNodeToSlackChannel::OrHash,
357
+ Courier::JourneySendNodeToSlackUserID::OrHash,
358
+ Courier::JourneySendNodeToSlackEmail::OrHash
359
+ ),
301
360
  user_id_override: String
302
361
  ).returns(T.attached_class)
303
362
  end
304
363
  def self.new(
305
364
  email_override: nil,
365
+ # Send to a Microsoft Teams address directly, bypassing the recipient's stored
366
+ # profile. Requires exactly one target: `channel_id`, `channel_name` (with
367
+ # `team_id`), `user_id`, or `email`. `channel_name`, `user_id`, and `email` also
368
+ # need at least one of `service_url` or `tenant_id` — if you provide both, they
369
+ # must agree. `channel_id` doesn't require tenant context to publish, but provide
370
+ # `service_url` or `tenant_id` anyway: sends without either have failed at
371
+ # delivery in testing. `conversation_id` and `reply_to_activity_id`, available on
372
+ # the send API's `MsTeams` profile, aren't supported here yet.
373
+ ms_teams: nil,
306
374
  phone_number_override: nil,
375
+ # Send to a Slack address directly, bypassing the recipient's stored profile.
376
+ # Requires exactly one of `channel`, `user_id`, or `email`.
377
+ slack: nil,
307
378
  user_id_override: nil
308
379
  )
309
380
  end
@@ -312,7 +383,14 @@ module Courier
312
383
  override.returns(
313
384
  {
314
385
  email_override: String,
386
+ ms_teams: Courier::JourneySendNodeToMsTeams,
315
387
  phone_number_override: String,
388
+ slack:
389
+ T.any(
390
+ Courier::JourneySendNodeToSlackChannel,
391
+ Courier::JourneySendNodeToSlackUserID,
392
+ Courier::JourneySendNodeToSlackEmail
393
+ ),
316
394
  user_id_override: String
317
395
  }
318
396
  )
@@ -0,0 +1,124 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToMsTeams < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneySendNodeToMsTeams, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # Bot Framework channel ID to send to.
12
+ sig { returns(T.nilable(String)) }
13
+ attr_reader :channel_id
14
+
15
+ sig { params(channel_id: String).void }
16
+ attr_writer :channel_id
17
+
18
+ # Teams channel name to send to. Requires `team_id`.
19
+ sig { returns(T.nilable(String)) }
20
+ attr_reader :channel_name
21
+
22
+ sig { params(channel_name: String).void }
23
+ attr_writer :channel_name
24
+
25
+ # Email address of the Teams user to send to.
26
+ sig { returns(T.nilable(String)) }
27
+ attr_reader :email
28
+
29
+ sig { params(email: String).void }
30
+ attr_writer :email
31
+
32
+ # The regional Bot Framework host for this conversation, e.g.
33
+ # `https://smba.trafficmanager.net/amer`. A path segment naming the Microsoft
34
+ # tenant may follow it and is used to derive `tenant_id` when it is not supplied
35
+ # directly.
36
+ sig { returns(T.nilable(String)) }
37
+ attr_reader :service_url
38
+
39
+ sig { params(service_url: String).void }
40
+ attr_writer :service_url
41
+
42
+ # Microsoft Teams team ID. Required alongside `channel_name`.
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :team_id
45
+
46
+ sig { params(team_id: String).void }
47
+ attr_writer :team_id
48
+
49
+ # The Microsoft (Azure AD) tenant this send targets or authenticates against.
50
+ # Unrelated to `message.context.tenant_id`, which is the Courier customer's own
51
+ # multi-tenant context.
52
+ sig { returns(T.nilable(String)) }
53
+ attr_reader :tenant_id
54
+
55
+ sig { params(tenant_id: String).void }
56
+ attr_writer :tenant_id
57
+
58
+ # Microsoft Teams user ID to send to.
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :user_id
61
+
62
+ sig { params(user_id: String).void }
63
+ attr_writer :user_id
64
+
65
+ # Send to a Microsoft Teams address directly, bypassing the recipient's stored
66
+ # profile. Requires exactly one target: `channel_id`, `channel_name` (with
67
+ # `team_id`), `user_id`, or `email`. `channel_name`, `user_id`, and `email` also
68
+ # need at least one of `service_url` or `tenant_id` — if you provide both, they
69
+ # must agree. `channel_id` doesn't require tenant context to publish, but provide
70
+ # `service_url` or `tenant_id` anyway: sends without either have failed at
71
+ # delivery in testing. `conversation_id` and `reply_to_activity_id`, available on
72
+ # the send API's `MsTeams` profile, aren't supported here yet.
73
+ sig do
74
+ params(
75
+ channel_id: String,
76
+ channel_name: String,
77
+ email: String,
78
+ service_url: String,
79
+ team_id: String,
80
+ tenant_id: String,
81
+ user_id: String
82
+ ).returns(T.attached_class)
83
+ end
84
+ def self.new(
85
+ # Bot Framework channel ID to send to.
86
+ channel_id: nil,
87
+ # Teams channel name to send to. Requires `team_id`.
88
+ channel_name: nil,
89
+ # Email address of the Teams user to send to.
90
+ email: nil,
91
+ # The regional Bot Framework host for this conversation, e.g.
92
+ # `https://smba.trafficmanager.net/amer`. A path segment naming the Microsoft
93
+ # tenant may follow it and is used to derive `tenant_id` when it is not supplied
94
+ # directly.
95
+ service_url: nil,
96
+ # Microsoft Teams team ID. Required alongside `channel_name`.
97
+ team_id: nil,
98
+ # The Microsoft (Azure AD) tenant this send targets or authenticates against.
99
+ # Unrelated to `message.context.tenant_id`, which is the Courier customer's own
100
+ # multi-tenant context.
101
+ tenant_id: nil,
102
+ # Microsoft Teams user ID to send to.
103
+ user_id: nil
104
+ )
105
+ end
106
+
107
+ sig do
108
+ override.returns(
109
+ {
110
+ channel_id: String,
111
+ channel_name: String,
112
+ email: String,
113
+ service_url: String,
114
+ team_id: String,
115
+ tenant_id: String,
116
+ user_id: String
117
+ }
118
+ )
119
+ end
120
+ def to_hash
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,26 @@
1
+ # typed: strong
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
+ Variants =
11
+ T.type_alias do
12
+ T.any(
13
+ Courier::JourneySendNodeToSlackChannel,
14
+ Courier::JourneySendNodeToSlackUserID,
15
+ Courier::JourneySendNodeToSlackEmail
16
+ )
17
+ end
18
+
19
+ sig do
20
+ override.returns(T::Array[Courier::JourneySendNodeToSlack::Variants])
21
+ end
22
+ def self.variants
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,45 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToSlackChannel < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::JourneySendNodeToSlackChannel,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Slack channel to send to, by name or ID.
15
+ sig { returns(String) }
16
+ attr_accessor :channel
17
+
18
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
19
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
20
+ # them. Omit to use the token on the recipient's stored Slack profile.
21
+ sig { returns(T.nilable(String)) }
22
+ attr_reader :access_token
23
+
24
+ sig { params(access_token: String).void }
25
+ attr_writer :access_token
26
+
27
+ sig do
28
+ params(channel: String, access_token: String).returns(T.attached_class)
29
+ end
30
+ def self.new(
31
+ # Slack channel to send to, by name or ID.
32
+ channel:,
33
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
34
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
35
+ # them. Omit to use the token on the recipient's stored Slack profile.
36
+ access_token: nil
37
+ )
38
+ end
39
+
40
+ sig { override.returns({ channel: String, access_token: String }) }
41
+ def to_hash
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,47 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToSlackEmail < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::JourneySendNodeToSlackEmail,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Email address of the Slack user to send to, resolved via the workspace
15
+ # directory.
16
+ sig { returns(String) }
17
+ attr_accessor :email
18
+
19
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
20
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
21
+ # them. Omit to use the token on the recipient's stored Slack profile.
22
+ sig { returns(T.nilable(String)) }
23
+ attr_reader :access_token
24
+
25
+ sig { params(access_token: String).void }
26
+ attr_writer :access_token
27
+
28
+ sig do
29
+ params(email: String, access_token: String).returns(T.attached_class)
30
+ end
31
+ def self.new(
32
+ # Email address of the Slack user to send to, resolved via the workspace
33
+ # directory.
34
+ email:,
35
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
36
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
37
+ # them. Omit to use the token on the recipient's stored Slack profile.
38
+ access_token: nil
39
+ )
40
+ end
41
+
42
+ sig { override.returns({ email: String, access_token: String }) }
43
+ def to_hash
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,45 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneySendNodeToSlackUserID < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::JourneySendNodeToSlackUserID,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Slack user ID to send to.
15
+ sig { returns(String) }
16
+ attr_accessor :user_id
17
+
18
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
19
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
20
+ # them. Omit to use the token on the recipient's stored Slack profile.
21
+ sig { returns(T.nilable(String)) }
22
+ attr_reader :access_token
23
+
24
+ sig { params(access_token: String).void }
25
+ attr_writer :access_token
26
+
27
+ sig do
28
+ params(user_id: String, access_token: String).returns(T.attached_class)
29
+ end
30
+ def self.new(
31
+ # Slack user ID to send to.
32
+ user_id:,
33
+ # A runtime reference to a Slack access token, such as `{{data.slack_token}}`.
34
+ # Literal values are rejected — they'd be stored permanently with no way to rotate
35
+ # them. Omit to use the token on the recipient's stored Slack profile.
36
+ access_token: nil
37
+ )
38
+ end
39
+
40
+ sig { override.returns({ user_id: String, access_token: String }) }
41
+ def to_hash
42
+ end
43
+ end
44
+ end
45
+ end
@@ -2,6 +2,8 @@
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