notion

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations added in v0.0.3

type Annotations struct {
	Bold          bool  `json:"bold,omitempty" mapstructure:"bold"`
	Italic        bool  `json:"italic,omitempty" mapstructure:"italic"`
	StrikeThrough bool  `json:"strike_through,omitempty" mapstructure:"strike_through"`
	Underline     bool  `json:"underline,omitempty" mapstructure:"underline"`
	Code          bool  `json:"code,omitempty" mapstructure:"code"`
	Color         Color `json:"color,omitempty" mapstructure:"color"`
}

Annotations object represents Notion rich text annotation

type Block added in v0.0.4

type Block interface {
	GetType() object.BlockType
}

Block represents a block.

type BlocksService added in v0.0.3

type BlocksService service

BlocksService handles communication to Notion Blocks API.

API doc: https://developers.notion.com/reference/database

func (*BlocksService) AppendChildren added in v0.0.3

func (s *BlocksService) AppendChildren(ctx context.Context, blockID string, children Block) (Block, error)

AppendChildren children block.

API doc: https://developers.notion.com/reference/get-block-children

func (*BlocksService) ListChildren added in v0.0.3

func (s *BlocksService) ListChildren(ctx context.Context, blockID string) (*ListBlockChildrenResult, error)

ListChildren blocks list.

API doc: https://developers.notion.com/reference/get-block-children

type Bot

type Bot struct{}

Bot object represents Notion bot account.

type BulletedListItemBlock added in v0.0.4

type BulletedListItemBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
	Children       []Block          `json:"children" mapstructure:"children"`
}

BulletedListItemBlock object represents the retrieve block children.

func (*BulletedListItemBlock) GetType added in v0.0.4

func (b *BulletedListItemBlock) GetType() object.BlockType

GetType retrieves the block type.

type CheckboxFilter added in v0.0.14

