Documentation ¶
Index ¶
- Variables
- func ConvertImageBlock(blockDTO *notion.BlockDTO) notion.Block
- func GetBlockContent(block notion.Block) (string, error)
- func GetFullRichtext(richText []notion.RichText) string
- func GetRichtext(block notion.Block) (*[]notion.RichText, error)
- func IsSupported(dto *notion.BlockDTO) bool
- func MergeChildBlocks(content1, content2 string) (merged string, err error)
- func ReplaceBlockContent(block notion.Block, newContent string) error
- func ReplaceRichtext(richtext *[]notion.RichText, newContent string) error
- type INotionOperator
- type NotionOperator
- func (n *NotionOperator) AppendBlockChildren(parentId string, block notion.Block) error
- func (n *NotionOperator) Content2NotionPage(srcContent string) (*NotionPage, error)
- func (n *NotionOperator) CreateNewPage(parentId string, page *NotionPage) (uuid string, err error)
- func (n *NotionOperator) FetchPage(uuid string) (content string, err error)
- func (n *NotionOperator) UploadPage(parentId string, page *NotionPage) (uuid string, err error)
- type NotionPage
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ConvertImageBlock ¶
func ConvertImageBlock(blockDTO *notion.BlockDTO) notion.Block
ConvertImageBlock convert image block to richtext link.
func GetBlockContent ¶
Get string block content
func GetFullRichtext ¶
func GetFullRichtext(richText []notion.RichText) string
GetFullRickText Merging all richtext into a single string. May cause loss of some formatting properties, such as color attributes.
func GetRichtext ¶
func GetRichtext(block notion.Block) (*[]notion.RichText, error)
func MergeChildBlocks ¶
MergeChildBlocks merge the content into a single JSON string content format is notion.BlockChildrenResponse
func ReplaceBlockContent ¶
Replace block content by a new string content. May cause loss of some formatting properties, such as color attributes.
func ReplaceRichtext ¶
Types ¶
type INotionOperator ¶
type INotionOperator interface { // Fetch notion content for a given page. // !MUST support recursive // @Pararm uuid, // @Return string content FetchPage(uuid string) (content string, err error) // Upload content to notion // @Pararm parentId, uuid of parent page // @Pararm content, json format page content // @Return uuid, new page's uuid UploadPage(parentId string, page *NotionPage) (uuid string, err error) // Content2NotionPage converting string content to NotionPage struct // @Pararm srcContent, JSON string page content // @Return *NotionPage, converted page Content2NotionPage(srcContent string) (*NotionPage, error) }
INotionOperator. Get Notion page content, support for recursion. Object serialization.
type NotionOperator ¶
type NotionOperator struct {
// contains filtered or unexported fields
}
NotionOperator Implementation of INotionOperator Not considering concurrency
func CreateNotionOperator ¶
func CreateNotionOperator(auth string) *NotionOperator
CreateNotionOperator
func (*NotionOperator) AppendBlockChildren ¶
func (n *NotionOperator) AppendBlockChildren(parentId string, block notion.Block) error
func (*NotionOperator) Content2NotionPage ¶
func (n *NotionOperator) Content2NotionPage(srcContent string) (*NotionPage, error)
Content2NotionPage converting string content to NotionPage struct
func (*NotionOperator) CreateNewPage ¶
func (n *NotionOperator) CreateNewPage(parentId string, page *NotionPage) (uuid string, err error)
func (*NotionOperator) FetchPage ¶
func (n *NotionOperator) FetchPage(uuid string) (content string, err error)
Fetch page from notion @Pararm uuid, page uuid @Return txId, txId return by Arweave
func (*NotionOperator) UploadPage ¶
func (n *NotionOperator) UploadPage(parentId string, page *NotionPage) (uuid string, err error)
UploadPage uploading page content to notion @Pararm parentId, parent page uuid, where new page to be loaded @Pararm page, page content @Return uuid, uuid of new page
type NotionPage ¶
type NotionPage struct { PageInfo notion.Page `json:"page_info"` PageContent notion.BlockChildrenResponse `json:"page_content"` }
notion page
func Content2NotionPage ¶
func Content2NotionPage(srcContent string) (*NotionPage, error)
content2NotionPage converting string content to NotionPage struct