Documentation ¶
Index ¶
- Constants
- Variables
- func SetConnectTimeout(duration time.Duration)
- type Annotation
- type Block
- type BlockContent
- type BlockList
- type BlockListOptions
- type BlockService
- type Bot
- type Client
- func (client *Client) Do(ctx context.Context, req *http.Request, mods ...RequestModifier) (*http.Response, error)
- func (client *Client) Get(ctx context.Context, subject interface{}, path string, mods ...RequestModifier) error
- func (client *Client) NewRequest(method string, urlStr string, body interface{}) (*http.Request, error)
- func (client *Client) Patch(ctx context.Context, url string, body interface{}, mods ...RequestModifier) (*http.Response, error)
- func (client *Client) Post(ctx context.Context, url string, body interface{}, mods ...RequestModifier) (*http.Response, error)
- type Database
- type DatabaseListOptions
- type DatabaseQueryOptions
- type DatabaseQueryResults
- type DatabaseService
- type Error
- type FormulaProperty
- type List
- type MultiSelectProperty
- type Object
- type Options
- type Page
- type PageService
- type Person
- type Property
- type RelationProperty
- type RequestModifier
- type RichText
- type RollupProperty
- type SelectOption
- type SelectProperty
- type User
- type UserList
- type UserListOptions
- type UserService
Constants ¶
const ( UserTypePerson = "person" UserTypeBot = "bot" )
Variables ¶
var ( DefaultUserAgent = "go-notion-client" DefaultVersion = "2021-05-13" DefaultBaseUrl = "https://api.notion.com/" DefaultDialer = &net.Dialer{Timeout: 1000 * time.Millisecond} DefaultTransport http.RoundTripper = &http.Transport{Dial: DefaultDialer.Dial, Proxy: http.ProxyFromEnvironment} DefaultClient = &http.Client{Transport: DefaultTransport} DefaultRequestTimeout = 5 * time.Second DefaultRetries = 3 DefaultRetryDelay = 3 * time.Second DefaultRequestRate = 3 DefaultRequestBurst = 5 )
Functions ¶
Types ¶
type Annotation ¶
type Block ¶
type Block struct { ID string `json:"id"` Created time.Time `json:"created_time"` Edited time.Time `json:"last_edited_time"` HasChildren bool `json:"has_children"` Type string `json:"type"` Paragraph BlockContent `json:"paragraph"` HeadingOne BlockContent `json:"heading_1"` HeadingTwo BlockContent `json:"heading_2"` HeadingThree BlockContent `json:"heading_3"` BulletedListItem BlockContent `json:"bulleted_list_item"` Todo BlockContent `json:"to_do"` Toggle BlockContent `json:"toggle"` ChildPage BlockContent `json:"child_page"` // contains filtered or unexported fields }
type BlockContent ¶
type BlockList ¶
type BlockService ¶
type BlockService service
func (*BlockService) All ¶
func (s *BlockService) All(ctx context.Context, id string, options *BlockListOptions) <-chan Block
All allows for ranging over all users, handling pagination internally. If there is an error the User.Error() will return the non-nill error. To prevent leaking resources, either the channel must be read until it closes or the context must be cancelled.
func (*BlockService) Retrieve ¶
func (s *BlockService) Retrieve(ctx context.Context, id string, options *BlockListOptions) (BlockList, error)
Retrieve a user with the given id
type Bot ¶
type Bot struct{}
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Token string Version string Retries int RetryDelay time.Duration RequestRate int RequestBurst int RequestTimeout time.Duration Users *UserService Databases *DatabaseService Pages *PageService Blocks *BlockService // contains filtered or unexported fields }
func (*Client) Do ¶
func (client *Client) Do(ctx context.Context, req *http.Request, mods ...RequestModifier) (*http.Response, error)
Do sends an HTTP request and returns an HTTP response, following the settings configured by the client.
func (*Client) Get ¶
func (*Client) NewRequest ¶
func (*Client) Patch ¶
type Database ¶
type DatabaseListOptions ¶
type DatabaseListOptions = UserListOptions
type DatabaseQueryOptions ¶
type DatabaseQueryResults ¶
type DatabaseService ¶
type DatabaseService service
type Error ¶
type List ¶
type MultiSelectProperty ¶
type MultiSelectProperty struct {
Options []SelectOption
}
type Page ¶
type PageService ¶
type PageService service
type Property ¶
type Property struct { ID string `json:"id"` Type string `json:"type"` Title interface{} `json:"title"` Select SelectProperty `json:"select"` MultiSelect MultiSelectProperty `json:"multi_select"` Date time.Time `json:"date"` People interface{} `json:"people"` File interface{} `json:"file"` Checkbox interface{} `json:"checkbox"` URL interface{} `json:"url"` Email interface{} `json:"email"` PhoneNumber interface{} `json:"phone_number"` Formula FormulaProperty `json:"formula"` Relation RelationProperty `json:"relation"` Rollup RollupProperty `json:"rollup"` CreatedTime interface{} `json:"created_time"` CreatedBy interface{} `json:"created_by"` EditedTime interface{} `json:"edited_time"` EditedBy interface{} `json:"edited_by"` }
type RelationProperty ¶
type RequestModifier ¶
func Accepts ¶
func Accepts(t string) RequestModifier
func ContentType ¶
func ContentType(t string) RequestModifier
func QueryParams ¶
func QueryParams(vals url.Values) RequestModifier
QueryParams adds the given url.Values to the request
func UserAgent ¶
func UserAgent(t string) RequestModifier
type RichText ¶
type RollupProperty ¶
type SelectOption ¶
type SelectProperty ¶
type SelectProperty struct {
Options []SelectOption
}
type User ¶
type UserList ¶
type UserService ¶
type UserService service
func (*UserService) All ¶
func (s *UserService) All(ctx context.Context, options *UserListOptions) <-chan User
All allows for ranging over all users, handling pagination internally. If there is an error the User.Error() will return the non-nill error. To prevent leaking resources, either the channel must be read until it closes or the context must be cancelled.
func (*UserService) List ¶
func (s *UserService) List(ctx context.Context, options *UserListOptions) (UserList, error)
List the users. This is a paginated resource, see: https://developers.notion.com/reference/get-users