From 9e569eb24dca020f64abf8f3af232a460d89aebf Mon Sep 17 00:00:00 2001 From: courier-codegen Date: Sat, 29 Aug 2026 00:48:46 +0000 Subject: [PATCH] fix(api): text content is not required --- Gemfile.lock | 2 +- lib/courier/models/elemental_text_node.rb | 20 +++++++++---------- rbi/courier/models/elemental_text_node.rbi | 23 ++++++++++++---------- sig/courier/models/elemental_text_node.rbs | 14 ++++++------- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 30759f3..0cfc2b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - trycourier (6.4.1) + trycourier (6.4.2) cgi connection_pool diff --git a/lib/courier/models/elemental_text_node.rb b/lib/courier/models/elemental_text_node.rb index e616e75..62818b6 100644 --- a/lib/courier/models/elemental_text_node.rb +++ b/lib/courier/models/elemental_text_node.rb @@ -3,13 +3,6 @@ module Courier module Models class ElementalTextNode < Courier::Models::ElementalBaseNode - # @!attribute content - # The text content displayed in the notification. Either this field must be - # specified, or the elements field - # - # @return [String] - required :content, String - # @!attribute align # Text alignment. # @@ -28,6 +21,13 @@ class ElementalTextNode < Courier::Models::ElementalBaseNode # @return [String, nil] optional :color, String, nil?: true + # @!attribute content + # The text content displayed in the notification. Either this field must be + # specified, or the elements field + # + # @return [String, nil] + optional :content, String + # @!attribute font_size # CSS px font size for this text block, e.g. `16px`. Overrides the size of the # `text_style` preset. Email only. @@ -79,20 +79,20 @@ class ElementalTextNode < Courier::Models::ElementalBaseNode # @return [String, nil] optional :underline, String, nil?: true - # @!method initialize(content:, align: nil, bold: nil, color: nil, font_size: nil, format_: nil, italic: nil, line_height: nil, locales: nil, strikethrough: nil, text_style: nil, underline: nil) + # @!method initialize(align: nil, bold: nil, color: nil, content: nil, font_size: nil, format_: nil, italic: nil, line_height: nil, locales: nil, strikethrough: nil, text_style: nil, underline: nil) # Some parameter documentations has been truncated, see # {Courier::Models::ElementalTextNode} for more details. # # Represents a body of text to be rendered inside of the notification. # - # @param content [String] The text content displayed in the notification. Either this - # # @param align [Symbol, Courier::Models::ElementalTextNode::Align] Text alignment. # # @param bold [String, nil] Apply bold to the text # # @param color [String, nil] Specifies the color of text. Can be any valid css color value # + # @param content [String] The text content displayed in the notification. Either this + # # @param font_size [String, nil] CSS px font size for this text block, e.g. `16px`. Overrides the size of the `te # # @param format_ [Symbol, Courier::Models::ElementalTextNode::Format, nil] diff --git a/rbi/courier/models/elemental_text_node.rbi b/rbi/courier/models/elemental_text_node.rbi index 9a83f2e..b9d479f 100644 --- a/rbi/courier/models/elemental_text_node.rbi +++ b/rbi/courier/models/elemental_text_node.rbi @@ -8,11 +8,6 @@ module Courier T.any(Courier::ElementalTextNode, Courier::Internal::AnyHash) end - # The text content displayed in the notification. Either this field must be - # specified, or the elements field - sig { returns(String) } - attr_accessor :content - # Text alignment. sig { returns(T.nilable(Courier::ElementalTextNode::Align::OrSymbol)) } attr_reader :align @@ -28,6 +23,14 @@ module Courier sig { returns(T.nilable(String)) } attr_accessor :color + # The text content displayed in the notification. Either this field must be + # specified, or the elements field + sig { returns(T.nilable(String)) } + attr_reader :content + + sig { params(content: String).void } + attr_writer :content + # CSS px font size for this text block, e.g. `16px`. Overrides the size of the # `text_style` preset. Email only. sig { returns(T.nilable(String)) } @@ -66,10 +69,10 @@ module Courier # Represents a body of text to be rendered inside of the notification. sig do params( - content: String, align: Courier::ElementalTextNode::Align::OrSymbol, bold: T.nilable(String), color: T.nilable(String), + content: String, font_size: T.nilable(String), format_: T.nilable(Courier::ElementalTextNode::Format::OrSymbol), italic: T.nilable(String), @@ -81,15 +84,15 @@ module Courier ).returns(T.attached_class) end def self.new( - # The text content displayed in the notification. Either this field must be - # specified, or the elements field - content:, # Text alignment. align: nil, # Apply bold to the text bold: nil, # Specifies the color of text. Can be any valid css color value color: nil, + # The text content displayed in the notification. Either this field must be + # specified, or the elements field + content: nil, # CSS px font size for this text block, e.g. `16px`. Overrides the size of the # `text_style` preset. Email only. font_size: nil, @@ -115,10 +118,10 @@ module Courier sig do override.returns( { - content: String, align: Courier::ElementalTextNode::Align::OrSymbol, bold: T.nilable(String), color: T.nilable(String), + content: String, font_size: T.nilable(String), format_: T.nilable(Courier::ElementalTextNode::Format::OrSymbol), italic: T.nilable(String), diff --git a/sig/courier/models/elemental_text_node.rbs b/sig/courier/models/elemental_text_node.rbs index 5d2a010..a4d8ff5 100644 --- a/sig/courier/models/elemental_text_node.rbs +++ b/sig/courier/models/elemental_text_node.rbs @@ -2,10 +2,10 @@ module Courier module Models type elemental_text_node = { - content: String, align: Courier::Models::ElementalTextNode::align, bold: String?, color: String?, + content: String, font_size: String?, format_: Courier::Models::ElementalTextNode::format_?, italic: String?, @@ -17,10 +17,6 @@ module Courier } class ElementalTextNode < Courier::Models::ElementalBaseNode - def content: -> String - - def content=: (String _) -> String - def align: -> Courier::Models::ElementalTextNode::align? def align=: ( @@ -35,6 +31,10 @@ module Courier def color=: (String? _) -> String? + def content: -> String? + + def content=: (String _) -> String + def font_size: -> String? def font_size=: (String? _) -> String? @@ -72,10 +72,10 @@ module Courier def underline=: (String? _) -> String? def initialize: ( - content: String, ?align: Courier::Models::ElementalTextNode::align, ?bold: String?, ?color: String?, + ?content: String, ?font_size: String?, ?format_: Courier::Models::ElementalTextNode::format_?, ?italic: String?, @@ -87,10 +87,10 @@ module Courier ) -> void def to_hash: -> { - content: String, align: Courier::Models::ElementalTextNode::align, bold: String?, color: String?, + content: String, font_size: String?, format_: Courier::Models::ElementalTextNode::format_?, italic: String?,