version1

package module
v0.0.0-...-f800055 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Object  string `json:"object,omitempty"`
	Status  int32  `json:"status,omitempty"`
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

APIError represents a Notion API response https://developers.notion.com/reference/errors Object is always "error"

func (APIError) Error

func (e APIError) Error() string

type AccessTokenRequest

type AccessTokenRequest struct {
	GrantType   string `json:"grant_type"`
	Code        string `json:"code"`
	RedirectURI string `json:"redirect_uri"`
}

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken   string `json:"access_token"`
	WorkspaceName string `json:"workspace_name"`
	WorkspaceIcon string `json:"workspace_icon"`
	BotID         string `json:"bot_id"`
}

type Annotations

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

Color must be either "default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", or "red_background"

type AppendBlockChildrenBodyParams

type AppendBlockChildrenBodyParams struct {
	Children []Block `json:"children"`
}

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

func (*AuthService) AccessToken

func (a *AuthService) AccessToken(c *oauth2.Config, authCode string) (*AccessTokenResponse, *http.Response, error)

func (*AuthService) AuthorizationURL

func (a *AuthService) AuthorizationURL(c *oauth2.Config, state string) string

type Block

type Block struct {
	Object           string                 `json:"object,omitempty"`
	ID               string                 `json:"id,omitempty"`
	Type             string                 `json:"type,omitempty"`
	CreatedTime      string                 `json:"created_time,omitempty"`
	LastEditedTime   string                 `json:"last_edited_time,omitempty"`
	HasChildren      bool                   `json:"has_children,omitempty"`
	Paragraph        *ParagraphBlock        `json:"paragraph,omitempty"`
	HeadingOne       *HeadingOneBlock       `json:"heading_1,omitempty"`
	HeadingTwo       *HeadingTwoBlock       `json:"heading_2,omitempty"`
	HeadingThree     *HeadingThreeBlock     `json:"heading_3,omitempty"`
	BulletedListItem *BulletedListItemBlock `json:"bulleted_list_item,omitempty"`
	NumberedListItem *NumberedListItemBlock `json:"numbered_list_item,omitempty"`
	ToDo             *ToDoBlock             `json:"to_do,omitempty"`
	Toggle           *ToggleBlock           `json:"toggle,omitempty"`
	ChildPage        *ChildPageBlock        `json:"child_page,omitempty"`
}

https://developers.notion.com/reference/block Object is always "block" Type must be one of "paragraph", "heading_1", "heading_2", "heading_3", "bulleted_list_item", "numbered_list_item", "to_do", "toggle", "child_page", and "unsupported"

type BlockService

type BlockService struct {
	// contains filtered or unexported fields
}

func (*BlockService) AppendBlockChildren

func (b *BlockService) AppendBlockChildren(blockID string, params *AppendBlockChildrenBodyParams) (*Block, *http.Response, error)

https://developers.notion.com/reference/patch-block-children NB: Blocks cannot be modified currently. Once a block is appended as a child of another block, it cannot be updated or deleted.

type BulletedListItemBlock

type BulletedListItemBlock struct {
	Text     []RichText `json:"text,omitempty"`
	Children []Block    `json:"children,omitempty"`
}

https://developers.notion.com/reference/block#bulleted-list-item-blocks

type CheckboxCondition

type CheckboxCondition struct {
	Equals       bool `json:"equals,omitempty"`
	DoesNotEqual bool `json:"does_not_equal,omitempty"`
}

type ChildPageBlock

type ChildPageBlock struct {
	Title string `json:"title,omitempty"`
}

https://developers.notion.com/reference/block#child-page-blocks

type Client

type Client struct {

	// Notion API Services
	Users     *UserService
	Databases *DatabaseService
	Pages     *PageService
	Blocks    *BlockService
	Search    *SearchService
	Auth      *AuthService
	// contains filtered or unexported fields
}

func AuthClient

