trycourier 6.0.0 → 6.2.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -1
  4. data/lib/courier/models/automation_run_list_item.rb +57 -0
  5. data/lib/courier/models/automation_run_list_response.rb +25 -0
  6. data/lib/courier/models/automation_run_step.rb +64 -0
  7. data/lib/courier/models/automation_run_steps_response.rb +17 -0
  8. data/lib/courier/models/automations/run_list_params.rb +71 -0
  9. data/lib/courier/models/automations/run_list_steps_params.rb +22 -0
  10. data/lib/courier/models/create_journey_request.rb +2 -2
  11. data/lib/courier/models/journey_audience_trigger_node.rb +77 -0
  12. data/lib/courier/models/journey_node.rb +8 -2
  13. data/lib/courier/models/journey_response.rb +2 -2
  14. data/lib/courier/models/journey_run.rb +66 -0
  15. data/lib/courier/models/journey_run_list_item.rb +50 -0
  16. data/lib/courier/models/journey_run_list_response.rb +33 -0
  17. data/lib/courier/models/journey_run_response.rb +22 -0
  18. data/lib/courier/models/journey_run_step.rb +65 -0
  19. data/lib/courier/models/journey_run_steps_response.rb +17 -0
  20. data/lib/courier/models/journey_segment_trigger_node.rb +5 -1
  21. data/lib/courier/models/journey_webhook_trigger_node.rb +85 -0
  22. data/lib/courier/models/journeys/run_list_params.rb +71 -0
  23. data/lib/courier/models/journeys/run_list_steps_params.rb +22 -0
  24. data/lib/courier/models/journeys/run_retrieve_params.rb +22 -0
  25. data/lib/courier/models/notification_get_metrics_params.rb +83 -0
  26. data/lib/courier/models/notification_metrics_response.rb +165 -0
  27. data/lib/courier/models/users/topic_preference.rb +21 -1
  28. data/lib/courier/models.rb +28 -0
  29. data/lib/courier/resources/automations/runs.rb +80 -0
  30. data/lib/courier/resources/automations.rb +6 -0
  31. data/lib/courier/resources/journeys/runs.rb +104 -0
  32. data/lib/courier/resources/journeys.rb +8 -2
  33. data/lib/courier/resources/notifications.rb +53 -0
  34. data/lib/courier/version.rb +1 -1
  35. data/lib/courier.rb +21 -0
  36. data/rbi/courier/models/automation_run_list_item.rbi +87 -0
  37. data/rbi/courier/models/automation_run_list_response.rbi +47 -0
  38. data/rbi/courier/models/automation_run_step.rbi +96 -0
  39. data/rbi/courier/models/automation_run_steps_response.rbi +28 -0
  40. data/rbi/courier/models/automations/run_list_params.rbi +114 -0
  41. data/rbi/courier/models/automations/run_list_steps_params.rbi +40 -0
  42. data/rbi/courier/models/create_journey_request.rbi +6 -0
  43. data/rbi/courier/models/journey_audience_trigger_node.rbi +162 -0
  44. data/rbi/courier/models/journey_node.rbi +2 -0
  45. data/rbi/courier/models/journey_response.rbi +2 -0
  46. data/rbi/courier/models/journey_run.rbi +97 -0
  47. data/rbi/courier/models/journey_run_list_item.rbi +79 -0
  48. data/rbi/courier/models/journey_run_list_response.rbi +58 -0
  49. data/rbi/courier/models/journey_run_response.rbi +33 -0
  50. data/rbi/courier/models/journey_run_step.rbi +97 -0
  51. data/rbi/courier/models/journey_run_steps_response.rbi +28 -0
  52. data/rbi/courier/models/journey_segment_trigger_node.rbi +9 -1
  53. data/rbi/courier/models/journey_webhook_trigger_node.rbi +174 -0
  54. data/rbi/courier/models/journeys/run_list_params.rbi +111 -0
  55. data/rbi/courier/models/journeys/run_list_steps_params.rbi +40 -0
  56. data/rbi/courier/models/journeys/run_retrieve_params.rbi +40 -0
  57. data/rbi/courier/models/notification_get_metrics_params.rbi +167 -0
  58. data/rbi/courier/models/notification_metrics_response.rbi +269 -0
  59. data/rbi/courier/models/users/topic_preference.rbi +33 -3
  60. data/rbi/courier/models.rbi +28 -0
  61. data/rbi/courier/resources/automations/runs.rbi +69 -0
  62. data/rbi/courier/resources/automations.rbi +5 -0
  63. data/rbi/courier/resources/journeys/runs.rbi +87 -0
  64. data/rbi/courier/resources/journeys.rbi +9 -0
  65. data/rbi/courier/resources/notifications.rbi +57 -0
  66. data/sig/courier/models/automation_run_list_item.rbs +46 -0
  67. data/sig/courier/models/automation_run_list_response.rbs +24 -0
  68. data/sig/courier/models/automation_run_step.rbs +53 -0
  69. data/sig/courier/models/automation_run_steps_response.rbs +14 -0
  70. data/sig/courier/models/automations/run_list_params.rbs +65 -0
  71. data/sig/courier/models/automations/run_list_steps_params.rbs +22 -0
  72. data/sig/courier/models/journey_audience_trigger_node.rbs +66 -0
  73. data/sig/courier/models/journey_node.rbs +2 -0
  74. data/sig/courier/models/journey_run.rbs +53 -0
  75. data/sig/courier/models/journey_run_list_item.rbs +46 -0
  76. data/sig/courier/models/journey_run_list_response.rbs +34 -0
  77. data/sig/courier/models/journey_run_response.rbs +13 -0
  78. data/sig/courier/models/journey_run_step.rbs +53 -0
  79. data/sig/courier/models/journey_run_steps_response.rbs +14 -0
  80. data/sig/courier/models/journey_segment_trigger_node.rbs +2 -1
  81. data/sig/courier/models/journey_webhook_trigger_node.rbs +73 -0
  82. data/sig/courier/models/journeys/run_list_params.rbs +65 -0
  83. data/sig/courier/models/journeys/run_list_steps_params.rbs +25 -0
  84. data/sig/courier/models/journeys/run_retrieve_params.rbs +25 -0
  85. data/sig/courier/models/notification_get_metrics_params.rbs +69 -0
  86. data/sig/courier/models/notification_metrics_response.rbs +127 -0
  87. data/sig/courier/models/users/topic_preference.rbs +17 -3
  88. data/sig/courier/models.rbs +28 -0
  89. data/sig/courier/resources/automations/runs.rbs +24 -0
  90. data/sig/courier/resources/automations.rbs +2 -0
  91. data/sig/courier/resources/journeys/runs.rbs +29 -0
  92. data/sig/courier/resources/journeys.rbs +2 -0
  93. data/sig/courier/resources/notifications.rbs +9 -0
  94. metadata +65 -2
