notion

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 8 Imported by: 0

README

notion-go

Go Report Card Actions Status codecov

Go Reference GitHub go.mod Go version License

A go client for the Notion API

Description

This aims to be an unofficial Go version of the official SDK which is written in JavaScript.

Installation

go get -u github.com/mkfsn/notion-go

Usage

c := notion.New("<NOTION_AUTH_TOKEN>")

// Retrieve block children
c.Blocks().Children().List(context.Background(), notion.BlocksChildrenListParameters{...})

// Append block children
c.Blocks().Children().Append(context.Background(), notion.BlocksChildrenAppendParameters{...})

// List databases
c.Databases().List(context.Background(), notion.DatabasesListParameters{...})

// Query a database
c.Databases().Query(context.Background(), notion.DatabasesQueryParameters{...})

// Retrieve a database
c.Databases().Retrieve(context.Background(), notion.DatabasesRetrieveParameters{...})

// Create a page
c.Pages().Create(context.Background(), notion.PagesCreateParameters{...})

// Retrieve a page
c.Pages().Retreive(context.Background(), notion.PagesRetrieveParameters{...})

// Update page properties
c.Pages().Update(context.Background(), notion.PagesUpdateParameters{...})

// List all users
c.Users().List(context.Background(), notion.UsersListParameters{...})

// Retrieve a user
c.Users().Retrieve(context.Background(), notion.UsersRetrieveParameters{...})

// Search
c.Search(context.Background(), notion.SearchParameters{...})

For more information, please see examples.

Supported Features

This client supports all endpoints in the Notion API.

Documentation

Index

Constants

View Source
const (
	APIBaseURL                      = "https://api.notion.com"
	APIUsersListEndpoint            = "/v1/users"
	APIUsersRetrieveEndpoint        = "/v1/users/{user_id}"
	APIBlocksListChildrenEndpoint   = "/v1/blocks/{block_id}/children"
	APIBlocksAppendChildrenEndpoint = "/v1/blocks/{block_id}/children"
	APIPagesCreateEndpoint          = "/v1/pages"
	APIPagesRetrieveEndpoint        = "/v1/pages/{page_id}"
	APIPagesUpdateEndpoint          = "/v1/pages/{page_id}"
	APIDatabasesListEndpoint        = "/v1/databases"
	APIDatabasesRetrieveEndpoint    = "/v1/databases/{database_id}"
	APIDatabasesQueryEndpoint       = "/v1/databases/{database_id}/query"
	APISearchEndpoint               = "/v1/search"
)
View Source
const (
	DefaultNotionVersion = "2021-05-13"
	DefaultUserAgent     = "mkfsn/notion-go"
)

Variables

View Source
var (
	ErrUnknown = errors.New("unknown")
)

Functions

This section is empty.

Types

type API

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

func New

func New(authToken string, setters ...APISetting) *API

func (*API) Blocks

func (c *API) Blocks() BlocksInterface

func (*API) Databases

func (c *API) Databases() DatabasesInterface

func (*API) Pages

func (c *API) Pages() PagesInterface

func (*API) Search

func (c *API) Search(ctx context.Context, params SearchParameters) (*SearchResponse, error)

func (*API) Users

func (c *API) Users() UsersInterface

type APISetting added in v0.2.0

type APISetting func(o *apiSettings)

func WithBaseURL

func WithBaseURL(baseURL string) APISetting

func WithHTTPClient added in v0.2.0

func WithHTTPClient(httpClient *http.Client) APISetting

func WithNotionVersion

func WithNotionVersion(notionVersion string) APISetting

func WithUserAgent added in v0.2.0

func WithUserAgent(userAgent string) APISetting

type Annotations

type Annotations struct {
	// Whether the text is **bolded**.
	Bold bool `json:"bold"`
	// Whether the text is _italicized_.
	Italic bool `json:"italic"`
	// Whether the text is ~~struck~~ through.
	Strikethrough bool `json:"strikethrough"`
	// Whether the text is __underlined__.
	Underline bool `json:"underline"`
	// Whether the text is `code style`.
	Code bool `json:"code"`
	// Color of the text.
	Color Color `json:"color"`
}

type ArrayRollupValue

type ArrayRollupValue struct {
	Array []interface{} `json:"array"`
	// contains filtered or unexported fields
}

type BaseRichText

type BaseRichText struct {
	// The plain text without annotations.
	PlainText string `json:"plain_text,omitempty"`
	// (Optional) The URL of any link or internal Notion mention in this text, if any.
	Href string `json:"href,omitempty"`
	// Type of this rich text object.
	Type RichTextType `json:"type,omitempty"`
	// All annotations that apply to this rich text.
	// Annotations include colors and bold/italics/underline/strikethrough.
	Annotations *Annotations `json:"annotations,omitempty"`
}

type Block

type Block interface {
	// contains filtered or unexported methods
}

type BlockBase