func AuthClient(client *http.Client) *Client

func NewClient

func NewClient(client *http.Client, accessToken string) *Client

type CompoundFilter

type CompoundFilter struct {
	OR  interface{} `json:"or,omitempty"`
	AND interface{} `json:"and,omitempty"`
}

OR and AND can either be []SingleFilter or []CompoundFilter (this is only valid once).

type CreatePageBodyParams

type CreatePageBodyParams struct {
	Parent     interface{} `json:"parent,omitempty"`
	Properties interface{} `json:"properties,omitempty"`
	Children   []Block     `json:"children,omitempty"`
}

Use *DatabaseParent or *PageParent for Parent Read https://developers.notion.com/reference/post-page before using this

type Database

type Database struct {
	Object         string                 `json:"object,omitempty"`
	ID             string                 `json:"id,omitempty"`
	CreatedTime    string                 `json:"created_time,omitempty"`
	LastEditedTime string                 `json:"last_edited_time,omitempty"`
	Title          []RichText             `json:"title,omitempty"`
	Properties     map[string]PropertyObj `json:"properties,omitempty"`
}

type DatabaseMention

type DatabaseMention struct {
	ID string `json:"id,omitempty"`
}

type DatabaseParent

type DatabaseParent struct {
	Type       string `json:"type,omitempty"`
	DatabaseID string `json:"database_id,omitempty"`
}

Type is always "database_id" for Database Parent

type DatabaseService

type DatabaseService struct {
	// contains filtered or unexported fields
}

func (*DatabaseService) RetrieveDatabase

func (d *DatabaseService) RetrieveDatabase(databaseID string) (*Database, *http.Response, error)

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

type DateCondition

type DateCondition struct {
	Equals     string      `json:"equals,omitempty"`
	Before     string      `json:"before,omitempty"`
	After      string      `json:"after,omitempty"`
	OnOrBefore string      `json:"on_or_before,omitempty"`
	IsEmpty    bool        `json:"is_empty,omitempty"`
	IsNotEmpty bool        `json:"is_not_empty,omitempty"`
	OnOrAfter  string      `json:"on_or_after,omitempty"`
	PastWeek   interface{} `json:"past_week,omitempty"`
	PastMonth  interface{} `json:"past_month,omitempty"`
	PastYear   interface{} `json:"past_year,omitempty"`
	NextWeek   interface{} `json:"next_week,omitempty"`
	NextMonth  interface{} `json:"next_month,omitempty"`
	NextYear   interface{} `json:"next_year,omitempty"`
}

type DateProperty

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

If End is not defined, this Date struct isn't considered a range https://developers.notion.com/reference/page#date-property-values

type Equation

type Equation struct {
	Expression string `json:"expression,omitempty"`
}

type FileCondition

type FileCondition struct {
	IsEmpty    bool `json:"is_empty,omitempty"`
	IsNotEmpty bool `json:"is_not_empty,omitempty"`
}

type FileReferenceProperty

type FileReferenceProperty struct {
	Name string `json:"name,omitempty"`
}

https://developers.notion.com/reference/page#files-property-values

type FormulaCondition

type FormulaCondition struct {
	Text     *TextCondition     `json:"text,omitempty"`
	Checkbox *CheckboxCondition `json:"checkbox,omitempty"`
	Number   *NumberCondition   `json:"number,omitempty"`
	Date     *DateCondition     `json:"date,omitempty"`
}

type FormulaConfig

type FormulaConfig struct {
	Expression string `json:"expression,omitempty"`
}

type FormulaProperty

type FormulaProperty struct {
	Type    string        `json:"type"`
	String  string        `json:"string,omitempty"`
	Number  int32         `json:"number,omitempty"`
	Boolean bool          `json:"boolean,omitempty"`
	Date    *DateProperty `json:"date,omitempty"`
}

Type must be one of "string", "number", "boolean", and "date". https://developers.notion.com/reference/page#formula-property-values Use *Date for Date