@@ -0,0 +1,269 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class NotificationMetricsResponse < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::NotificationMetricsResponse,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # End of the window actually queried, ceiled onto the granularity grid.
15
+ # Second-precision UTC.
16
+ sig { returns(Time) }
17
+ attr_accessor :end_
18
+
19
+ # Bucket size the series was built at.
20
+ sig do
21
+ returns(Courier::NotificationMetricsResponse::Granularity::TaggedSymbol)
22
+ end
23
+ attr_accessor :granularity
24
+
25
+ # The template the series describes, echoed from the request.
26
+ sig { returns(String) }
27
+ attr_accessor :notification_id
28
+
29
+ # One entry per bucket between `start` and `end`, oldest first, including buckets
30
+ # with no activity.
31
+ sig { returns(T::Array[Courier::NotificationMetricsResponse::Series]) }
32
+ attr_accessor :series
33
+
34
+ # Inclusive start of the window actually queried, floored onto the granularity
35
+ # grid. Second-precision UTC.
36
+ sig { returns(Time) }
37
+ attr_accessor :start
38
+
39
+ sig do
40
+ params(
41
+ end_: Time,
42
+ granularity:
43
+ Courier::NotificationMetricsResponse::Granularity::OrSymbol,
44
+ notification_id: String,
45
+ series:
46
+ T::Array[Courier::NotificationMetricsResponse::Series::OrHash],
47
+ start: Time
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ # End of the window actually queried, ceiled onto the granularity grid.
52
+ # Second-precision UTC.
53
+ end_:,
54
+ # Bucket size the series was built at.
55
+ granularity:,
56
+ # The template the series describes, echoed from the request.
57
+ notification_id:,
58
+ # One entry per bucket between `start` and `end`, oldest first, including buckets
59
+ # with no activity.
60
+ series:,
61
+ # Inclusive start of the window actually queried, floored onto the granularity
62
+ # grid. Second-precision UTC.
63
+ start:
64
+ )
65
+ end
66
+
67
+ sig do
68
+ override.returns(
69
+ {
70
+ end_: Time,
71
+ granularity:
72
+ Courier::NotificationMetricsResponse::Granularity::TaggedSymbol,
73
+ notification_id: String,
74
+ series: T::Array[Courier::NotificationMetricsResponse::Series],
75
+ start: Time
76
+ }
77
+ )
78
+ end
79
+ def to_hash
80
+ end
81
+
82
+ # Bucket size the series was built at.
83
+ module Granularity
84
+ extend Courier::Internal::Type::Enum
85
+
86
+ TaggedSymbol =
87
+ T.type_alias do
88
+ T.all(Symbol, Courier::NotificationMetricsResponse::Granularity)
89
+ end
90
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
91
+
92
+ HOUR =
93
+ T.let(
94
+ :HOUR,
95
+ Courier::NotificationMetricsResponse::Granularity::TaggedSymbol
96
+ )
97
+ DAY =
98
+ T.let(
99
+ :DAY,
100
+ Courier::NotificationMetricsResponse::Granularity::TaggedSymbol
101
+ )
102
+ WEEK =
103
+ T.let(
104
+ :WEEK,
105
+ Courier::NotificationMetricsResponse::Granularity::TaggedSymbol
106
+ )
107
+ MONTH =
108
+ T.let(
109
+ :MONTH,
110
+ Courier::NotificationMetricsResponse::Granularity::TaggedSymbol
111
+ )
112
+
113
+ sig do
114
+ override.returns(
115
+ T::Array[
116
+ Courier::NotificationMetricsResponse::Granularity::TaggedSymbol
117
+ ]
118
+ )
119
+ end
120
+ def self.values
121
+ end
122
+ end
123
+
124
+ class Series < Courier::Internal::Type::BaseModel
125
+ OrHash =
126
+ T.type_alias do
127
+ T.any(
128
+ Courier::NotificationMetricsResponse::Series,
129
+ Courier::Internal::AnyHash
130
+ )
131
+ end
132
+
133
+ # One entry per provider and channel that handled a message in this bucket. Empty
134
+ # when nothing was sent.
135
+ sig do
136
+ returns(T::Array[Courier::NotificationMetricsResponse::Series::Data])
137
+ end
138
+ attr_accessor :data
139
+
140
+ # Start of the bucket, second-precision UTC.
141
+ sig { returns(Time) }
142
+ attr_accessor :period
143
+
144
+ sig do
145
+ params(
146
+ data:
147
+ T::Array[
148
+ Courier::NotificationMetricsResponse::Series::Data::OrHash
149
+ ],
150
+ period: Time
151
+ ).returns(T.attached_class)
152
+ end
153
+ def self.new(
154
+ # One entry per provider and channel that handled a message in this bucket. Empty
155
+ # when nothing was sent.
156
+ data:,
157
+ # Start of the bucket, second-precision UTC.
158
+ period:
159
+ )
160
+ end
161
+
162
+ sig do
163
+ override.returns(
164
+ {
165
+ data:
166
+ T::Array[Courier::NotificationMetricsResponse::Series::Data],
167
+ period: Time
168
+ }
169
+ )
170
+ end
171
+ def to_hash
172
+ end
173
+
174
+ class Data < Courier::Internal::Type::BaseModel
175
+ OrHash =
176
+ T.type_alias do
177
+ T.any(
178
+ Courier::NotificationMetricsResponse::Series::Data,
179
+ Courier::Internal::AnyHash
180
+ )
181
+ end
182
+
183
+ # Channel the provider delivered on, e.g. `email`.
184
+ sig { returns(String) }
185
+ attr_accessor :channel
186
+
187
+ # Messages with at least one tracked link click.
188
+ sig { returns(Integer) }
189
+ attr_accessor :clicked
190
+
191
+ # Messages the provider confirmed as delivered.
192
+ sig { returns(Integer) }
193
+ attr_accessor :delivered
194
+
195
+ # Messages the provider rejected or failed on, including ones a later provider
196
+ # then delivered.
197
+ sig { returns(Integer) }
198
+ attr_accessor :errors
199
+
200
+ # Messages opened at least once. Always `0` on channels with no open tracking.
201
+ sig { returns(Integer) }
202
+ attr_accessor :opened
203
+
204
+ # Provider that handled the messages, e.g. `sendgrid`.
205
+ sig { returns(String) }
206
+ attr_accessor :provider
207
+
208
+ # Messages handed to the provider.
209
+ sig { returns(Integer) }
210
+ attr_accessor :sent
211
+
212
+ # Messages Courier could not deliver on any provider for the channel.
213
+ sig { returns(Integer) }
214
+ attr_accessor :undeliverable
215
+
216
+ sig do
217
+ params(
218
+ channel: String,
219
+ clicked: Integer,
220
+ delivered: Integer,
221
+ errors: Integer,
222
+ opened: Integer,
223
+ provider: String,
224
+ sent: Integer,
225
+ undeliverable: Integer
226
+ ).returns(T.attached_class)
227
+ end
228
+ def self.new(
229
+ # Channel the provider delivered on, e.g. `email`.
230
+ channel:,
231
+ # Messages with at least one tracked link click.
232
+ clicked:,
233
+ # Messages the provider confirmed as delivered.
234
+ delivered:,
235
+ # Messages the provider rejected or failed on, including ones a later provider
236
+ # then delivered.
237
+ errors:,
238
+ # Messages opened at least once. Always `0` on channels with no open tracking.
239
+ opened:,
240
+ # Provider that handled the messages, e.g. `sendgrid`.
241
+ provider:,
242
+ # Messages handed to the provider.
243
+ sent:,
244
+ # Messages Courier could not deliver on any provider for the channel.
245
+ undeliverable:
246
+ )
247
+ end
248
+
249
+ sig do
250
+ override.returns(
251
+ {
252
+ channel: String,
253
+ clicked: Integer,
254
+ delivered: Integer,
255
+ errors: Integer,
256
+ opened: Integer,
257
+ provider: String,
258
+ sent: Integer,
259
+ undeliverable: Integer
260
+ }
261
+ )
262
+ end
263
+ def to_hash
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
@@ -43,6 +43,24 @@ module Courier
43
43
  sig { returns(T.nilable(T::Boolean)) }