type BlockBase struct {
	// Always "block".
	Object ObjectType `json:"object"`
	// Identifier for the block.
	ID string `json:"id,omitempty"`
	// Type of block.
	Type BlockType `json:"type"`
	// Date and time when this block was created. Formatted as an ISO 8601 date time string.
	CreatedTime *time.Time `json:"created_time,omitempty"`
	// Date and time when this block was last updated. Formatted as an ISO 8601 date time string.
	LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
	// Whether or not the block has children blocks nested within it.
	HasChildren bool `json:"has_children,omitempty"`
}

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 BlocksChildrenAppendParameters

type BlocksChildrenAppendParameters struct {
	// Identifier for a block
	BlockID string `json:"-" url:"-"`
	// Child content to append to a container block as an array of block objects
	Children []Block `json:"children"  url:"-"`
}

type BlocksChildrenAppendResponse

type BlocksChildrenAppendResponse struct {
	Block
}

func (*BlocksChildrenAppendResponse) UnmarshalJSON

func (b *BlocksChildrenAppendResponse) UnmarshalJSON(data []byte) error

type BlocksChildrenListParameters

type BlocksChildrenListParameters struct {
	PaginationParameters

	// Identifier for a block
	BlockID string `json:"-" url:"-"`
}

type BlocksChildrenListResponse

type BlocksChildrenListResponse struct {
	PaginatedList
	Results []Block `json:"results"`
}

func (*BlocksChildrenListResponse) UnmarshalJSON

func (b *BlocksChildrenListResponse) UnmarshalJSON(data []byte) error

type BlocksInterface

type BlocksInterface interface {
	Children() BlocksChildrenInterface
}

type BooleanFormulaValue

type BooleanFormulaValue struct {
	Boolean bool `json:"boolean"`
	// contains filtered or unexported fields
}

type Bot added in v0.2.0

type Bot struct{}

type BotUser

type BotUser struct {
	Bot Bot `json:"bot"`
	// contains filtered or unexported fields
}

type BulletedListItemBlock

type BulletedListItemBlock struct {
	BlockBase
	BulletedListItem RichTextBlock `json:"bulleted_list_item"`
}

type CheckboxFilter

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

type CheckboxProperty

type CheckboxProperty struct {
	Checkbox interface{} `json:"checkbox"`
	// contains filtered or unexported fields
}

type CheckboxPropertyValue

type CheckboxPropertyValue struct {
	Checkbox bool `json:"checkbox"`
	// contains filtered or unexported fields
}

type ChildPageBlock

type ChildPageBlock struct {
	BlockBase
	ChildPage TitleBlock `json:"child_page"`
}

type Color

type Color string
const (
	ColorDefault          Color = "default"
	ColorGray             Color = "gray"
	ColorBrown            Color = "brown"
	ColorOrange           Color = "orange"
	ColorYellow           Color = "yellow"
	ColorGreen            Color = "green"
	ColorBlue             Color = "blue"
	ColorPurple           Color = "purple"
	ColorPink             Color = "pink"
	ColorRed              Color = "red"
	BackgroundColorGray   Color = "gray_background"
	BackgroundColorBrown  Color = "brown_background"
	BackgroundColorOrange Color = "orange_background"
	BackgroundColorYellow Color = "yellow_background"
	BackgroundColorGreen  Color = "green_background"
	BackgroundColorBlue   Color = "blue_background"
	BackgroundColorPurple Color = "purple_background"
	BackgroundColorPink   Color = "pink_background"
	BackgroundColorRed    Color = "red_background"
)

type CompoundFilter

type CompoundFilter struct {
	Or  []Filter `json:"or,omitempty"`
	And []Filter `json:"and,omitempty"`
}

type CreatedByProperty

type CreatedByProperty struct {
	CreatedBy interface{} `json:"created_by"`
	// contains filtered or unexported fields
}

type CreatedByPropertyValue

type CreatedByPropertyValue struct {
	CreatedBy User `json:"created_by"`
	// contains filtered or unexported fields
}

type CreatedTimeProperty

type CreatedTimeProperty struct {
	CreatedTime interface{} `json:"created_time"`
	// contains filtered or unexported fields
}

type CreatedTimePropertyValue

type CreatedTimePropertyValue struct {
	CreatedTime time.Time `json:"created_time"`
	// contains filtered or unexported fields
}

type Database

type Database struct {
	Object ObjectType `json:"object"`
	ID     string     `json:"id"`

	CreatedTime    time.Time           `json:"created_time"`
	LastEditedTime time.Time           `json:"last_edited_time"`
	Title          []RichText          `json:"title"`
	Properties     map[string]Property `json:"properties"`
}

func (*Database) UnmarshalJSON

func (d *Database) UnmarshalJSON(data []byte) error

type DatabaseMention

type DatabaseMention struct {
	Database struct {
		ID string `json:"id"`
	} `json:"database"`
	// contains filtered or unexported fields
}

type DatabaseParent

type DatabaseParent struct {
	DatabaseID string `json:"database_id"`
	// contains filtered or unexported fields
}