type HeadingOneBlock

type HeadingOneBlock struct {
	Text []RichText `json:"text,omitempty"`
}

https://developers.notion.com/reference/block#heading-one-blocks

type HeadingThreeBlock

type HeadingThreeBlock struct {
	Text []RichText `json:"text,omitempty"`
}

https://developers.notion.com/reference/block#heading-three-blocks

type HeadingTwoBlock

type HeadingTwoBlock struct {
	Text []RichText `json:"text,omitempty"`
}

https://developers.notion.com/reference/block#heading-two-blocks

type Link struct {
	Type string `json:"type,omitempty"`
	URL  string `json:"url,omitempty"`
}

If, Link != nil, Type is always "url" and URL is always a web address. https://developers.notion.com/reference/rich-text#link-objects

type ListDatabasesQueryParams

type ListDatabasesQueryParams struct {
	StartCursor string `url:"start_cursor,omitempty"`
	PageSize    int32  `url:"page_size,omitempty"`
}

type ListDatabasesResponse

type ListDatabasesResponse struct {
	Results    []Database `json:"results,omitempty"`
	NextCursor string     `json:"next_cursor,omitempty"`
	HasMore    bool       `json:"has_more,omitempty"`
}

type ListUsersQueryParams

type ListUsersQueryParams struct {
	StartCursor string `url:"start_cursor,omitempty"`
	PageSize    int32  `url:"page_size,omitempty"`
}

type ListUsersResponse

type ListUsersResponse struct {
	Object     string `json:"object,omitempty"`
	Results    []User `json:"results"`
	NextCursor string `json:"next_cursor"`
	HasMore    bool   `json:"has_more"`
}

type Mention

type Mention struct {
	Type            string           `json:"type"`
	UserMention     *User            `json:"user,omitempty"`
	PageMention     *PageMention     `json:"page,omitempty"`
	DatabaseMention *DatabaseMention `json:"database,omitempty"`
	Date            *DateProperty    `json:"date,omitempty"`
}

Use PageMention for PageMention Use DatabaseMention for DatabaseMention Use Date for Date

type MultiSelectCondition

type MultiSelectCondition struct {
	Contains       string `json:"contains,omitempty"`
	DoesNotContain string `json:"does_not_contain,omitempty"`
	IsEmpty        bool   `json:"is_empty,omitempty"`
	// contains filtered or unexported fields
}

type MultiSelectConfig

type MultiSelectConfig struct {
	Options []MultiSelectOption `json:"options,omitempty"`
}

type MultiSelectOption

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

Color can only be one of default, gray, brown, orange, yellow, green, blue, purple, pink, red.

type MultiSelectPropertyOpts

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

When updating a multi-select property, you can use either name or id. Setting a multi-select option by name will only update the page if the multi-select database property has an option by that name. Color can only be "default", "gray", "brown", "red", "orange", "yellow", "green", "blue", "purple" or "pink" https://developers.notion.com/reference/page#multi-select-property-values

type NumberCondition

type NumberCondition struct {
	Equals               int32 `json:"equals,omitempty"`
	DoesNotEqual         int32 `json:"does_not_equal,omitempty"`
	GreaterThan          int32 `json:greater_than, omitempty`
	LessThan             int32 `json:"less_than,omitempty"`
	GreaterThanOrEqualTo int32 `json:"greater_than_or_equal_to,omitempty"`
	LessThanOrEqualTo    int32 `json:"less_than_or_equal_to,omitempty"`
	IsEmpty              bool  `json:"is_empty,omitempty"`
	// contains filtered or unexported fields
}

type NumberConfig

type NumberConfig struct {
	Format string `json:"format,omitempty"`
}

Format can only be one of number, number_with_commas, percent, dollar, euro, pound, yen, ruble, rupee, won, yuan.

type NumberProperty

type NumberProperty struct {
	Number int32 `json:"number,omitempty"`
}

