Documentation
¶
Index ¶
- Constants
- func RegisterProperty(p Property)
- func RegisterPropertyConfig(pc PropertyConfig)
- type Client
- func (c *Client) Database() *DatabaseService
- func (c *Client) DoRequest(req *request.Request) (*Response, error)
- func (c *Client) Get(path string, morePath ...string) (*Response, error)
- func (c *Client) NewRequest(opts ...request.Option) (*request.Request, error)
- func (c *Client) Page() *PageService
- func (c *Client) Patch(body any, path string, morePath ...string) (*Response, error)
- func (c *Client) Post(body any, path string, morePath ...string) (*Response, error)
- type ClientOption
- type Database
- type DatabaseDateFilter
- type DatabaseFilter
- type DatabaseQueryRequestBody
- type DatabaseQueryResponseBody
- type DatabaseService
- type DatabaseStringFilter
- type DatabaseUpdateRequestBody
- type DateValue
- type Error
- type Page
- type PageService
- type Parent
- type Properties
- func (m Properties) Exists(name string) bool
- func (m Properties) Get(name string) any
- func (m Properties) GetString(name string) string
- func (m Properties) Raw() map[string]any
- func (m Properties) Set(name string, value any)
- func (m Properties) String() string
- func (m *Properties) UnmarshalJSON(data []byte) error
- type Property
- type PropertyCheckbox
- type PropertyConfig
- type PropertyConfigCheckbox
- type PropertyConfigCreatedTime
- type PropertyConfigDate
- type PropertyConfigEmail
- type PropertyConfigMultiSelect
- type PropertyConfigNumber
- type PropertyConfigPhoneNumber
- type PropertyConfigRichText
- type PropertyConfigSelect
- type PropertyConfigTitle
- type PropertyConfigUniqueId
- type PropertyConfigUrl
- type PropertyConfigs
- type PropertyCreatedTime
- type PropertyDate
- type PropertyEmail
- type PropertyMultiSelect
- type PropertyNumber
- type PropertyPhoneNumber
- type PropertyRichText
- type PropertySelect
- type PropertyTitle
- type PropertyUniqueId
- type PropertyUniqueIdValue
- type PropertyUrl
- type Response
- type RichText
- type RichTextText
- type SelectValue
- type WebhookData
- type WebhookDataBlock
- type WebhookDataProperty
- type WebhookEntity
- type WebhookEvent
- type WebhookPerson
Constants ¶
const ( ParentTypeDatabase = "database_id" ParentTypePage = "page_id" ParentTypeWorkspace = "workspace" ParentTypeBlock = "block_id" )
const ( PropertyTypeCreatedBy = "created_by" PropertyTypeFiles = "files" PropertyTypeFormula = "formula" PropertyTypeLastEditedBy = "last_edited_by" PropertyTypeLastEditedTime = "last_edited_time" PropertyTypePeople = "people" PropertyTypeRelation = "relation" PropertyTypeRollup = "rollup" PropertyTypeStatus = "status" PropertyTypeVerification = "verification" )
const PropertyTypeCheckbox = "checkbox"
const PropertyTypeCreatedTime = "created_time"
const PropertyTypeDate = "date"
const PropertyTypeEmail = "email"
const PropertyTypeMultiSelect = "multi_select"
const PropertyTypeNumber = "number"
const PropertyTypePhoneNumber = "phone_number"
const PropertyTypeRichText = "rich_text"
const PropertyTypeSelect = "select"
const PropertyTypeTitle = "title"
const PropertyTypeUniqueId = "unique_id"
const PropertyTypeUrl = "url"
Variables ¶
This section is empty.
Functions ¶
func RegisterProperty ¶
func RegisterProperty(p Property)
func RegisterPropertyConfig ¶
func RegisterPropertyConfig(pc PropertyConfig)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Database ¶
func (c *Client) Database() *DatabaseService
func (*Client) NewRequest ¶
func (*Client) Page ¶
func (c *Client) Page() *PageService
type ClientOption ¶
func ClientWithApiBaseUrl ¶
func ClientWithApiBaseUrl(u string) ClientOption
func ClientWithApiVersion ¶
func ClientWithApiVersion(v string) ClientOption
func ClientWithLogger ¶
func ClientWithLogger(logger *slog.Logger) ClientOption
type Database ¶
type Database struct {
Object string `json:"object,omitempty"`
Id string `json:"id,omitempty"`
CreatedTime string `json:"created_time,omitempty"`
LastEditedTime string `json:"last_edited_time,omitempty"`
Title []*RichText `json:"title,omitempty"`
Description []*RichText `json:"description,omitempty"`
Properties PropertyConfigs `json:"properties,omitempty"`
}
type DatabaseDateFilter ¶
type DatabaseDateFilter struct {
After string `json:"after,omitempty"`
Before string `json:"before,omitempty"`
Equals string `json:"equals,omitempty"`
IsEmpty bool `json:"is_empty,omitempty"`
IsNotEmpty bool `json:"is_not_empty,omitempty"`
OnOrAfter string `json:"on_or_after,omitempty"`
OnOrBefore string `json:"on_or_before,omitempty"`
}
type DatabaseFilter ¶
type DatabaseFilter struct {
Property string `json:"property,omitempty"`
String *DatabaseStringFilter `json:"string,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
CreatedTime *DatabaseDateFilter `json:"created_time,omitempty"`
LastEditedTime *DatabaseDateFilter `json:"last_edited_time,omitempty"`
}
type DatabaseQueryRequestBody ¶
type DatabaseQueryRequestBody struct {
Filter *DatabaseFilter `json:"filter"`
}
type DatabaseService ¶
type DatabaseService struct {
// contains filtered or unexported fields
}
func (*DatabaseService) Query ¶
func (s *DatabaseService) Query(id string, body *DatabaseQueryRequestBody) (result *DatabaseQueryResponseBody, err error)
func (*DatabaseService) Update ¶
func (s *DatabaseService) Update(id string, body *DatabaseUpdateRequestBody) error
type DatabaseStringFilter ¶
type DatabaseStringFilter struct {
Equals string `json:"equals,omitempty"`
}
type DatabaseUpdateRequestBody ¶
type DatabaseUpdateRequestBody struct {
Properties Properties `json:"properties"`
}
type Error ¶
type Page ¶
type Page struct {
Object string `json:"object,omitempty"`
Id string `json:"id,omitempty"`
CreatedTime string `json:"created_time,omitempty"`
LastEditedTime string `json:"last_edited_time,omitempty"`
Archived bool `json:"archived,omitempty"`
InTrash bool `json:"in_trash,omitempty"`
Properties Properties `json:"properties,omitempty"`
Parent *Parent `json:"parent,omitempty"`
}
type PageService ¶
type PageService struct {
// contains filtered or unexported fields
}
func (*PageService) Delete ¶
func (s *PageService) Delete(page *Page) error
func (*PageService) Update ¶
func (s *PageService) Update(page *Page) error
type Properties ¶
func (Properties) Exists ¶
func (m Properties) Exists(name string) bool
func (Properties) Get ¶
func (m Properties) Get(name string) any
func (Properties) GetString ¶
func (m Properties) GetString(name string) string
func (Properties) Raw ¶
func (m Properties) Raw() map[string]any
func (Properties) Set ¶
func (m Properties) Set(name string, value any)
func (Properties) String ¶
func (m Properties) String() string
func (*Properties) UnmarshalJSON ¶
func (m *Properties) UnmarshalJSON(data []byte) error
type Property ¶
type Property interface {
GetId() string
GetType() string
GetValue() any
SetValue(v any)
Editable() bool
}
func NewProperty ¶
type PropertyCheckbox ¶
type PropertyCheckbox struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Checkbox bool `json:"checkbox"`
}
func (*PropertyCheckbox) Editable ¶
func (p *PropertyCheckbox) Editable() bool
Editable implements Property.
func (*PropertyCheckbox) GetId ¶
func (p *PropertyCheckbox) GetId() string
GetId implements Property.
func (*PropertyCheckbox) GetType ¶
func (p *PropertyCheckbox) GetType() string
GetType implements Property.
func (*PropertyCheckbox) GetValue ¶
func (p *PropertyCheckbox) GetValue() any
GetValue implements Property.
func (*PropertyCheckbox) SetValue ¶
func (p *PropertyCheckbox) SetValue(v any)
SetValue implements Property.
type PropertyConfig ¶
func NewPropertyConfig ¶
func NewPropertyConfig(propertyType string) PropertyConfig
type PropertyConfigCheckbox ¶
type PropertyConfigCheckbox struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Checkbox struct{} `json:"checkbox"`
}
func (*PropertyConfigCheckbox) GetId ¶
func (p *PropertyConfigCheckbox) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigCheckbox) GetType ¶
func (p *PropertyConfigCheckbox) GetType() string
GetType implements PropertyConfig.
type PropertyConfigCreatedTime ¶
type PropertyConfigCreatedTime struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
CreatedTime struct{} `json:"created_time"`
}
func (*PropertyConfigCreatedTime) GetId ¶
func (p *PropertyConfigCreatedTime) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigCreatedTime) GetType ¶
func (p *PropertyConfigCreatedTime) GetType() string
GetType implements PropertyConfig.
type PropertyConfigDate ¶
type PropertyConfigDate struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Date struct{} `json:"date"`
}
func (*PropertyConfigDate) GetId ¶
func (p *PropertyConfigDate) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigDate) GetType ¶
func (p *PropertyConfigDate) GetType() string
GetType implements PropertyConfig.
type PropertyConfigEmail ¶
type PropertyConfigEmail struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Email struct{} `json:"email"`
}
func (*PropertyConfigEmail) GetId ¶
func (p *PropertyConfigEmail) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigEmail) GetType ¶
func (p *PropertyConfigEmail) GetType() string
GetType implements PropertyConfig.
type PropertyConfigMultiSelect ¶
type PropertyConfigMultiSelect struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Options []struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Color string `json:"color,omitempty"`
} `json:"options"`
}
func (*PropertyConfigMultiSelect) GetId ¶
func (p *PropertyConfigMultiSelect) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigMultiSelect) GetType ¶
func (p *PropertyConfigMultiSelect) GetType() string
GetType implements PropertyConfig.
type PropertyConfigNumber ¶
type PropertyConfigNumber struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Number struct {
Format string `json:"format"`
} `json:"number"`
}
func (*PropertyConfigNumber) GetId ¶
func (p *PropertyConfigNumber) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigNumber) GetType ¶
func (p *PropertyConfigNumber) GetType() string
GetType implements PropertyConfig.
type PropertyConfigPhoneNumber ¶
type PropertyConfigPhoneNumber struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
PhoneNumber struct{} `json:"phone_number"`
}
func (*PropertyConfigPhoneNumber) GetId ¶
func (p *PropertyConfigPhoneNumber) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigPhoneNumber) GetType ¶
func (p *PropertyConfigPhoneNumber) GetType() string
GetType implements PropertyConfig.
type PropertyConfigRichText ¶
type PropertyConfigRichText struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
RichText struct{} `json:"rich_text"`
}
func (*PropertyConfigRichText) GetId ¶
func (p *PropertyConfigRichText) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigRichText) GetType ¶
func (p *PropertyConfigRichText) GetType() string
GetType implements PropertyConfig.
type PropertyConfigSelect ¶
type PropertyConfigSelect struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Options []struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Color string `json:"color,omitempty"`
} `json:"options"`
}
func (*PropertyConfigSelect) GetId ¶
func (p *PropertyConfigSelect) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigSelect) GetType ¶
func (p *PropertyConfigSelect) GetType() string
GetType implements PropertyConfig.
type PropertyConfigTitle ¶
type PropertyConfigTitle struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Title struct{} `json:"title"`
}
func (*PropertyConfigTitle) GetId ¶
func (p *PropertyConfigTitle) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigTitle) GetType ¶
func (p *PropertyConfigTitle) GetType() string
GetType implements PropertyConfig.
type PropertyConfigUniqueId ¶
type PropertyConfigUniqueId struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
UniqueId struct {
Prefix string `json:"prefix"`
} `json:"unique_id"`
}
func (*PropertyConfigUniqueId) GetId ¶
func (p *PropertyConfigUniqueId) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigUniqueId) GetType ¶
func (p *PropertyConfigUniqueId) GetType() string
GetType implements PropertyConfig.
type PropertyConfigUrl ¶
type PropertyConfigUrl struct {
Id string `json:"id,omitempty"`
Type string `json:"type"`
Url struct{} `json:"url"`
}
func (*PropertyConfigUrl) GetId ¶
func (p *PropertyConfigUrl) GetId() string
GetId implements PropertyConfig.
func (*PropertyConfigUrl) GetType ¶
func (p *PropertyConfigUrl) GetType() string
GetType implements PropertyConfig.
type PropertyConfigs ¶
type PropertyConfigs map[string]PropertyConfig
func (PropertyConfigs) Exists ¶
func (m PropertyConfigs) Exists(name string) bool
func (PropertyConfigs) String ¶
func (m PropertyConfigs) String() string
func (*PropertyConfigs) UnmarshalJSON ¶
func (m *PropertyConfigs) UnmarshalJSON(data []byte) error
type PropertyCreatedTime ¶
type PropertyCreatedTime struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
CreatedTime string `json:"created_time"`
}
func (*PropertyCreatedTime) Editable ¶
func (p *PropertyCreatedTime) Editable() bool
Editable implements Property.
func (*PropertyCreatedTime) GetId ¶
func (p *PropertyCreatedTime) GetId() string
GetId implements Property.
func (*PropertyCreatedTime) GetType ¶
func (p *PropertyCreatedTime) GetType() string
GetType implements Property.
func (*PropertyCreatedTime) GetValue ¶
func (p *PropertyCreatedTime) GetValue() any
GetValue implements Property.
func (*PropertyCreatedTime) SetValue ¶
func (p *PropertyCreatedTime) SetValue(v any)
SetValue implements Property.
type PropertyDate ¶
type PropertyDate struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Date *DateValue `json:"date"`
}
func (*PropertyDate) Editable ¶
func (p *PropertyDate) Editable() bool
Editable implements Property.
func (*PropertyDate) SetValue ¶
func (p *PropertyDate) SetValue(v any)
SetValue implements Property.
type PropertyEmail ¶
type PropertyEmail struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Email *string `json:"email"`
}
func (*PropertyEmail) Editable ¶
func (p *PropertyEmail) Editable() bool
Editable implements Property.
func (*PropertyEmail) GetType ¶
func (p *PropertyEmail) GetType() string
GetType implements Property.
func (*PropertyEmail) GetValue ¶
func (p *PropertyEmail) GetValue() any
GetValue implements Property.
func (*PropertyEmail) SetValue ¶
func (p *PropertyEmail) SetValue(v any)
SetValue implements Property.
type PropertyMultiSelect ¶
type PropertyMultiSelect struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
MultiSelect []struct {
Name string `json:"name"`
} `json:"multi_select"`
}
func (*PropertyMultiSelect) Editable ¶
func (p *PropertyMultiSelect) Editable() bool
Editable implements Property.
func (*PropertyMultiSelect) GetId ¶
func (p *PropertyMultiSelect) GetId() string
GetId implements Property.
func (*PropertyMultiSelect) GetType ¶
func (p *PropertyMultiSelect) GetType() string
GetType implements Property.
func (*PropertyMultiSelect) GetValue ¶
func (p *PropertyMultiSelect) GetValue() any
GetValue implements Property.
func (*PropertyMultiSelect) SetValue ¶
func (p *PropertyMultiSelect) SetValue(v any)
SetValue implements Property.
type PropertyNumber ¶
type PropertyNumber struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Number float64 `json:"number"`
}
func (*PropertyNumber) Editable ¶
func (p *PropertyNumber) Editable() bool
Editable implements Property.
func (*PropertyNumber) GetType ¶
func (p *PropertyNumber) GetType() string
GetType implements Property.
func (*PropertyNumber) GetValue ¶
func (p *PropertyNumber) GetValue() any
GetValue implements Property.
func (*PropertyNumber) SetValue ¶
func (p *PropertyNumber) SetValue(v any)
SetValue implements Property.
type PropertyPhoneNumber ¶
type PropertyPhoneNumber struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
PhoneNumber *string `json:"phone_number"`
}
func (*PropertyPhoneNumber) Editable ¶
func (p *PropertyPhoneNumber) Editable() bool
Editable implements Property.
func (*PropertyPhoneNumber) GetId ¶
func (p *PropertyPhoneNumber) GetId() string
GetId implements Property.
func (*PropertyPhoneNumber) GetType ¶
func (p *PropertyPhoneNumber) GetType() string
GetType implements Property.
func (*PropertyPhoneNumber) GetValue ¶
func (p *PropertyPhoneNumber) GetValue() any
GetValue implements Property.
func (*PropertyPhoneNumber) SetValue ¶
func (p *PropertyPhoneNumber) SetValue(v any)
SetValue implements Property.
type PropertyRichText ¶
type PropertyRichText struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
RichText []*RichText `json:"rich_text"`
}
func (*PropertyRichText) Editable ¶
func (p *PropertyRichText) Editable() bool
Editable implements Property.
func (*PropertyRichText) GetId ¶
func (p *PropertyRichText) GetId() string
GetId implements Property.
func (*PropertyRichText) GetType ¶
func (p *PropertyRichText) GetType() string
GetType implements Property.
func (*PropertyRichText) GetValue ¶
func (p *PropertyRichText) GetValue() any
GetValue implements Property.
func (*PropertyRichText) SetValue ¶
func (p *PropertyRichText) SetValue(v any)
SetValue implements Property.
type PropertySelect ¶
type PropertySelect struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Select *SelectValue `json:"select"`
}
func (*PropertySelect) Editable ¶
func (p *PropertySelect) Editable() bool
Editable implements Property.
func (*PropertySelect) GetType ¶
func (p *PropertySelect) GetType() string
GetType implements Property.
func (*PropertySelect) GetValue ¶
func (p *PropertySelect) GetValue() any
GetValue implements Property.
func (*PropertySelect) SetValue ¶
func (p *PropertySelect) SetValue(v any)
SetValue implements Property.
type PropertyTitle ¶
type PropertyTitle struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Title []*RichText `json:"title"`
}
func (*PropertyTitle) Editable ¶
func (p *PropertyTitle) Editable() bool
Editable implements Property.
func (*PropertyTitle) GetType ¶
func (p *PropertyTitle) GetType() string
GetType implements Property.
func (*PropertyTitle) GetValue ¶
func (p *PropertyTitle) GetValue() any
GetValue implements Property.
func (*PropertyTitle) SetValue ¶
func (p *PropertyTitle) SetValue(v any)
SetValue implements Property.
type PropertyUniqueId ¶
type PropertyUniqueId struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
UniqueId *PropertyUniqueIdValue `json:"unique_id"`
}
func (*PropertyUniqueId) Editable ¶
func (p *PropertyUniqueId) Editable() bool
Editable implements Property.
func (*PropertyUniqueId) GetId ¶
func (p *PropertyUniqueId) GetId() string
GetId implements Property.
func (*PropertyUniqueId) GetType ¶
func (p *PropertyUniqueId) GetType() string
GetType implements Property.
func (*PropertyUniqueId) GetValue ¶
func (p *PropertyUniqueId) GetValue() any
GetValue implements Property.
func (*PropertyUniqueId) SetValue ¶
func (p *PropertyUniqueId) SetValue(v any)
SetValue implements Property.
type PropertyUniqueIdValue ¶
type PropertyUrl ¶
type RichText ¶
type RichText struct {
Type string `json:"type,omitempty"`
Text *RichTextText `json:"text,omitempty"`
}
type RichTextText ¶
type RichTextText struct {
Content string `json:"content"`
}
type SelectValue ¶
type SelectValue struct {
Name string `json:"name"`
}
type WebhookData ¶
type WebhookData struct {
Parent *WebhookEntity `json:"parent"`
UpdatedBlocks []*WebhookDataBlock `json:"updated_blocks"`
UpdatedPropertyValues []string `json:"-"`
UpdatedPropertySchemas []*WebhookDataProperty `json:"-"`
PageId string `json:"page_id"`
}
func (*WebhookData) UnmarshalJSON ¶
func (d *WebhookData) UnmarshalJSON(data []byte) error
type WebhookDataBlock ¶
type WebhookDataProperty ¶
type WebhookEntity ¶
type WebhookEvent ¶
type WebhookEvent struct {
Id string `json:"id"`
Timestamp string `json:"timestamp"`
WorkspaceId string `json:"workspace_id"`
WorkspaceName string `json:"workspace_name"`
SubscriptionId string `json:"subscription_id"`
IntegrationId string `json:"integration_id"`
Type string `json:"type"`
Authors []*WebhookPerson `json:"authors"`
AccessibleBy []*WebhookPerson `json:"accessible_by"`
AttemptNumber int `json:"attempt_number"`
Entity *WebhookEntity `json:"entity"`
Data *WebhookData `json:"data"`
VerificationToken string `json:"verification_token"`
}
type WebhookPerson ¶
Source Files
¶
- client.go
- client_options.go
- database.go
- database_service.go
- error.go
- page.go
- page_service.go
- parent.go
- properties.go
- property.go
- property_checkbox.go
- property_created_time.go
- property_date.go
- property_email.go
- property_leftovers.go
- property_multi_select.go
- property_number.go
- property_phone_number.go
- property_rich_text.go
- property_select.go
- property_title.go
- property_unique_id.go
- property_url.go
- response.go
- rich_text.go
- webhook_event.go