44
44
  attr_accessor :has_custom_routing
45
45
 
46
+ # The unique identifier of the section this topic belongs to. Always present when
47
+ # listing a user's preferences; omitted by the single-topic read when the topic
48
+ # has no resolvable section.
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :section_id
51
+
52
+ sig { params(section_id: String).void }
53
+ attr_writer :section_id
54
+
55
+ # The display name of the section this topic belongs to. Always present when
56
+ # listing a user's preferences; omitted by the single-topic read when the topic
57
+ # has no resolvable section.
58
+ sig { returns(T.nilable(String)) }
59
+ attr_reader :section_name
60
+
61
+ sig { params(section_name: String).void }
62
+ attr_writer :section_name
63
+
46
64
  sig do
47
65
  params(
48
66
  default_status: Courier::PreferenceStatus::OrSymbol,
@@ -51,7 +69,9 @@ module Courier
51
69
  topic_name: String,
52
70
  custom_routing:
53
71
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
54
- has_custom_routing: T.nilable(T::Boolean)
72
+ has_custom_routing: T.nilable(T::Boolean),
73
+ section_id: String,
74
+ section_name: String
55
75
  ).returns(T.attached_class)
56
76
  end
57
77
  def self.new(
@@ -72,7 +92,15 @@ module Courier
72
92
  custom_routing: nil,
73
93
  # Whether the user has chosen specific delivery channels for this topic (listed in
74
94
  # custom_routing) rather than the topic's default routing.
75
- has_custom_routing: nil
95
+ has_custom_routing: nil,
96
+ # The unique identifier of the section this topic belongs to. Always present when
97
+ # listing a user's preferences; omitted by the single-topic read when the topic
98
+ # has no resolvable section.
99
+ section_id: nil,
100
+ # The display name of the section this topic belongs to. Always present when
101
+ # listing a user's preferences; omitted by the single-topic read when the topic
102
+ # has no resolvable section.
103
+ section_name: nil
76
104
  )