type NumberedListItemBlock

type NumberedListItemBlock struct {
	Text     []RichText `json:"text,omitempty"`
	Children []Block    `json:"children,omitempty"`
}

https://developers.notion.com/reference/block#numbered-list-item-blocks

type Page

type Page struct {
	Object         string                  `json:"object,omitempty"`
	ID             string                  `json:"id,omitempty"`
	CreatedTime    string                  `json:"created_time,omitempty"`
	LastEditedTime string                  `json:"last_edited_time,omitempty"`
	Parent         interface{}             `json:"parent,omitempty"`
	Archived       bool                    `json:"archived,omitempty"`
	Properties     map[string]PageProperty `json:"properties,omitempty"`
}

https://developers.notion.com/reference/page#all-pages Object must always be "page" For Properties,

  • If parent.type is "page_id" or "workspace", then the only valid key is title.
  • If parent.type is "database_id", then the keys and values of this field are determined by the properties of the database this page belongs to.

Page can be *DatabaseParent, *PageParent or *WorkspaceParent

type PageMention

type PageMention struct {
	ID string `json:"id,omitempty"`
}

type PageParent

type PageParent struct {
	Type   string `json:"type,omitempty"`
	PageID string `json:"page_id,omitempty"`
}

Type is always "page_id

type PageProperty

type PageProperty struct {
	ID             string                    `json:"id,omitempty"`
	Type           string                    `json:"type,omitempty"`
	Title          []RichText                `json:"title,omitempty"`
	RichText       []RichText                `json:"rich_text,omitempty"`
	Number         int64                     `json:"number,omitempty"`
	Select         *SelectProperty           `json:"select,omitempty"`
	URL            string                    `json:"url,omitempty"`
	Email          string                    `json:"email,omitempty"`
	Phone          interface{}               `json:"phone,omitempty"`
	Checkbox       bool                      `json:"checkbox,omitempty"`
	MultiSelect    []MultiSelectPropertyOpts `json:"multi_select,omitempty"`
	CreatedTime    string                    `json:"created_time,omitempty"`
	LastEditedTime string                    `json:"last_edited_time,omitempty"`
	Date           *DateProperty             `json:"date,omitempty"`
	CreatedBy      *User                     `json:"created_by,omitempty"`
	LastEditedBy   *User                     `json:"last_edited_by,omitempty"`
	Files          []FileReferenceProperty   `json:"files,omitempty"`
	Relation       []PageReferenceProperty   `json:"relation,omitempty"`
	Formula        *FormulaProperty          `json:"formula,omitempty"`
	Rollup         *RollupProperty           `json:"rollup,omitempty"`
	People         []User                    `json:"people,omitempty"`
	PhoneNumber    string                    `json:"phone_number,omitempty"`
}

Type can be only one of "rich_text", "number", "select", "multi_select", "date", "formula", "relation", "rollup", "title", "people", "files", "checkbox", "url", "email", "phone_number", "created_time", "created_by", "last_edited_time", and "last_edited_by". https://developers.notion.com/reference/page#all-property-values

type PageReferenceProperty

type PageReferenceProperty struct {
	ID string `json:"id,omitempty"`
}

https://developers.notion.com/reference/page#relation-property-values

type PageService

type PageService struct {
	// contains filtered or unexported fields
}

func (*PageService) RetrievePage

func (p *PageService) RetrievePage(pageID string) (*Page, *http.Response, error)

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

type ParagraphBlock

type ParagraphBlock struct {
	Text     []RichText `json:"text,omitempty"`
	Children []Block    `json:"children,omitempty"`
}

https://developers.notion.com/reference/block#paragraph-blocks

type PeopleCondition

type PeopleCondition struct {
	Contains       string `json:"contains,omitempty"`
	DoesNotContain string `json:"does_not_contain,omitempty"`
	IsEmpty        bool   `json:"is_empty,omitempty"`
	IsNotEmpty     bool   `json:"is_not_empty,omitempty"`
}

