trycourier 6.5.0 → 6.6.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/courier/models/digest_day_of_week.rb +21 -0
  5. data/lib/courier/models/digest_frequency.rb +21 -0
  6. data/lib/courier/models/journey_conditions_field.rb +11 -1
  7. data/lib/courier/models/journey_node.rb +17 -2
  8. data/lib/courier/models/topic_digest_category.rb +71 -0
  9. data/lib/courier/models/topic_digest_release_request.rb +35 -0
  10. data/lib/courier/models/topic_digest_request.rb +63 -0
  11. data/lib/courier/models/topic_digest_response.rb +66 -0
  12. data/lib/courier/models/topic_digest_schedule_request.rb +93 -0
  13. data/lib/courier/models/topic_digest_schedule_response.rb +103 -0
  14. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +13 -1
  15. data/lib/courier/models/users/topic_preference.rb +12 -1
  16. data/lib/courier/models/workspace_preference_topic_create_request.rb +15 -1
  17. data/lib/courier/models/workspace_preference_topic_get_response.rb +9 -1
  18. data/lib/courier/models/workspace_preference_topic_replace_request.rb +15 -1
  19. data/lib/courier/models/workspace_preferences/topic_delete_digest_params.rb +28 -0
  20. data/lib/courier/models/workspace_preferences/topic_release_digest_params.rb +28 -0
  21. data/lib/courier/models.rb +16 -0
  22. data/lib/courier/resources/digests/schedules.rb +1 -1
  23. data/lib/courier/resources/workspace_preferences/topics.rb +77 -4
  24. data/lib/courier/resources/workspace_preferences.rb +0 -2
  25. data/lib/courier/version.rb +1 -1
  26. data/lib/courier.rb +10 -0
  27. data/rbi/courier/models/digest_day_of_week.rbi +25 -0
  28. data/rbi/courier/models/digest_frequency.rbi +25 -0
  29. data/rbi/courier/models/journey_node.rbi +12 -1
  30. data/rbi/courier/models/topic_digest_category.rbi +116 -0
  31. data/rbi/courier/models/topic_digest_release_request.rbi +51 -0
  32. data/rbi/courier/models/topic_digest_request.rbi +95 -0
  33. data/rbi/courier/models/topic_digest_response.rbi +98 -0
  34. data/rbi/courier/models/topic_digest_schedule_request.rbi +141 -0
  35. data/rbi/courier/models/topic_digest_schedule_response.rbi +159 -0
  36. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +16 -0
  37. data/rbi/courier/models/users/topic_preference.rbi +17 -0
  38. data/rbi/courier/models/workspace_preference_topic_create_request.rbi +25 -0
  39. data/rbi/courier/models/workspace_preference_topic_get_response.rbi +13 -0
  40. data/rbi/courier/models/workspace_preference_topic_replace_request.rbi +25 -0
  41. data/rbi/courier/models/workspace_preferences/topic_delete_digest_params.rbi +48 -0
  42. data/rbi/courier/models/workspace_preferences/topic_release_digest_params.rbi +48 -0
  43. data/rbi/courier/models.rbi +16 -0
  44. data/rbi/courier/resources/digests/schedules.rbi +5 -2
  45. data/rbi/courier/resources/workspace_preferences/topics.rbi +72 -2
  46. data/rbi/courier/resources/workspace_preferences.rbi +0 -2
  47. data/sig/courier/models/digest_day_of_week.rbs +26 -0
  48. data/sig/courier/models/digest_frequency.rbs +19 -0
  49. data/sig/courier/models/topic_digest_category.rbs +57 -0
  50. data/sig/courier/models/topic_digest_release_request.rbs +17 -0
  51. data/sig/courier/models/topic_digest_request.rbs +48 -0
  52. data/sig/courier/models/topic_digest_response.rbs +58 -0
  53. data/sig/courier/models/topic_digest_schedule_request.rbs +80 -0
  54. data/sig/courier/models/topic_digest_schedule_response.rbs +96 -0
  55. data/sig/courier/models/users/preference_update_or_create_topic_params.rbs +5 -0
  56. data/sig/courier/models/users/topic_preference.rbs +7 -0
  57. data/sig/courier/models/workspace_preference_topic_create_request.rbs +5 -0
  58. data/sig/courier/models/workspace_preference_topic_get_response.rbs +5 -0
  59. data/sig/courier/models/workspace_preference_topic_replace_request.rbs +5 -0
  60. data/sig/courier/models/workspace_preferences/topic_delete_digest_params.rbs +30 -0
  61. data/sig/courier/models/workspace_preferences/topic_release_digest_params.rbs +34 -0
  62. data/sig/courier/models.rbs +16 -0
  63. data/sig/courier/resources/workspace_preferences/topics.rbs +16 -0
  64. 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: 72f51e60173a98ce2cc1e4b6d3c0613e82f18de751e7ea855ed2418808cac4d9
