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,97 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyRunStep < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyRunStep, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The kind of node that ran, e.g. `send`, `delay`, or `exit`.
12
+ sig { returns(String) }
13
+ attr_accessor :action
14
+
15
+ # The state of the step: the seven run statuses, plus `SKIPPED` and `COMPUTING`.
16
+ # Not an enum — new values have been added before.
17
+ sig { returns(String) }
18
+ attr_accessor :status
19
+
20
+ # When the step started, as an ISO 8601 timestamp.
21
+ sig { returns(T.nilable(String)) }
22
+ attr_reader :created_at
23
+
24
+ sig { params(created_at: String).void }
25
+ attr_writer :created_at
26
+
27
+ # The message this step produced, present on send steps. Pass it to
28
+ # `GET /messages/{message_id}` for delivery status. A send to a List or an
29
+ # Audience yields one id for the request, not one per recipient.
30
+ sig { returns(T.nilable(String)) }
31
+ attr_reader :message_id
32
+
33
+ sig { params(message_id: String).void }
34
+ attr_writer :message_id
35
+
36
+ # The id of the node in the published Journey that this step executed.
37
+ sig { returns(T.nilable(String)) }
38
+ attr_reader :node_id
39
+
40
+ sig { params(node_id: String).void }
41
+ attr_writer :node_id
42
+
43
+ # When the step last changed state, as an ISO 8601 timestamp.
44
+ sig { returns(T.nilable(String)) }
45
+ attr_reader :updated_at
46
+
47
+ sig { params(updated_at: String).void }
48
+ attr_writer :updated_at
49
+
50
+ # One executed node of a Journey run. `node_id` is the id of the node in the
51
+ # published Journey, so a step maps directly onto the Journey graph.
52
+ sig do
53
+ params(
54
+ action: String,
55
+ status: String,
56
+ created_at: String,
57
+ message_id: String,
58
+ node_id: String,
59
+ updated_at: String
60
+ ).returns(T.attached_class)
61
+ end
62
+ def self.new(
63
+ # The kind of node that ran, e.g. `send`, `delay`, or `exit`.
64
+ action:,
65
+ # The state of the step: the seven run statuses, plus `SKIPPED` and `COMPUTING`.
66
+ # Not an enum — new values have been added before.
67
+ status:,
68
+ # When the step started, as an ISO 8601 timestamp.
69
+ created_at: nil,
70
+ # The message this step produced, present on send steps. Pass it to
71
+ # `GET /messages/{message_id}` for delivery status. A send to a List or an
72
+ # Audience yields one id for the request, not one per recipient.
73
+ message_id: nil,
74
+ # The id of the node in the published Journey that this step executed.
75
+ node_id: nil,
76
+ # When the step last changed state, as an ISO 8601 timestamp.
77
+ updated_at: nil
78
+ )
79
+ end
80
+
81
+ sig do
82
+ override.returns(
83
+ {
84
+ action: String,
85
+ status: String,
86
+ created_at: String,
87
+ message_id: String,
88
+ node_id: String,
89
+ updated_at: String
90
+ }
91
+ )
92
+ end
93
+ def to_hash
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,28 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyRunStepsResponse < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyRunStepsResponse, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T::Array[Courier::JourneyRunStep]) }
12
+ attr_accessor :steps
13
+
14
+ # Every step of a Journey run. Not paginated.
15
+ sig do
16
+ params(steps: T::Array[Courier::JourneyRunStep::OrHash]).returns(
17
+ T.attached_class
18
+ )
19
+ end
20
+ def self.new(steps:)
21
+ end
22
+
23
+ sig { override.returns({ steps: T::Array[Courier::JourneyRunStep] }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end
@@ -57,7 +57,10 @@ module Courier
57
57
  sig { params(event_id: String).void }
58
58
  attr_writer :event_id
59
59
 
60
- # Trigger fired by a segment event (`identify`, `group`, or `track`).
60
+ # Trigger fired by a segment event (`identify`, `group`, `track`, or `page`). A
61
+ # trigger with no `event_id` fires on any event of its type — the only shape
62
+ # `identify` and `group` can take, and the one that catches a stock
63
+ # `analytics.page()` call.
61
64
  sig do
62
65
  params(
63
66
  request_type:
@@ -134,6 +137,11 @@ module Courier
134
137
  :track,
135
138
  Courier::JourneySegmentTriggerNode::RequestType::TaggedSymbol
136
139
  )
140
+ PAGE =
141
+ T.let(
142
+ :page,
143
+ Courier::JourneySegmentTriggerNode::RequestType::TaggedSymbol
144
+ )
137
145
 
138
146
  sig do
139
147
  override.returns(
@@ -0,0 +1,174 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyWebhookTriggerNode < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyWebhookTriggerNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The provider key the webhook URL is minted for. Required, and must not contain a
12
+ # forward slash.
13
+ sig { returns(String) }
14
+ attr_accessor :event_source
15
+
16
+ sig { returns(Courier::JourneyWebhookTriggerNode::TriggerType::OrSymbol) }
17
+ attr_accessor :trigger_type
18
+
19
+ sig { returns(Courier::JourneyWebhookTriggerNode::Type::OrSymbol) }
20
+ attr_accessor :type
21
+
22
+ sig { returns(T.nilable(String)) }
23
+ attr_reader :id
24
+
25
+ sig { params(id: String).void }
26
+ attr_writer :id
27
+
28
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
29
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
30
+ # express "no conditions".
31
+ sig do
32
+ returns(
33
+ T.nilable(
34
+ T.any(
35
+ T::Array[String],
36
+ Courier::JourneyConditionGroup,
37
+ Courier::JourneyConditionNestedGroup
38
+ )
39
+ )
40
+ )
41
+ end
42
+ attr_reader :conditions
43
+
44
+ sig do
45
+ params(
46
+ conditions:
47
+ T.any(
48
+ T::Array[String],
49
+ Courier::JourneyConditionGroup::OrHash,
50
+ Courier::JourneyConditionNestedGroup::OrHash
51
+ )
52
+ ).void
53
+ end
54
+ attr_writer :conditions
55
+
56
+ # An optional event filter, matched against the payload's `event` field. A sender
57
+ # that supplies no `event` matches the literal `custom`. Must not contain a
58
+ # forward slash. Omit to accept every event delivered to the URL.
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :event_id
61
+
62
+ sig { params(event_id: String).void }
63
+ attr_writer :event_id
64
+
65
+ # Trigger fired when an external system POSTs to the webhook URL minted for
66
+ # `event_source`. Narrow it to one event with `event_id`, or omit `event_id` to
67
+ # accept every event delivered to the URL.
68
+ sig do
69
+ params(
70
+ event_source: String,
71
+ trigger_type:
72
+ Courier::JourneyWebhookTriggerNode::TriggerType::OrSymbol,
73
+ type: Courier::JourneyWebhookTriggerNode::Type::OrSymbol,
74
+ id: String,
75
+ conditions:
76
+ T.any(
77
+ T::Array[String],
78
+ Courier::JourneyConditionGroup::OrHash,
79
+ Courier::JourneyConditionNestedGroup::OrHash
80
+ ),
81
+ event_id: String
82
+ ).returns(T.attached_class)
83
+ end
84
+ def self.new(
85
+ # The provider key the webhook URL is minted for. Required, and must not contain a
86
+ # forward slash.
87
+ event_source:,
88
+ trigger_type:,
89
+ type:,
90
+ id: nil,
91
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
92
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
93
+ # express "no conditions".
94
+ conditions: nil,
95
+ # An optional event filter, matched against the payload's `event` field. A sender
96
+ # that supplies no `event` matches the literal `custom`. Must not contain a
97
+ # forward slash. Omit to accept every event delivered to the URL.
98
+ event_id: nil
99
+ )
100
+ end
101
+
102
+ sig do
103
+ override.returns(
104
+ {
105
+ event_source: String,
106
+ trigger_type:
107
+ Courier::JourneyWebhookTriggerNode::TriggerType::OrSymbol,
108
+ type: Courier::JourneyWebhookTriggerNode::Type::OrSymbol,
109
+ id: String,
110
+ conditions:
111
+ T.any(
112
+ T::Array[String],
113
+ Courier::JourneyConditionGroup,
114
+ Courier::JourneyConditionNestedGroup
115
+ ),
116
+ event_id: String
117
+ }
118
+ )
119
+ end
120
+ def to_hash
121
+ end
122
+
123
+ module TriggerType
124
+ extend Courier::Internal::Type::Enum
125
+
126
+ TaggedSymbol =
127
+ T.type_alias do
128
+ T.all(Symbol, Courier::JourneyWebhookTriggerNode::TriggerType)
129
+ end
130
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
131
+
132
+ WEBHOOK =
133
+ T.let(
134
+ :webhook,
135
+ Courier::JourneyWebhookTriggerNode::TriggerType::TaggedSymbol
136
+ )
137
+
138
+ sig do
139
+ override.returns(
140
+ T::Array[
141
+ Courier::JourneyWebhookTriggerNode::TriggerType::TaggedSymbol
142
+ ]
143
+ )
144
+ end
145
+ def self.values
146
+ end
147
+ end
148
+
149
+ module Type
150
+ extend Courier::Internal::Type::Enum
151
+
152
+ TaggedSymbol =
153
+ T.type_alias do
154
+ T.all(Symbol, Courier::JourneyWebhookTriggerNode::Type)
155
+ end
156
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
157
+
158
+ TRIGGER =
159
+ T.let(
160
+ :trigger,
161
+ Courier::JourneyWebhookTriggerNode::Type::TaggedSymbol
162
+ )
163
+
164
+ sig do
165
+ override.returns(
166
+ T::Array[Courier::JourneyWebhookTriggerNode::Type::TaggedSymbol]
167
+ )
168
+ end
169
+ def self.values
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,111 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Journeys
6
+ class RunListParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(Courier::Journeys::RunListParams, Courier::Internal::AnyHash)
13
+ end
14
+
15
+ # A cursor token for pagination. Use the `next_cursor` from the previous response
16
+ # to fetch the next page of results. Treat it as opaque.
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :cursor
19
+
20
+ sig { params(cursor: String).void }
21
+ attr_writer :cursor
22
+
23
+ # An inclusive upper bound on `created_at`, in the same format as `start_date`.
24
+ sig { returns(T.nilable(String)) }
25
+ attr_reader :end_date
26
+
27
+ sig { params(end_date: String).void }
28
+ attr_writer :end_date
29
+
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
+ sig { returns(T.nilable(String)) }
34
+ attr_reader :limit
35
+
36
+ sig { params(limit: String).void }
37
+ attr_writer :limit
38
+
39
+ # An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
40
+ # `2026-08-18` or `2026-08-18T20:06:36.259Z`). Any other format returns `400`.
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :start_date
43
+
44
+ sig { params(start_date: String).void }
45
+ attr_writer :start_date
46
+
47
+ # A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
48
+ sig { returns(T.nilable(String)) }
49
+ attr_reader :status
50
+
51
+ sig { params(status: String).void }
52
+ attr_writer :status
53
+
54
+ # A comma-separated list of Journey ids to filter on.
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :template_id
57
+
58
+ sig { params(template_id: String).void }
59
+ attr_writer :template_id
60
+
61
+ sig do
62
+ params(
63
+ cursor: String,
64
+ end_date: String,
65
+ limit: String,
66
+ start_date: String,
67
+ status: String,
68
+ template_id: String,
69
+ request_options: Courier::RequestOptions::OrHash
70
+ ).returns(T.attached_class)
71
+ end
72
+ def self.new(
73
+ # A cursor token for pagination. Use the `next_cursor` from the previous response
74
+ # to fetch the next page of results. Treat it as opaque.
75
+ cursor: nil,
76
+ # An inclusive upper bound on `created_at`, in the same format as `start_date`.
77
+ end_date: nil,
78
+ # The number of runs to return per page, between `1` and `50`. Defaults to `20`.
79
+ # Values outside the range are clamped, and a non-numeric value falls back to
80
+ # `20`.
81
+ limit: nil,
82
+ # An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
83
+ # `2026-08-18` or `2026-08-18T20:06:36.259Z`). Any other format returns `400`.
84
+ start_date: nil,
85
+ # A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
86
+ status: nil,
87
+ # A comma-separated list of Journey ids to filter on.
88
+ template_id: nil,
89
+ request_options: {}
90
+ )
91
+ end
92
+
93
+ sig do
94
+ override.returns(
95
+ {
96
+ cursor: String,
97
+ end_date: String,
98
+ limit: String,
99
+ start_date: String,
100
+ status: String,
101
+ template_id: String,
102
+ request_options: Courier::RequestOptions
103
+ }
104
+ )
105
+ end
106
+ def to_hash
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Journeys
6
+ class RunListStepsParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Courier::Journeys::RunListStepsParams,
14
+ Courier::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :run_id
20
+
21
+ sig do
22
+ params(
23
+ run_id: String,
24
+ request_options: Courier::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(run_id:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ { run_id: String, request_options: Courier::RequestOptions }
33
+ )
34
+ end
35
+ def to_hash
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Journeys
6
+ class RunRetrieveParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Courier::Journeys::RunRetrieveParams,
14
+ Courier::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :run_id
20
+
21
+ sig do
22
+ params(
23
+ run_id: String,
24
+ request_options: Courier::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(run_id:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ { run_id: String, request_options: Courier::RequestOptions }
33
+ )
34
+ end
35
+ def to_hash
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,167 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class NotificationGetMetricsParams < Courier::Internal::Type::BaseModel
6
+ extend Courier::Internal::Type::RequestParameters::Converter
7
+ include Courier::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Courier::NotificationGetMetricsParams,
13
+ Courier::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :id
19
+
20
+ # The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
21
+ # together with `start`. An `end` in the future is accepted and not clamped — the
22
+ # trailing buckets come back empty.
23
+ sig { returns(T.nilable(Time)) }
24
+ attr_reader :end_
25
+
26
+ sig { params(end_: Time).void }
27
+ attr_writer :end_
28
+
29
+ # The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
30
+ # on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
31
+ # 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
32
+ # coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
33
+ # 1000-bucket limit on a single response.
34
+ sig do
35
+ returns(
36
+ T.nilable(
37
+ Courier::NotificationGetMetricsParams::Granularity::OrSymbol
38
+ )
39
+ )
40
+ end
41
+ attr_reader :granularity
42
+
43
+ sig do
44
+ params(
45
+ granularity:
46
+ Courier::NotificationGetMetricsParams::Granularity::OrSymbol
47
+ ).void
48
+ end
49
+ attr_writer :granularity
50
+
51
+ # The length of the window, counted back from now, as an ISO 8601 duration
52
+ # (`P30D`, `P12W`, `PT12H`). Defaults to `P30D`, and is ignored when `start` and
53
+ # `end` are supplied. A malformed or non-positive duration returns `400`.
54
+ sig { returns(T.nilable(String)) }
55
+ attr_reader :lookback
56
+
57
+ sig { params(lookback: String).void }
58
+ attr_writer :lookback
59
+
60
+ # The inclusive start of the window, as an ISO 8601 timestamp with an offset
61
+ # (`2026-04-01T00:00:00Z`). Must be supplied together with `end` and be earlier
62
+ # than it; either one alone returns `400`.
63
+ sig { returns(T.nilable(Time)) }
64
+ attr_reader :start
65
+
66
+ sig { params(start: Time).void }
67
+ attr_writer :start
68
+
69
+ sig do
70
+ params(
71
+ id: String,
72
+ end_: Time,
73
+ granularity:
74
+ Courier::NotificationGetMetricsParams::Granularity::OrSymbol,
75
+ lookback: String,
76
+ start: Time,
77
+ request_options: Courier::RequestOptions::OrHash
78
+ ).returns(T.attached_class)
79
+ end
80
+ def self.new(
81
+ id:,
82
+ # The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
83
+ # together with `start`. An `end` in the future is accepted and not clamped — the
84
+ # trailing buckets come back empty.
85
+ end_: nil,
86
+ # The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
87
+ # on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
88
+ # 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
89
+ # coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
90
+ # 1000-bucket limit on a single response.
91
+ granularity: nil,
92
+ # The length of the window, counted back from now, as an ISO 8601 duration
93
+ # (`P30D`, `P12W`, `PT12H`). Defaults to `P30D`, and is ignored when `start` and
94
+ # `end` are supplied. A malformed or non-positive duration returns `400`.
95
+ lookback: nil,
96
+ # The inclusive start of the window, as an ISO 8601 timestamp with an offset
97
+ # (`2026-04-01T00:00:00Z`). Must be supplied together with `end` and be earlier
98
+ # than it; either one alone returns `400`.
99
+ start: nil,
100
+ request_options: {}
101
+ )
102
+ end
103
+
104
+ sig do
105
+ override.returns(
106
+ {
107
+ id: String,
108
+ end_: Time,
109
+ granularity:
110
+ Courier::NotificationGetMetricsParams::Granularity::OrSymbol,
111
+ lookback: String,
112
+ start: Time,
113
+ request_options: Courier::RequestOptions
114
+ }
115
+ )
116
+ end
117
+ def to_hash
118
+ end
119
+
120
+ # The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
121
+ # on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
122
+ # 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
123
+ # coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
124
+ # 1000-bucket limit on a single response.
125
+ module Granularity
126
+ extend Courier::Internal::Type::Enum
127
+
128
+ TaggedSymbol =
129
+ T.type_alias do
130
+ T.all(Symbol, Courier::NotificationGetMetricsParams::Granularity)
131
+ end
132
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
133
+
134
+ HOUR =
135
+ T.let(
136
+ :HOUR,
137
+ Courier::NotificationGetMetricsParams::Granularity::TaggedSymbol
138
+ )
139
+ DAY =
140
+ T.let(
141
+ :DAY,
142
+ Courier::NotificationGetMetricsParams::Granularity::TaggedSymbol
143
+ )
144
+ WEEK =
145
+ T.let(
146
+ :WEEK,
147
+ Courier::NotificationGetMetricsParams::Granularity::TaggedSymbol
148
+ )
149
+ MONTH =
150
+ T.let(
151
+ :MONTH,
152
+ Courier::NotificationGetMetricsParams::Granularity::TaggedSymbol
153
+ )
154
+
155
+ sig do
156
+ override.returns(
157
+ T::Array[
158
+ Courier::NotificationGetMetricsParams::Granularity::TaggedSymbol
159
+ ]
160
+ )
161
+ end
162
+ def self.values
163
+ end
164
+ end
165
+ end
166
+ end
167
+ end