type Person

type Person struct {
	PersonEmail string `json:"email,omitempty"`
}

https://developers.notion.com/reference/user#people Display-only properties: Person, PersonEmail

type PropertyObj

type PropertyObj struct {
	ID             string             `json:"id,omitempty"`
	Type           string             `json:"type,omitempty"`
	Title          interface{}        `json:"title,omitempty"`
	Text           interface{}        `json:"text,omitempty"`
	RichText       interface{}        `json:"rich_text,omitempty"`
	Number         *NumberConfig      `json:"number,omitempty"`
	Select         *SelectConfig      `json:"select,omitempty"`
	MultiSelect    *MultiSelectConfig `json:"multi_select,omitempty"`
	Date           interface{}        `json:"date,omitempty"`
	People         interface{}        `json:"people,omitempty"`
	File           interface{}        `json:"file,omitempty"`
	Checkbox       interface{}        `json:"checkbox,omitempty"`
	URL            interface{}        `json:"url,omitempty"`
	Email          interface{}        `json:"email,omitempty"`
	PhoneNumber    interface{}        `json:"phone_number,omitempty"`
	Formula        *FormulaConfig     `json:"formula,omitempty"`
	Relation       *RelationConfig    `json:"relation,omitempty"`
	Rollup         *RollupConfig      `json:"rollup,omitempty"`
	CreatedTime    interface{}        `json:"created_time,omitempty"`
	CreatedBy      interface{}        `json:"created_by,omitempty"`
	LastEditedTime interface{}        `json:"last_edited_time,omitempty"`
	LastEditedBy   interface{}        `json:"last_edited_by,omitempty"`
}

Type can only be one of "title", "rich_text", "number", "select", "multi_select", "date", "people", "file", "checkbox", "url", "email", "phone_number", "formula", "relation", "rollup", "created_time", "created_by", "last_edited_time", "last_edited_by".

type QueryDatabaseBodyParams

type QueryDatabaseBodyParams struct {
	Filter      interface{}    `json:"filter,omitempty"`
	Sorts       []SortCriteria `json:"sorts,omitempty"`
	StartCursor string         `json:"start_cursor,omitempty"`
	PageSize    int32          `json:"page_size,omitempty"`
}

Filter can be either SingleFilter or CompoundFilter

type QueryDatabaseResponse

type QueryDatabaseResponse struct {
	Object     string `json:"object,omitempty"`
	Results    []Page `json:"results,omitempty"`
	NextCursor string `json:"next_cursor,omitempty"`
	HasMore    bool   `json:"has_more,omitempty"`
}

type RelationCondition

type RelationCondition struct {
	Contains        string `json:"contains,omitempty"`
	DoesNotContains string `json:"does_not_contains,omitempty"`
	IsEmpty         string `json:"is_empty,omitempty"`
	IsNotEmpty      string `json:"is_not_empty,omitempty"`
}

type RelationConfig

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

type RetrieveBlockChildrenParams

type RetrieveBlockChildrenParams struct {
	StartCursor string `url:"start_cursor,omitempty"`
	PageSize    int32  `url:"page_size,omitempty"`
}

type RetrieveBlockChildrenResponse

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

type RichText

type RichText struct {
	PlainText   string       `json:"plain_text,omitempty"`
	Href        string       `json:"href,omitempty"`
	Annotations *Annotations `json:"annotations,omitempty"`
	Type        string       `json:"type,omitempty"`
	Text        *Text        `json:"text,omitempty"`
	Mention     *Mention     `json:"mention,omitempty"`
	Equation    *Equation    `json:"equation,omitempty"`
}

Type must be either "text", "mention" or "equation" Use Mention for Mention

type RollupConfig

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

Function can be one of count_all, count_values, count_unique_values, count_empty, count_not_empty, percent_empty, percent_not_empty, sum, average, median, min, max, range