77
105
  end
78
106
 
@@ -87,7 +115,9 @@ module Courier
87
115
  T.nilable(
88
116
  T::Array[Courier::ChannelClassification::TaggedSymbol]
89
117
  ),
90
- has_custom_routing: T.nilable(T::Boolean)
118
+ has_custom_routing: T.nilable(T::Boolean),
119
+ section_id: String,
120
+ section_name: String
91
121
  }
92
122
  )
93
123
  end
@@ -42,6 +42,14 @@ module Courier
42
42
 
43
43
  AutomationListParams = Courier::Models::AutomationListParams
44
44
 
45
+ AutomationRunListItem = Courier::Models::AutomationRunListItem
46
+
47
+ AutomationRunListResponse = Courier::Models::AutomationRunListResponse
48
+
49
+ AutomationRunStep = Courier::Models::AutomationRunStep
50
+
51
+ AutomationRunStepsResponse = Courier::Models::AutomationRunStepsResponse
52
+
45
53
  Automations = Courier::Models::Automations
46
54
 
47
55
  AutomationTemplate = Courier::Models::AutomationTemplate
@@ -210,6 +218,8 @@ module Courier
210
218
 
211
219
  JourneyArchiveParams = Courier::Models::JourneyArchiveParams
212
220
 
221
+ JourneyAudienceTriggerNode = Courier::Models::JourneyAudienceTriggerNode
222
+
213
223
  JourneyCancelParams = Courier::Models::JourneyCancelParams