type DatabaseParentInput

type DatabaseParentInput struct {
	DatabaseID string `json:"database_id"`
	// contains filtered or unexported fields
}

type DatabasesListParameters

type DatabasesListParameters struct {
	PaginationParameters
}

type DatabasesListResponse

type DatabasesListResponse struct {
	PaginatedList
	Results []Database `json:"results"`
}

type DatabasesQueryParameters

type DatabasesQueryParameters struct {
	PaginationParameters
	// Identifier for a Notion database.
	DatabaseID string `json:"-" url:"-"`
	// When supplied, limits which pages are returned based on the
	// [filter conditions](https://developers.com/reference-link/post-database-query-filter).
	Filter Filter `json:"filter,omitempty" url:"-"`
	// When supplied, orders the results based on the provided
	// [sort criteria](https://developers.com/reference-link/post-database-query-sort).
	Sorts []Sort `json:"sorts,omitempty" url:"-"`
}

type DatabasesQueryResponse

type DatabasesQueryResponse struct {
	PaginatedList
	Results []Page `json:"results"`
}

type DatabasesRetrieveParameters

type DatabasesRetrieveParameters struct {
	DatabaseID string `json:"-" url:"-"`
}

type DatabasesRetrieveResponse

type DatabasesRetrieveResponse struct {
	Database
}

type Date added in v0.2.0

type Date struct {
	Start string  `json:"start"`
	End   *string `json:"end"`
}

type DateFilter

type DateFilter 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   map[string]interface{} `json:"past_week,omitempty"`
	PastMonth  map[string]interface{} `json:"past_month,omitempty"`
	PastYear   map[string]interface{} `json:"past_year,omitempty"`
	NextWeek   map[string]interface{} `json:"next_week,omitempty"`
	NextMonth  map[string]interface{} `json:"next_month,omitempty"`
	NextYear   map[string]interface{} `json:"next_year,omitempty"`
}

type DateFormulaValue

type DateFormulaValue struct {
	Date DatePropertyValue `json:"date"`
	// contains filtered or unexported fields
}

type DateMention

type DateMention struct {
	Date DatePropertyValue `json:"date"`
	// contains filtered or unexported fields
}

type DateProperty

type DateProperty struct {
	Date interface{} `json:"date"`
	// contains filtered or unexported fields
}

type DatePropertyValue

type DatePropertyValue struct {
	Date Date `json:"date"`
	// contains filtered or unexported fields
}

type DateRollupValue

type DateRollupValue struct {
	Date DatePropertyValue `json:"date"`
	// contains filtered or unexported fields
}

type EmailProperty

type EmailProperty struct {
	Email interface{} `json:"email"`
	// contains filtered or unexported fields
}

type EmailPropertyValue

type EmailPropertyValue struct {
	Email string `json:"email"`
	// contains filtered or unexported fields
}

type EquationObject

type EquationObject struct {
	Expression string `json:"expression"`
}

type ErrorCode added in v0.2.0

type ErrorCode string

ErrorCode https://developers.notion.com/reference/errors

const (
	ErrorCodeInvalidJSON         ErrorCode = "invalid_json"
	ErrorCodeInvalidRequestURI   ErrorCode = "invalid_request_url"
	ErrorCodeInvalidRequest      ErrorCode = "invalid_request"
	ErrorCodeValidationError     ErrorCode = "validation_error"
	ErrorCodeUnauthorized        ErrorCode = "unauthorized"
	ErrorCodeRestrictedResource  ErrorCode = "restricted_resource"
	ErrorCodeObjectNotFound      ErrorCode = "object_not_found"
	ErrorCodeConflictError       ErrorCode = "conflict_error"
	ErrorCodeRateLimited         ErrorCode = "rate_limited"
	ErrorCodeInternalServerError ErrorCode = "internal_server_error"
	ErrorCodeServiceUnavailable  ErrorCode = "service_unavailable"
)

type File added in v0.2.0

type File struct {
	Name string `json:"name"`
}

type FileProperty

type FileProperty struct {
	File interface{} `json:"file"`
	// contains filtered or unexported fields
}

type FilesFilter

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

type FilesPropertyValue

type FilesPropertyValue struct {
	Files []File `json:"files"`
	// contains filtered or unexported fields
}

type Filter

type Filter interface {
	// contains filtered or unexported methods
}

type Formula added in v0.2.0

type Formula struct {
	Expression string `json:"expression"`
}

type FormulaFilter

type FormulaFilter struct {
	Text     *TextFilter     `json:"text,omitempty"`
	Checkbox *CheckboxFilter `json:"checkbox,omitempty"`
	Number   *NumberFilter   `json:"number,omitempty"`
	Date     *DateFilter     `json:"date,omitempty"`
}

type FormulaProperty

type FormulaProperty struct {
	Formula Formula `json:"formula"`
	// contains filtered or unexported fields
}

type FormulaPropertyValue

