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
@@ -0,0 +1,95 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestRequest < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::TopicDigestRequest, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The cadences this digest delivers on. At least one is required: a digest with no
12
+ # schedule collects events into an instance that can never fire. Omitting the key
13
+ # on a replace leaves stored schedules untouched; sending `[]` is a `400`.
14
+ sig { returns(T::Array[Courier::TopicDigestScheduleRequest]) }
15
+ attr_accessor :schedules
16
+
17
+ # The notification template that renders the digest. A digest with no template
18
+ # collects nothing, so this is required.
19
+ sig { returns(String) }
20
+ attr_accessor :template_id
21
+
22
+ # Optional audience the digest is scoped to.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :audience_id
25
+
26
+ sig { params(audience_id: String).void }
27
+ attr_writer :audience_id
28
+
29
+ # Retention rules per category key. Defaults to a single `digest` category
30
+ # retaining `FIRST`.
31
+ sig { returns(T.nilable(T::Array[Courier::TopicDigestCategory])) }
32
+ attr_reader :categories
33
+
34
+ sig do
35
+ params(categories: T::Array[Courier::TopicDigestCategory::OrHash]).void
36
+ end
37
+ attr_writer :categories
38
+
39
+ # Whether to deliver the digest even when nothing was collected.
40
+ sig { returns(T.nilable(T::Boolean)) }
41
+ attr_reader :trigger_empty
42
+
43
+ sig { params(trigger_empty: T::Boolean).void }
44
+ attr_writer :trigger_empty
45
+
46
+ # A topic's digest configuration: the template that renders it, the cadences it
47
+ # delivers on, and how collected events are retained.
48
+ #
49
+ # Send `null` for the whole object to turn a digest off, which unlinks the
50
+ # template and removes its schedules. There is no `enabled` flag, and
51
+ # `schedules: []` is rejected, because both states are un-deliverable rather than
52
+ # merely off.
53
+ sig do
54
+ params(
55
+ schedules: T::Array[Courier::TopicDigestScheduleRequest::OrHash],
56
+ template_id: String,
57
+ audience_id: String,
58
+ categories: T::Array[Courier::TopicDigestCategory::OrHash],
59
+ trigger_empty: T::Boolean
60
+ ).returns(T.attached_class)
61
+ end
62
+ def self.new(
63
+ # The cadences this digest delivers on. At least one is required: a digest with no
64
+ # schedule collects events into an instance that can never fire. Omitting the key
65
+ # on a replace leaves stored schedules untouched; sending `[]` is a `400`.
66
+ schedules:,
67
+ # The notification template that renders the digest. A digest with no template
68
+ # collects nothing, so this is required.
69
+ template_id:,
70
+ # Optional audience the digest is scoped to.
71
+ audience_id: nil,
72
+ # Retention rules per category key. Defaults to a single `digest` category
73
+ # retaining `FIRST`.
74
+ categories: nil,
75
+ # Whether to deliver the digest even when nothing was collected.
76
+ trigger_empty: nil
77
+ )
78
+ end
79
+
80
+ sig do
81
+ override.returns(
82
+ {
83
+ schedules: T::Array[Courier::TopicDigestScheduleRequest],
84
+ template_id: String,
85
+ audience_id: String,
86
+ categories: T::Array[Courier::TopicDigestCategory],
87
+ trigger_empty: T::Boolean
88
+ }
89
+ )
90
+ end
91
+ def to_hash
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,98 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestResponse < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::TopicDigestResponse, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # Retention rules per category key.
12
+ sig { returns(T::Array[Courier::TopicDigestCategory]) }
13
+ attr_accessor :categories
14
+
15
+ # The digest's delivery cadences, each with its server-assigned `schedule_id`.
16
+ sig { returns(T::Array[Courier::TopicDigestScheduleResponse]) }
17
+ attr_accessor :schedules
18
+
19
+ # The notification template that renders the digest.
20
+ sig { returns(String) }
21
+ attr_accessor :template_id
22
+
23
+ # The audience the digest is scoped to, when set.
24
+ sig { returns(T.nilable(String)) }
25
+ attr_reader :audience_id
26
+
27
+ sig { params(audience_id: String).void }
28
+ attr_writer :audience_id
29
+
30
+ # ISO-8601 timestamp of when the digest was configured.
31
+ sig { returns(T.nilable(String)) }
32
+ attr_reader :created
33
+
34
+ sig { params(created: String).void }
35
+ attr_writer :created
36
+
37
+ # Whether the digest is delivered even when nothing was collected.
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :trigger_empty
40
+
41
+ sig { params(trigger_empty: T::Boolean).void }
42
+ attr_writer :trigger_empty
43
+
44
+ # ISO-8601 timestamp of the last update.
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :updated
47
+
48
+ sig { params(updated: String).void }
49
+ attr_writer :updated
50
+
51
+ # A topic's digest configuration.
52
+ sig do
53
+ params(
54
+ categories: T::Array[Courier::TopicDigestCategory::OrHash],
55
+ schedules: T::Array[Courier::TopicDigestScheduleResponse::OrHash],
56
+ template_id: String,
57
+ audience_id: String,
58
+ created: String,
59
+ trigger_empty: T::Boolean,
60
+ updated: String
61
+ ).returns(T.attached_class)
62
+ end
63
+ def self.new(
64
+ # Retention rules per category key.
65
+ categories:,
66
+ # The digest's delivery cadences, each with its server-assigned `schedule_id`.
67
+ schedules:,
68
+ # The notification template that renders the digest.
69
+ template_id:,
70
+ # The audience the digest is scoped to, when set.
71
+ audience_id: nil,
72
+ # ISO-8601 timestamp of when the digest was configured.
73
+ created: nil,
74
+ # Whether the digest is delivered even when nothing was collected.
75
+ trigger_empty: nil,
76
+ # ISO-8601 timestamp of the last update.
77
+ updated: nil
78
+ )
79
+ end
80
+
81
+ sig do
82
+ override.returns(
83
+ {
84
+ categories: T::Array[Courier::TopicDigestCategory],
85
+ schedules: T::Array[Courier::TopicDigestScheduleResponse],
86
+ template_id: String,
87
+ audience_id: String,
88
+ created: String,
89
+ trigger_empty: T::Boolean,
90
+ updated: String
91
+ }
92
+ )
93
+ end
94
+ def to_hash
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,141 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestScheduleRequest < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::TopicDigestScheduleRequest, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # How often a digest is delivered. `instant` delivers immediately without
12
+ # batching, and is the one value that takes no `time`.
13
+ sig { returns(Courier::DigestFrequency::OrSymbol) }
14
+ attr_accessor :frequency
15
+
16
+ # Required when `frequency` is `monthly`.
17
+ sig { returns(T.nilable(Integer)) }
18
+ attr_reader :day_of_month
19
+
20
+ sig { params(day_of_month: Integer).void }
21
+ attr_writer :day_of_month
22
+
23
+ # Required when `frequency` is `weekly`.
24
+ sig { returns(T.nilable(Courier::DigestDayOfWeek::OrSymbol)) }
25
+ attr_reader :day_of_week
26
+
27
+ sig { params(day_of_week: Courier::DigestDayOfWeek::OrSymbol).void }
28
+ attr_writer :day_of_week
29
+
30
+ # Required when `frequency` is `custom_days`.
31
+ sig { returns(T.nilable(T::Array[Courier::DigestDayOfWeek::OrSymbol])) }
32
+ attr_reader :days_of_week
33
+
34
+ sig do
35
+ params(days_of_week: T::Array[Courier::DigestDayOfWeek::OrSymbol]).void
36
+ end
37
+ attr_writer :days_of_week
38
+
39
+ # Whether the schedule is disabled.
40
+ sig { returns(T.nilable(T::Boolean)) }
41
+ attr_reader :disabled
42
+
43
+ sig { params(disabled: T::Boolean).void }
44
+ attr_writer :disabled
45
+
46
+ # The schedule recipients are placed on when they have not chosen one. Set this
47
+ # explicitly rather than relying on array position.
48
+ sig { returns(T.nilable(T::Boolean)) }
49
+ attr_reader :is_default
50
+
51
+ sig { params(is_default: T::Boolean).void }
52
+ attr_writer :is_default
53
+
54
+ # Identifier of an existing schedule to update. Omit when creating a new one.
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :schedule_id
57
+
58
+ sig { params(schedule_id: String).void }
59
+ attr_writer :schedule_id
60
+
61
+ # 24-hour local delivery time, `HH:MM`. Required for every frequency except
62
+ # `instant`.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_reader :time
65
+
66
+ sig { params(time: String).void }
67
+ attr_writer :time
68
+
69
+ # IANA timezone the `time` and day fields are expressed in, e.g.
70
+ # `America/New_York`. Absent means UTC. Delivery follows the same local wall-clock
71
+ # across daylight-saving changes.
72
+ sig { returns(T.nilable(String)) }
73
+ attr_reader :timezone
74
+
75
+ sig { params(timezone: String).void }
76
+ attr_writer :timezone
77
+
78
+ # One delivery cadence for a topic's digest. Supply `schedule_id` to update an
79
+ # existing schedule in place; omit it and one is assigned and returned. The
80
+ # `schedules` array is a full replacement, so a stored schedule absent from it is
81
+ # deleted along with its delivery rule.
82
+ sig do
83
+ params(
84
+ frequency: Courier::DigestFrequency::OrSymbol,
85
+ day_of_month: Integer,
86
+ day_of_week: Courier::DigestDayOfWeek::OrSymbol,
87
+ days_of_week: T::Array[Courier::DigestDayOfWeek::OrSymbol],
88
+ disabled: T::Boolean,
89
+ is_default: T::Boolean,
90
+ schedule_id: String,
91
+ time: String,
92
+ timezone: String
93
+ ).returns(T.attached_class)
94
+ end
95
+ def self.new(
96
+ # How often a digest is delivered. `instant` delivers immediately without
97
+ # batching, and is the one value that takes no `time`.
98
+ frequency:,
99
+ # Required when `frequency` is `monthly`.
100
+ day_of_month: nil,
101
+ # Required when `frequency` is `weekly`.
102
+ day_of_week: nil,
103
+ # Required when `frequency` is `custom_days`.
104
+ days_of_week: nil,
105
+ # Whether the schedule is disabled.
106
+ disabled: nil,
107
+ # The schedule recipients are placed on when they have not chosen one. Set this
108
+ # explicitly rather than relying on array position.
109
+ is_default: nil,
110
+ # Identifier of an existing schedule to update. Omit when creating a new one.
111
+ schedule_id: nil,
112
+ # 24-hour local delivery time, `HH:MM`. Required for every frequency except
113
+ # `instant`.
114
+ time: nil,
115
+ # IANA timezone the `time` and day fields are expressed in, e.g.
116
+ # `America/New_York`. Absent means UTC. Delivery follows the same local wall-clock
117
+ # across daylight-saving changes.
118
+ timezone: nil
119
+ )
120
+ end
121
+
122
+ sig do
123
+ override.returns(
124
+ {
125
+ frequency: Courier::DigestFrequency::OrSymbol,
126
+ day_of_month: Integer,
127
+ day_of_week: Courier::DigestDayOfWeek::OrSymbol,
128
+ days_of_week: T::Array[Courier::DigestDayOfWeek::OrSymbol],
129
+ disabled: T::Boolean,
130
+ is_default: T::Boolean,
131
+ schedule_id: String,
132
+ time: String,
133
+ timezone: String
134
+ }
135
+ )
136
+ end
137
+ def to_hash
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,159 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class TopicDigestScheduleResponse < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::TopicDigestScheduleResponse,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The schedule's identifier, assigned by the server. This is the value the
15
+ # `/digests/schedules/{schedule_id}` endpoints are keyed by.
16
+ sig { returns(String) }
17
+ attr_accessor :schedule_id
18
+
19
+ # ISO-8601 timestamp of when the schedule was created.
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :created
22
+
23
+ sig { params(created: String).void }
24
+ attr_writer :created
25
+
26
+ # Day of the month, 1-31.
27
+ sig { returns(T.nilable(Integer)) }
28
+ attr_reader :day_of_month
29
+
30
+ sig { params(day_of_month: Integer).void }
31
+ attr_writer :day_of_month
32
+
33
+ # A day of the week. Accepted case-insensitively, returned lowercase.
34
+ sig { returns(T.nilable(Courier::DigestDayOfWeek::TaggedSymbol)) }
35
+ attr_reader :day_of_week
36
+
37
+ sig { params(day_of_week: Courier::DigestDayOfWeek::OrSymbol).void }
38
+ attr_writer :day_of_week
39
+
40
+ sig do
41
+ returns(T.nilable(T::Array[Courier::DigestDayOfWeek::TaggedSymbol]))
42
+ end
43
+ attr_reader :days_of_week
44
+
45
+ sig do
46
+ params(days_of_week: T::Array[Courier::DigestDayOfWeek::OrSymbol]).void
47
+ end
48
+ attr_writer :days_of_week
49
+
50
+ # Whether the schedule is disabled.
51
+ sig { returns(T.nilable(T::Boolean)) }
52
+ attr_reader :disabled
53
+
54
+ sig { params(disabled: T::Boolean).void }
55
+ attr_writer :disabled
56
+
57
+ # Omitted for a stored schedule this enum cannot express. Those schedules never
58
+ # fire, but their `schedule_id` is still returned so the `/digests/*` endpoints
59
+ # remain reachable for them.
60
+ sig { returns(T.nilable(Courier::DigestFrequency::TaggedSymbol)) }
61
+ attr_reader :frequency
62
+
63
+ sig { params(frequency: Courier::DigestFrequency::OrSymbol).void }
64
+ attr_writer :frequency
65
+
66
+ # Whether this is the schedule recipients are placed on by default.
67
+ sig { returns(T.nilable(T::Boolean)) }
68
+ attr_reader :is_default
69
+
70
+ sig { params(is_default: T::Boolean).void }
71
+ attr_writer :is_default
72
+
73
+ # 24-hour local delivery time, `HH:MM`.
74
+ sig { returns(T.nilable(String)) }
75
+ attr_reader :time
76
+
77
+ sig { params(time: String).void }
78
+ attr_writer :time
79
+
80
+ # IANA timezone the schedule is expressed in. Absent means UTC.
81
+ sig { returns(T.nilable(String)) }
82
+ attr_reader :timezone
83
+
84
+ sig { params(timezone: String).void }
85
+ attr_writer :timezone
86
+
87
+ # ISO-8601 timestamp of the last update.
88
+ sig { returns(T.nilable(String)) }
89
+ attr_reader :updated
90
+
91
+ sig { params(updated: String).void }
92
+ attr_writer :updated
93
+
94
+ # A delivery cadence for a topic's digest, with its assigned id.
95
+ sig do
96
+ params(
97
+ schedule_id: String,
98
+ created: String,
99
+ day_of_month: Integer,
100
+ day_of_week: Courier::DigestDayOfWeek::OrSymbol,
101
+ days_of_week: T::Array[Courier::DigestDayOfWeek::OrSymbol],
102
+ disabled: T::Boolean,
103
+ frequency: Courier::DigestFrequency::OrSymbol,
104
+ is_default: T::Boolean,
105
+ time: String,
106
+ timezone: String,
107
+ updated: String
108
+ ).returns(T.attached_class)
109
+ end
110
+ def self.new(
111
+ # The schedule's identifier, assigned by the server. This is the value the
112
+ # `/digests/schedules/{schedule_id}` endpoints are keyed by.
113
+ schedule_id:,
114
+ # ISO-8601 timestamp of when the schedule was created.
115
+ created: nil,
116
+ # Day of the month, 1-31.
117
+ day_of_month: nil,
118
+ # A day of the week. Accepted case-insensitively, returned lowercase.
119
+ day_of_week: nil,
120
+ days_of_week: nil,
121
+ # Whether the schedule is disabled.
122
+ disabled: nil,
123
+ # Omitted for a stored schedule this enum cannot express. Those schedules never
124
+ # fire, but their `schedule_id` is still returned so the `/digests/*` endpoints
125
+ # remain reachable for them.
126
+ frequency: nil,
127
+ # Whether this is the schedule recipients are placed on by default.
128
+ is_default: nil,
129
+ # 24-hour local delivery time, `HH:MM`.
130
+ time: nil,
131
+ # IANA timezone the schedule is expressed in. Absent means UTC.
132
+ timezone: nil,
133
+ # ISO-8601 timestamp of the last update.
134
+ updated: nil
135
+ )
136
+ end
137
+
138
+ sig do
139
+ override.returns(
140
+ {
141
+ schedule_id: String,
142
+ created: String,
143
+ day_of_month: Integer,
144
+ day_of_week: Courier::DigestDayOfWeek::TaggedSymbol,
145
+ days_of_week: T::Array[Courier::DigestDayOfWeek::TaggedSymbol],
146
+ disabled: T::Boolean,
147
+ frequency: Courier::DigestFrequency::TaggedSymbol,
148
+ is_default: T::Boolean,
149
+ time: String,
150
+ timezone: String,
151
+ updated: String
152
+ }
153
+ )
154
+ end
155
+ def to_hash
156
+ end
157
+ end
158
+ end
159
+ end
@@ -96,6 +96,14 @@ module Courier
96
96
  end