214
224
 
215
225
  JourneyConditionAtom =
@@ -260,6 +270,18 @@ module Courier
260
270
 
261
271
  JourneyRetrieveParams = Courier::Models::JourneyRetrieveParams
262
272
 
273
+ JourneyRun = Courier::Models::JourneyRun
274
+
275
+ JourneyRunListItem = Courier::Models::JourneyRunListItem
276
+
277
+ JourneyRunListResponse = Courier::Models::JourneyRunListResponse
278
+
279
+ JourneyRunResponse = Courier::Models::JourneyRunResponse
280
+
281
+ JourneyRunStep = Courier::Models::JourneyRunStep
282
+
283
+ JourneyRunStepsResponse = Courier::Models::JourneyRunStepsResponse
284
+
263
285
  Journeys = Courier::Models::Journeys
264
286
 
265
287
  JourneySegmentTriggerNode = Courier::Models::JourneySegmentTriggerNode
@@ -294,6 +316,8 @@ module Courier
294
316
 
295
317
  JourneyVersionsListResponse = Courier::Models::JourneyVersionsListResponse
296
318
 
319
+ JourneyWebhookTriggerNode = Courier::Models::JourneyWebhookTriggerNode
320
+
297
321
  ListDeleteParams = Courier::Models::ListDeleteParams