type FormulaPropertyValue struct {
	Formula FormulaValue `json:"formula"`
	// contains filtered or unexported fields
}

func (*FormulaPropertyValue) UnmarshalJSON

func (f *FormulaPropertyValue) UnmarshalJSON(data []byte) error

type FormulaValue

type FormulaValue interface {
	// contains filtered or unexported methods
}

type FormulaValueType

type FormulaValueType string
const (
	FormulaValueTypeString  FormulaValueType = "string"
	FormulaValueTypeNumber  FormulaValueType = "number"
	FormulaValueTypeBoolean FormulaValueType = "boolean"
	FormulaValueTypeDate    FormulaValueType = "date"
)

type HTTPError

type HTTPError struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

func (HTTPError) Error

func (e HTTPError) Error() string

type Heading1Block

type Heading1Block struct {
	BlockBase
	Heading1 HeadingBlock `json:"heading_1"`
}

type Heading2Block

type Heading2Block struct {
	BlockBase
	Heading2 HeadingBlock `json:"heading_2"`
}

type Heading3Block

type Heading3Block struct {
	BlockBase
	Heading3 HeadingBlock `json:"heading_3"`
}

type HeadingBlock

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

func (*HeadingBlock) UnmarshalJSON added in v0.2.0

func (h *HeadingBlock) UnmarshalJSON(data []byte) error

type LastEditedByProperty

type LastEditedByProperty struct {
	LastEditedBy interface{} `json:"last_edited_by"`
	// contains filtered or unexported fields
}

type LastEditedByPropertyValue

type LastEditedByPropertyValue struct {
	LastEditedBy User `json:"last_edited_by"`
	// contains filtered or unexported fields
}

type LastEditedTimeProperty

type LastEditedTimeProperty struct {
	LastEditedTime interface{} `json:"last_edited_time"`
	// contains filtered or unexported fields
}

type LastEditedTimePropertyValue

type LastEditedTimePropertyValue struct {
	LastEditedTime time.Time `json:"last_edited_time"`
	// contains filtered or unexported fields
}
type Link struct {
	// TODO: What is this? Is this still in used?
	Type string `json:"type,omitempty"`
	URL  string `json:"url"`
}

type Mention

type Mention interface {
	// contains filtered or unexported methods
}

type MultiSelectFilter

type MultiSelectFilter 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 MultiSelectOption

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

type MultiSelectProperty

type MultiSelectProperty struct {
	MultiSelect MultiSelectPropertyOption `json:"multi_select"`
	// contains filtered or unexported fields
}

type MultiSelectPropertyOption added in v0.2.0

type MultiSelectPropertyOption struct {
	Options []MultiSelectOption `json:"options"`
}

type MultiSelectPropertyValue

type MultiSelectPropertyValue struct {
	MultiSelect []MultiSelectPropertyValueOption `json:"multi_select"`
	// contains filtered or unexported fields
}

type MultiSelectPropertyValueOption

type MultiSelectPropertyValueOption struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color Color  `json:"color"`
}

type NumberFilter

type NumberFilter 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,omitempty"`
	LessThanOrEqualTo    *float64 `json:"less_than_or_equal_to,omitempty"`
	IsEmpty              bool     `json:"is_empty,omitempty"`
	IsNotEmpty           bool     `json:"is_not_empty,omitempty"`
}

type NumberFormat

type NumberFormat string
const (
	NumberFormatNumber           NumberFormat = "number"
	NumberFormatNumberWithCommas NumberFormat = "number_with_commas"
	NumberFormatPercent          NumberFormat = "percent"
	NumberFormatDollar           NumberFormat = "dollar"
	NumberFormatEuro             NumberFormat = "euro"
	NumberFormatPound            NumberFormat = "pound"
	NumberFormatYen              NumberFormat = "yen"
	NumberFormatRuble            NumberFormat = "ruble"
	NumberFormatRupee            NumberFormat = "rupee"
	NumberFormatWon              NumberFormat = "won"
	NumberFormatYuan             NumberFormat = "yuan"
)

type NumberFormulaValue

type NumberFormulaValue struct {
	Number *float64 `json:"number"`
	// contains filtered or unexported fields
}

type NumberProperty

type NumberProperty struct {
	Number NumberPropertyOption `json:"number"`
	// contains filtered or unexported fields
}

type NumberPropertyOption added in v0.2.0

type NumberPropertyOption struct {
	Format NumberFormat `json:"format"`
}

type NumberPropertyValue

type NumberPropertyValue struct {
	Number float64 `json:"number"`
	// contains filtered or unexported fields
}

type NumberRollupValue

type NumberRollupValue struct {
	Number float64 `json:"number"`
	// contains filtered or unexported fields
}

type NumberedListItemBlock

type NumberedListItemBlock struct {
	BlockBase
	NumberedListItem RichTextBlock `json:"numbered_list_item"`
}

type ObjectType