97
97
  attr_accessor :custom_routing
98
98
 
99
+ # Put this recipient on one of the topic's digest schedules. Send `null` to clear
100
+ # the choice and return them to the topic's default. Omit to leave an existing
101
+ # choice alone, unlike the routing fields, which this endpoint replaces. An id
102
+ # that is not an active schedule on the topic is rejected with a `400` before
103
+ # anything is written.
104
+ sig { returns(T.nilable(String)) }
105
+ attr_accessor :digest_schedule_id
106
+
99
107
  # Set to true to route this topic to the channels in custom_routing instead of the
100
108
  # topic's default routing.
101
109
  sig { returns(T.nilable(T::Boolean)) }
@@ -106,6 +114,7 @@ module Courier
106
114
  status: Courier::PreferenceStatus::OrSymbol,
107
115
  custom_routing:
108
116
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
117
+ digest_schedule_id: T.nilable(String),
109
118
  has_custom_routing: T.nilable(T::Boolean)
110
119
  ).returns(T.attached_class)
111
120
  end
@@ -117,6 +126,12 @@ module Courier
117
126
  # The channels to deliver this topic on when has_custom_routing is true. One or
118
127
  # more of: direct_message, email, push, sms, webhook, inbox.
119
128
  custom_routing: nil,
129
+ # Put this recipient on one of the topic's digest schedules. Send `null` to clear
130
+ # the choice and return them to the topic's default. Omit to leave an existing
131
+ # choice alone, unlike the routing fields, which this endpoint replaces. An id
132
+ # that is not an active schedule on the topic is rejected with a `400` before
133
+ # anything is written.
134
+ digest_schedule_id: nil,
120
135
  # Set to true to route this topic to the channels in custom_routing instead of the
