Class: Courier::Models::TopicDigestRequest

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/topic_digest_request.rb,
sig/courier/models/topic_digest_request.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(template_id:, audience_id: nil, categories: nil, schedules: nil, trigger_empty: nil) ⇒ Object

Some parameter documentations has been truncated, see Courier::Models::TopicDigestRequest for more details.

A topic's digest configuration: the template that renders it, the cadences it delivers on, and how collected events are retained.

Send null for the whole object to turn a digest off, which unlinks the template and removes its schedules. There is no enabled flag, and schedules: [] is rejected, because both states are un-deliverable rather than merely off.

Parameters:

  • template_id (String) —

    The notification template that renders the digest. A digest with no template col

  • audience_id (String) (defaults to: nil) —

    Optional audience the digest is scoped to.

  • categories (Array<Courier::Models::TopicDigestCategory>) (defaults to: nil) —

    Retention rules per category key. Defaults to a single digest category retaini

  • schedules (Array<Courier::Models::TopicDigestScheduleRequest>) (defaults to: nil) —

    The cadences this digest delivers on.

  • trigger_empty (Boolean) (defaults to: nil) —

    Whether to deliver the digest even when nothing was collected.



# File 'lib/courier/models/topic_digest_request.rb', line 52

Instance Attribute Details

#audience_id ⇒ String?

Optional audience the digest is scoped to.

Parameters:

  • (String)

Returns:

  • (String, nil)


17
# File 'lib/courier/models/topic_digest_request.rb', line 17

optional :audience_id, String

#categories ⇒ Array<Courier::Models::TopicDigestCategory>?

Retention rules per category key. Defaults to a single digest category retaining FIRST.

Returns:



24
# File 'lib/courier/models/topic_digest_request.rb', line 24

optional :categories, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestCategory] }

#schedules ⇒ Array<Courier::Models::TopicDigestScheduleRequest>?

The cadences this digest delivers on.

The array replaces the stored schedules wholesale, so a schedule you leave out of it is deleted along with its delivery rule. Omit the key entirely to leave the stored schedules untouched — useful for changing template_id or categories without restating every schedule.

A digest must end up with at least one schedule, because one with none collects events into an instance that can never fire. So sending [] is always a 400, and so is omitting the key on a topic that has no schedules stored yet.

On create the key is required outright: a topic being created has nothing stored to leave alone, and the topic row is written before its digest, so rejecting it any later would leave the topic behind and let a retry duplicate it.



44
# File 'lib/courier/models/topic_digest_request.rb', line 44

optional :schedules, -> { Courier::Internal::Type::ArrayOf[Courier::TopicDigestScheduleRequest] }

#template_id ⇒ String

The notification template that renders the digest. A digest with no template collects nothing, so this is required.

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/courier/models/topic_digest_request.rb', line 11

required :template_id, String

#trigger_empty ⇒ Boolean?

Whether to deliver the digest even when nothing was collected.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


50
# File 'lib/courier/models/topic_digest_request.rb', line 50

optional :trigger_empty, Courier::Internal::Type::Boolean

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


43
# File 'sig/courier/models/topic_digest_request.rbs', line 43

def to_hash: -> {