type RollupProperty

type RollupProperty struct {
	Type   string                  `json:"type,omitempty"`
	Number int32                   `json:"number,omitempty"`
	Date   *DateProperty           `json:"date,omitempty"`
	Array  []RollupPropertyElement `json:"array,omitempty"`
}

https://developers.notion.com/reference/page#rollup-property-values Use *DateProperty for Date Use for Array

type RollupPropertyElement

type RollupPropertyElement struct {
	Type           string                    `json:"type"`
	Title          []RichText                `json:"title,omitempty"`
	RichText       []RichText                `json:"rich_text,omitempty"`
	Number         int64                     `json:"number,omitempty"`
	Select         *SelectProperty           `json:"select,omitempty"`
	URL            string                    `json:"url,omitempty"`
	Email          string                    `json:"email,omitempty"`
	Phone          interface{}               `json:"phone,omitempty"`
	Checkbox       bool                      `json:"checkbox,omitempty"`
	MultiSelect    []MultiSelectPropertyOpts `json:"multi_select,omitempty"`
	CreatedTime    string                    `json:"created_time,omitempty"`
	LastEditedTime string                    `json:"last_edited_time,omitempty"`
	Date           *DateProperty             `json:"date,omitempty"`
	CreatedBy      *User                     `json:"created_by,omitempty"`
	LastEditedBy   *User                     `json:"last_edited_by,omitempty"`
	Files          []FileReferenceProperty   `json:"files,omitempty"`
	Relation       interface{}               `json:"relation,omitempty"`
	Formula        *FormulaProperty          `json:"formula,omitempty"`
	Rollup         interface{}               `json:"rollup,omitempty"`
	People         []User                    `json:"people,omitempty"`
	PhoneNumber    string                    `json:"phone_number,omitempty"`
}

https://developers.notion.com/reference/page#rollup-property-value-element Type is one of rich_text", "number", "select", "multi_select", "date", "formula", "relation", "rollup", "title", "people", "files", "checkbox", "url", "email", "phone_number", "created_time", "created_by", "last_edited_time", or "last_edited_by"

type SearchBodyParams

type SearchBodyParams struct {
	Query       string        `json:"query,omitempty"`
	Sort        *Sort         `json:"sort,omitempty"`
	Filter      *SearchFilter `json:"filter,omitempty"`
	StartCursor string        `json:"start_cursor,omitempty"`
	PageSize    int32         `json:"page_size,omitempty"`
}

From my tests it looks like the api checks if page titles contain the query

type SearchDatabaseResponse

type SearchDatabaseResponse struct {
	Object     string     `json:"object,omitempty"`
	Results    []Database `json:"results,omitempty"`
	NextCursor string     `json:"next_cursor,omitempty"`
	HasMore    bool       `json:"has_more,omitempty"`
}

type SearchFilter

type SearchFilter struct {
	Value    string `json:"value,omitempty"`
	Property string `json:"property,omitempty"`
}

Value is either "page" or "database" Property can only be "object"

type SearchPageResponse

type SearchPageResponse struct {
	Object     string `json:"object,omitempty"`
	Results    []Page `json:"results,omitempty"`
	NextCursor string `json:"next_cursor,omitempty"`
	HasMore    bool   `json:"has_more,omitempty"`
}

type SearchService

type SearchService struct {
	// contains filtered or unexported fields
}

func (*SearchService) SearchDatabase

func (s *SearchService) SearchDatabase(params *SearchBodyParams) (*SearchDatabaseResponse, *http.Response, error)

func (*SearchService) SearchPage

func (s *SearchService) SearchPage(params *SearchBodyParams) (*SearchPageResponse, *http.Response, error)

type SelectCondition

type SelectCondition struct {
	Equals       string `json:"equals,omitempty"`
	DoesNotEqual string `json:"does_not_equal,omitempty"`
	IsEmpty      bool   `json:"is_empty,omitempty"`
	// contains filtered or unexported fields
}