4
+ data.tar.gz: 5a10110fea4a9c3b8c5acaf39d169a902c7a8566e4ddfb49933eaed3600c0924
5
5
  SHA512:
6
- metadata.gz: f9355b12ee2ed402c0f2e13d1f20b23cf5e3ee63e23e627894f66f517cf0522f866626b28485d3a5c98cfd021869f3fea6aeb3112a3e2208d65abc2733b0b10a
7
- data.tar.gz: 45f4b13f45dbb29cdc1ed14845e7ff243fa90f215f45a6c4fcc324a3c725ed750d907da8571e4eb2ccf7b894aa7b9884bba71892454bc0f36f9d0f8036668695
6
+ metadata.gz: 7940121c65ecbb1ef483b5f8594cdde2a3b08f1c93d22c04ebbd829b2989030e6d3bc43359b98196fc749a4c21fe8d54cb2a3355f37e057996da472e807751eb
7
+ data.tar.gz: 569ff793ab8fa5d18202278cd38630cb6556c391f3097e2931c938afb87e2a6c163c4b061bab684dc4a18d668843d0b36a7ebbb5b11699976483d49e466d5370
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.6.0](https://github.com/trycourier/courier-ruby/compare/v6.5.0...v6.6.0) (2026-09-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * **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))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * **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))
14
+ * **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))
15
+
3
16
  ## [6.5.0](https://github.com/trycourier/courier-ruby/compare/v6.4.4...v6.5.0) (2026-09-04)
4
17
 
