.
type RichBlockSectionHeading struct {
// Type of the block, always “heading”
@@ -6510,6 +7681,30 @@ func (v *RichBlockSectionHeading) MarshalJSON() ([]byte, error) {
})
}
+// UnmarshalJSON decodes RichBlockSectionHeading by dispatching union-typed fields
+// (Text) through their concrete UnmarshalXxx helpers.
+func (m *RichBlockSectionHeading) UnmarshalJSON(data []byte) error {
+ type Alias RichBlockSectionHeading
+ aux := &struct {
+ Text json.RawMessage `json:"text,omitempty"`
+ *Alias
+ }{Alias: (*Alias)(m)}
+ if err := json.Unmarshal(data, aux); err != nil {
+ return err
+ }
+
+ if len(aux.Text) > 0 && string(aux.Text) != "null" {
+ v, err := UnmarshalRichText(aux.Text)
+ if err != nil {
+ return fmt.Errorf("decoding text: %w", err)
+ }
+ m.Text = v
+
+ }
+
+ return nil
+}
+
// A preformatted text block, corresponding to the nested HTML tags and .
type RichBlockPreformatted struct {
// Type of the block, always “pre”
@@ -6536,6 +7731,30 @@ func (v *RichBlockPreformatted) MarshalJSON() ([]byte, error) {
})
}
+// UnmarshalJSON decodes RichBlockPreformatted by dispatching union-typed fields
+// (Text) through their concrete UnmarshalXxx helpers.
+func (m *RichBlockPreformatted) UnmarshalJSON(data []byte) error {
+ type Alias RichBlockPreformatted
+ aux := &struct {
+ Text json.RawMessage `json:"text,omitempty"`
+ *Alias
+ }{Alias: (*Alias)(m)}
+ if err := json.Unmarshal(data, aux); err != nil {
+ return err
+ }
+
+ if len(aux.Text) > 0 && string(aux.Text) != "null" {
+ v, err := UnmarshalRichText(aux.Text)
+ if err != nil {
+ return fmt.Errorf("decoding text: %w", err)
+ }
+ m.Text = v
+
+ }
+
+ return nil
+}
+
// A footer, corresponding to the HTML tag