type CheckboxFilter struct {
	Property    string `json:"property" mapstructure:"property"`
	Equals      bool   `json:"equals,omitempty" mapstructure:"equals"`
	DoeNotEqual bool   `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
}

CheckboxFilter filters object properties.

type CheckboxProperty added in v0.0.5

type CheckboxProperty struct {
	Type     object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID       string              `json:"id,omitempty" mapstructure:"id" `
	Checkbox interface{}         `json:"checkbox" mapstructure:"checkbox" `
}

CheckboxProperty object represents Notion CheckboxProperty Property.

func (*CheckboxProperty) GetType added in v0.0.5

func (p *CheckboxProperty) GetType() object.PropertyType

GetType returns the type of the property.

type ChildPageBlock added in v0.0.4

type ChildPageBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Title          string           `json:"title" mapstructure:"title"`
}

ChildPageBlock object represents the retrieve block children.

func (*ChildPageBlock) GetType added in v0.0.4

func (b *ChildPageBlock) GetType() object.BlockType

GetType retrieves the block type.

type Client

type Client struct {
	RateLimit   *RateLimit
	UserAgent   string
	AccessToken string
	BaseURL     *url.URL

	Blocks    *BlocksService
	Databases *DatabasesService
	Pages     *PagesService
	Search    *SearchService
	Users     *UsersService
	// contains filtered or unexported fields
}

Client represents the API client for Notion

func NewClient

func NewClient(accessKey string, opts ...ClientOption) *Client

NewClient returns the API client for Notion

type ClientOption added in v0.0.2

type ClientOption func(c *Client)

ClientOption represents options to configure this Notion API client.

func WithHTTPClient added in v0.0.7

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient overrides the default http.Client.

func WithVersion added in v0.0.2

func WithVersion(version string) ClientOption

WithVersion overrides the Notion API version to communicate.

type Color added in v0.0.3

type Color string

Color is type for text and background colors.

const (
	DefaultColor          Color = "default"
	GrayColor             Color = "gray"
	BrownColor            Color = "brown"
	OrangeColor           Color = "orange"
	YellowColor           Color = "yellow"
	GreenColor            Color = "green"
	BlueColor             Color = "blue"
	PurpleColor           Color = "purple"
	PinkColor             Color = "ping"
	RedColor              Color = "red"
	GrayBackGroundColor   Color = "gray_background"
	BrownBackGroundColor  Color = "brown_background"
	OrangeBackGroundColor Color = "orange_background"
	YellowBackGroundColor Color = "yellow_background"
	GreenBackGroundColor  Color = "green_background"
	BlueBackGroundColor   Color = "blue_background"
	PurpleBackGroundColor Color = "purple_background"
	PinkBackGroundColor   Color = "pink_background"
	RedBackGroundColor    Color = "red_background"
)

type CompoundFilterType added in v0.0.14

type CompoundFilterType string

CompoundFilterType is a type for compound filters.

const (
	OrFilter  CompoundFilterType = "or"
	AndFilter CompoundFilterType = "and"
)

type CreatePageRequest added in v0.0.3

type CreatePageRequest struct {
	Parent     Parent              `json:"parent" mapstructure:"parent"`
	Properties map[string]Property `json:"properties" mapstructure:"properties"`
	Children   []Block             `json:"children,omitempty" mapstructure:"children"`
}

CreatePageRequest object represents the retrieve page.

type CreatedByProperty added in v0.0.5

type CreatedByProperty struct {
	Type      object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID        string              `json:"id,omitempty" mapstructure:"id" `
	CreatedBy interface{}         `json:"created_by,omitempty" mapstructure:"created_by" `
}

CreatedByProperty object represents Notion created by Property.

func (*CreatedByProperty) GetType added in v0.0.5

func (p *CreatedByProperty) GetType() object.PropertyType

GetType returns the type of the property.

type CreatedTimeProperty added in v0.0.5

type CreatedTimeProperty struct {
	Type        object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID          string              `json:"id,omitempty" mapstructure:"id" `
	CreatedTime interface{}         `json:"created_time,omitempty" mapstructure:"created_time" `
}

CreatedTimeProperty object represents Notion created time Property.

func (*CreatedTimeProperty) GetType added in v0.0.5

GetType returns the type of the property.

type DataFilter added in v0.0.14

type DataFilter struct {
	Property   string      `json:"property" mapstructure:"property"`
	Equals     string      `json:"equals,omitempty" mapstructure:"equals"`
	Before     string      `json:"before,omitempty" mapstructure:"before"`
	After      string      `json:"after,omitempty" mapstructure:"after"`
	OnOrBefore string      `json:"on_or_before,omitempty" mapstructure:"on_or_before"`
	IsEmpty    bool        `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty bool        `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
	OnOrAfter  string      `json:"on_or_after,omitempty" mapstructure:"on_or_after"`
	PassWeek   interface{} `json:"pass_week,omitempty" mapstructure:"pass_week"`
	PassMonth  interface{} `json:"pass_month,omitempty" mapstructure:"pass_month"`
	PassYear   interface{} `json:"pass_year,omitempty" mapstructure:"pass_year"`
	NextWeek   interface{} `json:"next_weeb,omitempty" mapstructure:"next_weeb"`
	NextMonth  interface{} `json:"next_month,omitempty" mapstructure:"next_month"`
	NextYear   interface{} `json:"next_year,omitempty" mapstructure:"next_year"`
}

DataFilter filters data properties.

type Database added in v0.0.3

type Database struct {
	Object         object.Type         `json:"object" mapstructure:"object"`
	ID             string              `json:"id" mapstructure:"id"`
	CreatedTime    string              `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string              `json:"last_edited_time" mapstructure:"last_edited_time"`
	Title          []TextObject        `json:"title" mapstructure:"title"`
	Properties     map[string]Property `json:"properties" mapstructure:"properties"`
}

Database object represents Notion Database.

API doc: https://developers.notion.com/reference/database

func (*Database) GetObject added in v0.0.8

func (db *Database) GetObject() object.Type

type DatabaseParent added in v0.0.5

type DatabaseParent struct {
	Type       object.ParentType `json:"type,omitempty" mapstructure:"type"`
	DatabaseID string            `json:"database_id" mapstructure:"database_id"`
}

DatabaseParent object represents the retrieve parent.

func (*DatabaseParent) GetType added in v0.0.5

func (p *DatabaseParent) GetType() object.ParentType

GetType returns the ty GetType returns the type of the parent.pe of the parent.

type DatabaseQuery added in v0.0.14

type DatabaseQuery struct {
	Filter      map[CompoundFilterType]FilterObject `json:"filter,omitempty" mapstructure:"filter"`
	Sorts       []Sort                              `json:"sorts,omitempty" mapstructure:"sort"`
	StartCursor string                              `json:"start_cursor,omitempty" mapstructure:"start_cursor"`
	PageSize    int32                               `json:"page_size,omitempty" mapstructure:"page_size"`
}

DatabaseQuery is a query for database

type DatabaseTitleProperty added in v0.0.8

type DatabaseTitleProperty struct {
	Type  object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID    string              `json:"id,omitempty" mapstructure:"id" `
	Title *TextObject         `json:"title,omitempty" mapstructure:"title" `
}

DatabaseTitleProperty object represents Notion title Property.

func (*DatabaseTitleProperty) GetType added in v0.0.8

GetType returns the type of the property.

type DatabasesService added in v0.0.3

type DatabasesService service

DatabasesService handles communication to Notion Databases API.

API doc: https://developers.notion.com/reference/database

func (*DatabasesService) Get added in v0.0.3

