99Equation  RichTextType  =  "equation" 
1010)
1111
12- // RichText object represents Notion rich text object 
13- // 
14- // API doc: https://developers.notion.com/reference/rich-text 
15- //go:generate gomodifytags -file $GOFILE -struct RichText -clear-tags -w 
16- //go:generate gomodifytags --file $GOFILE --struct RichText -add-tags json,mapstructure -w -transform snakecase 
17- type  RichText  struct  {
18- PlainText  string  `json:"plain_text" mapstructure:"plain_text"` 
19- Href  string  `json:"href" mapstructure:"href"` 
20- Annotations  * Annotations  `json:"annotations" mapstructure:"annotations"` 
21- Type  RichTextType  `json:"type" mapstructure:"type"` 
12+ // RicchText is descibed in API doc: https://developers.notion.com/reference/rich-text 
13+ type  RichText  interface  {
14+ GetType () RichTextType 
2215}
2316
2417// Annotations object represents Notion rich text annotation 
@@ -62,16 +55,33 @@ const (
6255//go:generate gomodifytags -file $GOFILE -struct TextObject -clear-tags -w 
6356//go:generate gomodifytags --file $GOFILE --struct TextObject -add-tags json,mapstructure -w -transform snakecase 
6457type  TextObject  struct  {
65- Content  string  `json:"content" mapstructure:"content"` 
66- Link  * LinkObject  `json:"link" mapstructure:"link"` 
58+ PlainText  string  `json:"plain_text" mapstructure:"plain_text"` 
59+ Href  string  `json:"href" mapstructure:"href"` 
60+ Annotations  * Annotations  `json:"annotations" mapstructure:"annotations"` 
61+ Type  RichTextType  `json:"type" mapstructure:"type"` 
62+ Content  string  `json:"content" mapstructure:"content"` 
63+ Link  * LinkObject  `json:"link" mapstructure:"link"` 
64+ }
65+ 
66+ // GetType returns the object type 
67+ func  (obj  * TextObject ) GetType () RichTextType  {
68+ return  obj .Type 
6769}
6870
6971// LinkObject object represents Notion rich text object 
7072//go:generate gomodifytags -file $GOFILE -struct LinkObject -clear-tags -w 
7173//go:generate gomodifytags --file $GOFILE --struct LinkObject -add-tags json,mapstructure -w -transform snakecase 
7274type  LinkObject  struct  {
73- Type  string  `json:"type" mapstructure:"type"` 
74- URL  string  `json:"url" mapstructure:"url"` 
75+ PlainText  string  `json:"plain_text" mapstructure:"plain_text"` 
76+ Href  string  `json:"href" mapstructure:"href"` 
77+ Annotations  * Annotations  `json:"annotations" mapstructure:"annotations"` 
78+ Type  RichTextType  `json:"type" mapstructure:"type"` 
79+ URL  string  `json:"url" mapstructure:"url"` 
80+ }
81+ 
82+ // GetType returns the object type 
83+ func  (obj  * LinkObject ) GetType () RichTextType  {
84+ return  obj .Type 
7585}
7686
7787// MentionObjectType is for types of mentions. 
@@ -84,18 +94,35 @@ const (
8494DateionObject  MentionObjectType  =  "date" 
8595)
8696
87- // TextObject  object represents Notion rich text object 
88- //go:generate gomodifytags -file $GOFILE -struct TextObject  -clear-tags -w 
89- //go:generate gomodifytags --file $GOFILE --struct TextObject  -add-tags json,mapstructure -w -transform snakecase 
97+ // MentionObject  object represents Notion rich text object 
98+ //go:generate gomodifytags -file $GOFILE -struct MentionObject  -clear-tags -w 
99+ //go:generate gomodifytags --file $GOFILE --struct MentionObject  -add-tags json,mapstructure -w -transform snakecase 
90100type  MentionObject  struct  {
91- Type  MentionObjectType 
92- Database  * Database 
93- User  * User 
101+ PlainText  string  `json:"plain_text" mapstructure:"plain_text"` 
102+ Href  string  `json:"href" mapstructure:"href"` 
103+ Annotations  * Annotations  `json:"annotations" mapstructure:"annotations"` 
104+ Type  RichTextType  `json:"type" mapstructure:"type"` 
105+ Database  * Database  `json:"database" mapstructure:"database"` 
106+ User  * User  `json:"user" mapstructure:"user"` 
107+ }
108+ 
109+ // GetType returns the object type 
110+ func  (obj  * MentionObject ) GetType () RichTextType  {
111+ return  obj .Type 
94112}
95113
96114// EquationObject object represents Notion rich text object 
97115//go:generate gomodifytags -file $GOFILE -struct EquationObject -clear-tags -w 
98116//go:generate gomodifytags --file $GOFILE --struct EquationObject -add-tags json,mapstructure -w -transform snakecase 
99117type  EquationObject  struct  {
100- Expression  string  `json:"expression" mapstructure:"expression"` 
118+ PlainText  string  `json:"plain_text" mapstructure:"plain_text"` 
119+ Href  string  `json:"href" mapstructure:"href"` 
120+ Annotations  * Annotations  `json:"annotations" mapstructure:"annotations"` 
121+ Type  RichTextType  `json:"type" mapstructure:"type"` 
122+ Expression  string  `json:"expression" mapstructure:"expression"` 
123+ }
124+ 
125+ // GetType returns the object type 
126+ func  (obj  * EquationObject ) GetType () RichTextType  {
127+ return  obj .Type 
101128}
0 commit comments