notion

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations

type Annotations struct {
	Bold          bool   `json:"bold"`
	Italic        bool   `json:"italic"`
	Strikethrough bool   `json:"strikethrough"`
	Underline     bool   `json:"underline"`
	Code          bool   `json:"code"`
	Color         string `json:"color"`
}

type Block

type Block struct {
	BlockBase

	BulletedListItem BulletedListItemBlock `json:"bulleted_list_item"`
}

type BlockBase

type BlockBase struct {
	Object         string    `json:"object"`
	Id             string    `json:"id"`
	CreatedTime    time.Time `json:"created_time"`
	LastEditedTime time.Time `json:"last_edited_time"`
	HasChildren    bool      `json:"has_children"`
	Type           string    `json:"type"`
}

type BlockList

type BlockList struct {
	Object     string      `json:"object"`
	Results    []Block     `json:"results"`
	NextCursor interface{} `json:"next_cursor"`
	HasMore    bool        `json:"has_more"`
}

type BulletedListItemBlock

type BulletedListItemBlock struct {
	Text []RichText `json:"text"`
}

type Client

type Client struct {
	AuthToken  string
	HTTPClient *http.Client
}

func (Client) RetrieveDatabase

func (c Client) RetrieveDatabase(databaseId string) (*Database, error)

func (Client) RetrievePage

func (c Client) RetrievePage(pageId string) (*Page, error)

type Database

type Database struct {
	Object         string     `json:"object"`
	ID             string     `json:"id"`
	CreatedTime    time.Time  `json:"created_time"`
	LastEditedTime time.Time  `json:"last_edited_time"`
	Title          []RichText `json:"title"`
}

func (Database) DatabaseTitle

func (d Database) DatabaseTitle() string

type DatabaseTypeProperties

type DatabaseTypeProperties struct {
	// TODO: since the key of the property changes dynamically,
	// only getting the title property ad hoc.
	TitleValue TitlePropertyValue
}

func (DatabaseTypeProperties) Title

func (d DatabaseTypeProperties) Title() string

type Page

type Page struct {
	Object         string    `json:"object"`
	ID             string    `json:"id"`
	CreatedTime    time.Time `json:"created_time"`
	LastEditedTime time.Time `json:"last_edited_time"`
	Parent         Parent    `json:"parent"`
	Archived       bool      `json:"archived"`
	Properties     Properties
}

func (*Page) UnmarshalJSON

func (p *Page) UnmarshalJSON(data []byte) error

type PageTypeProperties

type PageTypeProperties struct {
	TitleValue TitlePropertyValue `json:"title"`
}

func (PageTypeProperties) Title

func (p PageTypeProperties) Title() string

type Parent

type Parent struct {
	Type       string `json:"type"`
	DatabaseID string `json:"database_id"`
	PageID     string `json:"page_id"`
}

type Properties

type Properties interface {
	Title() string
}

type RichText

type RichText struct {
	RichTextBase

	Text struct {
		Content string `json:"content"`
		Link    struct {
			Type string `json:"type"`
			Url  string `json:"url"`
		} `json:"link"`
	} `json:"text"`
}

type RichTextBase

type RichTextBase struct {
	PlainText   string      `json:"plain_text"`
	Href        string      `json:"href"`
	Type        string      `json:"type"`
	Annotations Annotations `json:"annotations"`
}

type TitlePropertyValue

type TitlePropertyValue struct {
	Id    string     `json:"id"`
	Type  string     `json:"type"`
	Title []RichText `json:"title"`
}

type WorkSpaceTypeProperties

type WorkSpaceTypeProperties struct {
	TitleValue TitlePropertyValue `json:"title"`
}

func (WorkSpaceTypeProperties) Title

func (w WorkSpaceTypeProperties) Title() string

Jump to

Keyboard shortcuts

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