func (s *DatabasesService) Get(ctx context.Context, databaseID string) (*Database, error)

Get retrieves database by database ID.

API doc: https://developers.notion.com/reference/get-database

func (*DatabasesService) List added in v0.0.3

List lists database.

API doc: https://developers.notion.com/reference/get-databases

func (*DatabasesService) Query added in v0.0.14

func (s *DatabasesService) Query(ctx context.Context, databaseID string, query *DatabaseQuery) (*QueryDatabaseResults, error)

Query queries a database.

API doc: https://developers.notion.com/reference/post-databases-query

type Date added in v0.0.14

type Date struct {
	Start string `json:"start" mapstructure:"start"`
	End   string `json:"end,omitempty" mapstructure:"end"`
}

Date represents data object's date

type DateProperty added in v0.0.5

type DateProperty struct {
	Type object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID   string              `json:"id,omitempty" mapstructure:"id" `
	Date *Date               `json:"date" mapstructure:"date"`
}

DateProperty object represents Notion date Property.

func (*DateProperty) GetType added in v0.0.5

func (p *DateProperty) GetType() object.PropertyType

GetType returns the type of the property.

type Direction added in v0.0.2

type Direction string

Direction is a type to specify how to sort the search results.

const (
	Ascending  Direction = "ascending"
	Descending Direction = "descending"
)

type EmailProperty added in v0.0.5

type EmailProperty struct {
	Type  object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID    string              `json:"id,omitempty" mapstructure:"id" `
	Email interface{}         `json:"email" mapstructure:"email" `
}

EmailProperty object represents Notion emailProperty Property.

func (*EmailProperty) GetType added in v0.0.5

func (p *EmailProperty) GetType() object.PropertyType

GetType returns the type of the property.

type EquationObject added in v0.0.3

type EquationObject struct {
	PlainText   string       `json:"plain_text,omitempty" mapstructure:"plain_text"`
	Href        string       `json:"href,omitempty" mapstructure:"href"`
	Annotations *Annotations `json:"annotations,omitempty" mapstructure:"annotations"`
	Type        RichTextType `json:"type,omitempty" mapstructure:"type"`
	Expression  string       `json:"expression,omitempty" mapstructure:"expression"`
}

EquationObject object represents Notion rich text object

func (*EquationObject) GetType added in v0.0.11

func (obj *EquationObject) GetType() RichTextType

GetType returns the object type

type Error added in v0.0.5

type Error struct {
	Object  object.Type      `json:"object" mapstructure:"object"`
	Status  int              `json:"status" mapstructure:"status"`
	Code    object.ErrorCode `json:"code" mapstructure:"code"`
	Message string           `json:"message" mapstructure:"message"`
}

Error represents error response from Notion

func (*Error) Error added in v0.0.5

func (e *Error) Error() string

Error implements the error interface

type FilesFilter added in v0.0.14