type ObjectType string
const (
	ObjectTypeBlock    ObjectType = "block"
	ObjectTypePage     ObjectType = "page"
	ObjectTypeDatabase ObjectType = "database"
	ObjectTypeList     ObjectType = "list"
	ObjectTypeUser     ObjectType = "user"
)

type Page

type Page struct {
	// Always "page".
	Object ObjectType `json:"object"`
	// Unique identifier of the page.
	ID string `json:"id"`
	// The page's parent
	Parent Parent `json:"parent"`
	// Property values of this page.
	Properties map[string]PropertyValue `json:"properties"`
	// Date and time when this page was created. Formatted as an ISO 8601 date time string.
	CreatedTime time.Time `json:"created_time"`
	// Date and time when this page was updated. Formatted as an ISO 8601 date time string.
	LastEditedTime time.Time `json:"last_edited_time"`
	// The archived status of the page.
	Archived bool `json:"archived"`
}

func (*Page) UnmarshalJSON

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

type PageMention

type PageMention struct {
	Page struct {
		ID string `json:"id"`
	} `json:"page"`
	// contains filtered or unexported fields
}

type PageParent

type PageParent struct {
	PageID string `json:"page_id"`
	// contains filtered or unexported fields
}

type PageParentInput

type PageParentInput struct {
	PageID string `json:"page_id"`
	// contains filtered or unexported fields
}

type PageReference added in v0.2.0

type PageReference struct {
	ID string `json:"id"`
}

type PagesCreateParameters

type PagesCreateParameters struct {
	// A DatabaseParentInput or PageParentInput
	Parent ParentInput `json:"parent" url:"-"`
	// Property values of this page. The keys are the names or IDs of the property and the values are property values.
	Properties map[string]PropertyValue `json:"properties" url:"-"`
	// Page content for the new page as an array of block objects
	Children []Block `json:"children,omitempty" url:"-"`
}

type PagesCreateResponse

type PagesCreateResponse struct {
	Page
}

type PagesRetrieveParameters

type PagesRetrieveParameters struct {
	PageID string `json:"-" url:"-"`
}

type PagesRetrieveResponse

type PagesRetrieveResponse struct {
	Page
}

type PagesUpdateParameters

type PagesUpdateParameters struct {
	PageID     string                   `json:"-" url:"-"`
	Properties map[string]PropertyValue `json:"properties" url:"-"`
}

type PagesUpdateResponse

type PagesUpdateResponse struct {
	Page
}

type PaginatedList

type PaginatedList struct {
	Object     ObjectType `json:"object"`
	HasMore    bool       `json:"has_more"`
	NextCursor string     `json:"next_cursor"`
}

type PaginationParameters

type PaginationParameters struct {
	// If supplied, this endpoint will return a page of results starting after the cursor provided.
	// If not supplied, this endpoint will return the first page of results.
	StartCursor string `json:"-" url:"start_cursor,omitempty"`
	// The number of items from the full list desired in the response. Maximum: 100
	PageSize int32 `json:"-" url:"page_size,omitempty"`
}

type ParagraphBlock

type ParagraphBlock struct {
	BlockBase
	Paragraph RichTextBlock `json:"paragraph"`
}

type Parent

type Parent interface {
	// contains filtered or unexported methods
}

type ParentInput

type ParentInput interface {
	// contains filtered or unexported methods
}

type ParentType

type ParentType string
const (
	ParentTypeDatabase  ParentType = "database_id"
	ParentTypePage      ParentType = "page"
	ParentTypeWorkspace ParentType = "workspace"
)

type PeopleFilter

type PeopleFilter 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 PeopleProperty

type PeopleProperty struct {
	People interface{} `json:"people"`
	// contains filtered or unexported fields
}

type PeoplePropertyValue

type PeoplePropertyValue struct {
	People []User `json:"people"`
	// contains filtered or unexported fields
}

type Person added in v0.2.0

type Person struct {
	Email string `json:"email"`
}

type PersonUser

type PersonUser struct {
	Person Person `json:"person"`
	// contains filtered or unexported fields
}

type PhoneNumberProperty

type PhoneNumberProperty struct {
	PhoneNumber interface{} `json:"phone_number"`
	// contains filtered or unexported fields
}

type PhoneNumberPropertyValue

type PhoneNumberPropertyValue struct {
	PhoneNumber string `json:"phone_number"`
	// contains filtered or unexported fields
}

type Property

type Property interface {
	// contains filtered or unexported methods
}

type PropertyType

type PropertyType string
const (
	PropertyTypeTitle          PropertyType = "title"
	PropertyTypeRichText       PropertyType = "rich_text"
	PropertyTypeNumber         PropertyType = "number"
	PropertyTypeSelect         PropertyType = "select"
	PropertyTypeMultiSelect    PropertyType = "multi_select"
	PropertyTypeDate           PropertyType = "date"
	PropertyTypePeople         PropertyType = "people"
	PropertyTypeFile           PropertyType = "file"
	PropertyTypeCheckbox       PropertyType = "checkbox"
	PropertyTypeURL            PropertyType = "url"
	PropertyTypeEmail          PropertyType = "email"
	PropertyTypePhoneNumber    PropertyType = "phone_number"
	PropertyTypeFormula        PropertyType = "formula"
	PropertyTypeRelation       PropertyType = "relation"
	PropertyTypeRollup         PropertyType = "rollup"
	PropertyTypeCreatedTime    PropertyType = "created_time"
	PropertyTypeCreatedBy      PropertyType = "created_by"
	PropertyTypeLastEditedTime PropertyType = "last_edited_time"
	PropertyTypeLastEditedBy   PropertyType = "last_edited_by"
)

type PropertyValue

type PropertyValue interface {
	// contains filtered or unexported methods
}

type PropertyValueType

type PropertyValueType string
const (
	PropertyValueTypeRichText       PropertyValueType = "rich_text"
	PropertyValueTypeNumber         PropertyValueType = "number"
	PropertyValueTypeSelect         PropertyValueType = "select"
	PropertyValueTypeMultiSelect    PropertyValueType = "multi_select"
	PropertyValueTypeDate           PropertyValueType = "date"
	PropertyValueTypeFormula        PropertyValueType = "formula"
	PropertyValueTypeRelation       PropertyValueType = "relation"
	PropertyValueTypeRollup         PropertyValueType = "rollup"
	PropertyValueTypeTitle          PropertyValueType = "title"
	PropertyValueTypePeople         PropertyValueType = "people"
	PropertyValueTypeFiles          PropertyValueType = "files"
	PropertyValueTypeCheckbox       PropertyValueType = "checkbox"
	PropertyValueTypeURL            PropertyValueType = "url"
	PropertyValueTypeEmail          PropertyValueType = "email"
	PropertyValueTypePhoneNumber    PropertyValueType = "phone_number"
	PropertyValueTypeCreatedTime    PropertyValueType = "created_time"
	PropertyValueTypeCreatedBy      PropertyValueType = "created_by"
	PropertyValueTypeLastEditedTime PropertyValueType = "last_edited_time"
	PropertyValueTypeLastEditedBy   PropertyValueType = "last_edited_by"
)

type Relation added in v0.2.0

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

type RelationFilter

type RelationFilter 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 RelationProperty

type RelationProperty struct {
	Relation Relation `json:"relation"`
	// contains filtered or unexported fields
}

type RelationPropertyValue added in v0.2.0

type RelationPropertyValue struct {
	Relation []PageReference `json:"relation"`
	// contains filtered or unexported fields
}

type RichText

type RichText interface {
	// contains filtered or unexported methods
}

type RichTextBlock

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

func (*RichTextBlock) UnmarshalJSON added in v0.2.0

func (r *RichTextBlock) UnmarshalJSON(data []byte) error

type RichTextEquation

type RichTextEquation struct {
	BaseRichText
	Equation EquationObject `json:"equation"`
}

type RichTextMention

type RichTextMention struct {
	BaseRichText
	Mention Mention `json:"mention"`
}

type RichTextProperty

type RichTextProperty struct {
	RichText interface{} `json:"rich_text"`
	// contains filtered or unexported fields
}

type RichTextPropertyValue

type RichTextPropertyValue struct {
	RichText []RichText `json:"rich_text"`
	// contains filtered or unexported fields
}

func (*RichTextPropertyValue) UnmarshalJSON

func (r *RichTextPropertyValue) UnmarshalJSON(data []byte) error

type RichTextText

type RichTextText struct {
	BaseRichText
	Text TextObject `json:"text"`
}

type RichTextType

type RichTextType string
const (
	RichTextTypeText     RichTextType = "text"
	RichTextTypeMention  RichTextType = "mention"
	RichTextTypeEquation RichTextType = "equation"
)

type RichTextWithCheckBlock

type RichTextWithCheckBlock struct {
	Text     []RichText  `json:"text"`
	Checked  bool        `json:"checked"`
	Children []BlockBase `json:"children"`
}

type RollupFunction

type RollupFunction string
const (
	RollupFunctionCountAll          RollupFunction = "count_all"
	RollupFunctionCountValues       RollupFunction = "count_values"
	RollupFunctionCountUniqueValues RollupFunction = "count_unique_values"
	RollupFunctionCountEmpty        RollupFunction = "count_empty"
	RollupFunctionCountNotEmpty     RollupFunction = "count_not_empty"
	RollupFunctionPercentEmpty      RollupFunction = "percent_empty"
	RollupFunctionPercentNotEmpty   RollupFunction = "percent_not_empty"
	RollupFunctionSum               RollupFunction = "sum"
	RollupFunctionAverage           RollupFunction = "average"
	RollupFunctionMedian            RollupFunction = "median"
	RollupFunctionMin               RollupFunction = "min"
	RollupFunctionMax               RollupFunction = "max"
	RollupFunctionRange             RollupFunction = "range"
)

type RollupProperty

type RollupProperty struct {
	Rollup RollupPropertyOption `json:"rollup"`
	// contains filtered or unexported fields
}

type RollupPropertyOption added in v0.2.0

type RollupPropertyOption struct {
	RelationPropertyName string         `json:"relation_property_name"`
	RelationPropertyID   string         `json:"relation_property_id"`
	RollupPropertyName   string         `json:"rollup_property_name"`
	RollupPropertyID     string         `json:"rollup_property_id"`
	Function             RollupFunction `json:"function"`
}

type RollupPropertyValue

type RollupPropertyValue struct {
	Rollup RollupValueType `json:"rollup"`
	// contains filtered or unexported fields
}

type RollupValueType

type RollupValueType interface {
	// contains filtered or unexported methods
}

type SearchFilter

type SearchFilter struct {
	// The value of the property to filter the results by. Possible values for object type include `page` or `database`.
	// Limitation: Currently the only filter allowed is object which will filter by type of `object`
	// (either `page` or `database`)
	Value SearchFilterValue `json:"value"`
	// The name of the property to filter by. Currently the only property you can filter by is the object type.
	// Possible values include `object`. Limitation: Currently the only filter allowed is `object` which will
	// filter by type of object (either `page` or `database`)
	Property SearchFilterProperty `json:"property"`
}

type SearchFilterProperty

type SearchFilterProperty string
const (
	SearchFilterPropertyObject SearchFilterProperty = "object"
)

type SearchFilterValue

type SearchFilterValue string
const (
	SearchFilterValuePage     SearchFilterValue = "page"
	SearchFilterValueDatabase SearchFilterValue = "database"
)

type SearchInterface

type SearchInterface interface {
	Search(ctx context.Context, params SearchParameters) (*SearchResponse, error)
}

type SearchParameters

type SearchParameters struct {
	PaginationParameters
	Query  string       `json:"query" url:"-"`
	Sort   SearchSort   `json:"sort" url:"-"`
	Filter SearchFilter `json:"filter" url:"-"`
}

type SearchResponse

type SearchResponse struct {
	PaginatedList
	Results []SearchableObject `json:"results"`
}

func (*SearchResponse) UnmarshalJSON

func (s *SearchResponse) UnmarshalJSON(data []byte) error

type SearchSort

type SearchSort struct {
	// The direction to sort.
	Direction SearchSortDirection `json:"direction"`
	// The name of the timestamp to sort against. Possible values include `last_edited_time`.
	Timestamp SearchSortTimestamp `json:"timestamp"`
}

type SearchSortDirection

type SearchSortDirection string
const (
	SearchSortDirectionAscending  SearchSortDirection = "ascending"
	SearchSortDirectionDescending SearchSortDirection = " descending"
)

type SearchSortTimestamp

type SearchSortTimestamp string
const (
	SearchSortTimestampLastEditedTime SearchSortTimestamp = "last_edited_time"
)

type SearchableObject

type SearchableObject interface {
	// contains filtered or unexported methods
}

type SelectFilter

type SelectFilter struct {
	Equals       *string `json:"equals,omitempty"`
	DoesNotEqual *string `json:"does_not_equal,omitempty"`
	IsEmpty      bool    `json:"is_empty,omitempty"`
	IsNotEmpty   bool    `json:"is_not_empty,omitempty"`
}

type SelectOption

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

type SelectProperty

type SelectProperty struct {
	Select SelectPropertyOption `json:"select"`
	// contains filtered or unexported fields
}

type SelectPropertyOption added in v0.2.0

type SelectPropertyOption struct {
	Options []SelectOption `json:"options"`
}

type SelectPropertyValue

type SelectPropertyValue struct {
	Select SelectPropertyValueOption `json:"select"`
	// contains filtered or unexported fields
}

type SelectPropertyValueOption

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

type SingleCheckboxFilter

type SingleCheckboxFilter struct {
	SinglePropertyFilter
	Checkbox CheckboxFilter `json:"checkbox"`
}

SingleCheckboxFilter is a checkbox filter condition applies to database properties of type "checkbox".

type SingleDateFilter

type SingleDateFilter struct {
	SinglePropertyFilter
	Date           *DateFilter `json:"date,omitempty"`
	CreatedTime    *DateFilter `json:"created_time,omitempty"`
	LastEditedTime *DateFilter `json:"last_edited_time,omitempty"`
}

SingleDateFilter is a date filter condition applies to database properties of types "date", "created_time", and "last_edited_time".

type SingleFilesFilter

type SingleFilesFilter struct {
	SinglePropertyFilter
	Files FilesFilter `json:"files"`
}

SingleFilesFilter is a files filter condition applies to database properties of type "files".

type SingleFormulaFilter

type SingleFormulaFilter struct {
	SinglePropertyFilter
	Formula FormulaFilter `json:"formula"`
}

SingleFormulaFilter is a formula filter condition applies to database properties of type "formula".