type SelectConfig

type SelectConfig struct {
	Options []SelectOption `json:"options,omitempty"`
}

type SelectOption

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

Color can only be one of default, gray, brown, orange, yellow, green, blue, purple, pink, red.

type SelectProperty

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

Color can only be "default", "gray", "brown", "red", "orange", "yellow", "green", "blue", "purple" or "pink"

type SingleFilter

type SingleFilter struct {
	Property       string                `json:"property,omitempty"`
	Title          *TextCondition        `json:"title,omitempty"`
	RichText       *TextCondition        `json:"rich_text,omitempty"`
	URL            *TextCondition        `json:"url,omitempty"`
	Email          *TextCondition        `json:"email,omitempty"`
	Phone          *TextCondition        `json:"phone,omitempty"`
	Number         *NumberCondition      `json:"number,omitempty"`
	Checkbox       *CheckboxCondition    `json:"checkbox,omitempty"`
	Select         *SelectCondition      `json:"select,omitempty"`
	MultiSelect    *MultiSelectCondition `json:"multi_select,omitempty"`
	CreatedTime    *DateCondition        `json:"created_time,omitempty"`
	LastEditedTime *DateCondition        `json:"last_edited_time,omitempty"`
	Date           *DateCondition        `json:"date,omitempty"`
	CreatedBy      *PeopleCondition      `json:"created_by,omitempty"`
	LastEditedBy   *PeopleCondition      `json:"last_edited_by,omitempty"`
	Files          *FileCondition        `json:"files,omitempty"`
	Relation       *RelationCondition    `json:"relation,omitempty"`
	Formula        *FormulaCondition     `json:"formula,omitempty"`
}

type Sort

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

Direction is either "ascending" or "descending" Timestamp is always "last_edited_time"

type SortCriteria

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

Timestamp must either be "created_time" or "last_edited_time" Direction must either be "ascending" or "descending"

type Text

type Text struct {
	Content string `json:"content,omitempty"`
	Link    *Link  `json:"link,omitempty"`
}

type TextCondition

type TextCondition struct {
	Equals         string `json:"equals,omitempty"`
	DoesNotEqual   string `json:"does_not_equal,omitempty"`
	Contains       string `json:"contains,omitempty"`
	DoesNotContain string `json:"does_not_contain,omitempty"`
	StartsWith     string `json:"starts_with,omitempty"`
	EndsWith       string `json:"ends_with,omitempty"`
	IsEmpty        bool   `json:"is_empty,omitempty"`
	// contains filtered or unexported fields
}

type ToDoBlock

type ToDoBlock struct {
	Text     []RichText `json:"text,omitempty"`
	Checked  bool       `json:"checked,omitempty"`
	Children []Block    `json:"children,omitempty"`
}

https://developers.notion.com/reference/block#to-do-blocks

type ToggleBlock

type ToggleBlock struct {
	Text     []RichText `json:"text,omitempty"`
	Children []Block    `json:"children,omitempty"`
}

https://developers.notion.com/reference/block#toggle-blocks

type UpdatePagePropertiesBodyParams

type UpdatePagePropertiesBodyParams struct {
	Properties map[string]PageProperty `json:"properties,omitempty"`
}

type User

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

https://developers.notion.com/reference/user Updateable properties: ID Display-only properties: Object, Type, Name, AvatarURL Object is always "user" and it Type is either "person" or "bot"

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func (*UserService) ListUsers

https://developers.notion.com/reference/get-users See https://developers.notion.com/reference/pagination to understand how to iterate through paginated responses

func (*UserService) RetrieveUser

func (u *UserService) RetrieveUser(userID string) (*User, *http.Response, error)

type WorkspaceParent

type WorkspaceParent struct {
	Type string `json:"type,omitempty"`
}

Type is always "workspace"

Jump to

Keyboard shortcuts

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