trycourier 4.17.1 → 4.18.1

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/lib/courier/models/audience.rb +5 -3
  4. data/lib/courier/models/audience_filter_config.rb +29 -1
  5. data/lib/courier/models/audience_update_params.rb +7 -3
  6. data/lib/courier/models/cancel_journey_request.rb +39 -0
  7. data/lib/courier/models/cancel_journey_response.rb +55 -0
  8. data/lib/courier/models/journey_cancel_params.rb +14 -0
  9. data/lib/courier/models/journey_experiment.rb +49 -0
  10. data/lib/courier/models/journey_experiment_variant.rb +44 -0
  11. data/lib/courier/models/journey_node.rb +1 -1
  12. data/lib/courier/models/journey_send_node.rb +23 -10
  13. data/lib/courier/models.rb +10 -0
  14. data/lib/courier/resources/audiences.rb +1 -1
  15. data/lib/courier/resources/journeys.rb +30 -0
  16. data/lib/courier/version.rb +1 -1
  17. data/lib/courier.rb +5 -0
  18. data/rbi/courier/models/audience.rbi +6 -3
  19. data/rbi/courier/models/audience_filter_config.rbi +54 -5
  20. data/rbi/courier/models/audience_update_params.rbi +9 -3
  21. data/rbi/courier/models/cancel_journey_request.rbi +68 -0
  22. data/rbi/courier/models/cancel_journey_response.rbi +81 -0
  23. data/rbi/courier/models/journey_cancel_params.rbi +27 -0
  24. data/rbi/courier/models/journey_experiment.rbi +74 -0
  25. data/rbi/courier/models/journey_experiment_variant.rbi +61 -0
  26. data/rbi/courier/models/journey_send_node.rbi +32 -11
  27. data/rbi/courier/models.rbi +10 -0
  28. data/rbi/courier/resources/audiences.rbi +3 -1
  29. data/rbi/courier/resources/journeys.rbi +25 -0
  30. data/sig/courier/models/audience_filter_config.rbs +30 -3
  31. data/sig/courier/models/cancel_journey_request.rbs +33 -0
  32. data/sig/courier/models/cancel_journey_response.rbs +35 -0
  33. data/sig/courier/models/journey_cancel_params.rbs +15 -0
  34. data/sig/courier/models/journey_experiment.rbs +39 -0
  35. data/sig/courier/models/journey_experiment_variant.rbs +32 -0
  36. data/sig/courier/models/journey_send_node.rbs +19 -8
  37. data/sig/courier/models.rbs +10 -0
  38. data/sig/courier/resources/journeys.rbs +5 -0
  39. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 767d16490b100cdf1a74b068086a2d8dce286dc441ceaf2d6a1014f7a87e8117
4
- data.tar.gz: c5d5013207f3876f9a2a98c87ece15788851f3720dc48a4e5814a3a7ba0273d7
3
+ metadata.gz: ce3813405deb188367bed5849b23a16ea329a497b654278d0a18b2f992b15bec
4
+ data.tar.gz: dd921945bf22141d5505b42420046cd6447a77b033f9866714c8f6fa7692e240
5
5
  SHA512:
