Documentation ¶
Index ¶
- type Annotation
- type BlockManager
- func (i BlockManager) Headers() []fetch.RequestOption
- func (bm *BlockManager) ID() string
- func (i BlockManager) Set(version, token string)
- func (bm BlockManager) WithContext(ctx context.Context) *BlockManager
- func (bm BlockManager) WithID(id string) *BlockManager
- func (bm BlockManager) WithLimiter(limiter *rate.Limiter) *BlockManager
- type CheckBoxFilter
- type Condition
- type DatabaseManager
- func (dm *DatabaseManager) AsynQuery(cond *Condition) <-chan Object
- func (dm *DatabaseManager) Create(parent PageItem, title []TextObject, properties map[string]*Property) error
- func (i DatabaseManager) Headers() []fetch.RequestOption
- func (dm *DatabaseManager) ID() string
- func (dm *DatabaseManager) Query(cond *Condition) (objects []Object, err error)
- func (dm *DatabaseManager) Retrieve() (*Object, error)
- func (i DatabaseManager) Set(version, token string)
- func (dm *DatabaseManager) Update(payload io.Reader) error
- func (dm DatabaseManager) WithContext(ctx context.Context) *DatabaseManager
- func (dm DatabaseManager) WithID(id string) *DatabaseManager
- func (dm DatabaseManager) WithLimiter(limiter *rate.Limiter) *DatabaseManager
- type FileItem
- type FilesFilter
- type FilterCondition
- type FilterSingleCondition
- type IconItem
- type Manager
- type NumberFilter
- type NumberProperty
- type Object
- type PageItem
- type PageManager
- func (pm *PageManager) Create(parent PageItem, properties ...*Property) error
- func (i PageManager) Headers() []fetch.RequestOption
- func (pm *PageManager) ID() string
- func (i PageManager) Set(version, token string)
- func (pm *PageManager) Update(properties ...*Property) error
- func (pm PageManager) WithContext(ctx context.Context) *PageManager
- func (pm PageManager) WithID(id string) *PageManager
- func (pm PageManager) WithLimiter(limiter *rate.Limiter) *PageManager
- type PropSortCondition
- type Property
- type PropertyArray
- type PropertyType
- type PureObject
- type RichTextFilter
- type SearchManager
- type SelectOption
- type SelectProperty
- type TextItem
- type TextObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type BlockManager ¶
type BlockManager struct {
// contains filtered or unexported fields
}
BlockManager ...
func NewBlockManager ¶
func NewBlockManager(version, token string) *BlockManager
NewBlockManager return a new database manager
func (BlockManager) Headers ¶
func (i BlockManager) Headers() []fetch.RequestOption
func (BlockManager) WithContext ¶
func (bm BlockManager) WithContext(ctx context.Context) *BlockManager
WithContext set Context
func (BlockManager) WithID ¶
func (bm BlockManager) WithID(id string) *BlockManager
WithID set block id
func (BlockManager) WithLimiter ¶
func (bm BlockManager) WithLimiter(limiter *rate.Limiter) *BlockManager
WithLimiter with limiiter
type CheckBoxFilter ¶
type CheckBoxFilter struct { Equals bool `json:"equals"` DoesNotEqual bool `json:"does_not_equal"` }
CheckBoxFilter ...
type Condition ¶
type Condition struct { PageSize int `json:"page_size,omitempty"` StartCursor string `json:"start_cursor,omitempty"` Filter *FilterCondition `json:"filter,omitempty"` Sorts []PropSortCondition `json:"sorts,omitempty"` }
Condition query filter
type DatabaseManager ¶
type DatabaseManager struct {
// contains filtered or unexported fields
}
DatabaseManager ...
func NewDatabaseManager ¶
func NewDatabaseManager(version, token string) *DatabaseManager
NewDatabaseManager return a new database manager
func (*DatabaseManager) AsynQuery ¶
func (dm *DatabaseManager) AsynQuery(cond *Condition) <-chan Object
AsynQuery ...
func (*DatabaseManager) Create ¶
func (dm *DatabaseManager) Create(parent PageItem, title []TextObject, properties map[string]*Property) error
Create create database docs: https://developers.notion.com/reference/create-a-database POST https://api.notion.com/v1/databases
func (DatabaseManager) Headers ¶
func (i DatabaseManager) Headers() []fetch.RequestOption
func (*DatabaseManager) Query ¶
func (dm *DatabaseManager) Query(cond *Condition) (objects []Object, err error)
Query query databases docs: https://developers.notion.com/reference/post-database-query POST https://api.notion.com/v1/databases/{database_id}/query
func (*DatabaseManager) Retrieve ¶
func (dm *DatabaseManager) Retrieve() (*Object, error)
Retrieve retrieve database docs: https://developers.notion.com/reference/retrieve-a-database GET https://api.notion.com/v1/databases/{database_id}
func (*DatabaseManager) Update ¶
func (dm *DatabaseManager) Update(payload io.Reader) error
Update update database docs: https://developers.notion.com/reference/update-a-database PATCH https://api.notion.com/v1/databases/{database_id}
func (DatabaseManager) WithContext ¶
func (dm DatabaseManager) WithContext(ctx context.Context) *DatabaseManager
WithContext set Context
func (DatabaseManager) WithID ¶
func (dm DatabaseManager) WithID(id string) *DatabaseManager
WithID set database id
func (DatabaseManager) WithLimiter ¶
func (dm DatabaseManager) WithLimiter(limiter *rate.Limiter) *DatabaseManager
WithLimiter with limiiter
type FilesFilter ¶
type FilesFilter struct { IsEmpty bool `json:"is_empty,omitempty"` IsNotEmpty bool `json:"is_not_empty,omitempty"` }
FilesFilter ... doc: https://developers.notion.com/reference/post-database-query-filter#files
type FilterCondition ¶
type FilterCondition struct { FilterSingleCondition CompoundConditions map[string][]FilterCondition }
FilterCondition ...
{ "and": [ { "property": "Done", "checkbox": { "equals": true } }, { "or": [ { "property": "Tags", "contains": "A" }, { "property": "Tags", "contains": "B" } ] } ] }
func (*FilterCondition) MarshalJSON ¶
func (cond *FilterCondition) MarshalJSON() ([]byte, error)
type FilterSingleCondition ¶
type FilterSingleCondition struct { Property string `json:"property"` CheckBox *CheckBoxFilter `json:"checkbox,omitempty"` RichText *RichTextFilter `json:"rich_text,omitempty"` Number *NumberFilter `json:"number,omitempty"` Files *FilesFilter `json:"files,omitempty"` Contains string `json:"contains,omitempty"` }
FilterSingleCondition filter single condition https://developers.notion.com/reference/post-database-query-filter#the-filter-object
type Manager ¶
type Manager struct { *DatabaseManager *PageManager *BlockManager *SearchManager // contains filtered or unexported fields }
Manager is a manager for notion
func NewManager ¶
NewManager return a new notion manager
func (Manager) Headers ¶
func (i Manager) Headers() []fetch.RequestOption
func (Manager) WithContext ¶
WithContext set context for notion manager
type NumberFilter ¶
type NumberFilter struct { Equals float64 `json:"equals,omitempty"` DoesNotEqual float64 `json:"does_not_equal,omitempty"` GreaterThan float64 `json:"greater_than,omitempty"` GreaterThanOrEqualTo float64 `json:"greater_than_or_equal_to,omitempty"` LessThan float64 `json:"less_than,omitempty"` LessThanOrEqualTo float64 `json:"less_than_or_equal_to,omitempty"` IsEmpty bool `json:"is_empty,omitempty"` IsNotEmpty bool `json:"is_not_empty,omitempty"` }
NumberFilter ... doc: https://developers.notion.com/reference/post-database-query-filter#number
type NumberProperty ¶
type NumberProperty struct {
Format string `json:"format"`
}
type Object ¶
type Object struct { PureObject CreatedTime string `json:"created_time"` CreatedBy PureObject `json:"created_by"` LastEditedTime string `json:"last_edited_time"` LastEditedBy PureObject `json:"last_edited_by"` Cover FileItem `json:"cover,omitempty"` Icon IconItem `json:"icon,omitempty"` Title []TextItem `json:"title,omitempty"` Description []TextItem `json:"description,omitempty"` IsInline bool `json:"is_inline,omitempty"` Properties map[string]Property `json:"properties,omitempty"` Parent PageItem `json:"parent,omitempty"` URL string `json:"url,omitempty"` Archived bool `json:"archived,omitempty"` Results []Object `json:"results,omitempty"` NextCursor string `json:"next_cursor"` HasMore bool `json:"has_more"` Type string `json:"type"` Status int `json:"status,omitempty"` Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` }
Object notion object
type PageManager ¶
type PageManager struct {
// contains filtered or unexported fields
}
PageManager ...
func NewPageManager ¶
func NewPageManager(version, token string) *PageManager
NewPageManager return a new page manager
func (*PageManager) Create ¶
func (pm *PageManager) Create(parent PageItem, properties ...*Property) error
Create create page docs: https://developers.notion.com/reference/post-page POST https://api.notion.com/v1/pages
func (PageManager) Headers ¶
func (i PageManager) Headers() []fetch.RequestOption
func (*PageManager) Update ¶
func (pm *PageManager) Update(properties ...*Property) error
Update update page docs: https://developers.notion.com/reference/patch-page PATCH https://api.notion.com/v1/pages/{page_id}
func (PageManager) WithContext ¶
func (pm PageManager) WithContext(ctx context.Context) *PageManager
WithContext set Context
func (PageManager) WithLimiter ¶
func (pm PageManager) WithLimiter(limiter *rate.Limiter) *PageManager
WithLimiter with limiiter
type PropSortCondition ¶
type Property ¶
type Property struct { ID string `json:"id"` Name string `json:"name"` Type PropertyType `json:"type"` Title interface{} `json:"title,omitempty"` Number interface{} `json:"number,omitempty"` RichText interface{} `json:"rich_text,omitempty"` Select interface{} `json:"select,omitempty"` MultiSelect interface{} `json:"multi_select,omitempty"` Files interface{} `json:"files,omitempty"` }
Property
func (*Property) ForUpdate ¶
func (p *Property) ForUpdate() map[PropertyType]interface{}
ForUpdate return update format data
type PropertyArray ¶
type PropertyArray []*Property
func (PropertyArray) ForUpdate ¶
func (pa PropertyArray) ForUpdate() map[string]interface{}
type PropertyType ¶
type PropertyType string
PropertyType property type
const ( TitleProp PropertyType = "title" NumberProp PropertyType = "number" RichTextProp PropertyType = "rich_text" SelectProp PropertyType = "select" MultiSelectProp PropertyType = "multi_select" FilesProp PropertyType = "files" )
type PureObject ¶
PureObject pure notion object
type RichTextFilter ¶
type RichTextFilter struct { Contains string `json:"contains,omitempty"` DoesNotContain string `json:"does_not_contain,omitempty"` Equals string `json:"equals,omitempty"` DoesNotEqual string `json:"does_not_equal,omitempty"` StartsWith string `json:"starts_with,omitempty"` EndsWith string `json:"ends_with,omitempty"` IsEmpty bool `json:"is_empty,omitempty"` IsNotEmpty bool `json:"is_not_empty,omitempty"` }
RichTextFilter ...
type SearchManager ¶
type SearchManager struct {
// contains filtered or unexported fields
}
SearchManager ...
func NewSearchManager ¶
func NewSearchManager(version, token string) *SearchManager
NewSearchManager return a new search manager
func (SearchManager) Headers ¶
func (i SearchManager) Headers() []fetch.RequestOption
func (SearchManager) WithContext ¶
func (sm SearchManager) WithContext(ctx context.Context) *SearchManager
WithContext set Context
func (SearchManager) WithLimiter ¶
func (sm SearchManager) WithLimiter(limiter *rate.Limiter) *SearchManager
WithLimiter with limiiter
type SelectOption ¶
type SelectProperty ¶
type SelectProperty struct {
Options []SelectOption `json:"options"`
}
type TextObject ¶
type TextObject struct { Type string `json:"type,omitempty"` Text TextItem `json:"text"` Annotations *Annotation `json:"annotations,omitempty"` PlainText string `json:"plain_text,omitempty"` Href *string `json:"href,omitempty"` }