121
136
  # topic's default routing.
122
137
  has_custom_routing: nil
@@ -129,6 +144,7 @@ module Courier
129
144
  status: Courier::PreferenceStatus::OrSymbol,
130
145
  custom_routing:
131
146
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
147
+ digest_schedule_id: T.nilable(String),
132
148
  has_custom_routing: T.nilable(T::Boolean)
133
149
  }
134
150
  )
@@ -38,6 +38,16 @@ module Courier
38
38
  end
39
39
  attr_accessor :custom_routing
40
40
 
41
+ # The digest schedule this recipient is on for the topic. Omitted rather than null
42
+ # when they have not chosen one, in which case the topic's default schedule
43
+ # applies. Ids come from the topic's digest configuration or from
44
+ # `GET /digests/schedules`.
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :digest_schedule_id
47
+
48
+ sig { params(digest_schedule_id: String).void }
49
+ attr_writer :digest_schedule_id
50
+
41
51
  # Whether the user has chosen specific delivery channels for this topic (listed in
42
52
  # custom_routing) rather than the topic's default routing.
43
53
  sig { returns(T.nilable(T::Boolean)) }
@@ -69,6 +79,7 @@ module Courier
69
79
  topic_name: String,
70
80
  custom_routing:
71
81
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
82
+ digest_schedule_id: String,
72
83
  has_custom_routing: T.nilable(T::Boolean),
