meta

package
v0.0.0-...-f9b4ebf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubTitleKey = "sub_title"
)

Variables

This section is empty.

Functions

func CommentMetaAndTags

func CommentMetaAndTags(comments []string) (metaMap map[string]string, tags []string)

func WalkIndex

func WalkIndex(entrances []string) (pages map[string]*PageMeta, err error)

Types

type PageChunkBlock

type PageChunkBlock struct {
	Role  string `json:"role"`
	Value struct {
		ID         string     `json:"id"`
		Version    int        `json:"version"`
		Type       string     `json:"type"`
		Text       [][]string `json:"text"` // comment
		Properties struct {
			Title [][]interface{} `json:"title"` // most string otherwise [[]] style params
		} `json:"properties"`
		Format struct {
			PageIcon          string  `json:"page_icon"`
			PageCover         string  `json:"page_cover"`
			PageFullWidth     bool    `json:"page_full_width"`
			PageCoverPosition float64 `json:"page_cover_position"`
		}
		Discussions       []string `json:"discussions"`
		CreatedTime       int64    `json:"created_time"`
		LastEditedTime    int64    `json:"last_edited_time"`
		ParentID          string   `json:"parent_id"`
		ParentTable       string   `json:"parent_table"`
		Alive             bool     `json:"alive"`
		CreatedByTable    string   `json:"created_by_table"`
		CreatedByID       string   `json:"created_by_id"`
		LastEditedByTable string   `json:"last_edited_by_table"`
		LastEditedByID    string   `json:"last_edited_by_id"`
		ShardID           int      `json:"shard_id"`
		SpaceID           string   `json:"space_id"`
	} `json:"value"`
}

func (*PageChunkBlock) RawComments

func (r *PageChunkBlock) RawComments() (comments []string)

func (*PageChunkBlock) SourceImageUrl

func (r *PageChunkBlock) SourceImageUrl(s string) string

type PageChunkRequest

type PageChunkRequest struct {
	PageID          string      `json:"pageId"`
	Limit           int         `json:"limit"`
	ChunkNumber     int         `json:"chunkNumber"`
	Cursor          *PageCursor `json:"cursor"`
	VerticalColumns bool        `json:"verticalColumns"`
}

type PageChunkResponse

type PageChunkResponse struct {
	RecordMap struct {
		Block      map[string]*PageChunkBlock `json:"block"`
		Comment    map[string]*PageChunkBlock `json:"comment"`
		Discussion map[string]*PageDiscussion `json:"discussion"`
	} `json:"recordMap"`
}

func LoadPageChunk

func LoadPageChunk(pageId string) (pageChunkResp *PageChunkResponse, err error)

func (*PageChunkResponse) CurrentPageMeta

func (r *PageChunkResponse) CurrentPageMeta(pageId string) (meta *PageMeta)

CurrentPageMeta fetch current page meta from response notion page may contains child page comments in parent page chunk

func (*PageChunkResponse) FetchBlockMeta

func (r *PageChunkResponse) FetchBlockMeta(block *PageChunkBlock) (meta *PageMeta)

func (*PageChunkResponse) SubPages

func (r *PageChunkResponse) SubPages(pageId string) (res map[string]*PageMeta)

type PageCursor

type PageCursor struct {
	Stack [][]*PageStackItem `json:"stack"`
}

type PageDiscussion

type PageDiscussion struct {
	Role  string `json:"role"`
	Value struct {
		ID          string   `json:"id"`
		Version     int      `json:"version"`
		ParentID    string   `json:"parent_id"`
		ParentTable string   `json:"parent_table"`
		Resolved    bool     `json:"resolved"`
		Comments    []string `json:"comments"`
		SpaceID     string   `json:"space_id"`
	} `json:"value"`
}

type PageMeta

type PageMeta struct {
	CreatedAt           string            `json:"created_at"`
	CreateTimestamp     int64             `json:"create_timestamp"` // /1000 to seconds
	LastModifyAt        string            `json:"last_modify_at"`
	LastModifyTimestamp int64             `json:"last_modify_timestamp"` // /1000 to seconds
	Title               string            `json:"title"`
	SubTitle            string            `json:"sub_title"` // must be alphabet and number
	PageName            string            `json:"page_name"`
	PageFolders         []string          `json:"page_folders"`
	Comment             []string          `json:"comment"`
	Meta                map[string]string `json:"meta"`
	Tags                []string          `json:"tags"`

	PageCover string `json:"page_cover"`
}

type PageStackItem

type PageStackItem struct {
	Table string `json:"table"`
	ID    string `json:"id"`
	Index int    `json:"index"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL