Documentation
¶
Index ¶
- type Annotations
- type AppendBlockChildrenRequest
- type Block
- type BlockClient
- type BlockID
- type BlockService
- type BlockType
- type Bot
- type BulletedListItemBlock
- type CheckboxFilterCondition
- type CheckboxProperty
- type CheckboxPropertyConfig
- type ChildPageBlock
- type Client
- type ClientOption
- type Color
- type CompoundFilter
- type Condition
- type CreatedByProperty
- type CreatedByPropertyConfig
- type CreatedTimeProperty
- type CreatedTimePropertyConfig
- type Cursor
- type Database
- type DatabaseClient
- func (dc *DatabaseClient) Get(ctx context.Context, id DatabaseID) (*Database, error)
- func (dc *DatabaseClient) List(ctx context.Context, pagination *Pagination) (*DatabaseListResponse, error)
- func (dc *DatabaseClient) Query(ctx context.Context, id DatabaseID, requestBody *DatabaseQueryRequest) (*DatabaseQueryResponse, error)
- func (dc *DatabaseClient) Update(ctx context.Context, id DatabaseID, requestBody *DatabaseUpdateRequest) (*Database, error)
- type DatabaseID
- type DatabaseListResponse
- type DatabaseQueryRequest
- type DatabaseQueryResponse
- type DatabaseService
- type DatabaseUpdateRequest
- type Date
- type DateFilterCondition
- type DateObject
- type DateProperty
- type DatePropertyConfig
- type EmailProperty
- type EmailPropertyConfig
- type Error
- type ErrorCode
- type File
- type FilesFilterCondition
- type FilesProperty
- type FilesPropertyConfig
- type FilterOperator
- type FormatType
- type Formula
- type FormulaConfig
- type FormulaFilterCondition
- type FormulaProperty
- type FormulaPropertyConfig
- type FormulaType
- type FunctionType
- type GetChildrenResponse
- type Heading1Block
- type Heading2Block
- type Heading3Block
- type LastEditedByProperty
- type LastEditedByPropertyConfig
- type LastEditedTimeProperty
- type LastEditedTimePropertyConfig
- type MultiSelectFilterCondition
- type MultiSelectProperty
- type MultiSelectPropertyConfig
- type NumberFilterCondition
- type NumberProperty
- type NumberPropertyConfig
- type NumberedListItemBlock
- type Object
- type ObjectID
- type ObjectType
- type Option
- type Page
- type PageClient
- type PageCreateRequest
- type PageID
- type PageService
- type PageUpdateRequest
- type Pagination
- type Paragraph
- type ParagraphBlock
- type Parent
- type ParentType
- type PeopleFilterCondition
- type PeopleProperty
- type PeoplePropertyConfig
- type Person
- type PhoneNumberProperty
- type PhoneNumberPropertyConfig
- type Properties
- type Property
- type PropertyConfig
- type PropertyConfigType
- type PropertyConfigs
- type PropertyFilter
- type PropertyID
- type PropertyType
- type Relation
- type RelationConfig
- type RelationFilterCondition
- type RelationObject
- type RelationProperty
- type RelationPropertyConfig
- type RichText
- type RichTextProperty
- type RichTextPropertyConfig
- type Rollup
- type RollupConfig
- type RollupProperty
- type RollupPropertyConfig
- type RollupType
- type SearchClient
- type SearchRequest
- type SearchResponse
- type SearchService
- type Select
- type SelectFilterCondition
- type SelectProperty
- type SelectPropertyConfig
- type SortObject
- type SortOrder
- type Text
- type TextFilterCondition
- type TextProperty
- type TimestampType
- type TitleProperty
- type TitlePropertyConfig
- type ToDoBlock
- type ToggleBlock
- type Token
- type URLProperty
- type URLPropertyConfig
- type User
- type UserClient
- type UserID
- type UserService
- type UserType
- type UsersListResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotations ¶
type AppendBlockChildrenRequest ¶
type AppendBlockChildrenRequest struct {
Children []Block `json:"children"`
}
type BlockClient ¶
type BlockClient struct {
// contains filtered or unexported fields
}
func (*BlockClient) AppendChildren ¶
func (bc *BlockClient) AppendChildren(ctx context.Context, id BlockID, requestBody *AppendBlockChildrenRequest) (Block, error)
AppendChildren https://developers.notion.com/reference/patch-block-children
func (*BlockClient) GetChildren ¶
func (bc *BlockClient) GetChildren(ctx context.Context, id BlockID, pagination *Pagination) (*GetChildrenResponse, error)
GetChildren https://developers.notion.com/reference/get-block-children
type BlockService ¶
type BlockService interface {
GetChildren(context.Context, BlockID, *Pagination) (*GetChildrenResponse, error)
AppendChildren(context.Context, BlockID, *AppendBlockChildrenRequest) (Block, error)
}
type BlockType ¶
type BlockType string
const ( BlockTypeParagraph BlockType = "paragraph" BlockTypeHeading1 BlockType = "heading_1" BlockTypeHeading2 BlockType = "heading_2" BlockTypeHeading3 BlockType = "heading_3" BlockTypeBulletedListItem BlockType = "bulleted_list_item" BlockTypeNumberedListItem BlockType = "numbered_list_item" BlockTypeToDo BlockType = "to_do" BlockTypeToggle BlockType = "toggle" BlockTypeChildPage BlockType = "child_page" BlockTypeUnsupported BlockType = "unsupported" )
type BulletedListItemBlock ¶
type BulletedListItemBlock struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
BulletedListItem struct {
Text []RichText `json:"text"`
Children []Block `json:"children,omitempty"`
} `json:"bulleted_list_item"`
}
func (BulletedListItemBlock) GetType ¶
func (b BulletedListItemBlock) GetType() BlockType
type CheckboxFilterCondition ¶ added in v1.2.0
type CheckboxProperty ¶
type CheckboxProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Checkbox bool `json:"checkbox"`
}
func (CheckboxProperty) GetType ¶
func (p CheckboxProperty) GetType() PropertyType
type CheckboxPropertyConfig ¶ added in v1.2.0
type CheckboxPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Checkbox struct{} `json:"checkbox"`
}
func (CheckboxPropertyConfig) GetType ¶ added in v1.2.0
func (p CheckboxPropertyConfig) GetType() PropertyConfigType
type ChildPageBlock ¶
type ChildPageBlock struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
ChildPage struct {
Title string `json:"title"`
} `json:"child_page"`
}
func (ChildPageBlock) GetType ¶
func (b ChildPageBlock) GetType() BlockType
type Client ¶
type Client struct {
Token Token
Database DatabaseService
Block BlockService
Page PageService
User UserService
Search SearchService
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(token Token, opts ...ClientOption) *Client
type ClientOption ¶
type ClientOption func(*Client)
ClientOption to configure API client
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
WithHTTPClient overrides the default http.Client
func WithVersion ¶
func WithVersion(version string) ClientOption
WithVersion overrides the Notion API version
type CompoundFilter ¶
type CompoundFilter map[FilterOperator][]PropertyFilter
type Condition ¶
type Condition string
const ( ConditionEquals Condition = "equals" ConditionDoesNotEqual Condition = "does_not_equal" ConditionContains Condition = "contains" ConditionDoesNotContain Condition = "does_not_contain" ConditionDoesStartsWith Condition = "starts_with" ConditionDoesEndsWith Condition = "ends_with" ConditionDoesIsEmpty Condition = "is_empty" ConditionGreaterThan Condition = "greater_than" ConditionLessThan Condition = "less_than" ConditionGreaterThanOrEqualTo Condition = "greater_than_or_equal_to" ConditionLessThanOrEqualTo Condition = "greater_than_or_equal_to" ConditionBefore Condition = "before" ConditionAfter Condition = "after" ConditionOnOrBefore Condition = "on_or_before" ConditionOnOrAfter Condition = "on_or_after" ConditionPastWeek Condition = "past_week" ConditionPastMonth Condition = "past_month" ConditionPastYear Condition = "past_year" ConditionNextWeek Condition = "next_week" ConditionNextMonth Condition = "next_month" ConditionNextYear Condition = "next_year" ConditionText Condition = "text" ConditionCheckbox Condition = "checkbox" ConditionNumber Condition = "number" ConditionDate Condition = "date" )
type CreatedByProperty ¶
type CreatedByProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
CreatedBy User `json:"created_by"`
}
func (CreatedByProperty) GetType ¶
func (p CreatedByProperty) GetType() PropertyType
type CreatedByPropertyConfig ¶ added in v1.2.0
type CreatedByPropertyConfig struct {
ID ObjectID `json:"id"`
Type PropertyConfigType `json:"type"`
CreatedBy struct{} `json:"created_by"`
}
func (CreatedByPropertyConfig) GetType ¶ added in v1.2.0
func (p CreatedByPropertyConfig) GetType() PropertyConfigType
type CreatedTimeProperty ¶
type CreatedTimeProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
CreatedTime time.Time `json:"created_time"`
}
func (CreatedTimeProperty) GetType ¶
func (p CreatedTimeProperty) GetType() PropertyType
type CreatedTimePropertyConfig ¶ added in v1.2.0
type CreatedTimePropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
CreatedTime struct{} `json:"created_time"`
}
func (CreatedTimePropertyConfig) GetType ¶ added in v1.2.0
func (p CreatedTimePropertyConfig) GetType() PropertyConfigType
type Database ¶
type Database struct {
Object ObjectType `json:"object"`
ID ObjectID `json:"id"`
CreatedTime time.Time `json:"created_time"`
LastEditedTime time.Time `json:"last_edited_time"`
Title []RichText `json:"title"`
// Properties is a map of property configurations that defines what Page.Properties each page of the database can use
Properties PropertyConfigs `json:"properties"`
}
func (*Database) GetObject ¶
func (db *Database) GetObject() ObjectType
type DatabaseClient ¶
type DatabaseClient struct {
// contains filtered or unexported fields
}
func (*DatabaseClient) Get ¶
func (dc *DatabaseClient) Get(ctx context.Context, id DatabaseID) (*Database, error)
func (*DatabaseClient) List ¶
func (dc *DatabaseClient) List(ctx context.Context, pagination *Pagination) (*DatabaseListResponse, error)
func (*DatabaseClient) Query ¶
func (dc *DatabaseClient) Query(ctx context.Context, id DatabaseID, requestBody *DatabaseQueryRequest) (*DatabaseQueryResponse, error)
Query https://developers.notion.com/reference/post-database-query
func (*DatabaseClient) Update ¶ added in v1.3.0
func (dc *DatabaseClient) Update(ctx context.Context, id DatabaseID, requestBody *DatabaseUpdateRequest) (*Database, error)
Update https://developers.notion.com/reference/update-a-database
type DatabaseID ¶
type DatabaseID string
func (DatabaseID) String ¶
func (dID DatabaseID) String() string
type DatabaseListResponse ¶
type DatabaseListResponse struct {
Object ObjectType `json:"object"`
Results []Database `json:"results"`
NextCursor string `json:"next_cursor"`
HasMore bool `json:"has_more"`
}
type DatabaseQueryRequest ¶
type DatabaseQueryRequest struct {
PropertyFilter *PropertyFilter
CompoundFilter *CompoundFilter
Sorts []SortObject `json:"sorts,omitempty"`
StartCursor Cursor `json:"start_cursor,omitempty"`
PageSize int `json:"page_size,omitempty"`
}
func (*DatabaseQueryRequest) MarshalJSON ¶ added in v1.2.0
func (qr *DatabaseQueryRequest) MarshalJSON() ([]byte, error)
type DatabaseQueryResponse ¶
type DatabaseQueryResponse struct {
Object ObjectType `json:"object"`
Results []Page `json:"results"`
HasMore bool `json:"has_more"`
NextCursor Cursor `json:"next_cursor"`
}
type DatabaseService ¶
type DatabaseService interface {
Get(context.Context, DatabaseID) (*Database, error)
List(context.Context, *Pagination) (*DatabaseListResponse, error)
Query(context.Context, DatabaseID, *DatabaseQueryRequest) (*DatabaseQueryResponse, error)
Update(context.Context, DatabaseID, *DatabaseUpdateRequest) (*Database, error)
}
type DatabaseUpdateRequest ¶ added in v1.3.0
type DatabaseUpdateRequest struct {
Title []RichText `json:"title,omitempty"`
Properties PropertyConfigs `json:"properties,omitempty"`
}
type Date ¶ added in v1.2.0
func (Date) MarshalText ¶ added in v1.2.0
func (*Date) UnmarshalText ¶ added in v1.3.1
type DateFilterCondition ¶ added in v1.2.0
type DateFilterCondition struct {
Equals *Date `json:"equals,omitempty"`
Before *Date `json:"before,omitempty"`
After *Date `json:"after,omitempty"`
OnOrBefore *Date `json:"on_or_before,omitempty"`
OnOrAfter *Date `json:"on_or_after,omitempty"`
PastWeek *struct{} `json:"past_week,omitempty"`
PastMonth *struct{} `json:"past_month,omitempty"`
PastYear *struct{} `json:"past_year,omitempty"`
NextWeek *struct{} `json:"next_week,omitempty"`
NextMonth *struct{} `json:"next_month,omitempty"`
NextYear *struct{} `json:"next_year,omitempty"`
IsEmpty bool `json:"is_empty,omitempty"`
IsNotEmpty bool `json:"is_not_empty,omitempty"`
}
type DateObject ¶ added in v1.2.0
type DateProperty ¶
type DateProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Date DateObject `json:"date"`
}
func (DateProperty) GetType ¶
func (p DateProperty) GetType() PropertyType
type DatePropertyConfig ¶ added in v1.2.0
type DatePropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Date struct{} `json:"date"`
}
func (DatePropertyConfig) GetType ¶ added in v1.2.0
func (p DatePropertyConfig) GetType() PropertyConfigType
type EmailProperty ¶
type EmailProperty struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Email string `json:"email"`
}
func (EmailProperty) GetType ¶
func (p EmailProperty) GetType() PropertyType
type EmailPropertyConfig ¶ added in v1.2.0
type EmailPropertyConfig struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Email struct{} `json:"email"`
}
func (EmailPropertyConfig) GetType ¶ added in v1.2.0
func (p EmailPropertyConfig) GetType() PropertyConfigType
type Error ¶
type Error struct {
Object ObjectType `json:"object"`
Status int `json:"status"`
Code ErrorCode `json:"code"`
Message string `json:"message"`
}
type FilesFilterCondition ¶ added in v1.2.0
type FilesProperty ¶ added in v1.2.0
type FilesProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Files []File `json:"files"`
}
func (FilesProperty) GetType ¶ added in v1.2.0
func (p FilesProperty) GetType() PropertyType
type FilesPropertyConfig ¶ added in v1.2.0
type FilesPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Files struct{} `json:"files"`
}
func (FilesPropertyConfig) GetType ¶ added in v1.2.0
func (p FilesPropertyConfig) GetType() PropertyConfigType
type FilterOperator ¶
type FilterOperator string
const ( FilterOperatorAND FilterOperator = "and" FilterOperatorOR FilterOperator = "or" )
type FormatType ¶
type FormatType string
const ( FormatNumber FormatType = "number" FormatNumberWithCommas FormatType = "number_with_commas" FormatPercent FormatType = "percent" FormatDollar FormatType = "dollar" FormatEuro FormatType = "euro" FormatPound FormatType = "pound" FormatYen FormatType = "yen" FormatRuble FormatType = "ruble" FormatRupee FormatType = "rupee" FormatYuan FormatType = "yuan" FormatHongKongDollar FormatType = "hong_kong_dollar" FormatNewZealandDollar FormatType = "hong_kong_dollar" FormatKrona FormatType = "krona" FormatNorwegianKrone FormatType = "norwegian_krone" FormatMexicanPeso FormatType = "mexican_peso" FormatRand FormatType = "rand" FormatNewTaiwanDollar FormatType = "new_taiwan_dollar" FormatDanishKrone FormatType = "danish_krone" FormatZloty FormatType = "zloty" FormatBath FormatType = "baht" FormatForint FormatType = "forint" FormatKoruna FormatType = "koruna" FormatShekel FormatType = "shekel" FormatChileanPeso FormatType = "chilean_peso" FormatPhilippinePeso FormatType = "philippine_peso" FormatDirham FormatType = "dirham" FormatColombianPeso FormatType = "colombian_peso" FormatRiyal FormatType = "riyal" FormatRinggit FormatType = "ringgit" FormatLeu FormatType = "leu" )
func (FormatType) String ¶
func (ft FormatType) String() string
type Formula ¶ added in v1.2.0
type Formula struct {
Type FormulaType `json:"type,omitempty"`
String string `json:"string,omitempty"`
Number float64 `json:"number,omitempty"`
Boolean bool `json:"boolean,omitempty"`
Date *DateObject `json:"date,omitempty"`
}
type FormulaConfig ¶ added in v1.2.0
type FormulaConfig struct {
Expression string `json:"expression"`
}
type FormulaFilterCondition ¶ added in v1.2.0
type FormulaFilterCondition struct {
Text *TextFilterCondition `json:"text,omitempty"`
Checkbox *CheckboxFilterCondition `json:"checkbox,omitempty"`
Number *NumberFilterCondition `json:"number,omitempty"`
Date *DateFilterCondition `json:"date,omitempty"`
}
type FormulaProperty ¶
type FormulaProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Formula Formula `json:"formula"`
}
func (FormulaProperty) GetType ¶
func (p FormulaProperty) GetType() PropertyType
type FormulaPropertyConfig ¶ added in v1.2.0
type FormulaPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Formula FormulaConfig `json:"formula"`
}
func (FormulaPropertyConfig) GetType ¶ added in v1.2.0
func (p FormulaPropertyConfig) GetType() PropertyConfigType
type FormulaType ¶ added in v1.2.0
type FormulaType string
const ( FormulaTypeString FormulaType = "string" FormulaTypeNumber FormulaType = "number" FormulaTypeBoolean FormulaType = "boolean" FormulaTypeDate FormulaType = "date" )
type FunctionType ¶
type FunctionType string
const ( FunctionCountAll FunctionType = "count_all" FunctionCountValues FunctionType = "count_values" FunctionCountUniqueValues FunctionType = "count_unique_values" FunctionCountEmpty FunctionType = "count_empty" FunctionCountNotEmpty FunctionType = "count_not_empty" FunctionPercentEmpty FunctionType = "percent_empty" FunctionPercentNotEmpty FunctionType = "percent_not_empty" FunctionSum FunctionType = "sum" FunctionAverage FunctionType = "average" FunctionMedian FunctionType = "median" FunctionMin FunctionType = "min" FunctionMax FunctionType = "max" FunctionRange FunctionType = "range" )
func (FunctionType) String ¶
func (ft FunctionType) String() string
type GetChildrenResponse ¶
type GetChildrenResponse struct {
Object ObjectType `json:"object"`
Results []Block `json:"results"`
}
type Heading1Block ¶
type Heading1Block struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
Heading1 struct {
Text []RichText `json:"text"`
} `json:"heading_1"`
}
func (Heading1Block) GetType ¶
func (b Heading1Block) GetType() BlockType
type Heading2Block ¶
type Heading2Block struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
Heading2 struct {
Text []RichText `json:"text"`
} `json:"heading_2"`
}
func (Heading2Block) GetType ¶
func (b Heading2Block) GetType() BlockType
type Heading3Block ¶
type Heading3Block struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
Heading3 struct {
Text []RichText `json:"text"`
} `json:"heading_3"`
}
func (Heading3Block) GetType ¶
func (b Heading3Block) GetType() BlockType
type LastEditedByProperty ¶
type LastEditedByProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
LastEditedBy User `json:"last_edited_by"`
}
func (LastEditedByProperty) GetType ¶
func (p LastEditedByProperty) GetType() PropertyType
type LastEditedByPropertyConfig ¶ added in v1.2.0
type LastEditedByPropertyConfig struct {
ID ObjectID `json:"id"`
Type PropertyConfigType `json:"type"`
LastEditedBy struct{} `json:"last_edited_by"`
}
func (LastEditedByPropertyConfig) GetType ¶ added in v1.2.0
func (p LastEditedByPropertyConfig) GetType() PropertyConfigType
type LastEditedTimeProperty ¶
type LastEditedTimeProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
LastEditedTime time.Time `json:"last_edited_time"`
}
func (LastEditedTimeProperty) GetType ¶
func (p LastEditedTimeProperty) GetType() PropertyType
type LastEditedTimePropertyConfig ¶ added in v1.2.0
type LastEditedTimePropertyConfig struct {
ID ObjectID `json:"id"`
Type PropertyConfigType `json:"type"`
LastEditedTime struct{} `json:"last_edited_time"`
}
func (LastEditedTimePropertyConfig) GetType ¶ added in v1.2.0
func (p LastEditedTimePropertyConfig) GetType() PropertyConfigType
type MultiSelectFilterCondition ¶ added in v1.2.0
type MultiSelectProperty ¶
type MultiSelectProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
MultiSelect []Option `json:"multi_select"`
}
func (MultiSelectProperty) GetType ¶
func (p MultiSelectProperty) GetType() PropertyType
type MultiSelectPropertyConfig ¶ added in v1.2.0
type MultiSelectPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
MultiSelect Select `json:"multi_select"`
}
func (MultiSelectPropertyConfig) GetType ¶ added in v1.2.0
func (p MultiSelectPropertyConfig) GetType() PropertyConfigType
type NumberFilterCondition ¶ added in v1.2.0
type NumberFilterCondition struct {
Equals float64 `json:"equals,omitempty"`
DoesNotEqual float64 `json:"does_not_equal,omitempty"`
GreaterThan float64 `json:"greater_than,omitempty"`
LessThan float64 `json:"less_than,omitempty"`
GreaterThanOrEqualTo float64 `json:"greater_than_or_equal_to"`
LessThanOrEqualTo float64 `json:"less_than_or_equal_to"`
IsEmpty bool `json:"is_empty,omitempty"`
IsNotEmpty bool `json:"is_not_empty,omitempty"`
}
type NumberProperty ¶
type NumberProperty struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Number float64 `json:"number"`
}
func (NumberProperty) GetType ¶
func (p NumberProperty) GetType() PropertyType
type NumberPropertyConfig ¶ added in v1.2.0
type NumberPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Format FormatType `json:"format"`
}
func (NumberPropertyConfig) GetType ¶ added in v1.2.0
func (p NumberPropertyConfig) GetType() PropertyConfigType
type NumberedListItemBlock ¶
type NumberedListItemBlock struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
NumberedListItem struct {
Text []RichText `json:"text"`
Children []Block `json:"children,omitempty"`
} `json:"numbered_list_item"`
}
func (NumberedListItemBlock) GetType ¶
func (b NumberedListItemBlock) GetType() BlockType
type Object ¶
type Object interface {
GetObject() ObjectType
}
type ObjectType ¶
type ObjectType string
const ( ObjectTypeDatabase ObjectType = "database" ObjectTypeBlock ObjectType = "block" ObjectTypePage ObjectType = "page" ObjectTypeList ObjectType = "list" ObjectTypeText ObjectType = "text" ObjectTypeUser ObjectType = "user" ObjectTypeError ObjectType = "error" )
func (ObjectType) String ¶
func (ot ObjectType) String() string
type Option ¶
type Option struct {
ID PropertyID `json:"id,omitempty"`
Name string `json:"name"`
Color Color `json:"color,omitempty"`
}
type Page ¶
type Page struct {
Object ObjectType `json:"object"`
ID ObjectID `json:"id"`
CreatedTime time.Time `json:"created_time"`
LastEditedTime time.Time `json:"last_edited_time"`
Archived bool `json:"archived"`
Properties Properties `json:"properties"`
Parent Parent `json:"parent"`
URL string `json:"url"`
}
func (*Page) GetObject ¶
func (p *Page) GetObject() ObjectType
type PageClient ¶
type PageClient struct {
// contains filtered or unexported fields
}
func (*PageClient) Create ¶
func (pc *PageClient) Create(ctx context.Context, requestBody *PageCreateRequest) (*Page, error)
func (*PageClient) Update ¶
func (pc *PageClient) Update(ctx context.Context, id PageID, request *PageUpdateRequest) (*Page, error)
type PageCreateRequest ¶
type PageCreateRequest struct {
Parent Parent `json:"parent"`
Properties Properties `json:"properties"`
Children []Block `json:"children,omitempty"`
}
type PageService ¶
type PageUpdateRequest ¶
type PageUpdateRequest struct {
Properties Properties `json:"properties"`
Archived bool `json:"archived"`
}
type Pagination ¶
func (*Pagination) ToQuery ¶
func (p *Pagination) ToQuery() map[string]string
type ParagraphBlock ¶
type ParagraphBlock struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
Paragraph Paragraph `json:"paragraph"`
}
func (ParagraphBlock) GetType ¶
func (b ParagraphBlock) GetType() BlockType
type Parent ¶
type Parent struct {
Type ParentType `json:"type,omitempty"`
PageID PageID `json:"page_id,omitempty"`
DatabaseID DatabaseID `json:"database_id,omitempty"`
}
type ParentType ¶
type ParentType string
const ( ParentTypeDatabaseID ParentType = "database_id" ParentTypePageID ParentType = "page_id" ParentTypeWorkspace ParentType = "workspace" )
type PeopleFilterCondition ¶ added in v1.2.0
type PeopleProperty ¶
type PeopleProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
People []User `json:"people"`
}
func (PeopleProperty) GetType ¶
func (p PeopleProperty) GetType() PropertyType
type PeoplePropertyConfig ¶ added in v1.2.0
type PeoplePropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
People struct{} `json:"people"`
}
func (PeoplePropertyConfig) GetType ¶ added in v1.2.0
func (p PeoplePropertyConfig) GetType() PropertyConfigType
type PhoneNumberProperty ¶
type PhoneNumberProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
PhoneNumber string `json:"phone_number"`
}
func (PhoneNumberProperty) GetType ¶
func (p PhoneNumberProperty) GetType() PropertyType
type PhoneNumberPropertyConfig ¶ added in v1.2.0
type PhoneNumberPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
PhoneNumber struct{} `json:"phone_number"`
}
func (PhoneNumberPropertyConfig) GetType ¶ added in v1.2.0
func (p PhoneNumberPropertyConfig) GetType() PropertyConfigType
type Properties ¶
func (*Properties) UnmarshalJSON ¶
func (p *Properties) UnmarshalJSON(data []byte) error
type Property ¶
type Property interface {
GetType() PropertyType
}
type PropertyConfig ¶ added in v1.2.0
type PropertyConfig interface {
GetType() PropertyConfigType
}
type PropertyConfigType ¶ added in v1.2.0
type PropertyConfigType string
const ( PropertyConfigTypeTitle PropertyConfigType = "title" PropertyConfigTypeRichText PropertyConfigType = "rich_text" PropertyConfigTypeNumber PropertyConfigType = "number" PropertyConfigTypeSelect PropertyConfigType = "select" PropertyConfigTypeMultiSelect PropertyConfigType = "multi_select" PropertyConfigTypeDate PropertyConfigType = "date" PropertyConfigTypePeople PropertyConfigType = "people" PropertyConfigTypeFiles PropertyConfigType = "files" PropertyConfigTypeCheckbox PropertyConfigType = "checkbox" PropertyConfigTypeURL PropertyConfigType = "url" PropertyConfigTypeEmail PropertyConfigType = "email" PropertyConfigTypePhoneNumber PropertyConfigType = "phone_number" PropertyConfigTypeFormula PropertyConfigType = "formula" PropertyConfigTypeRelation PropertyConfigType = "relation" PropertyConfigTypeRollup PropertyConfigType = "rollup" PropertyConfigCreatedTime PropertyConfigType = "created_time" PropertyConfigCreatedBy PropertyConfigType = "created_by" PropertyConfigLastEditedTime PropertyConfigType = "last_edited_time" PropertyConfigLastEditedBy PropertyConfigType = "last_edited_by" )
type PropertyConfigs ¶ added in v1.2.0
type PropertyConfigs map[string]PropertyConfig
func (*PropertyConfigs) UnmarshalJSON ¶ added in v1.2.0
func (p *PropertyConfigs) UnmarshalJSON(data []byte) error
type PropertyFilter ¶
type PropertyFilter struct {
Property string `json:"property"`
Text *TextFilterCondition `json:"text,omitempty"`
Number *NumberFilterCondition `json:"number,omitempty"`
Checkbox *CheckboxFilterCondition `json:"checkbox,omitempty"`
Select *SelectFilterCondition `json:"select,omitempty"`
MultiSelect *MultiSelectFilterCondition `json:"multi_select,omitempty"`
Date *DateFilterCondition `json:"date,omitempty"`
People *PeopleFilterCondition `json:"people,omitempty"`
Files *FilesFilterCondition `json:"files,omitempty"`
Relation *RelationFilterCondition `json:"relation,omitempty"`
Formula *FormulaFilterCondition `json:"formula,omitempty"`
}
type PropertyID ¶
type PropertyID string
func (PropertyID) String ¶
func (pID PropertyID) String() string
type PropertyType ¶
type PropertyType string
const ( PropertyTypeTitle PropertyType = "title" PropertyTypeRichText PropertyType = "rich_text" PropertyTypeText PropertyType = "text" PropertyTypeNumber PropertyType = "number" PropertyTypeSelect PropertyType = "select" PropertyTypeMultiSelect PropertyType = "multi_select" PropertyTypeDate PropertyType = "date" PropertyTypeFormula PropertyType = "formula" PropertyTypeRelation PropertyType = "relation" PropertyTypeRollup PropertyType = "rollup" PropertyTypePeople PropertyType = "people" PropertyTypeFiles PropertyType = "files" PropertyTypeCheckbox PropertyType = "checkbox" PropertyTypeURL PropertyType = "url" PropertyTypeEmail PropertyType = "email" PropertyTypePhoneNumber PropertyType = "phone_number" PropertyTypeCreatedTime PropertyType = "created_time" PropertyTypeCreatedBy PropertyType = "created_by" PropertyTypeLastEditedTime PropertyType = "last_edited_time" PropertyTypeLastEditedBy PropertyType = "last_edited_by" )
type RelationConfig ¶ added in v1.2.0
type RelationConfig struct {
DatabaseID DatabaseID `json:"database_id"`
SyncedPropertyID PropertyID `json:"synced_property_id"`
SyncedPropertyName string `json:"synced_property_name"`
}
type RelationFilterCondition ¶ added in v1.2.0
type RelationObject ¶
type RelationObject struct {
Database DatabaseID `json:"database"`
SyncedPropertyName string `json:"synced_property_name"`
}
type RelationProperty ¶
type RelationProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Relation []Relation `json:"relation"`
}
func (RelationProperty) GetType ¶
func (p RelationProperty) GetType() PropertyType
type RelationPropertyConfig ¶ added in v1.2.0
type RelationPropertyConfig struct {
Type PropertyConfigType `json:"type"`
Relation RelationConfig `json:"relation"`
}
func (RelationPropertyConfig) GetType ¶ added in v1.2.0
func (p RelationPropertyConfig) GetType() PropertyConfigType
type RichText ¶
type RichText struct {
Type ObjectType `json:"type,omitempty"`
Text Text `json:"text"`
Annotations *Annotations `json:"annotations,omitempty"`
PlainText string `json:"plain_text,omitempty"`
Href string `json:"href,omitempty"`
}
type RichTextProperty ¶
type RichTextProperty struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
RichText []RichText `json:"rich_text"`
}
func (RichTextProperty) GetType ¶
func (p RichTextProperty) GetType() PropertyType
type RichTextPropertyConfig ¶ added in v1.2.0
type RichTextPropertyConfig struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
RichText struct{} `json:"rich_text"`
}
func (RichTextPropertyConfig) GetType ¶ added in v1.2.0
func (p RichTextPropertyConfig) GetType() PropertyConfigType
type Rollup ¶
type Rollup struct {
Type RollupType `json:"type,omitempty"`
Number float64 `json:"number,omitempty"`
Date *DateObject `json:"date,omitempty"`
Array []Property `json:"array,omitempty"` //todo: unmarshal
}
type RollupConfig ¶ added in v1.2.0
type RollupConfig struct {
RelationPropertyName string `json:"relation_property_name"`
RelationPropertyID PropertyID `json:"relation_property_id"`
RollupPropertyName string `json:"rollup_property_name"`
RollupPropertyID PropertyID `json:"rollup_property_id"`
Function FunctionType `json:"function"`
}
type RollupProperty ¶
type RollupProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Rollup Rollup `json:"rollup"`
}
func (RollupProperty) GetType ¶
func (p RollupProperty) GetType() PropertyType
type RollupPropertyConfig ¶ added in v1.2.0
type RollupPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Rollup RollupConfig `json:"rollup"`
}
func (RollupPropertyConfig) GetType ¶ added in v1.2.0
func (p RollupPropertyConfig) GetType() PropertyConfigType
type RollupType ¶ added in v1.2.0
type RollupType string
const ( RollupTypeNumber RollupType = "number" RollupTypeDate RollupType = "date" RollupTypeArray RollupType = "array" )
type SearchClient ¶
type SearchClient struct {
// contains filtered or unexported fields
}
func (*SearchClient) Do ¶
func (sc *SearchClient) Do(ctx context.Context, request *SearchRequest) (*SearchResponse, error)
Do search https://developers.notion.com/reference/post-search
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query,omitempty"`
Sort *SortObject `json:"sort,omitempty"`
Filter interface{} `json:"filter,omitempty"`
StartCursor Cursor `json:"start_cursor,omitempty"`
PageSize int `json:"page_size,omitempty"`
}
type SearchResponse ¶
type SearchResponse struct {
Object ObjectType `json:"object"`
Results []Object `json:"results"`
HasMore bool `json:"has_more"`
NextCursor Cursor `json:"next_cursor"`
}
func (*SearchResponse) UnmarshalJSON ¶
func (sr *SearchResponse) UnmarshalJSON(data []byte) error
type SearchService ¶
type SearchService interface {
Do(context.Context, *SearchRequest) (*SearchResponse, error)
}
type SelectFilterCondition ¶ added in v1.2.0
type SelectProperty ¶
type SelectProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Select Option `json:"select"`
}
func (SelectProperty) GetType ¶
func (p SelectProperty) GetType() PropertyType
type SelectPropertyConfig ¶ added in v1.2.0
type SelectPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Select Select `json:"select"`
}
func (SelectPropertyConfig) GetType ¶ added in v1.2.0
func (p SelectPropertyConfig) GetType() PropertyConfigType
type SortObject ¶
type SortObject struct {
Property string `json:"property,omitempty"`
Timestamp TimestampType `json:"timestamp,omitempty"`
Direction SortOrder `json:"direction,omitempty"`
}
type TextFilterCondition ¶ added in v1.2.0
type TextFilterCondition 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"`
IsNotEmpty bool `json:"is_not_empty,omitempty"`
}
type TextProperty ¶
type TextProperty struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Text []RichText `json:"text"`
}
func (TextProperty) GetType ¶
func (p TextProperty) GetType() PropertyType
type TimestampType ¶
type TimestampType string
const ( TimestampCreated TimestampType = "created_time" TimestampLastEdited TimestampType = "last_edited_time" )
type TitleProperty ¶ added in v1.2.0
type TitleProperty struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
Title []RichText `json:"title"`
}
func (TitleProperty) GetType ¶ added in v1.2.0
func (p TitleProperty) GetType() PropertyType
type TitlePropertyConfig ¶ added in v1.2.0
type TitlePropertyConfig struct {
ID PropertyID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
Title RichText `json:"title"`
}
func (TitlePropertyConfig) GetType ¶ added in v1.2.0
func (p TitlePropertyConfig) GetType() PropertyConfigType
type ToDoBlock ¶
type ToDoBlock struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children"`
ToDo struct {
Text []RichText `json:"text"`
Children []Block `json:"children,omitempty"`
Checked bool `json:"checked"`
} `json:"to_do"`
}
type ToggleBlock ¶
type ToggleBlock struct {
Object ObjectType `json:"object"`
ID BlockID `json:"id,omitempty"`
Type BlockType `json:"type"`
CreatedTime *time.Time `json:"created_time,omitempty"`
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
Text []RichText `json:"text"`
Children []Block `json:"children,omitempty"`
Toggle struct {
Text []RichText `json:"text"`
Children []Block `json:"children,omitempty"`
} `json:"toggle"`
}
func (ToggleBlock) GetType ¶
func (b ToggleBlock) GetType() BlockType
type URLProperty ¶
type URLProperty struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyType `json:"type,omitempty"`
URL string `json:"url"`
}
func (URLProperty) GetType ¶
func (p URLProperty) GetType() PropertyType
type URLPropertyConfig ¶ added in v1.2.0
type URLPropertyConfig struct {
ID ObjectID `json:"id,omitempty"`
Type PropertyConfigType `json:"type"`
URL struct{} `json:"url"`
}
func (URLPropertyConfig) GetType ¶ added in v1.2.0
func (p URLPropertyConfig) GetType() PropertyConfigType
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
func (*UserClient) List ¶
func (uc *UserClient) List(ctx context.Context, pagination *Pagination) (*UsersListResponse, error)
type UserService ¶
type UserService interface {
Get(context.Context, UserID) (*User, error)
List(context.Context, *Pagination) (*UsersListResponse, error)
}
type UsersListResponse ¶
type UsersListResponse struct {
Object ObjectType `json:"object"`
Results []User `json:"results"`
HasMore bool `json:"has_more"`
NextCursor Cursor `json:"next_cursor"`
}
Click to show internal directories.
Click to hide internal directories.