73
84
  section_id: String,
74
85
  section_name: String
@@ -90,6 +101,11 @@ module Courier
90
101
  # has_custom_routing is true. One or more of: direct_message, email, push, sms,
91
102
  # webhook, inbox.
92
103
  custom_routing: nil,
104
+ # The digest schedule this recipient is on for the topic. Omitted rather than null
105
+ # when they have not chosen one, in which case the topic's default schedule
106
+ # applies. Ids come from the topic's digest configuration or from
107
+ # `GET /digests/schedules`.
108
+ digest_schedule_id: nil,
93
109
  # Whether the user has chosen specific delivery channels for this topic (listed in
94
110
  # custom_routing) rather than the topic's default routing.
95
111
  has_custom_routing: nil,
@@ -115,6 +131,7 @@ module Courier
115
131
  T.nilable(
116
132
  T::Array[Courier::ChannelClassification::TaggedSymbol]
117
133
  ),
134
+ digest_schedule_id: String,
118
135
  has_custom_routing: T.nilable(T::Boolean),
119
136
  section_id: String,
120
137
  section_name: String
@@ -40,6 +40,21 @@ module Courier
40
40
  sig { returns(T.nilable(String)) }
41
41
  attr_accessor :description
42
42
 
43
+ # A topic's digest configuration: the template that renders it, the cadences it
44
+ # delivers on, and how collected events are retained.
45
+ #
46
+ # Send `null` for the whole object to turn a digest off, which unlinks the
47
+ # template and removes its schedules. There is no `enabled` flag, and
48
+ # `schedules: []` is rejected, because both states are un-deliverable rather than
49
+ # merely off.
50
+ sig { returns(T.nilable(Courier::TopicDigestRequest)) }
51
+ attr_reader :digest
52
+
53
+ sig do
54
+ params(digest: T.nilable(Courier::TopicDigestRequest::OrHash)).void
55
+ end
56
+ attr_writer :digest
57
+
43
58
  # Whether to include a list-unsubscribe header on emails for this topic.