298
322
 
299
323
  ListFilter = Courier::Models::ListFilter
@@ -368,6 +392,8 @@ module Courier
368
392
 
369
393
  NotificationGetContent = Courier::Models::NotificationGetContent
370
394
 
395
+ NotificationGetMetricsParams = Courier::Models::NotificationGetMetricsParams
396
+
371
397
  NotificationListParams = Courier::Models::NotificationListParams
372
398
 
373
399
  NotificationListVersionsParams =
@@ -375,6 +401,8 @@ module Courier
375
401
 
376
402
  NotificationLocalePutRequest = Courier::Models::NotificationLocalePutRequest
377
403
 
404
+ NotificationMetricsResponse = Courier::Models::NotificationMetricsResponse
405
+
378
406
  NotificationPreferenceDetails = Courier::Models::NotificationPreferenceDetails
379
407
 
380
408
  NotificationPublishParams = Courier::Models::NotificationPublishParams
@@ -0,0 +1,69 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Resources
5
+ class Automations
6
+ # Invoke a stored automation template or an ad hoc automation defined in the
7
+ # request.
8
+ class Runs
9
+ # List runs of the workspace's v2 Automations, newest first, filtered by status,
10
+ # Template, or date range and paged by cursor. Journey (v3) runs are listed by
11
+ # `GET /journeys/runs` instead — the two surfaces never return each other's runs.
12
+ # Runs are retained for 95 days.
13
+ sig do
14
+ params(
15
+ cursor: String,
16
+ end_date: String,
17
+ limit: String,
18
+ start_date: String,
19
+ status: String,
20
+ template_id: String,
21
+ request_options: Courier::RequestOptions::OrHash
22
+ ).returns(Courier::AutomationRunListResponse)
23
+ end
24
+ def list(
25
+ # A cursor token for pagination. Use the `next_cursor` from the previous response
26
+ # to fetch the next page of results. Treat it as opaque.
27
+ cursor: nil,
28
+ # An inclusive upper bound on `created_at`, in the same format as `start_date`.
29
+ end_date: nil,
30
+ # The number of runs to return per page, between `1` and `50`. Defaults to `20`.
31
+ # Values outside the range are clamped, and a non-numeric value falls back to
32
+ # `20`.
33
+ limit: nil,
34
+ # An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
35
+ # `2026-08-18` or `2026-08-18T20:06:36.259Z`). Any other format returns `400`.
36
+ start_date: nil,
37
+ # A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
38
+ status: nil,
39
+ # A comma-separated list of Automation Template ids to filter on.
40
+ template_id: nil,
41
+ request_options: {}
42
+ )
43
+ end
44
+
45
+ # List the per-step state of one Automation run, in full — this endpoint is not
46
+ # paginated. `message_id` is present on send steps that produced a message; follow
47
+ # it to `GET /messages/{message_id}` for delivery status. A send to a List or an
48
+ # Audience yields one `message_id` for the request, not one per recipient.
49
+ sig do
50
+ params(
51
+ id: String,
52
+ request_options: Courier::RequestOptions::OrHash
53
+ ).returns(Courier::AutomationRunStepsResponse)
54
+ end
55
+ def list_steps(
56
+ # A unique identifier representing the Automation run.
57
+ id,
58
+ request_options: {}
59
+ )
60
+ end
61
+
62
+ # @api private
63
+ sig { params(client: Courier::Client).returns(T.attached_class) }
64
+ def self.new(client:)
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -10,6 +10,11 @@ module Courier
10
10
  sig { returns(Courier::Resources::Automations::Invoke) }
11
11
  attr_reader :invoke
12
12
 
13
+ # Invoke a stored automation template or an ad hoc automation defined in the
14
+ # request.
15
+ sig { returns(Courier::Resources::Automations::Runs) }
16
+ attr_reader :runs
17
+
13
18
  # Lists the workspace's saved automation templates, each with its id and a cursor
