1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-27 00:41:07 +02:00

Add support for link_preview block type and rich text mentions

This commit is contained in:
David Stotijn
2021-12-17 13:14:55 +01:00
parent 1ee9d231ed
commit 8e676e0df8
2 changed files with 16 additions and 8 deletions

View File

@ -40,6 +40,7 @@ type Block struct {
Breadcrumb *Breadcrumb `json:"breadcrumb,omitempty"` Breadcrumb *Breadcrumb `json:"breadcrumb,omitempty"`
ColumnList *ColumnList `json:"column_list,omitempty"` ColumnList *ColumnList `json:"column_list,omitempty"`
Column *Column `json:"column,omitempty"` Column *Column `json:"column,omitempty"`
LinkPreview *LinkPreview `json:"link_preview,omitempty"`
} }
type RichTextBlock struct { type RichTextBlock struct {
@ -149,6 +150,7 @@ const (
BlockTypeBreadCrumb BlockType = "breadcrumb" BlockTypeBreadCrumb BlockType = "breadcrumb"
BlockTypeColumnList BlockType = "column_list" BlockTypeColumnList BlockType = "column_list"
BlockTypeColumn BlockType = "column" BlockTypeColumn BlockType = "column"
BlockTypeLinkPreview BlockType = "link_preview"
BlockTypeUnsupported BlockType = "unsupported" BlockTypeUnsupported BlockType = "unsupported"
) )

View File

@ -27,10 +27,11 @@ type Annotations struct {
type Mention struct { type Mention struct {
Type MentionType `json:"type"` Type MentionType `json:"type"`
User *User `json:"user,omitempty"` User *User `json:"user,omitempty"`
Page *ID `json:"page,omitempty"` Page *ID `json:"page,omitempty"`
Database *ID `json:"database,omitempty"` Database *ID `json:"database,omitempty"`
Date *Date `json:"date,omitempty"` Date *Date `json:"date,omitempty"`
LinkPreview *LinkPreview `json:"link_preview,omitempty"`
} }
type Date struct { type Date struct {
@ -38,6 +39,10 @@ type Date struct {
End *DateTime `json:"end,omitempty"` End *DateTime `json:"end,omitempty"`
} }
type LinkPreview struct {
URL string `json:"url"`
}
type Text struct { type Text struct {
Content string `json:"content"` Content string `json:"content"`
Link *Link `json:"link,omitempty"` Link *Link `json:"link,omitempty"`
@ -64,10 +69,11 @@ const (
) )
const ( const (
MentionTypeUser MentionType = "user" MentionTypeUser MentionType = "user"
MentionTypePage MentionType = "page" MentionTypePage MentionType = "page"
MentionTypeDatabase MentionType = "database" MentionTypeDatabase MentionType = "database"
MentionTypeDate MentionType = "date" MentionTypeDate MentionType = "date"
MentionTypeLinkPreview MentionType = "link_preview"
) )
const ( const (