trycourier 6.5.0 → 6.7.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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +1 -1
  4. data/lib/courier/models/create_journey_request.rb +16 -1
  5. data/lib/courier/models/digest_day_of_week.rb +21 -0
  6. data/lib/courier/models/digest_frequency.rb +21 -0
  7. data/lib/courier/models/journey_conditions_field.rb +11 -1
  8. data/lib/courier/models/journey_node.rb +17 -2
  9. data/lib/courier/models/journey_response.rb +14 -1
  10. data/lib/courier/models/topic_digest_category.rb +71 -0
  11. data/lib/courier/models/topic_digest_release_request.rb +35 -0
  12. data/lib/courier/models/topic_digest_request.rb +75 -0
  13. data/lib/courier/models/topic_digest_response.rb +66 -0
  14. data/lib/courier/models/topic_digest_schedule_request.rb +99 -0
  15. data/lib/courier/models/topic_digest_schedule_response.rb +111 -0
  16. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +13 -1
  17. data/lib/courier/models/users/topic_preference.rb +17 -1
  18. data/lib/courier/models/workspace_preference_topic_create_request.rb +97 -1
  19. data/lib/courier/models/workspace_preference_topic_get_response.rb +9 -1
  20. data/lib/courier/models/workspace_preference_topic_replace_request.rb +15 -1
  21. data/lib/courier/models/workspace_preferences/topic_delete_digest_params.rb +28 -0
  22. data/lib/courier/models/workspace_preferences/topic_release_digest_params.rb +28 -0
  23. data/lib/courier/models.rb +16 -0
  24. data/lib/courier/resources/digests/schedules.rb +1 -1
  25. data/lib/courier/resources/journeys.rb +9 -2
  26. data/lib/courier/resources/workspace_preferences/topics.rb +77 -4
  27. data/lib/courier/resources/workspace_preferences.rb +0 -2
  28. data/lib/courier/version.rb +1 -1
  29. data/lib/courier.rb +10 -0
  30. data/rbi/courier/models/create_journey_request.rbi +19 -0
  31. data/rbi/courier/models/digest_day_of_week.rbi +25 -0
  32. data/rbi/courier/models/digest_frequency.rbi +25 -0
  33. data/rbi/courier/models/journey_node.rbi +12 -1
  34. data/rbi/courier/models/journey_response.rbi +12 -0
  35. data/rbi/courier/models/topic_digest_category.rbi +116 -0
  36. data/rbi/courier/models/topic_digest_release_request.rbi +51 -0
  37. data/rbi/courier/models/topic_digest_request.rbi +126 -0
  38. data/rbi/courier/models/topic_digest_response.rbi +98 -0
  39. data/rbi/courier/models/topic_digest_schedule_request.rbi +147 -0
  40. data/rbi/courier/models/topic_digest_schedule_response.rbi +175 -0
  41. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +16 -0
  42. data/rbi/courier/models/users/topic_preference.rbi +27 -0
  43. data/rbi/courier/models/workspace_preference_topic_create_request.rbi +172 -0
  44. data/rbi/courier/models/workspace_preference_topic_get_response.rbi +13 -0
  45. data/rbi/courier/models/workspace_preference_topic_replace_request.rbi +25 -0
  46. data/rbi/courier/models/workspace_preferences/topic_delete_digest_params.rbi +48 -0
  47. data/rbi/courier/models/workspace_preferences/topic_release_digest_params.rbi +48 -0
  48. data/rbi/courier/models.rbi +16 -0
  49. data/rbi/courier/resources/digests/schedules.rbi +5 -2
  50. data/rbi/courier/resources/journeys.rbi +14 -0
  51. data/rbi/courier/resources/workspace_preferences/topics.rbi +80 -2
  52. data/rbi/courier/resources/workspace_preferences.rbi +0 -2
  53. data/sig/courier/models/create_journey_request.rbs +7 -0
  54. data/sig/courier/models/digest_day_of_week.rbs +26 -0
  55. data/sig/courier/models/digest_frequency.rbs +19 -0
  56. data/sig/courier/models/journey_response.rbs +5 -0
  57. data/sig/courier/models/topic_digest_category.rbs +57 -0
  58. data/sig/courier/models/topic_digest_release_request.rbs +17 -0
  59. data/sig/courier/models/topic_digest_request.rbs +52 -0
  60. data/sig/courier/models/topic_digest_response.rbs +58 -0
  61. data/sig/courier/models/topic_digest_schedule_request.rbs +80 -0
  62. data/sig/courier/models/topic_digest_schedule_response.rbs +96 -0
  63. data/sig/courier/models/users/preference_update_or_create_topic_params.rbs +5 -0
  64. data/sig/courier/models/users/topic_preference.rbs +7 -0
  65. data/sig/courier/models/workspace_preference_topic_create_request.rbs +50 -0
  66. data/sig/courier/models/workspace_preference_topic_get_response.rbs +5 -0
  67. data/sig/courier/models/workspace_preference_topic_replace_request.rbs +5 -0
  68. data/sig/courier/models/workspace_preferences/topic_delete_digest_params.rbs +30 -0
  69. data/sig/courier/models/workspace_preferences/topic_release_digest_params.rbs +34 -0
  70. data/sig/courier/models.rbs +16 -0
  71. data/sig/courier/resources/journeys.rbs +2 -0
  72. data/sig/courier/resources/workspace_preferences/topics.rbs +16 -0
  73. metadata +32 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aec72cc2e6e742c57ffd2f2c5f8fde487e6597a34d0351cf4613abc3f369ab07