14
19
  # for paging to the next page of results.
15
20
  sig do
@@ -0,0 +1,87 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Resources
5
+ class Journeys
6
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
7
+ # along with the templates scoped to them.
8
+ class Runs
9
+ # Fetch one Journey run by id. Returns `404` for an unknown run, a run belonging
10
+ # to another workspace, a run past the 95-day retention window, or an Automation
11
+ # run id — the same body in every case, so the response never reveals whether a
12
+ # run exists elsewhere.
13
+ sig do
14
+ params(
15
+ run_id: String,
16
+ request_options: Courier::RequestOptions::OrHash
17
+ ).returns(Courier::JourneyRunResponse)
18
+ end
19
+ def retrieve(
20
+ # A unique identifier representing the Journey run.
21
+ run_id,
22
+ request_options: {}
23
+ )
24
+ end
25
+
26
+ # List runs of the workspace's Journeys, newest first, filtered by status,
27
+ # Journey, or date range and paged by cursor. Runs of v2 Automations are listed by
28
+ # `GET /automations/runs` instead — the two surfaces never return each other's
29
+ # runs. Runs are retained for 95 days.
30
+ sig do
31
+ params(
32
+ cursor: String,
33
+ end_date: String,
34
+ limit: String,
35
+ start_date: String,
36
+ status: String,
37
+ template_id: String,
38
+ request_options: Courier::RequestOptions::OrHash
39
+ ).returns(Courier::JourneyRunListResponse)
40
+ end
41
+ def list(
42
+ # A cursor token for pagination. Use the `next_cursor` from the previous response
43
+ # to fetch the next page of results. Treat it as opaque.
44
+ cursor: nil,
45
+ # An inclusive upper bound on `created_at`, in the same format as `start_date`.
46
+ end_date: nil,
47
+ # The number of runs to return per page, between `1` and `50`. Defaults to `20`.
48
+ # Values outside the range are clamped, and a non-numeric value falls back to
49
+ # `20`.
50
+ limit: nil,
51
+ # An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
52
+ # `2026-08-18` or `2026-08-18T20:06:36.259Z`). Any other format returns `400`.
53
+ start_date: nil,
54
+ # A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
55
+ status: nil,
56
+ # A comma-separated list of Journey ids to filter on.
57
+ template_id: nil,
58
+ request_options: {}
59
+ )
60
+ end
61
+
62
+ # List the per-node state of one Journey run, in full — this endpoint is not
63
+ # paginated. Each step's `node_id` is the id of the node in the published Journey,
64
+ # so a step maps directly onto the Journey graph. `message_id` is present on send
65
+ # steps that produced a message; follow it to `GET /messages/{message_id}` for
66
+ # delivery status.
67
+ sig do
68
+ params(
69
+ run_id: String,
70
+ request_options: Courier::RequestOptions::OrHash
71
+ ).returns(Courier::JourneyRunStepsResponse)
72
+ end
73
+ def list_steps(
74
+ # A unique identifier representing the Journey run.
75
+ run_id,
76
+ request_options: {}
77
+ )
78
+ end
79
+
80
+ # @api private
81
+ sig { params(client: Courier::Client).returns(T.attached_class) }
82
+ def self.new(client:)
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -10,6 +10,11 @@ module Courier
10
10
  sig { returns(Courier::Resources::Journeys::Templates) }
11
11
  attr_reader :templates
12
12
 
13
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
14
+ # along with the templates scoped to them.
15
+ sig { returns(Courier::Resources::Journeys::Runs) }
16
+ attr_reader :runs
17
+
13
18
  # Creates a journey from a set of nodes, in draft state unless you pass a
14
19
  # published state. Send nodes cannot be included until their templates exist.
15
20
  sig do