type FilesFilter struct {
	Property   string `json:"property" mapstructure:"property"`
	IsEmpty    bool   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty bool   `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

FilesFilter filters select properties.

type FilesProperty added in v0.0.5

type FilesProperty struct {
	Type object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID   string              `json:"id,omitempty" mapstructure:"id" `
	File interface{}         `json:"file,omitempty" mapstructure:"file" `
}

FilesProperty object represents Notion file Property.

func (*FilesProperty) GetType added in v0.0.5

func (p *FilesProperty) GetType() object.PropertyType

GetType returns the type of the property.

type Filter added in v0.0.2

type Filter struct {
	Value    FilterValue         `json:"value" mapstructure:"value"`
	Property FilterPropertyValue `json:"property" mapstructure:"property"`
}

Filter object represents Notion User.

type FilterObject added in v0.0.14

type FilterObject interface{}

type FilterPropertyValue added in v0.0.3

type FilterPropertyValue string

FilterPropertyValue is a type for what value to filter.

const (
	ObjectFilterProperty FilterPropertyValue = "object"
)

type FilterValue added in v0.0.2

type FilterValue string

FiterValue is a type for specifying what to filter

const (
	Object FilterValue = "object"
)

type FormulaFilter added in v0.0.14

type FormulaFilter struct {
	Property string          `json:"property" mapstructure:"property"`
	Text     *TextFilter     `json:"equals,omitempty" mapstructure:"equals"`
	Checkbox *CheckboxFilter `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
	Number   *NumberFilter   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	Date     *DataFilter     `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

FormulaFilter filters select properties.

type FormulaProperty added in v0.0.5

type FormulaProperty struct {
	Type       object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID         string              `json:"id,omitempty" mapstructure:"id" `
	Expression interface{}         `json:"expression,omitempty" mapstructure:"expression" `
}

FormulaProperty object represents Notion formula Property.

func (*FormulaProperty) GetType added in v0.0.5

func (p *FormulaProperty) GetType() object.PropertyType

GetType returns the type of the property.

type HeadingOneBlock added in v0.0.4

type HeadingOneBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
}

HeadingOneBlock object represents the retrieve block children.

func (*HeadingOneBlock) GetType added in v0.0.4

func (b *HeadingOneBlock) GetType() object.BlockType

GetType retrieves the block type.

type HeadingThreeBlock added in v0.0.4

type HeadingThreeBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
}

HeadingThreeBlock object represents the retrieve block children.

func (*HeadingThreeBlock) GetType added in v0.0.4

func (b *HeadingThreeBlock) GetType() object.BlockType

GetType retrieves the block type.

type HeadingTwoBlock added in v0.0.4

type HeadingTwoBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
}

HeadingTwoBlock object represents the retrieve block children.

func (*HeadingTwoBlock) GetType added in v0.0.4

func (b *HeadingTwoBlock) GetType() object.BlockType

GetType retrieves the block type.

type LastEditedByProperty added in v0.0.5

type LastEditedByProperty struct {
	Type         object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID           string              `json:"id,omitempty" mapstructure:"id" `
	LastEditedBy interface{}         `json:"last_edited_by,omitempty" mapstructure:"last_edited_by" `
}

LastEditedByProperty object represents Notion last edited by Property.

func (*LastEditedByProperty) GetType added in v0.0.5

GetType returns the type of the property.

type LastEditedTimeProperty added in v0.0.5

type LastEditedTimeProperty struct {
	Type           object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID             string              `json:"id,omitempty" mapstructure:"id" `
	LastEditedTime interface{}         `json:"last_edited_time,omitempty" mapstructure:"last_edited_time" `
}

LastEditedTimeProperty object represents Notion last edited time Property.

func (*LastEditedTimeProperty) GetType added in v0.0.5

GetType returns the type of the property.

type LinkObject added in v0.0.3

type LinkObject struct {
	PlainText   string       `json:"plain_text,omitempty" mapstructure:"plain_text"`
	Href        string       `json:"href,omitempty" mapstructure:"href"`
	Annotations *Annotations `json:"annotations,omitempty" mapstructure:"annotations"`
	Type        RichTextType `json:"type,omitempty" mapstructure:"type"`
	URL         string       `json:"url,omitempty" mapstructure:"url"`
}

LinkObject object represents Notion rich text object

func (*LinkObject) GetType added in v0.0.11

func (obj *LinkObject) GetType() RichTextType

GetType returns the object type

type ListBlockChildrenResult added in v0.0.3

type ListBlockChildrenResult struct {
	Object  object.Type `json:"object" mapstructure:"object"`
	Results []Block     `json:"results" mapstructure:"results"`
}

ListBlockChildrenResult object represents the retrieve block children.

type ListDatabase added in v0.0.3

type ListDatabase struct {
	Object         object.Type            `json:"object" mapstructure:"object"`
	ID             string                 `json:"id" mapstructure:"id"`
	CreatedTime    string                 `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string                 `json:"last_edited_time" mapstructure:"last_edited_time"`
	Title          []TextObject           `json:"title" mapstructure:"title"`
	Properties     map[string]interface{} `json:"properties" mapstructure:"properties"`
}

ListDatabase object represents Notion ListDatabase.

API doc: https://developers.notion.com/reference/database

type ListDatabaseResponse added in v0.0.3

type ListDatabaseResponse struct {
	Object     object.Type    `json:"object" mapstructure:"object"`
	Results    []ListDatabase `json:"results" mapstructure:"results"`
	NextCursor string         `json:"next_cursor" mapstructure:"next_cursor"`
	HasMore    bool           `json:"has_more" mapstructure:"has_more"`
}

ListDatabaseResponse represents the response from the list User API

type ListUserResponse

type ListUserResponse struct {
	Object     object.Type `json:"object" mapstructure:"object"`
	Results    []User      `json:"results" mapstructure:"results"`
	NextCursor string      `json:"next_cursor" mapstructure:"next_cursor"`
	HasMore    bool        `json:"has_more" mapstructure:"has_more"`
}

ListUserResponse represents the response from the list User API

type MentionObject added in v0.0.3

type MentionObject struct {
	PlainText   string       `json:"plain_text,omitempty" mapstructure:"plain_text"`
	Href        string       `json:"href,omitempty" mapstructure:"href"`
	Annotations *Annotations `json:"annotations,omitempty" mapstructure:"annotations"`
	Type        RichTextType `json:"type,omitempty" mapstructure:"type"`
	Database    *Database    `json:"database,omitempty" mapstructure:"database"`
	User        *User        `json:"user,omitempty" mapstructure:"user"`
}