5
18
 
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.6.0"
13
13
  ```
14
14
 
15
15
  <!-- x-release-please-end -->
@@ -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
  #
@@ -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,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute schedules
7
+ # The cadences this digest delivers on. At least one is required: a digest with no
8
+ # schedule collects events into an instance that can never fire. Omitting the key
9
+ # on a replace leaves stored schedules untouched; sending `[]` is a `400`.
10
+ #
11
+ # @return [Array<Courier::Models::TopicDigestScheduleRequest>]
12
+ required :schedules, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestScheduleRequest] }
13
+
14
+ # @!attribute template_id
15
+ # The notification template that renders the digest. A digest with no template
16
+ # collects nothing, so this is required.
17
+ #
18
+ # @return [String]
19
+ required :template_id, String
20
+
21
+ # @!attribute audience_id
22
+ # Optional audience the digest is scoped to.
23
+ #
24
+ # @return [String, nil]
25
+ optional :audience_id, String
26
+
27
+ # @!attribute categories
28
+ # Retention rules per category key. Defaults to a single `digest` category
29
+ # retaining `FIRST`.
30
+ #
31
+ # @return [Array<Courier::Models::TopicDigestCategory>, nil]
32
+ optional :categories, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestCategory] }
33
+
34
+ # @!attribute trigger_empty
35
+ # Whether to deliver the digest even when nothing was collected.
36
+ #
37
+ # @return [Boolean, nil]
38
+ optional :trigger_empty, Courier::Internal::Type::Boolean
39
+
40
+ # @!method initialize(schedules:, template_id:, audience_id: nil, categories: nil, trigger_empty: nil)
41
+ # Some parameter documentations has been truncated, see
42
+ # {Courier::Models::TopicDigestRequest} for more details.
43
+ #
44
+ # A topic's digest configuration: the template that renders it, the cadences it
45
+ # delivers on, and how collected events are retained.
46
+ #
47
+ # Send `null` for the whole object to turn a digest off, which unlinks the
48
+ # template and removes its schedules. There is no `enabled` flag, and
49
+ # `schedules: []` is rejected, because both states are un-deliverable rather than
50
+ # merely off.
51
+ #
52
+ # @param schedules [Array<Courier::Models::TopicDigestScheduleRequest>] The cadences this digest delivers on. At least one is required: a digest with no
53
+ #
54
+ # @param template_id [String] The notification template that renders the digest. A digest with no template col
55
+ #
56
+ # @param audience_id [String] Optional audience the digest is scoped to.
57
+ #
58
+ # @param categories [Array<Courier::Models::TopicDigestCategory>] Retention rules per category key. Defaults to a single `digest` category retaini
59
+ #
60
+ # @param trigger_empty [Boolean] Whether to deliver the digest even when nothing was collected.
61
+ end
62
+ end
63
+ 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,93 @@
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
+ # @param frequency [Symbol, Courier::Models::DigestFrequency] How often a digest is delivered. `instant` delivers immediately without batching
75
+ #
76
+ # @param day_of_month [Integer] Required when `frequency` is `monthly`.
77
+ #
78
+ # @param day_of_week [Symbol, Courier::Models::DigestDayOfWeek] Required when `frequency` is `weekly`.
79
+ #
80
+ # @param days_of_week [Array<Symbol, Courier::Models::DigestDayOfWeek>] Required when `frequency` is `custom_days`.
81
+ #
82
+ # @param disabled [Boolean] Whether the schedule is disabled.
83
+ #
84
+ # @param is_default [Boolean] The schedule recipients are placed on when they have not chosen one. Set this ex
85
+ #
86
+ # @param schedule_id [String] Identifier of an existing schedule to update. Omit when creating a new one.
87
+ #
88
+ # @param time [String] 24-hour local delivery time, `HH:MM`. Required for every frequency except `insta
89
+ #
90
+ # @param timezone [String] IANA timezone the `time` and day fields are expressed in, e.g. `America/New_York
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestScheduleResponse < Courier::Internal::Type::BaseModel
6
+ # @!attribute schedule_id
7
+ # The schedule's identifier, assigned by the server. This is the value the
8
+ # `/digests/schedules/{schedule_id}` endpoints are keyed by.
9
+ #
10
+ # @return [String]
11
+ required :schedule_id, String
12
+
13
+ # @!attribute created
14
+ # ISO-8601 timestamp of when the schedule was created.
15
+ #
16
+ # @return [String, nil]
17
+ optional :created, String
18
+
19
+ # @!attribute day_of_month
20
+ # Day of the month, 1-31.
21
+ #
22
+ # @return [Integer, nil]
23
+ optional :day_of_month, Integer
24
+
25
+ # @!attribute day_of_week
26
+ # A day of the week. Accepted case-insensitively, returned lowercase.
27
+ #
28
+ # @return [Symbol, Courier::Models::DigestDayOfWeek, nil]
29
+ optional :day_of_week, enum: -> { Courier::DigestDayOfWeek }
30
+
31
+ # @!attribute days_of_week
32
+ #
33
+ # @return [Array<Symbol, Courier::Models::DigestDayOfWeek>, nil]
34
+ optional :days_of_week, -> { Courier::Internal::Type::ArrayOf[enum: Courier::DigestDayOfWeek] }
35
+
36
+ # @!attribute disabled
37
+ # Whether the schedule is disabled.
38
+ #
39
+ # @return [Boolean, nil]
40
+ optional :disabled, Courier::Internal::Type::Boolean
41
+
42
+ # @!attribute frequency
43
+ # Omitted for a stored schedule this enum cannot express. Those schedules never
44
+ # fire, but their `schedule_id` is still returned so the `/digests/*` endpoints
45
+ # remain reachable for them.
46
+ #
47
+ # @return [Symbol, Courier::Models::DigestFrequency, nil]
48
+ optional :frequency, enum: -> { Courier::DigestFrequency }
49
+
50
+ # @!attribute is_default
51
+ # Whether this is the schedule recipients are placed on by default.
52
+ #
53
+ # @return [Boolean, nil]
54
+ optional :is_default, Courier::Internal::Type::Boolean
55
+
56
+ # @!attribute time
57
+ # 24-hour local delivery time, `HH:MM`.
58
+ #
59
+ # @return [String, nil]
60
+ optional :time, String
61
+
62
+ # @!attribute timezone
63
+ # IANA timezone the schedule is expressed in. Absent means UTC.
64
+ #
65
+ # @return [String, nil]
66
+ optional :timezone, String
67
+
68
+ # @!attribute updated
69
+ # ISO-8601 timestamp of the last update.
70
+ #
71
+ # @return [String, nil]
72
+ optional :updated, String
73
+
74
+ # @!method initialize(schedule_id:, created: nil, day_of_month: nil, day_of_week: nil, days_of_week: nil, disabled: nil, frequency: nil, is_default: nil, time: nil, timezone: nil, updated: nil)
75
+ # Some parameter documentations has been truncated, see
76
+ # {Courier::Models::TopicDigestScheduleResponse} for more details.
77
+ #
78
+ # A delivery cadence for a topic's digest, with its assigned id.
79
+ #
80
+ # @param schedule_id [String] The schedule's identifier, assigned by the server. This is the value the `/diges
81
+ #
82
+ # @param created [String] ISO-8601 timestamp of when the schedule was created.
83
+ #
84
+ # @param day_of_month [Integer] Day of the month, 1-31.
85
+ #
86
+ # @param day_of_week [Symbol, Courier::Models::DigestDayOfWeek] A day of the week. Accepted case-insensitively, returned lowercase.
87
+ #
88
+ # @param days_of_week [Array<Symbol, Courier::Models::DigestDayOfWeek>]
89
+ #
90
+ # @param disabled [Boolean] Whether the schedule is disabled.
91
+ #
92
+ # @param frequency [Symbol, Courier::Models::DigestFrequency] Omitted for a stored schedule this enum cannot express. Those schedules never fi
93
+ #
94
+ # @param is_default [Boolean] Whether this is the schedule recipients are placed on by default.
95
+ #
96
+ # @param time [String] 24-hour local delivery time, `HH:MM`.
97
+ #
98
+ # @param timezone [String] IANA timezone the schedule is expressed in. Absent means UTC.
99
+ #
100
+ # @param updated [String] ISO-8601 timestamp of the last update.
101
+ end
102
+ end
103
+ end
@@ -58,6 +58,16 @@ module Courier
58
58
  -> { Courier::Internal::Type::ArrayOf[enum: Courier::ChannelClassification] },