44
59
  sig { returns(T.nilable(T::Boolean)) }
45
60
  attr_accessor :include_unsubscribe_header
@@ -67,6 +82,7 @@ module Courier
67
82
  ]
68
83
  ),
69
84
  description: T.nilable(String),
85
+ digest: T.nilable(Courier::TopicDigestRequest::OrHash),
70
86
  include_unsubscribe_header: T.nilable(T::Boolean),
71
87
  routing_options:
72
88
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
@@ -83,6 +99,14 @@ module Courier
83
99
  allowed_preferences: nil,
84
100
  # Optional description shown under the topic on the hosted preferences page.
85
101
  description: nil,
102
+ # A topic's digest configuration: the template that renders it, the cadences it
103
+ # delivers on, and how collected events are retained.
104
+ #
105
+ # Send `null` for the whole object to turn a digest off, which unlinks the
106
+ # template and removes its schedules. There is no `enabled` flag, and
107
+ # `schedules: []` is rejected, because both states are un-deliverable rather than
108
+ # merely off.
109
+ digest: nil,
86
110
  # Whether to include a list-unsubscribe header on emails for this topic.
87
111
  include_unsubscribe_header: nil,
88
112
  # Default channels delivered for this topic. Defaults to empty if omitted.
@@ -105,6 +129,7 @@ module Courier
105
129
  ]