6
- metadata.gz: 170f814c04185d95c823f0309563ba0223b661d4079dc8cddd34785234fe39b2c8c7a1dfa54171f7e752897f82be866d26a6bd97f54a4a06babb23a155aa4b9b
7
- data.tar.gz: f18775095318e5eafdd9cc9b7cfe8b8109d06f7ba86c61e397436db89173030257808fc07a75b1ffeb7f6f63777fc4c8d6d6e7dded71c29d5c2e601a7a09f7ff
6
+ metadata.gz: 9174a2e66c46289020fe6d1837690667a7fc1918b7035a18f964be0b46b55eb41cee98a5f8befd8c5acae02b07030e47d0c49e6fd50114be096565850981c849
7
+ data.tar.gz: 48a7ccea6a0357ae2c452a7f9e727daf41b4675a884eb7c03dc1cf20b18a052bae53b022357f69a1e3841ab4ad38662ccca5b026beea8e5261dd44238f69291e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.18.1 (2026-07-07)
4
+
5
+ Full Changelog: [v4.18.0...v4.18.1](https://github.com/trycourier/courier-ruby/compare/v4.18.0...v4.18.1)
6
+
7
+ ### Documentation
8
+
9
+ * **openapi:** document audiences filter combinator (SUP-686) ([fdf42fe](https://github.com/trycourier/courier-ruby/commit/fdf42fecbd77058dbba53a198942efa509bbc1a1))
10
+
11
+ ## 4.18.0 (2026-07-06)
12
+
13
+ Full Changelog: [v4.17.1...v4.18.0](https://github.com/trycourier/courier-ruby/compare/v4.17.1...v4.18.0)
14
+
15
+ ### Features
16
+
17
+ * **openapi:** Journeys cancel-by-token endpoint + send-node experiments (C-18986) ([12613c6](https://github.com/trycourier/courier-ruby/commit/12613c65e9b4facc19f7fa23cc92fac0b2ea8684))
18
+
19
+
20
+ ### Chores
21
+
22
+ * **internal:** bound formatter parallelism to CPU count ([192d613](https://github.com/trycourier/courier-ruby/commit/192d6133c29e2ae7bfcd7c54bd1c244894f01b94))
23
+
24
+
25
+ ### Documentation
26
+
27
+ * **openapi:** reword Cancel journey runs 400 description (re-trigger deploy) ([89ceaab](https://github.com/trycourier/courier-ruby/commit/89ceaab2e20d45c3dd807427f5e4d248ba94cc8a))
28
+ * **openapi:** reword Cancel journey runs description (re-trigger deploy) ([ccce802](https://github.com/trycourier/courier-ruby/commit/ccce8027d4279de031ff2f7e95a250e512dbfbed))
29
+ * **openapi:** tighten Journeys cancel/experiment copy (C-19177) ([10c4f1d](https://github.com/trycourier/courier-ruby/commit/10c4f1d3ca27c525ec5d75d49f4bb30cc0d6180d))
30
+
3
31
  ## 4.17.1 (2026-06-25)
4
32
 
5
33
  Full Changelog: [v4.17.0...v4.17.1](https://github.com/trycourier/courier-ruby/compare/v4.17.0...v4.17.1)
@@ -39,7 +39,8 @@ module Courier
39
39
  optional :filter, -> { Courier::AudienceFilterConfig }, nil?: true
40
40
 
41
41
  # @!attribute operator
42
- # The logical operator (AND/OR) for the top-level filter
42
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
43
+ # Convenience alias for `filter.operator`.
43
44
  #
44
45
  # @return [Symbol, Courier::Models::Audience::Operator, nil]
45
46
  optional :operator, enum: -> { Courier::Audience::Operator }
@@ -60,9 +61,10 @@ module Courier
60
61
  #
61
62
  # @param filter [Courier::Models::AudienceFilterConfig, nil] Filter configuration for audience membership containing an array of filter rules
62
63
  #
63
- # @param operator [Symbol, Courier::Models::Audience::Operator] The logical operator (AND/OR) for the top-level filter
64
+ # @param operator [Symbol, Courier::Models::Audience::Operator] The logical operator (AND/OR) combining the top-level `filter.filters`. Convenie
64
65
 
65
- # The logical operator (AND/OR) for the top-level filter
66
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
67
+ # Convenience alias for `filter.operator`.
66
68
  #
67
69
  # @see Courier::Models::Audience#operator
68
70
  module Operator
@@ -9,10 +9,38 @@ module Courier
9
9
  # @return [Array<Courier::Models::FilterConfig>]
10
10
  required :filters, -> { Courier::Internal::Type::ArrayOf[Courier::FilterConfig] }
11
11
 
12
- # @!method initialize(filters:)
12
+ # @!attribute operator
13
+ # The logical operator (AND/OR) combining the rules in `filters`. Required when
14
+ # `filters` contains more than one rule. If omitted, the top-level `operator`
15
+ # field on the request is used instead.
16
+ #
17
+ # @return [Symbol, Courier::Models::AudienceFilterConfig::Operator, nil]
18
+ optional :operator, enum: -> { Courier::AudienceFilterConfig::Operator }
19
+
20
+ # @!method initialize(filters:, operator: nil)
21
+ # Some parameter documentations has been truncated, see
22
+ # {Courier::Models::AudienceFilterConfig} for more details.
23
+ #
13
24
  # Filter configuration for audience membership containing an array of filter rules
14
25
  #
15
26
  # @param filters [Array<Courier::Models::FilterConfig>] Array of filter rules (single conditions or nested groups)
27
+ #
28
+ # @param operator [Symbol, Courier::Models::AudienceFilterConfig::Operator] The logical operator (AND/OR) combining the rules in `filters`. Required when `f
29
+
30
+ # The logical operator (AND/OR) combining the rules in `filters`. Required when
31
+ # `filters` contains more than one rule. If omitted, the top-level `operator`
32
+ # field on the request is used instead.
33
+ #
34
+ # @see Courier::Models::AudienceFilterConfig#operator
35
+ module Operator
36
+ extend Courier::Internal::Type::Enum
37
+
38
+ AND = :AND
39
+ OR = :OR
40
+
41
+ # @!method self.values
42
+ # @return [Array<Symbol>]
43
+ end
16
44
  end
17
45
  end
18
46
  end
@@ -31,7 +31,9 @@ module Courier
31
31
  optional :name, String, nil?: true
32
32
 
33
33
  # @!attribute operator
34
- # The logical operator (AND/OR) for the top-level filter
34
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
35
+ # Convenience alias for `filter.operator`: if set, it is applied to the top-level
36
+ # filter group. Prefer setting `operator` directly inside `filter`.
35
37
  #
36
38
  # @return [Symbol, Courier::Models::AudienceUpdateParams::Operator, nil]
37
39
  optional :operator, enum: -> { Courier::AudienceUpdateParams::Operator }, nil?: true
@@ -48,11 +50,13 @@ module Courier
48
50
  #
49
51
  # @param name [String, nil] The name of the audience
50
52
  #
51
- # @param operator [Symbol, Courier::Models::AudienceUpdateParams::Operator, nil] The logical operator (AND/OR) for the top-level filter
53
+ # @param operator [Symbol, Courier::Models::AudienceUpdateParams::Operator, nil] The logical operator (AND/OR) combining the top-level `filter.filters`. Convenie
52
54
  #
53
55
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
54
56
 
55
- # The logical operator (AND/OR) for the top-level filter
57
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
58
+ # Convenience alias for `filter.operator`: if set, it is applied to the top-level
59
+ # filter group. Prefer setting `operator` directly inside `filter`.
56
60
  module Operator
57
61
  extend Courier::Internal::Type::Enum
58
62
 
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of
6
+ # `cancelation_token` (cancels every run associated with the token) or `run_id`
7
+ # (cancels a single tenant-scoped run).
8
+ module CancelJourneyRequest
9
+ extend Courier::Internal::Type::Union
10
+
11
+ variant -> { Courier::CancelJourneyRequest::ByCancelationToken }
12
+
13
+ variant -> { Courier::CancelJourneyRequest::ByRunID }
14
+
15
+ class ByCancelationToken < Courier::Internal::Type::BaseModel
16
+ # @!attribute cancelation_token
17
+ #
18
+ # @return [String]
19
+ required :cancelation_token, String
20
+
21
+ # @!method initialize(cancelation_token:)
22
+ # @param cancelation_token [String]
23
+ end
24
+
25
+ class ByRunID < Courier::Internal::Type::BaseModel
26
+ # @!attribute run_id
27
+ #
28
+ # @return [String]
29
+ required :run_id, String
30
+
31
+ # @!method initialize(run_id:)
32
+ # @param run_id [String]
33
+ end
34
+
35
+ # @!method self.variants
36
+ # @return [Array(Courier::Models::CancelJourneyRequest::ByCancelationToken, Courier::Models::CancelJourneyRequest::ByRunID)]
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # `202 Accepted` body for `POST /journeys/cancel`, returning the submitted
6
+ # identifier. When called with `cancelation_token`, returns
7
+ # `{ cancelation_token }`; when called with `run_id`, returns
8
+ # `{ run_id, status }`.
9
+ #
10
+ # @see Courier::Resources::Journeys#cancel
11
+ module CancelJourneyResponse
12
+ extend Courier::Internal::Type::Union
13
+
14
+ variant -> { Courier::CancelJourneyResponse::TokenBranch }
15
+
16
+ variant -> { Courier::CancelJourneyResponse::RunIDBranch }
17
+
18
+ class TokenBranch < Courier::Internal::Type::BaseModel
19
+ # @!attribute cancelation_token
20
+ #
21
+ # @return [String]
22
+ required :cancelation_token, String
23
+
24
+ # @!method initialize(cancelation_token:)
25
+ # @param cancelation_token [String]
26
+ end
27
+
28
+ class RunIDBranch < Courier::Internal::Type::BaseModel
29
+ # @!attribute run_id
30
+ #
31
+ # @return [String]
32
+ required :run_id, String
33
+
34
+ # @!attribute status
35
+ # The run's resulting status. `CANCELED` when the run was active and has been
36
+ # canceled; `PROCESSED` or `ERROR` when the run had already finished and was left
37
+ # unchanged; `CANCELED` for an already-canceled run.
38
+ #
39
+ # @return [String]
40
+ required :status, String
41
+
42
+ # @!method initialize(run_id:, status:)
43
+ # Some parameter documentations has been truncated, see
44
+ # {Courier::Models::CancelJourneyResponse::RunIDBranch} for more details.
45
+ #
46
+ # @param run_id [String]
47
+ #
48
+ # @param status [String] The run's resulting status. `CANCELED` when the run was active and has been canc
49
+ end
50
+
51
+ # @!method self.variants
52
+ # @return [Array(Courier::Models::CancelJourneyResponse::TokenBranch, Courier::Models::CancelJourneyResponse::RunIDBranch)]
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Journeys#cancel
6
+ class JourneyCancelParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyExperiment < Courier::Internal::Type::BaseModel
6
+ # @!attribute bucketing_key
7
+ # The value used to deterministically assign a recipient to a variant. Must be
8
+ # non-empty with no leading or trailing whitespace.
9
+ #
10
+ # @return [String]
11
+ required :bucketing_key, String, api_name: :bucketingKey
12
+
13
+ # @!attribute variants
14
+ # Between 2 and 10 weighted template variants.
15
+ #
16
+ # @return [Array<Courier::Models::JourneyExperimentVariant>]
17
+ required :variants, -> { Courier::Internal::Type::ArrayOf[Courier::JourneyExperimentVariant] }
18
+
19
+ # @!attribute id
20
+ # Unique experiment id (prefixed `exp_`). Omit to have one generated
21
+ # automatically; when supplied it must be a valid `exp_` id.
22
+ #
23
+ # @return [String, nil]
24
+ optional :id, String
25
+
26
+ # @!attribute name
27
+ # Optional display name for the experiment.
28
+ #
29
+ # @return [String, nil]
30
+ optional :name, String
31
+
32
+ # @!method initialize(bucketing_key:, variants:, id: nil, name: nil)
33
+ # Some parameter documentations has been truncated, see
34
+ # {Courier::Models::JourneyExperiment} for more details.
35
+ #
36
+ # A/B experiment config for a send node. The recipient is deterministically
37
+ # bucketed by `bucketingKey` and routed to one of the `variants` in proportion to
38
+ # its `weight`. Present on a send node INSTEAD OF `message.template`.
39
+ #
40
+ # @param bucketing_key [String] The value used to deterministically assign a recipient to a variant. Must be non
41
+ #
42
+ # @param variants [Array<Courier::Models::JourneyExperimentVariant>] Between 2 and 10 weighted template variants.
43
+ #
44
+ # @param id [String] Unique experiment id (prefixed `exp_`). Omit to have one generated automatically
45
+ #
46
+ # @param name [String] Optional display name for the experiment.
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyExperimentVariant < Courier::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ #
8
+ # @return [String]
9
+ required :id, String
10
+
11
+ # @!attribute template_id
12
+ # The notification template sent for this variant.
13
+ #
14
+ # @return [String]
15
+ required :template_id, String, api_name: :templateId
16
+
17
+ # @!attribute weight
18
+ # Relative routing weight. Must be non-negative.
19
+ #
20
+ # @return [Float]
21
+ required :weight, Float
22
+
23
+ # @!attribute name
24
+ # Optional display name for the variant.
25
+ #
26
+ # @return [String, nil]
27
+ optional :name, String
28
+
29
+ # @!method initialize(id:, template_id:, weight:, name: nil)
30
+ # A single weighted variant of an experiment. Variant ids must be unique within
31
+ # the experiment and the sum of all variant weights must be greater than 0.
32
+ # Weights are relative (no sum-to-100 requirement) — routing normalizes them
33
+ # proportionally.
34
+ #
35
+ # @param id [String]
36
+ #
37
+ # @param template_id [String] The notification template sent for this variant.
38
+ #
39
+ # @param weight [Float] Relative routing weight. Must be non-negative.
40
+ #
41
+ # @param name [String] Optional display name for the variant.
42
+ end
43
+ end
44
+ end
@@ -14,7 +14,7 @@ module Courier
14
14
  # Trigger fired by a segment event (`identify`, `group`, or `track`).
15
15
  variant -> { Courier::JourneySegmentTriggerNode }
16
16
 
17
- # Send a notification template to the recipient. Optionally override the recipient address, delay the send, or attach `data`.
17
+ # Send to the recipient. A send node sources its content from EXACTLY ONE of `message.template` (a single notification template) or `experiment` (an A/B split across weighted template variants) — supplying both, or neither, is rejected. Optionally override the recipient address, delay the send, or attach `data`.
18
18
  variant -> { Courier::JourneySendNode }
19
19
 
20
20
  # Pause the journey run for a fixed `duration`.
@@ -26,12 +26,23 @@ module Courier
26
26
  # @return [Array<String>, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup, nil]
27
27
  optional :conditions, union: -> { Courier::JourneyConditionsField }
28
28
 
29
- # @!method initialize(message:, type:, id: nil, conditions: nil)
29
+ # @!attribute experiment
30
+ # A/B experiment config for a send node. The recipient is deterministically
31
+ # bucketed by `bucketingKey` and routed to one of the `variants` in proportion to
32
+ # its `weight`. Present on a send node INSTEAD OF `message.template`.
33
+ #
34
+ # @return [Courier::Models::JourneyExperiment, nil]
35
+ optional :experiment, -> { Courier::JourneyExperiment }
36
+
37
+ # @!method initialize(message:, type:, id: nil, conditions: nil, experiment: nil)
30
38
  # Some parameter documentations has been truncated, see
31
39
  # {Courier::Models::JourneySendNode} for more details.
32
40
  #
33
- # Send a notification template to the recipient. Optionally override the recipient
34
- # address, delay the send, or attach `data`.
41
+ # Send to the recipient. A send node sources its content from EXACTLY ONE of
42
+ # `message.template` (a single notification template) or `experiment` (an A/B
43
+ # split across weighted template variants) — supplying both, or neither, is
44
+ # rejected. Optionally override the recipient address, delay the send, or attach
45
+ # `data`.
35
46
  #
36
47
  # @param message [Courier::Models::JourneySendNode::Message]
37
48
  #
@@ -40,14 +51,11 @@ module Courier
40
51
  # @param id [String]
41
52
  #
42
53
  # @param conditions [Array<String>, Courier::Models::JourneyConditionGroup, Courier::Models::JourneyConditionNestedGroup] Condition spec for a journey node. Accepts a single condition atom, an AND/OR gr
54
+ #
55
+ # @param experiment [Courier::Models::JourneyExperiment] A/B experiment config for a send node. The recipient is deterministically bucket
43
56
 
44
57
  # @see Courier::Models::JourneySendNode#message
45
58
  class Message < Courier::Internal::Type::BaseModel
46
- # @!attribute template
47
- #
48
- # @return [String]
49
- required :template, String
50
-
51
59
  # @!attribute data
52
60
  #
53
61
  # @return [Hash{Symbol=>Object}, nil]
@@ -58,15 +66,20 @@ module Courier
58
66
  # @return [Courier::Models::JourneySendNode::Message::Delay, nil]
59
67
  optional :delay, -> { Courier::JourneySendNode::Message::Delay }
60
68
 
69
+ # @!attribute template
70
+ #
71
+ # @return [String, nil]
72
+ optional :template, String
73
+
61
74
  # @!attribute to
62
75
  #
63
76
  # @return [Courier::Models::JourneySendNode::Message::To, nil]
64
77
  optional :to, -> { Courier::JourneySendNode::Message::To }
65
78
 
66
- # @!method initialize(template:, data: nil, delay: nil, to: nil)
67
- # @param template [String]
79
+ # @!method initialize(data: nil, delay: nil, template: nil, to: nil)
68
80
  # @param data [Hash{Symbol=>Object}]
69
81
  # @param delay [Courier::Models::JourneySendNode::Message::Delay]
82
+ # @param template [String]
70
83
  # @param to [Courier::Models::JourneySendNode::Message::To]
71
84
 
72
85
  # @see Courier::Models::JourneySendNode::Message#delay
@@ -123,6 +123,10 @@ module Courier
123
123
 
124
124
  BulkRunJobParams = Courier::Models::BulkRunJobParams
125
125
 
126
+ CancelJourneyRequest = Courier::Models::CancelJourneyRequest
127
+
128
+ CancelJourneyResponse = Courier::Models::CancelJourneyResponse
129
+
126
130
  Channel = Courier::Models::Channel
127
131
 
128
132
  ChannelClassification = Courier::Models::ChannelClassification
@@ -207,6 +211,8 @@ module Courier
207
211
 
208
212
  JourneyArchiveParams = Courier::Models::JourneyArchiveParams
209
213
 
214
+ JourneyCancelParams = Courier::Models::JourneyCancelParams
215
+
210
216
  # @type [Courier::Internal::Type::Converter]
211
217
  JourneyConditionAtom = Courier::Models::JourneyConditionAtom
212
218
 
@@ -224,6 +230,10 @@ module Courier
224
230
 
225
231
  JourneyExitNode = Courier::Models::JourneyExitNode
226
232
 
233
+ JourneyExperiment = Courier::Models::JourneyExperiment
234
+
235
+ JourneyExperimentVariant = Courier::Models::JourneyExperimentVariant
236
+
227
237
  JourneyFetchGetDeleteNode = Courier::Models::JourneyFetchGetDeleteNode
228
238
 
229
239
  JourneyFetchPostPutNode = Courier::Models::JourneyFetchPostPutNode
@@ -38,7 +38,7 @@ module Courier
38
38
  #
39
39
  # @param name [String, nil] The name of the audience
40
40
  #
41
- # @param operator [Symbol, Courier::Models::AudienceUpdateParams::Operator, nil] The logical operator (AND/OR) for the top-level filter
41
+ # @param operator [Symbol, Courier::Models::AudienceUpdateParams::Operator, nil] The logical operator (AND/OR) combining the top-level `filter.filters`. Convenie
42
42
  #
43
43
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
44
44
  #
@@ -114,6 +114,36 @@ module Courier
114
114
  )
115
115
  end
116
116
 
117
+ # Some parameter documentations has been truncated, see
118
+ # {Courier::Models::JourneyCancelParams} for more details.
119
+ #
120
+ # Cancel journey runs. The request body must include EXACTLY ONE of
121
+ # `cancelation_token` (cancels every run associated with the token) or `run_id`
122
+ # (cancels a single tenant-scoped run). Supplying both or neither returns a `400`.
123
+ # A `run_id` that does not match a run for the tenant returns `404`. Cancelation
124
+ # is idempotent: a run that has already finished (`PROCESSED`/`ERROR`) or was
125
+ # already `CANCELED` is left unchanged and its current status is returned.
126
+ #
127
+ # @overload cancel(cancel_journey_request:, request_options: {})
128
+ #
129
+ # @param cancel_journey_request [Courier::Models::CancelJourneyRequest::ByCancelationToken, Courier::Models::CancelJourneyRequest::ByRunID] Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of `cancelation_to
130
+ #
131
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
132
+ #
133
+ # @return [Courier::Models::CancelJourneyResponse::TokenBranch, Courier::Models::CancelJourneyResponse::RunIDBranch]
134
+ #
135
+ # @see Courier::Models::JourneyCancelParams
136
+ def cancel(params)
137
+ parsed, options = Courier::JourneyCancelParams.dump_request(params)
138
+ @client.request(
139
+ method: :post,
140
+ path: "journeys/cancel",
141
+ body: parsed[:cancel_journey_request],
142
+ model: Courier::CancelJourneyResponse,
143
+ options: options
144
+ )
145
+ end
146
+
117
147
  # Some parameter documentations has been truncated, see
118
148
  # {Courier::Models::JourneyInvokeParams} for more details.
119
149
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Courier
4
- VERSION = "4.17.1"
4
+ VERSION = "4.18.1"
5
5
  end
data/lib/courier.rb CHANGED
@@ -58,6 +58,7 @@ require_relative "courier/models/inbound_bulk_message_user"
58
58
  require_relative "courier/models/base_check"
59
59
  require_relative "courier/models/subscription_topic_new"
60
60
  require_relative "courier/models/elemental_channel_node"
61
+ require_relative "courier/models/cancel_journey_request"
61
62
  require_relative "courier/models/create_journey_request"
62
63
  require_relative "courier/models/journeys_invoke_request"
63
64
  require_relative "courier/models/journey_publish_request"
@@ -131,6 +132,7 @@ require_relative "courier/models/bulk_list_users_response"
131
132
  require_relative "courier/models/bulk_retrieve_job_params"
132
133
  require_relative "courier/models/bulk_retrieve_job_response"
133
134
  require_relative "courier/models/bulk_run_job_params"
135
+ require_relative "courier/models/cancel_journey_response"
134
136
  require_relative "courier/models/channel"
135
137
  require_relative "courier/models/channel_classification"
136
138
  require_relative "courier/models/channel_metadata"
@@ -171,6 +173,7 @@ require_relative "courier/models/journey"
171
173
  require_relative "courier/models/journey_ai_node"
172
174
  require_relative "courier/models/journey_api_invoke_trigger_node"
173
175
  require_relative "courier/models/journey_archive_params"
176
+ require_relative "courier/models/journey_cancel_params"
174
177
  require_relative "courier/models/journey_condition_atom"
175
178
  require_relative "courier/models/journey_condition_group"
176
179
  require_relative "courier/models/journey_condition_nested_group"
@@ -179,6 +182,8 @@ require_relative "courier/models/journey_create_params"
179
182
  require_relative "courier/models/journey_delay_duration_node"
180
183
  require_relative "courier/models/journey_delay_until_node"
181
184
  require_relative "courier/models/journey_exit_node"
185
+ require_relative "courier/models/journey_experiment"
186
+ require_relative "courier/models/journey_experiment_variant"
182
187
  require_relative "courier/models/journey_fetch_get_delete_node"
183
188
  require_relative "courier/models/journey_fetch_post_put_node"
184
189
  require_relative "courier/models/journey_invoke_params"
@@ -33,7 +33,8 @@ module Courier
33
33
  end
34
34
  attr_writer :filter
35
35
 
36
- # The logical operator (AND/OR) for the top-level filter
36
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
37
+ # Convenience alias for `filter.operator`.
37
38
  sig { returns(T.nilable(Courier::Audience::Operator::TaggedSymbol)) }
38
39
  attr_reader :operator
39
40
 
@@ -62,7 +63,8 @@ module Courier
62
63
  updated_at:,
63
64
  # Filter configuration for audience membership containing an array of filter rules
64
65
  filter: nil,
65
- # The logical operator (AND/OR) for the top-level filter
66
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
67
+ # Convenience alias for `filter.operator`.
66
68
  operator: nil
67
69
  )
68
70
  end
@@ -83,7 +85,8 @@ module Courier
83
85
  def to_hash
84
86
  end
85
87
 
86
- # The logical operator (AND/OR) for the top-level filter
88
+ # The logical operator (AND/OR) combining the top-level `filter.filters`.
89
+ # Convenience alias for `filter.operator`.
87
90
  module Operator
88
91
  extend Courier::Internal::Type::Enum
89
92
 
@@ -12,21 +12,70 @@ module Courier
12
12
  sig { returns(T::Array[Courier::FilterConfig]) }
13
13
  attr_accessor :filters
14
14
 
15
+ # The logical operator (AND/OR) combining the rules in `filters`. Required when
16
+ # `filters` contains more than one rule. If omitted, the top-level `operator`
17
+ # field on the request is used instead.
18
+ sig do
19
+ returns(T.nilable(Courier::AudienceFilterConfig::Operator::OrSymbol))
20
+ end
21
+ attr_reader :operator
22
+
23
+ sig do
24
+ params(operator: Courier::AudienceFilterConfig::Operator::OrSymbol).void
25
+ end
26
+ attr_writer :operator
27
+
15
28
  # Filter configuration for audience membership containing an array of filter rules
16
29
  sig do
17
- params(filters: T::Array[Courier::FilterConfig::OrHash]).returns(
18
- T.attached_class
19
- )
30
+ params(
31
+ filters: T::Array[Courier::FilterConfig::OrHash],
32
+ operator: Courier::AudienceFilterConfig::Operator::OrSymbol
33
+ ).returns(T.attached_class)
20
34
  end
21
35
  def self.new(
22
36
  # Array of filter rules (single conditions or nested groups)
23
- filters:
37
+ filters:,
38
+ # The logical operator (AND/OR) combining the rules in `filters`. Required when
39
+ # `filters` contains more than one rule. If omitted, the top-level `operator`
40
+ # field on the request is used instead.
41
+ operator: nil
24
42
  )
25
43
  end
26
44
 
27
- sig { override.returns({ filters: T::Array[Courier::FilterConfig] }) }
45
+ sig do
46
+ override.returns(
47
+ {
48
+ filters: T::Array[Courier::FilterConfig],
49
+ operator: Courier::AudienceFilterConfig::Operator::OrSymbol
50
+ }
51
+ )
52
+ end
28
53
  def to_hash
29
54
  end
55
+
56
+ # The logical operator (AND/OR) combining the rules in `filters`. Required when
57
+ # `filters` contains more than one rule. If omitted, the top-level `operator`
58
+ # field on the request is used instead.
59
+ module Operator
60
+ extend Courier::Internal::Type::Enum
61
+
62
+ TaggedSymbol =
63
+ T.type_alias do
64
+ T.all(Symbol, Courier::AudienceFilterConfig::Operator)
65
+ end
66
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
67
+
68
+ AND = T.let(:AND, Courier::AudienceFilterConfig::Operator::TaggedSymbol)
69
+ OR = T.let(:OR, Courier::AudienceFilterConfig::Operator::TaggedSymbol)
70
+
71
+ sig do
72
+ override.returns(
73
+ T::Array[Courier::AudienceFilterConfig::Operator::TaggedSymbol]
74
+ )
75
+ end
76
+ def self.values
77
+ end
78
+ end
30
79
  end
31
80
  end
32
81
  end