4
- data.tar.gz: 037cfdab670141377df8fa5a5443c24b8d66e98b6ccc56b68c5db6176139bbb9
3
+ metadata.gz: c665c6475e9af26f67197651f5599bac614c384d86086dd974ed410005ab407d
4
+ data.tar.gz: 4e037944cf9a6cd6346aa647a5f097e3cd04a5be4676b1b0bc392bed497be990
5
5
  SHA512:
6
- metadata.gz: f9355b12ee2ed402c0f2e13d1f20b23cf5e3ee63e23e627894f66f517cf0522f866626b28485d3a5c98cfd021869f3fea6aeb3112a3e2208d65abc2733b0b10a
7
- data.tar.gz: 45f4b13f45dbb29cdc1ed14845e7ff243fa90f215f45a6c4fcc324a3c725ed750d907da8571e4eb2ccf7b894aa7b9884bba71892454bc0f36f9d0f8036668695
6
+ metadata.gz: 244553b3412e7041264a0ceb8e355e89fcf67b8f00098cfab876e00408c39089e4e6bf0031693e7ab49749e43e74ac4fbf6b7ca16f8e91c00f63bc061157725e
7
+ data.tar.gz: 60ce9fc7ae0c32289b97208cad86e4c97c0ca4b44f6d7f0d10967e72ea4922bc19104a95a46c6c7ee146372a57ba9a255b773a26f9d2bad505f3e905c84d66e9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.7.0](https://github.com/trycourier/courier-ruby/compare/v6.6.0...v6.7.0) (2026-09-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** add cancelation_token to journey create, replace, and get ([#158](https://github.com/trycourier/courier-ruby/issues/158)) ([ec47880](https://github.com/trycourier/courier-ruby/commit/ec47880a79aaefde00dedcbdc84527ff234a99f2))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * **api:** correct the digest schedule contract, and make `schedules` optional ([#156](https://github.com/trycourier/courier-ruby/issues/156)) ([8578d77](https://github.com/trycourier/courier-ruby/commit/8578d77848275105865c1b29b799f2cc6621987e))
14
+
15
+ ## [6.6.0](https://github.com/trycourier/courier-ruby/compare/v6.5.0...v6.6.0) (2026-09-15)
16
+
17
+
18
+ ### Features
19
+
20
+ * **api:** digest configuration, per-recipient schedules, and release ([#154](https://github.com/trycourier/courier-ruby/issues/154)) ([abaf9f2](https://github.com/trycourier/courier-ruby/commit/abaf9f215ae6c9e6aaeb36e7313c9300da23b39b))
21
+
22
+
23
+ ### Documentation
24
+
25
+ * **api:** group the topic digest endpoints under Digests, and match the docs voice ([#155](https://github.com/trycourier/courier-ruby/issues/155)) ([cb00e91](https://github.com/trycourier/courier-ruby/commit/cb00e91773b41f312db5c627ee500080da48b051))
26
+ * **api:** stop teaching an aud_ prefix that Courier does not issue ([#152](https://github.com/trycourier/courier-ruby/issues/152)) ([1bd0f05](https://github.com/trycourier/courier-ruby/commit/1bd0f05a5e3db1e593c04046a7b20e9bdd1f64bf))
27
+
3
28
  ## [6.5.0](https://github.com/trycourier/courier-ruby/compare/v6.4.4...v6.5.0) (2026-09-04)
4
29
 
5
30
 
data/README.md CHANGED
@@ -9,7 +9,7 @@ Add the gem to your `Gemfile`:
9
9
  <!-- x-release-please-start-version -->
10
10
 
11
11
  ```ruby
12
- gem "trycourier", "~> 6.5.0"
12
+ gem "trycourier", "~> 6.7.0"
13
13
  ```
14
14
 
15
15
  <!-- x-release-please-end -->
@@ -13,6 +13,16 @@ module Courier
13
13
  # @return [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneyAudienceTriggerNode, Courier::Models::JourneyWebhookTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
14
14
  required :nodes, -> { Courier::Internal::Type::ArrayOf[union: Courier::JourneyNode] }
15
15
 
16
+ # @!attribute cancelation_token
17
+ # Cancelation token stored on the journey definition. It tags every run the
18
+ # journey creates so that `POST /journeys/cancel` can later cancel those runs by
19
+ # token. Accepts a templated string such as `order-{{data.order_id}}`, which is
20
+ # resolved per run when the journey is invoked. On a replace, omitting this field
21
+ # preserves any existing token and sending a value replaces it.
22
+ #
23
+ # @return [String, nil]
24
+ optional :cancelation_token, String
25
+
16
26
  # @!attribute enabled
17
27
  #
18
28
  # @return [Boolean, nil]
@@ -24,13 +34,18 @@ module Courier
24
34
  # @return [Symbol, Courier::Models::JourneyState, nil]
25
35
  optional :state, enum: -> { Courier::JourneyState }
26
36
 
27
- # @!method initialize(name:, nodes:, enabled: nil, state: nil)
37
+ # @!method initialize(name:, nodes:, cancelation_token: nil, enabled: nil, state: nil)
38
+ # Some parameter documentations has been truncated, see
39
+ # {Courier::Models::CreateJourneyRequest} for more details.
40
+ #
28
41
  # Request body for creating a journey.
29
42
  #
30
43
  # @param name [String]
31
44
  #
32
45
  # @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneyAudienceTriggerNode, Courier::Models::JourneyWebhookTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
33
46
  #
47
+ # @param cancelation_token [String] Cancelation token stored on the journey definition. It tags every run the journe
48
+ #
34
49
  # @param enabled [Boolean]
35
50
  #
36
51
  # @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # A day of the week. Accepted case-insensitively, returned lowercase.
6
+ module DigestDayOfWeek
7
+ extend Courier::Internal::Type::Enum
8
+
9
+ SUNDAY = :sunday
10
+ MONDAY = :monday
11
+ TUESDAY = :tuesday
12
+ WEDNESDAY = :wednesday
13
+ THURSDAY = :thursday
14
+ FRIDAY = :friday
15
+ SATURDAY = :saturday
16
+
17
+ # @!method self.values
18
+ # @return [Array<Symbol>]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # How often a digest is delivered. `instant` delivers immediately without
6
+ # batching, and is the one value that takes no `time`.
7
+ module DigestFrequency
8
+ extend Courier::Internal::Type::Enum
9
+
10
+ INSTANT = :instant
11
+ DAILY = :daily
12
+ WEEKDAYS = :weekdays
13
+ WEEKLY = :weekly
14
+ CUSTOM_DAYS = :custom_days
15
+ MONTHLY = :monthly
16
+
17
+ # @!method self.values
18
+ # @return [Array<Symbol>]
19
+ end
20
+ end
21
+ end
@@ -12,10 +12,20 @@ module Courier
12
12
  # - Binary form (3 elements): `[path, operator, value]` where `operator`
13
13
  # is one of `is equal`, `is not equal`, `contains`, `does not contain`,
14
14
  # `starts with`, `ends with`, `greater than`, `greater than or equal`,
15
- # `less than`, `less than or equal`.
15
+ # `less than`, `less than or equal`, `was`, `was not`.
16
16
  #
17
17
  # Example: `["user.tier", "is equal", "gold"]`.
18
18
  #
19
+ # `was` / `was not` compare a `send_status.<nodeId>` path (referencing
20
+ # an earlier send node's node id) against one of `SENT`, `DELIVERED`,
21
+ # `OPENED`, `CLICKED`, `UNDELIVERABLE`. The first four are cumulative
22
+ # and ordered `SENT < DELIVERED < OPENED < CLICKED`, so `was DELIVERED`
23
+ # is true once the message has reached DELIVERED, OPENED, or CLICKED.
24
+ # `UNDELIVERABLE` is an exact match only and is never part of that
25
+ # ordering, in either direction.
26
+ # Example:
27
+ # `["send_status.P9Z3VCRJG647M7QNJZR3548HW741", "was", "DELIVERED"]`.
28
+ #
19
29
  # - Unary form (2 elements): `[path, operator]` where `operator` is
20
30
  # one of `exists`, `does not exist`.
21
31
  #
@@ -47,7 +47,11 @@ module Courier
47
47
  # Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. The first event into a batch owns the run; later contributing events terminate at the batch step. The batch releases when any of `max_items` is reached, a quiet window of `wait_period` elapses, or the `max_wait_period` ceiling hits.
48
48
  variant -> { Courier::JourneyNode::JourneyBatchNode }
49
49
 
50
- # Add the current event to a digest keyed by the given subscription topic. The digest accumulates events and releases them on the schedule configured for the topic.
50
+ # Add the current event to a digest keyed by the given subscription topic. The digest accumulates events and releases them on the schedule configured for the topic, using the notification template configured on that topic. This node's `type` value is `add-to-digest`.
51
+ #
52
+ # **The topic must have a template configured.** If the topic has no template when the first event reaches this node, the journey run fails immediately: the run is marked `ERROR`, no digest instance is created, and the journey does not continue past this node. Configure the topic's template before using the topic in a journey.
53
+ #
54
+ # If the journey run is scoped to a tenant, digests are kept separate per tenant: two runs for the same user under different tenants accumulate and release as separate digests, even on the same topic.
51
55
  variant -> { Courier::JourneyNode::JourneyAddToDigestNode }
52
56
 
53
57
  # Terminate the journey run.
@@ -240,7 +244,18 @@ module Courier
240
244
  #
241
245
  # Add the current event to a digest keyed by the given subscription topic. The
242
246
  # digest accumulates events and releases them on the schedule configured for the
243
- # topic.
247
+ # topic, using the notification template configured on that topic. This node's
248
+ # `type` value is `add-to-digest`.
249
+ #
250
+ # **The topic must have a template configured.** If the topic has no template when
251
+ # the first event reaches this node, the journey run fails immediately: the run is
252
+ # marked `ERROR`, no digest instance is created, and the journey does not continue
253
+ # past this node. Configure the topic's template before using the topic in a
254
+ # journey.
255
+ #
256
+ # If the journey run is scoped to a tenant, digests are kept separate per tenant:
257
+ # two runs for the same user under different tenants accumulate and release as
258
+ # separate digests, even on the same topic.
244
259
  #
245
260
  # @param subscription_topic_id [String] The subscription topic that owns the digest the event is added to.
246
261
  #
@@ -9,6 +9,14 @@ module Courier
9
9
  # @return [String]
10
10
  required :id, String
11
11
 
12
+ # @!attribute cancelation_token
13
+ # The journey cancelation token, or null when none is set. A token authored in the
14
+ # dashboard is returned in its raw templated form, such as
15
+ # `order-{{data.order_id}}`, so it can be read back and asserted.
16
+ #
17
+ # @return [String, nil]
18
+ required :cancelation_token, String, nil?: true
19
+
12
20
  # @!attribute created
13
21
  #
14
22
  # @return [Integer, nil]
@@ -55,11 +63,16 @@ module Courier
55
63
  # @return [String, nil]
56
64
  required :updater, String, nil?: true
57
65
 
58
- # @!method initialize(id:, created:, creator:, enabled:, name:, nodes:, published:, state:, updated:, updater:)
66
+ # @!method initialize(id:, cancelation_token:, created:, creator:, enabled:, name:, nodes:, published:, state:, updated:, updater:)
67
+ # Some parameter documentations has been truncated, see
68
+ # {Courier::Models::JourneyResponse} for more details.
69
+ #
59
70
  # A journey, with its current draft or published nodes and metadata.
60
71
  #
61
72
  # @param id [String]
62
73
  #
74
+ # @param cancelation_token [String, nil] The journey cancelation token, or null when none is set. A token authored in the
75
+ #
63
76
  # @param created [Integer, nil]
64
77
  #
65
78
  # @param creator [String, nil]
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestCategory < Courier::Internal::Type::BaseModel
6
+ # @!attribute category_key
7
+ # The key that identifies the category within the digest.
8
+ #
9
+ # @return [String]
10
+ required :category_key, String
11
+
12
+ # @!attribute limit
13
+ # How many collected events are carried into the rendered digest. Defaults to 10.
14
+ #
15
+ # Events beyond the limit are discarded, not held back for the next digest: the
16
+ # release consumes everything collected so far and only `limit` of them appear.
17
+ # `retain` decides which ones those are.
18
+ #
19
+ # @return [Integer, nil]
20
+ optional :limit, Integer
21
+
22
+ # @!attribute retain
23
+ # Which collected events survive the `limit`. `FIRST` and `LOWEST` keep the
24
+ # earliest or smallest; `LAST` and `HIGHEST` keep the latest or largest. Accepted
25
+ # case-insensitively, returned uppercase.
26
+ #
27
+ # @return [Symbol, Courier::Models::TopicDigestCategory::Retain, nil]
28
+ optional :retain, enum: -> { Courier::TopicDigestCategory::Retain }
29
+
30
+ # @!attribute sort_key
31
+ # The data key used to rank events. Required when `retain` is `HIGHEST` or
32
+ # `LOWEST`.
33
+ #
34
+ # @return [String, nil]
35
+ optional :sort_key, String
36
+
37
+ # @!method initialize(category_key:, limit: nil, retain: nil, sort_key: nil)
38
+ # Some parameter documentations has been truncated, see
39
+ # {Courier::Models::TopicDigestCategory} for more details.
40
+ #
41
+ # How events collected under a category key are retained when a digest holds more
42
+ # than it will render.
43
+ #
44
+ # @param category_key [String] The key that identifies the category within the digest.
45
+ #
46
+ # @param limit [Integer] How many collected events are carried into the rendered digest. Defaults to 10.
47
+ #
48
+ # @param retain [Symbol, Courier::Models::TopicDigestCategory::Retain] Which collected events survive the `limit`. `FIRST` and `LOWEST` keep the earlie
49
+ #
50
+ # @param sort_key [String] The data key used to rank events. Required when `retain` is `HIGHEST` or `LOWEST
51
+
52
+ # Which collected events survive the `limit`. `FIRST` and `LOWEST` keep the
53
+ # earliest or smallest; `LAST` and `HIGHEST` keep the latest or largest. Accepted
54
+ # case-insensitively, returned uppercase.
55
+ #
56
+ # @see Courier::Models::TopicDigestCategory#retain
57
+ module Retain
58
+ extend Courier::Internal::Type::Enum
59
+
60
+ FIRST = :FIRST
61
+ LAST = :LAST
62
+ HIGHEST = :HIGHEST
63
+ LOWEST = :LOWEST
64
+ NONE = :NONE
65
+
66
+ # @!method self.values
67
+ # @return [Array<Symbol>]
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestReleaseRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute user_id
7
+ # The recipient whose digest to release. Required: there is no "release everyone
8
+ # on this topic" form, because a whole-schedule flush already has its own endpoint
9
+ # and a body-shaped difference between one recipient and all of them is too easy
10
+ # to get wrong.
11
+ #
12
+ # @return [String]
13
+ required :user_id, String
14
+
15
+ # @!attribute tenant_id
16
+ # The recipient's tenant, when they were sent to as part of one -- the same value
17
+ # returned as `tenant_id` on a digest instance and sent as
18
+ # `message.context.tenant_id`. It is part of the held digest's key, so a tenanted
19
+ # recipient cannot be found without it. Omit for an ordinary recipient.
20
+ #
21
+ # @return [String, nil]
22
+ optional :tenant_id, String
23
+
24
+ # @!method initialize(user_id:, tenant_id: nil)
25
+ # Some parameter documentations has been truncated, see
26
+ # {Courier::Models::TopicDigestReleaseRequest} for more details.
27
+ #
28
+ # Which recipient's held digest to release.
29
+ #
30
+ # @param user_id [String] The recipient whose digest to release. Required: there is no "release everyone o
31
+ #
32
+ # @param tenant_id [String] The recipient's tenant, when they were sent to as part of one -- the same value
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute template_id
7
+ # The notification template that renders the digest. A digest with no template
8
+ # collects nothing, so this is required.
9
+ #
10
+ # @return [String]
11
+ required :template_id, String
12
+
13
+ # @!attribute audience_id
14
+ # Optional audience the digest is scoped to.
15
+ #
16
+ # @return [String, nil]
17
+ optional :audience_id, String
18
+
19
+ # @!attribute categories
20
+ # Retention rules per category key. Defaults to a single `digest` category
21
+ # retaining `FIRST`.
22
+ #
23
+ # @return [Array<Courier::Models::TopicDigestCategory>, nil]
24
+ optional :categories, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestCategory] }
25
+
26
+ # @!attribute schedules
27
+ # The cadences this digest delivers on.
28
+ #
29
+ # The array replaces the stored schedules wholesale, so a schedule you leave out
30
+ # of it is deleted along with its delivery rule. Omit the key entirely to leave
31
+ # the stored schedules untouched — useful for changing `template_id` or
32
+ # `categories` without restating every schedule.
33
+ #
34
+ # A digest must end up with at least one schedule, because one with none collects
35
+ # events into an instance that can never fire. So sending `[]` is always a `400`,
36
+ # and so is omitting the key on a topic that has no schedules stored yet.
37
+ #
38
+ # On **create** the key is required outright: a topic being created has nothing
39
+ # stored to leave alone, and the topic row is written before its digest, so
40
+ # rejecting it any later would leave the topic behind and let a retry duplicate
41
+ # it.
42
+ #
43
+ # @return [Array<Courier::Models::TopicDigestScheduleRequest>, nil]
44
+ optional :schedules, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestScheduleRequest] }
45
+
46
+ # @!attribute trigger_empty
47
+ # Whether to deliver the digest even when nothing was collected.
48
+ #
49
+ # @return [Boolean, nil]
50
+ optional :trigger_empty, Courier::Internal::Type::Boolean
51
+
52
+ # @!method initialize(template_id:, audience_id: nil, categories: nil, schedules: nil, trigger_empty: nil)
53
+ # Some parameter documentations has been truncated, see
54
+ # {Courier::Models::TopicDigestRequest} for more details.
55
+ #
56
+ # A topic's digest configuration: the template that renders it, the cadences it
57
+ # delivers on, and how collected events are retained.
58
+ #
59
+ # Send `null` for the whole object to turn a digest off, which unlinks the
60
+ # template and removes its schedules. There is no `enabled` flag, and
61
+ # `schedules: []` is rejected, because both states are un-deliverable rather than
62
+ # merely off.
63
+ #
64
+ # @param template_id [String] The notification template that renders the digest. A digest with no template col
65
+ #
66
+ # @param audience_id [String] Optional audience the digest is scoped to.
67
+ #
68
+ # @param categories [Array<Courier::Models::TopicDigestCategory>] Retention rules per category key. Defaults to a single `digest` category retaini
69
+ #
70
+ # @param schedules [Array<Courier::Models::TopicDigestScheduleRequest>] The cadences this digest delivers on.
71
+ #
72
+ # @param trigger_empty [Boolean] Whether to deliver the digest even when nothing was collected.
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestResponse < Courier::Internal::Type::BaseModel
6
+ # @!attribute categories
7
+ # Retention rules per category key.
8
+ #
9
+ # @return [Array<Courier::Models::TopicDigestCategory>]
10
+ required :categories, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestCategory] }
11
+
12
+ # @!attribute schedules
13
+ # The digest's delivery cadences, each with its server-assigned `schedule_id`.
14
+ #
15
+ # @return [Array<Courier::Models::TopicDigestScheduleResponse>]
16
+ required :schedules, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestScheduleResponse] }
17
+
18
+ # @!attribute template_id
19
+ # The notification template that renders the digest.
20
+ #
21
+ # @return [String]
22
+ required :template_id, String
23
+
24
+ # @!attribute audience_id
25
+ # The audience the digest is scoped to, when set.
26
+ #
27
+ # @return [String, nil]
28
+ optional :audience_id, String
29
+
30
+ # @!attribute created
31
+ # ISO-8601 timestamp of when the digest was configured.
32
+ #
33
+ # @return [String, nil]
34
+ optional :created, String
35
+
36
+ # @!attribute trigger_empty
37
+ # Whether the digest is delivered even when nothing was collected.
38
+ #
39
+ # @return [Boolean, nil]
40
+ optional :trigger_empty, Courier::Internal::Type::Boolean
41
+
42
+ # @!attribute updated
43
+ # ISO-8601 timestamp of the last update.
44
+ #
45
+ # @return [String, nil]
46
+ optional :updated, String
47
+
48
+ # @!method initialize(categories:, schedules:, template_id:, audience_id: nil, created: nil, trigger_empty: nil, updated: nil)
49
+ # A topic's digest configuration.
50
+ #
51
+ # @param categories [Array<Courier::Models::TopicDigestCategory>] Retention rules per category key.
52
+ #
53
+ # @param schedules [Array<Courier::Models::TopicDigestScheduleResponse>] The digest's delivery cadences, each with its server-assigned `schedule_id`.
54
+ #
55
+ # @param template_id [String] The notification template that renders the digest.
56
+ #
57
+ # @param audience_id [String] The audience the digest is scoped to, when set.
58
+ #
59
+ # @param created [String] ISO-8601 timestamp of when the digest was configured.
60
+ #
61
+ # @param trigger_empty [Boolean] Whether the digest is delivered even when nothing was collected.
62
+ #
63
+ # @param updated [String] ISO-8601 timestamp of the last update.
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestScheduleRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute frequency
7
+ # How often a digest is delivered. `instant` delivers immediately without
8
+ # batching, and is the one value that takes no `time`.
9
+ #
10
+ # @return [Symbol, Courier::Models::DigestFrequency]
11
+ required :frequency, enum: -> { Courier::DigestFrequency }
12
+
13
+ # @!attribute day_of_month
14
+ # Required when `frequency` is `monthly`.
15
+ #
16
+ # @return [Integer, nil]
17
+ optional :day_of_month, Integer
18
+
19
+ # @!attribute day_of_week
20
+ # Required when `frequency` is `weekly`.
21
+ #
22
+ # @return [Symbol, Courier::Models::DigestDayOfWeek, nil]
23
+ optional :day_of_week, enum: -> { Courier::DigestDayOfWeek }
24
+
25
+ # @!attribute days_of_week
26
+ # Required when `frequency` is `custom_days`.
27
+ #
28
+ # @return [Array<Symbol, Courier::Models::DigestDayOfWeek>, nil]
29
+ optional :days_of_week, -> { Courier::Internal::Type::ArrayOf[enum: Courier::DigestDayOfWeek] }
30
+
31
+ # @!attribute disabled
32
+ # Whether the schedule is disabled.
33
+ #
34
+ # @return [Boolean, nil]
35
+ optional :disabled, Courier::Internal::Type::Boolean
36
+
37
+ # @!attribute is_default
38
+ # The schedule recipients are placed on when they have not chosen one. Set this
39
+ # explicitly rather than relying on array position.
40
+ #
41
+ # @return [Boolean, nil]
42
+ optional :is_default, Courier::Internal::Type::Boolean
43
+
44
+ # @!attribute schedule_id
45
+ # Identifier of an existing schedule to update. Omit when creating a new one.
46
+ #
47
+ # @return [String, nil]
48
+ optional :schedule_id, String
49
+
50
+ # @!attribute time
51
+ # 24-hour local delivery time, `HH:MM`. Required for every frequency except
52
+ # `instant`.
53
+ #
54
+ # @return [String, nil]
55
+ optional :time, String
56
+
57
+ # @!attribute timezone
58
+ # IANA timezone the `time` and day fields are expressed in, e.g.
59
+ # `America/New_York`. Absent means UTC. Delivery follows the same local wall-clock
60
+ # across daylight-saving changes.
61
+ #
62
+ # @return [String, nil]
63
+ optional :timezone, String
64
+
65
+ # @!method initialize(frequency:, day_of_month: nil, day_of_week: nil, days_of_week: nil, disabled: nil, is_default: nil, schedule_id: nil, time: nil, timezone: nil)
66
+ # Some parameter documentations has been truncated, see
67
+ # {Courier::Models::TopicDigestScheduleRequest} for more details.
68
+ #
69
+ # One delivery cadence for a topic's digest. Supply `schedule_id` to update an
70
+ # existing schedule in place; omit it and one is assigned and returned. The
71
+ # `schedules` array is a full replacement, so a stored schedule absent from it is
72
+ # deleted along with its delivery rule.
73
+ #
74
+ # Updating by `schedule_id` replaces that schedule rather than merging into it:
75
+ # any field you leave out is cleared. Two of those change delivery silently — an
76
+ # omitted `timezone` reverts the schedule to UTC, and an omitted `is_default` can
77
+ # leave the topic with no default schedule, which is what recipients who have not
78
+ # chosen one fall back to. Restate every field you want to keep.
79
+ #
80
+ # @param frequency [Symbol, Courier::Models::DigestFrequency] How often a digest is delivered. `instant` delivers immediately without batching
81
+ #
82
+ # @param day_of_month [Integer] Required when `frequency` is `monthly`.
83
+ #
84
+ # @param day_of_week [Symbol, Courier::Models::DigestDayOfWeek] Required when `frequency` is `weekly`.
85
+ #
86
+ # @param days_of_week [Array<Symbol, Courier::Models::DigestDayOfWeek>] Required when `frequency` is `custom_days`.
87
+ #
88
+ # @param disabled [Boolean] Whether the schedule is disabled.
89
+ #
90
+ # @param is_default [Boolean] The schedule recipients are placed on when they have not chosen one. Set this ex
91
+ #
92
+ # @param schedule_id [String] Identifier of an existing schedule to update. Omit when creating a new one.
93
+ #
94
+ # @param time [String] 24-hour local delivery time, `HH:MM`. Required for every frequency except `insta
95
+ #
96
+ # @param timezone [String] IANA timezone the `time` and day fields are expressed in, e.g. `America/New_York
97
+ end
98
+ end
99
+ end