type SingleMultiSelectFilter

type SingleMultiSelectFilter struct {
	SinglePropertyFilter
	MultiSelect MultiSelectFilter `json:"multi_select"`
}

SingleMultiSelectFilter is a multi-select filter condition applies to database properties of type "multi_select".

type SingleNumberFilter

type SingleNumberFilter struct {
	SinglePropertyFilter
	Number NumberFilter `json:"number"`
}

SingleNumberFilter is a number filter condition applies to database properties of type "number".

type SinglePeopleFilter

type SinglePeopleFilter struct {
	SinglePropertyFilter
	People       *PeopleFilter `json:"people,omitempty"`
	CreatedBy    *PeopleFilter `json:"created_by,omitempty"`
	LastEditedBy *PeopleFilter `json:"last_edited_by,omitempty"`
}

SinglePeopleFilter is a people filter condition applies to database properties of types "people", "created_by", and "last_edited_by".

type SinglePropertyFilter

type SinglePropertyFilter struct {
	Property string `json:"property"`
}

type SingleRelationFilter

type SingleRelationFilter struct {
	SinglePropertyFilter
	Relation RelationFilter `json:"relation"`
}

SingleRelationFilter is a relation filter condition applies to database properties of type "relation".

type SingleSelectFilter

type SingleSelectFilter struct {
	SinglePropertyFilter
	Select SelectFilter `json:"select"`
}

SingleSelectFilter is a select filter condition applies to database properties of type "select".

type SingleTextFilter

type SingleTextFilter struct {
	SinglePropertyFilter
	Text     *TextFilter `json:"text,omitempty"`
	RichText *TextFilter `json:"rich_text,omitempty"`
	URL      *TextFilter `json:"url,omitempty"`
	Email    *TextFilter `json:"email,omitempty"`
	Phone    *TextFilter `json:"phone,omitempty"`
}

SingleTextFilter is a text filter condition applies to database properties of types "title", "rich_text", "url", "email", and "phone".

type Sort

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

type SortDirection

type SortDirection string
const (
	SortDirectionAscending  SortDirection = "ascending"
	SortDirectionDescending SortDirection = "descending"
)

type SortTimestamp

type SortTimestamp string
const (
	SortTimestampByCreatedTime    SortTimestamp = "created_time"
	SortTimestampByLastEditedTime SortTimestamp = "last_edited_time"
)

type StringFormulaValue

type StringFormulaValue struct {
	String *string `json:"string"`
	// contains filtered or unexported fields
}

type TextFilter

type TextFilter 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 TextObject

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

type TitleBlock

type TitleBlock struct {
	Title string `json:"title"`
}

type TitleProperty

type TitleProperty struct {
	Title interface{} `json:"title"`
	// contains filtered or unexported fields
}

type TitlePropertyValue

type TitlePropertyValue struct {
	Title []RichText `json:"title"`
	// contains filtered or unexported fields
}

func (*TitlePropertyValue) UnmarshalJSON

func (t *TitlePropertyValue) UnmarshalJSON(data []byte) error

type ToDoBlock

type ToDoBlock struct {
	BlockBase
	ToDo RichTextWithCheckBlock `json:"todo"`
}

type ToggleBlock

type ToggleBlock struct {
	BlockBase
	Toggle RichTextBlock `json:"toggle"`
}

type URLProperty

type URLProperty struct {
	URL interface{} `json:"url"`
	// contains filtered or unexported fields
}

type URLPropertyValue

type URLPropertyValue struct {
	URL string `json:"url"`
	// contains filtered or unexported fields
}

type UnsupportedBlock

type UnsupportedBlock struct {
	BlockBase
}

type User

type User interface {
	// contains filtered or unexported methods
}

type UserMention

type UserMention struct {
	User User `json:"user"`
	// contains filtered or unexported fields
}

type UserType

type UserType string
const (
	UserTypePerson UserType = "person"
	UserTypeBot    UserType = "bot"
)

type UsersInterface

type UsersInterface interface {
	Retrieve(ctx context.Context, params UsersRetrieveParameters) (*UsersRetrieveResponse, error)
	List(ctx context.Context, params UsersListParameters) (*UsersListResponse, error)
}

type UsersListParameters

type UsersListParameters struct {
	PaginationParameters
}

type UsersListResponse

type UsersListResponse struct {
	PaginatedList
	Results []User `json:"results"`
}

func (*UsersListResponse) UnmarshalJSON

func (u *UsersListResponse) UnmarshalJSON(data []byte) error

type UsersRetrieveParameters

type UsersRetrieveParameters struct {
	UserID string `json:"-" url:"-"`
}

type UsersRetrieveResponse

type UsersRetrieveResponse struct {
	User
}

func (*UsersRetrieveResponse) UnmarshalJSON

func (u *UsersRetrieveResponse) UnmarshalJSON(data []byte) (err error)

type WorkspaceParent

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

Jump to

Keyboard shortcuts

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