Class: Courier::Models::WorkspacePreferenceTopicCreateRequest::Digest

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

Overview

See Also:

  • Courier::Models::WorkspacePreferenceTopicCreateRequest#digest

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(schedules:, template_id:, audience_id: nil, categories: nil, trigger_empty: nil) ⇒ Object

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

A topic's digest, as supplied when the topic itself is created: the template that renders it, the cadences it delivers on, and how collected events are retained.

Identical to TopicDigestRequest, which a replace uses, except that schedules is required — a topic being created has no stored schedules for an absent key to leave alone.

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:

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

    The cadences this digest delivers on.

  • 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

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

    Whether to deliver the digest even when nothing was collected.



# File 'lib/courier/models/workspace_preference_topic_create_request.rb', line 167

Instance Attribute Details

#audience_id ⇒ String?

Optional audience the digest is scoped to.

Parameters:

  • (String)

Returns:

  • (String, nil)


152
# File 'lib/courier/models/workspace_preference_topic_create_request.rb', line 152

optional :audience_id, String

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

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

Returns:



159
# File 'lib/courier/models/workspace_preference_topic_create_request.rb', line 159

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.



139
# File 'lib/courier/models/workspace_preference_topic_create_request.rb', line 139

required :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)


146
# File 'lib/courier/models/workspace_preference_topic_create_request.rb', line 146

required :template_id, String

#trigger_empty ⇒ Boolean?

Whether to deliver the digest even when nothing was collected.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


165
# File 'lib/courier/models/workspace_preference_topic_create_request.rb', line 165

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

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


113
# File 'sig/courier/models/workspace_preference_topic_create_request.rbs', line 113

def to_hash: -> {