106
130
  ),
107
131
  description: T.nilable(String),
132
+ digest: T.nilable(Courier::TopicDigestRequest),
108
133
  include_unsubscribe_header: T.nilable(T::Boolean),
109
134
  routing_options:
110
135
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
@@ -65,6 +65,15 @@ module Courier
65
65
  sig { returns(T.nilable(String)) }
66
66
  attr_accessor :description
67
67
 
68
+ # A topic's digest configuration.
69
+ sig { returns(T.nilable(Courier::TopicDigestResponse)) }
70
+ attr_reader :digest
71
+
72
+ sig do
73
+ params(digest: T.nilable(Courier::TopicDigestResponse::OrHash)).void
74
+ end
75
+ attr_writer :digest
76
+
68
77
  # Id of the last updater.
69
78
  sig { returns(T.nilable(String)) }
70
79
  attr_accessor :updater
@@ -87,6 +96,7 @@ module Courier
87
96
  updated: String,
88
97
  creator: T.nilable(String),
89
98
  description: T.nilable(String),
99
+ digest: T.nilable(Courier::TopicDigestResponse::OrHash),
90
100
  updater: T.nilable(String)
91
101
  ).returns(T.attached_class)
92
102
  end
@@ -113,6 +123,8 @@ module Courier
113
123
  creator: nil,
114
124
  # Optional description shown under the topic on the hosted preferences page.
115
125
  description: nil,
126
+ # A topic's digest configuration.
127
+ digest: nil,
116
128
  # Id of the last updater.
117
129
  updater: nil
118
130
  )
@@ -137,6 +149,7 @@ module Courier
137
149
  updated: String,
138
150
  creator: T.nilable(String),
139
151
  description: T.nilable(String),
152
+ digest: T.nilable(Courier::TopicDigestResponse),
140
153
  updater: T.nilable(String)
141
154
  }
142
155
  )