59
59
  nil?: true
60
60
 
61
+ # @!attribute digest_schedule_id
62
+ # Put this recipient on one of the topic's digest schedules. Send `null` to clear
63
+ # the choice and return them to the topic's default. Omit to leave an existing
64
+ # choice alone, unlike the routing fields, which this endpoint replaces. An id
65
+ # that is not an active schedule on the topic is rejected with a `400` before
66
+ # anything is written.
67
+ #
68
+ # @return [String, nil]
69
+ optional :digest_schedule_id, String, nil?: true
70
+
61
71
  # @!attribute has_custom_routing
62
72
  # Set to true to route this topic to the channels in custom_routing instead of the
63
73
  # topic's default routing.
@@ -65,7 +75,7 @@ module Courier
65
75
  # @return [Boolean, nil]
66
76
  optional :has_custom_routing, Courier::Internal::Type::Boolean, nil?: true
67
77
 
68
- # @!method initialize(status:, custom_routing: nil, has_custom_routing: nil)
78
+ # @!method initialize(status:, custom_routing: nil, digest_schedule_id: nil, has_custom_routing: nil)
69
79
  # Some parameter documentations has been truncated, see
70
80
  # {Courier::Models::Users::PreferenceUpdateOrCreateTopicParams::Topic} for more
71
81
  # details.
@@ -74,6 +84,8 @@ module Courier
74
84
  #
75
85
  # @param custom_routing [Array<Symbol, Courier::Models::ChannelClassification>, nil] The channels to deliver this topic on when has_custom_routing is true. One or mo
76
86
  #
87
+ # @param digest_schedule_id [String, nil] Put this recipient on one of the topic's digest schedules. Send `null` to clear
88
+ #
77
89
  # @param has_custom_routing [Boolean, nil] Set to true to route this topic to the channels in custom_routing instead of the
78
90
  end
79
91
  end
@@ -41,6 +41,15 @@ module Courier
41
41
  -> { Courier::Internal::Type::ArrayOf[enum: Courier::ChannelClassification] },
42
42
  nil?: true
43
43
 
44
+ # @!attribute digest_schedule_id
45
+ # The digest schedule this recipient is on for the topic. Omitted rather than null
46
+ # when they have not chosen one, in which case the topic's default schedule
47
+ # applies. Ids come from the topic's digest configuration or from
48
+ # `GET /digests/schedules`.
49
+ #
50
+ # @return [String, nil]
51
+ optional :digest_schedule_id, String
52
+
44
53
  # @!attribute has_custom_routing
45
54
  # Whether the user has chosen specific delivery channels for this topic (listed in
46
55
  # custom_routing) rather than the topic's default routing.
@@ -64,7 +73,7 @@ module Courier
64
73
  # @return [String, nil]
65
74
  optional :section_name, String
66
75
 
67
- # @!method initialize(default_status:, status:, topic_id:, topic_name:, custom_routing: nil, has_custom_routing: nil, section_id: nil, section_name: nil)
76
+ # @!method initialize(default_status:, status:, topic_id:, topic_name:, custom_routing: nil, digest_schedule_id: nil, has_custom_routing: nil, section_id: nil, section_name: nil)
68
77
  # Some parameter documentations has been truncated, see
69
78
  # {Courier::Models::Users::TopicPreference} for more details.
70
79
  #
@@ -78,6 +87,8 @@ module Courier
78
87
  #
79
88
  # @param custom_routing [Array<Symbol, Courier::Models::ChannelClassification>, nil] The channels the user has chosen to receive this topic on, present only when has
80
89
  #
90
+ # @param digest_schedule_id [String] The digest schedule this recipient is on for the topic. Omitted rather than null
91
+ #
81
92
  # @param has_custom_routing [Boolean, nil] Whether the user has chosen specific delivery channels for this topic (listed in
82
93
  #
83
94
  # @param section_id [String] The unique identifier of the section this topic belongs to. Always present when