diff --git a/block_rich_text.go b/block_rich_text.go index 706bbf1d..32f73744 100644 --- a/block_rich_text.go +++ b/block_rich_text.go @@ -83,7 +83,8 @@ type RichTextElement interface { type RichTextElementGenericSection interface { RichTextElement - SectionElements() []RichTextSectionElement + GetElements() []RichTextSectionElement + SetElements([]RichTextSectionElement) } const ( @@ -193,10 +194,16 @@ func (s RichTextSection) RichTextElementType() RichTextElementType { return s.Type } -func (s RichTextSection) SectionElements() []RichTextSectionElement { +func (s *RichTextSection) GetElements() []RichTextSectionElement { return s.Elements } +func (s *RichTextSection) SetElements(elements []RichTextSectionElement) { + s.Elements = elements +} + +var _ RichTextElementGenericSection = &RichTextSection{} + func (e *RichTextSection) UnmarshalJSON(b []byte) error { var raw struct { RawElements []json.RawMessage `json:"elements"` @@ -499,10 +506,16 @@ func (s *RichTextQuote) RichTextElementType() RichTextElementType { return s.Type } -func (s RichTextQuote) SectionElements() []RichTextSectionElement { +func (s *RichTextQuote) GetElements() []RichTextSectionElement { return s.Elements } +func (s *RichTextQuote) SetElements(elements []RichTextSectionElement) { + s.Elements = elements +} + +var _ RichTextElementGenericSection = &RichTextQuote{} + func (s *RichTextQuote) UnmarshalJSON(b []byte) error { // reusing the RichTextSection struct, as it's the same as RichTextQuote. var rts RichTextSection @@ -534,10 +547,16 @@ func (s *RichTextPreformatted) RichTextElementType() RichTextElementType { return s.Type } -func (s RichTextPreformatted) SectionElements() []RichTextSectionElement { +func (s *RichTextPreformatted) GetElements() []RichTextSectionElement { return s.Elements } +func (s *RichTextPreformatted) SetElements(elements []RichTextSectionElement) { + s.Elements = elements +} + +var _ RichTextElementGenericSection = &RichTextPreformatted{} + func (s *RichTextPreformatted) UnmarshalJSON(b []byte) error { var rts RichTextSection if err := json.Unmarshal(b, &rts); err != nil {