@@ -20,6 +25,8 @@ module Courier
20
25
  T.any(
21
26
  Courier::JourneyAPIInvokeTriggerNode::OrHash,
22
27
  Courier::JourneySegmentTriggerNode::OrHash,
28
+ Courier::JourneyAudienceTriggerNode::OrHash,
29
+ Courier::JourneyWebhookTriggerNode::OrHash,
23
30
  Courier::JourneySendNode::OrHash,
24
31
  Courier::JourneyDelayDurationNode::OrHash,
25
32
  Courier::JourneyDelayUntilNode::OrHash,
@@ -260,6 +267,8 @@ module Courier
260
267
  T.any(
261
268
  Courier::JourneyAPIInvokeTriggerNode::OrHash,
262
269
  Courier::JourneySegmentTriggerNode::OrHash,
270
+ Courier::JourneyAudienceTriggerNode::OrHash,
271
+ Courier::JourneyWebhookTriggerNode::OrHash,
263
272
  Courier::JourneySendNode::OrHash,
264
273
  Courier::JourneyDelayDurationNode::OrHash,
265
274
  Courier::JourneyDelayUntilNode::OrHash,
@@ -99,6 +99,63 @@ module Courier
99
99
  )
100
100
  end
101
101
 
102
+ # Fetch the delivery funnel for one Notification Template as a time series — sent,
103
+ # delivered, opened, clicked, errors, and undeliverable — broken out per provider
104
+ # and channel inside each bucket. Sum the entries in a bucket for its totals;
105
+ # there is no bucket-level total.
106
+ #
107
+ # Choose the window absolutely with `start` and `end`, or relatively with
108
+ # `lookback` (an ISO 8601 duration). `start` and `end` take precedence when both
109
+ # are supplied, and a request carrying neither defaults to `lookback=P30D`. The
110
+ # window is snapped outwards onto the `granularity` grid so every bucket it
111
+ # overlaps is returned whole, and the snapped boundaries come back as `start` and
112
+ # `end` — align a chart on those rather than on what was requested. Every boundary
113
+ # is UTC; there is no timezone support.
114
+ #
115
+ # Every bucket in the window is returned, including the quiet ones, whose `data`
116
+ # array is empty, so a series is directly plottable with no gap filling
117
+ # client-side. An unknown template id returns `200` with an all-empty series
118
+ # rather than `404`, and messages sent without a Notification Template never
119
+ # appear here.
120
+ #
121
+ # Available in the US region only.
122
+ sig do
123
+ params(
124
+ id: String,
125
+ end_: Time,
126
+ granularity:
127
+ Courier::NotificationGetMetricsParams::Granularity::OrSymbol,
128
+ lookback: String,
129
+ start: Time,
130
+ request_options: Courier::RequestOptions::OrHash
131
+ ).returns(Courier::NotificationMetricsResponse)
132
+ end
133
+ def get_metrics(
134
+ # The Notification Template to report on — its ID (`nt_` prefix) or an alias. Must
135
+ # not contain commas or whitespace.
136
+ id,
137
+ # The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
138
+ # together with `start`. An `end` in the future is accepted and not clamped — the
139
+ # trailing buckets come back empty.
140
+ end_: nil,
141
+ # The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
142
+ # on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
143
+ # 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
144
+ # coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
145
+ # 1000-bucket limit on a single response.
146
+ granularity: nil,
147
+ # The length of the window, counted back from now, as an ISO 8601 duration
148
+ # (`P30D`, `P12W`, `PT12H`). Defaults to `P30D`, and is ignored when `start` and
149
+ # `end` are supplied. A malformed or non-positive duration returns `400`.
150
+ lookback: nil,
151
+ # The inclusive start of the window, as an ISO 8601 timestamp with an offset
152
+ # (`2026-04-01T00:00:00Z`). Must be supplied together with `end` and be earlier
153
+ # than it; either one alone returns `400`.
154
+ start: nil,
155
+ request_options: {}
156
+ )
157
+ end
158
+
102
159
  # Returns a notification template's published versions, most recent first, for
103
160
  # comparison or rollback. Paged.
104
161
  sig do