MentionObject object represents Notion rich text object

func (*MentionObject) GetType added in v0.0.11

func (obj *MentionObject) GetType() RichTextType

GetType returns the object type

type MentionObjectType added in v0.0.3

type MentionObjectType string

MentionObjectType is for types of mentions.

const (
	UserMentionObject     MentionObjectType = "user"
	PageMentionObject     MentionObjectType = "page"
	DatabaseMentionObject MentionObjectType = "database"
	DateionObject         MentionObjectType = "date"
)

type MultiSelectFilter added in v0.0.14

type MultiSelectFilter struct {
	Property    string `json:"property" mapstructure:"property"`
	Equals      string `json:"equals,omitempty" mapstructure:"equals"`
	DoeNotEqual string `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
	IsEmpty     bool   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty  bool   `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

MultiSelectFilter filters select properties.

type MultiSelectOption added in v0.0.5

type MultiSelectOption struct {
	Name  string `json:"name" mapstructure:"name" `
	ID    string `json:"id,omitempty" mapstructure:"id" `
	Color Color  `json:"color,omitempty" mapstructure:"color" `
}

MultiSelectOption object represents Notion select Property.

type MultiSelectProperty added in v0.0.5

type MultiSelectProperty struct {
	Type    object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID      string              `json:"id,omitempty" mapstructure:"id" `
	Options []MultiSelectOption `json:"options,omitempty" mapstructure:"options" `
}

MultiSelectProperty object represents Notion multi select Property.

func (*MultiSelectProperty) GetType added in v0.0.5

GetType returns the type of the property.

type NumberFilter added in v0.0.14

type NumberFilter struct {
	Property             string  `json:"property" mapstructure:"property"`
	Equals               float64 `json:"equals,omitempty" mapstructure:"equals"`
	GreaterThan          float64 `json:"greater_than,omitempty" mapstructure:"greater_than"`
	LessThan             float64 `json:"less_than,omitempty" mapstructure:"less_than"`
	GreaterThanOrEqualTo float64 `json:"greater_than_or_equal_to,omitempty" mapstructure:"greater_than_or_equal_to"`
	LessThanOrEqualTo    float64 `json:"less_than_or_equal_to,omitempty" mapstructure:"less_than_or_equal_to"`
	IsEmpty              bool    `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty           bool    `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

NumberFilter filters number properties.

type NumberListItemBlock added in v0.0.4

type NumberListItemBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
	Checked        bool             `json:"checked" mapstructure:"checked"`
	Children       []Block          `json:"children" mapstructure:"children"`
}

NumberListItemBlock object represents the retrieve block children.

func (*NumberListItemBlock) GetType added in v0.0.4

func (b *NumberListItemBlock) GetType() object.BlockType

GetType retrieves the block type.

type NumberProperty added in v0.0.5

type NumberProperty struct {
	Type   object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID     string              `json:"id,omitempty" mapstructure:"id" `
	Format string              `json:"format,omitempty" mapstructure:"format" `
	Number float64             `json:"number" mapstructure:"format" `
}

NumberProperty object represents Notion number Property.

func (*NumberProperty) GetType added in v0.0.5

func (p *NumberProperty) GetType() object.PropertyType

GetType returns the type of the property.

type NumberedListItemBlock added in v0.0.4

type NumberedListItemBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
	Children       []Block          `json:"children" mapstructure:"children"`
}

NumberedListItemBlock object represents the retrieve block children.

func (*NumberedListItemBlock) GetType added in v0.0.4

func (b *NumberedListItemBlock) GetType() object.BlockType

GetType retrieves the block type.

type Page added in v0.0.3

type Page struct {
	Object         object.Type         `json:"object" mapstructure:"object"`
	ID             string              `json:"id" mapstructure:"id"`
	CreatedTime    string              `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string              `json:"last_edited_time" mapstructure:"last_edited_time"`
	Parent         Parent              `json:"parent" mapstructure:"parent"`
	Properties     map[string]Property `json:"properties" mapstructure:"properties"`
}

Page object represents the retrieve page.

API doc: https://developers.notion.com/reference/get-page

func (*Page) GetObject added in v0.0.8

func (p *Page) GetObject() object.Type

type PageParent added in v0.0.5

type PageParent struct {
	Type   object.ParentType `json:"type,omitempty" mapstructure:"type"`
	PageID string            `json:"page_id" mapstructure:"page_id"`
}

PageParent object represents the retrieve parent.

func (*PageParent) GetType added in v0.0.5

func (p *PageParent) GetType() object.ParentType

GetType returns the type of the parent.

type PageTitleProperty added in v0.0.8

type PageTitleProperty struct {
	Type  object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID    string              `json:"id,omitempty" mapstructure:"id" `
	Title []TextObject        `json:"title,omitempty" mapstructure:"title" `
}

PageTitleProperty object represents Notion title Property.

func (*PageTitleProperty) GetType added in v0.0.8

func (p *PageTitleProperty) GetType() object.PropertyType

GetType returns the type of the property.

type PagesService added in v0.0.3

type PagesService service

PagesService handles communication to Notion Pages API.

API doc: https://developers.notion.com/reference/page

func (*PagesService) Create added in v0.0.3

func (s *PagesService) Create(ctx context.Context, preq *CreatePageRequest) (*Page, error)

Create page.

API doc: https://developers.notion.com/reference/post-page

func (*PagesService) Get added in v0.0.3

func (s *PagesService) Get(ctx context.Context, pageID string) (*Page, error)

Get retrieves a page.

API doc: https://developers.notion.com/reference/get-page

func (*PagesService) UpdateProperties added in v0.0.5

func (s *PagesService) UpdateProperties(ctx context.Context, pageID string, ureq *UpdatePageRequest) (*Page, error)

UpdateProperties page properties.

API doc: https://developers.notion.com/reference/patch-page

type ParagraphBlock added in v0.0.4

type ParagraphBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
	Children       []Block          `json:"children" mapstructure:"children"`
}

ParagraphBlock object represents the retrieve block children.

func (*ParagraphBlock) GetType added in v0.0.4

func (b *ParagraphBlock) GetType() object.BlockType

GetType retrieves the block type.

type Parent added in v0.0.3

type Parent interface {
	GetType() object.ParentType
}

Parent represens the interface for all parents of the page.

type People

type People struct {
	Email string `json:"email" mapstructure:"email"`
}

People object represents Notion human account.

type PeopleFilter added in v0.0.14

type PeopleFilter struct {
	Property    string `json:"property" mapstructure:"property"`
	Equals      string `json:"equals,omitempty" mapstructure:"equals"`
	DoeNotEqual string `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
	IsEmpty     bool   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty  bool   `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

PeopleFilter filters select properties.

type PersonProperty added in v0.0.14

type PersonProperty struct {
	Type   object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID     string              `json:"id,omitempty" mapstructure:"id" `
	People interface{}         `json:"people,omitempty" mapstructure:"people" `
}

PersonProperty object represents Notion people Property.

func (*PersonProperty) GetType added in v0.0.14

func (p *PersonProperty) GetType() object.PropertyType

GetType returns the type of the property.

type PhoneNumberProperty added in v0.0.5

type PhoneNumberProperty struct {
	Type        object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID          string              `json:"id,omitempty" mapstructure:"id" `
	PhoneNumber interface{}         `json:"phone_number,omitempty" mapstructure:"phone_number" `
}

PhoneNumberProperty object represents Notion phone number Property.

func (*PhoneNumberProperty) GetType added in v0.0.5

GetType returns the type of the property.

type Property added in v0.0.2

type Property interface {
	GetType() object.PropertyType
}

Property represents database properties.

type QueryDatabaseResults added in v0.0.14

type QueryDatabaseResults struct {
	HasMore    bool            `json:"has_more" mapstructure:"has_more"`
	NextCursor string          `json:"next_cursor" mapstructure:"next_cursor"`
	Object     object.Type     `json:"object" mapstructure:"object"`
	Results    []object.Object `json:"results" mapstructure:"results"`
}

QueryDatabaseResults object represents Notion Search params

type RateLimit

type RateLimit struct {
	Limit     int
	Remaining int
	Reset     time.Time
}

RateLimit represents the rate limit info for the API

type Relation added in v0.0.5

type Relation struct {
	DatabaseID         string `json:"database_id,omitempty" mapstructure:"database_id" `
	SyncedPropertyName string `json:"synced_property_name,omitempty" mapstructure:"synced_property_name" `
	SyncedPropertyID   string `json:"synced_property_id,omitempty" mapstructure:"synced_property_id" `
}

Relation object represents Notion relation.

type RelationFilter added in v0.0.14

type RelationFilter struct {
	Property    string `json:"property" mapstructure:"property"`
	Equals      string `json:"equals,omitempty" mapstructure:"equals"`
	DoeNotEqual string `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
	IsEmpty     bool   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty  bool   `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

RelationFilter filters select properties.

type RelationProperty added in v0.0.5

type RelationProperty struct {
	Type     object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID       string              `json:"id,omitempty" mapstructure:"id" `
	Relation []Relation          `json:"relation,omitempty" mapstructure:"relation" `
}

RelationProperty object represents Notion relation Property.

func (*RelationProperty) GetType added in v0.0.5

func (p *RelationProperty) GetType() object.PropertyType

GetType returns the type of the property.

type RichText added in v0.0.3

type RichText interface {
	GetType() RichTextType
}

RicchText is descibed in API doc: https://developers.notion.com/reference/rich-text

type RichTextType added in v0.0.3

type RichTextType string

RichTextType is type of this rich text object

const (
	TextRichTextType    RichTextType = "text"
	MentionRichTextType RichTextType = "mention"
	EquationRichTextTye RichTextType = "equation"
)

type Rollup added in v0.0.5

type Rollup struct {
	RelationPropertyName string `json:"relation_property_name,omitempty" mapstructure:"relation_property_name" `
	RelationPropertyID   string `json:"relation_property_id,omitempty" mapstructure:"relation_property_id" `
	RollupPropertyName   string `json:"rollup_property_name,omitempty" mapstructure:"rollup_property_name" `
	RollupPropertyID     string `json:"rollup_property_id,omitempty" mapstructure:"rollup_property_id" `
	Function             string `json:"function,omitempty" mapstructure:"function" `
}

Rollup object represents Notion rollup.

type RollupProperty added in v0.0.5

type RollupProperty struct {
	Type   object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID     string              `json:"id,omitempty" mapstructure:"id" `
	Rollup *Rollup             `json:"rollup,omitempty" mapstructure:"rollup" `
}

RollupProperty object represents Notion rollup Property.

func (*RollupProperty) GetType added in v0.0.5

func (p *RollupProperty) GetType() object.PropertyType

GetType returns the type of the property.

type SearchRequest added in v0.0.2

type SearchRequest struct {
	Query       string `json:"query" mapstructure:"query"`
	Sort        *Sort  `json:"sort" mapstructure:"sort"`
	StartCursor string `json:"start_cursor" mapstructure:"start_cursor"`
	PageSize    int32  `json:"page_size" mapstructure:"page_size"`
}

SearchRequest object represents Notion Search params

type SearchResults added in v0.0.5

type SearchResults struct {
	HasMore    bool            `json:"has_more" mapstructure:"has_more"`
	NextCursor string          `json:"next_cursor" mapstructure:"next_cursor"`
	Object     string          `json:"object" mapstructure:"object"`
	Results    []object.Object `json:"results" mapstructure:"results"`
}

SearchResults object represents Notion Search params

type SearchService added in v0.0.2

type SearchService service

SearchService handles communication to Notion Search API.

API doc: https://developers.notion.com/reference/post-search

func (*SearchService) Search added in v0.0.2

func (s *SearchService) Search(ctx context.Context, sreq *SearchRequest) (*SearchResults, error)

Get gets user by user ID.

API doc: https://developers.notion.com/reference/get-user

type SelectFilter added in v0.0.14

type SelectFilter struct {
	Property    string `json:"property" mapstructure:"property"`
	Equals      string `json:"equals,omitempty" mapstructure:"equals"`
	DoeNotEqual string `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
	IsEmpty     bool   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty  bool   `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

SelectFilter filters select properties.

type SelectOption added in v0.0.5

type SelectOption struct {
	Name  string `json:"name" mapstructure:"name" `
	ID    string `json:"id,omitempty" mapstructure:"id" `
	Color Color  `json:"color,omitempty" mapstructure:"color" `
}

SelectOption object represents Notion select Property.

type SelectProperty added in v0.0.5

type SelectProperty struct {
	Type    object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID      string              `json:"id,omitempty" mapstructure:"id" `
	Options []SelectOption      `json:"options" mapstructure:"options" `
}

SelectProperty object represents Notion select Property.

func (*SelectProperty) GetType added in v0.0.5

func (p *SelectProperty) GetType() object.PropertyType

GetType returns the type of the property.

type Sort added in v0.0.2

type Sort struct {
	Property  string    `json:"property,omitempty" mapstructure:"property"`
	Direction Direction `json:"direction" mapstructure:"direction"`
	Timestamp string    `json:"timestamp" mapstructure:"timestamp"`
}

Sort object represents Notion User.

type Text added in v0.0.3

type Text struct {
	Type    RichTextType `json:"type,omitempty" mapstructure:"type"`
	Content string       `json:"content,omitempty" mapstructure:"content"`
}

Text represents text object's text content.

type TextFilter added in v0.0.14

type TextFilter struct {
	Property       string `json:"property" mapstructure:"property"`
	Equals         string `json:"equals,omitempty" mapstructure:"equals"`
	DoesNotEqual   string `json:"does_not_equal,omitempty" mapstructure:"does_not_equal"`
	Contains       string `json:"contains,omitempty" mapstructure:"contains"`
	DoesNotContain string `json:"does_not_contain,omitempty" mapstructure:"does_not_contain"`
	StartsWith     string `json:"starts_with,omitempty" mapstructure:"starts_with"`
	EndsWith       string `json:"ends_with,omitempty" mapstructure:"ends_with"`
	IsEmpty        bool   `json:"is_empty,omitempty" mapstructure:"is_empty"`
	IsNotEmpty     bool   `json:"is_not_empty,omitempty" mapstructure:"is_not_empty"`
}

TextFilter filters text properties.

type TextObject added in v0.0.3

type TextObject struct {
	PlainText   string       `json:"plain_text,omitempty" mapstructure:"plain_text"`
	Href        string       `json:"href,omitempty" mapstructure:"href"`
	Annotations *Annotations `json:"annotations,omitempty" mapstructure:"annotations"`
	Type        RichTextType `json:"type,omitempty" mapstructure:"type"`
	Text        *Text        `json:"text,omitempty" mapstructure:"text"`
	Link        *LinkObject  `json:"link,omitempty" mapstructure:"link"`
}

TextObject object represents Notion rich text object

func (*TextObject) GetType added in v0.0.11

func (obj *TextObject) GetType() RichTextType

GetType returns the object type

type TextProperty added in v0.0.5

type TextProperty struct {
	Type object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID   string              `json:"id,omitempty" mapstructure:"id" `
	Text interface{}         `json:"text,omitempty" mapstructure:"text" `
}

TextProperty object represents Notion rich text Property.

func (*TextProperty) GetType added in v0.0.5

func (p *TextProperty) GetType() object.PropertyType

GetType returns the type of the property.

type ToDoBlock added in v0.0.4

type ToDoBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
	Checked        bool             `json:"checked" mapstructure:"checked"`
	Children       []Block          `json:"children" mapstructure:"children"`
}

ToDoBlock object represents the retrieve block children.

func (*ToDoBlock) GetType added in v0.0.4

func (b *ToDoBlock) GetType() object.BlockType

GetType retrieves the block type.

type ToggleBlock added in v0.0.4

type ToggleBlock struct {
	Object         object.Type      `json:"object" mapstructure:"object"`
	ID             string           `json:"id" mapstructure:"id"`
	Type           object.BlockType `json:"type" mapstructure:"type"`
	CreatedTime    string           `json:"created_time" mapstructure:"created_time"`
	LastEditedTime string           `json:"last_edited_time" mapstructure:"last_edited_time"`
	HasChildren    bool             `json:"has_children" mapstructure:"has_children"`
	Text           []RichTextType   `json:"text" mapstructure:"text"`
	Children       []Block          `json:"children" mapstructure:"children"`
}

ToggleBlock object represents the retrieve block children.

func (*ToggleBlock) GetType added in v0.0.4

func (b *ToggleBlock) GetType() object.BlockType

GetType retrieves the block type.

type URLProperty added in v0.0.5

type URLProperty struct {
	Type object.PropertyType `json:"type,omitempty" mapstructure:"type" `
	ID   string              `json:"id,omitempty" mapstructure:"id" `
	URL  interface{}         `json:"url,omitempty" mapstructure:"url" `
}

URLProperty object represents Notion text Property.

func (*URLProperty) GetType added in v0.0.5

func (p *URLProperty) GetType() object.PropertyType

GetType returns the type of the property.

type UpdatePageRequest added in v0.0.14

type UpdatePageRequest struct {
	Properties map[string]Property `json:"properties" mapstructure:"properties"`
}

UpdatePageRequest object represents the update request

type User

type User struct {
	ID        string      `json:"id" mapstructure:"id"`
	Type      object.Type `json:"type,omitempty" mapstructure:"type"`
	Name      string      `json:"name,omitempty" mapstructure:"name"`
	AvatarURL string      `json:"avatar_url,omitempty" mapstructure:"avatar_url"`
	Person    *People     `json:"person,omitempty" mapstructure:"person"`
	Bot       *Bot        `json:"bot,omitempty" mapstructure:"bot"`
}

User object represents Notion User.

API doc: https://developers.notion.com/reference/user

type UsersService

type UsersService service

UsersService handles communication to Notion Users API.

API doc: https://developers.notion.com/reference/user

func (*UsersService) Get

func (s *UsersService) Get(ctx context.Context, userID string) (*User, error)

Get gets user by user ID.

API doc: https://developers.notion.com/reference/get-user

func (*UsersService) List

List gets the list of users.

API doc: https://developers.notion.com/reference/get-users

type WorkspaceParent added in v0.0.5

type WorkspaceParent struct {
	Type      object.ParentType `json:"type,omitempty" mapstructure:"type"`
	Workspace bool              `json:"workspace" mapstructure:"workspace"`
}

WorkspaceParent object represents the retrieve parent.

func (*WorkspaceParent) GetType added in v0.0.5

func (p *WorkspaceParent) GetType() object.ParentType

GetType returns the type of the parent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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