Documentation ¶
Index ¶
- Constants
- Variables
- func ByteCountIEC(b int64) string
- func NewWebClient(token string) *webClient
- func PrintStruct(emp any)
- func ToDashID(id string) string
- type Block
- type GetUploadFileUrlResponse
- type LoadPageChunkResponse
- type Operation
- type PageDataRequest
- type PageDataResponse
- type Pointer
- type Record
- type RecordMap
- type Transaction
Constants ¶
View Source
const ( CommandSet = "set" CommandUpdate = "update" CommandListAfter = "listAfter" CommandListRemove = "listRemove" TableSpace = "space" TableActivity = "activity" TableBlock = "block" TableUser = "notion_user" TableCollection = "collection" TableCollectionView = "collection_view" TableComment = "comment" TableDiscussion = "discussion" )
Variables ¶
View Source
var (
Backend = new(notion)
)
Functions ¶
func ByteCountIEC ¶
func NewWebClient ¶
func NewWebClient(token string) *webClient
func PrintStruct ¶
func PrintStruct(emp any)
Types ¶
type Block ¶
type Block struct { // values that come from JSON // a unique ID of the block ID string `json:"id"` // if false, the page is deleted Alive bool `json:"alive"` // List of block ids for that make up content of this block // Use Content to get corresponding block (they are in the same order) ContentIDs []string `json:"content,omitempty"` CopiedFrom string `json:"copied_from,omitempty"` CollectionID string `json:"collection_id,omitempty"` // for BlockCollectionView // ID of the user who created this block CreatedBy string `json:"created_by"` CreatedTime int64 `json:"created_time"` CreatedByTable string `json:"created_by_table"` // e.g. "notion_user" CreatedByID string `json:"created_by_id"` // e.g. "bb760e2d-d679-4b64-b2a9-03005b21870a", LastEditedByTable string `json:"last_edited_by_table"` // e.g. "notion_user" LastEditedByID string `json:"last_edited_by_id"` // e.g. "bb760e2d-d679-4b64-b2a9-03005b21870a" // List of block ids with discussion content DiscussionIDs []string `json:"discussion,omitempty"` // those ids seem to map to storage in s3 // https://s3-us-west-2.amazonaws.com/secure.notion-static.com/${id}/${name} FileIDs []string `json:"file_ids,omitempty"` // TODO: don't know what this means IgnoreBlockCount bool `json:"ignore_block_count,omitempty"` // ID of the user who last edited this block LastEditedBy string `json:"last_edited_by"` LastEditedTime int64 `json:"last_edited_time"` // ID of parent Block ParentID string `json:"parent_id"` ParentTable string `json:"parent_table"` Properties map[string]any `json:"properties,omitempty"` // type of the block e.g. TypeText, TypePage etc. Type string `json:"type"` // blocks are versioned Version int64 `json:"version"` // for BlockCollectionView ViewIDs []string `json:"view_ids,omitempty"` // Parent of this block Parent *Block `json:"-"` // maps ContentIDs array to Block type Content []*Block `json:"-"` // for BlockPage Title string `json:"-"` // For BlockTodo, a checked state IsChecked bool `json:"-"` // for BlockBookmark Description string `json:"-"` Link string `json:"-"` // for BlockBookmark it's the url of the page // for BlockGist it's the url for the gist // fot BlockImage it's url of the image, but use ImageURL instead // because Source is sometimes not accessible // for BlockFile it's url of the file // for BlockEmbed it's url of the embed Source string `json:"-"` // for BlockFile FileSize string `json:"-"` // for BlockImage it's an URL built from Source that is always accessible ImageURL string `json:"-"` // for BlockCode Code string `json:"-"` CodeLanguage string `json:"-"` // RawJSON represents Block as RawJSON map[string]any `json:"-"` // contains filtered or unexported fields }
Block describes a block
type GetUploadFileUrlResponse ¶
type GetUploadFileUrlResponse struct { URL string `json:"url"` SignedGetURL string `json:"signedGetUrl"` SignedPutURL string `json:"signedPutUrl"` FileID string `json:"-"` RawJSON map[string]any `json:"-"` }
GetUploadFileUrlResponse is a response to POST /api/v3/getUploadFileUrl
func (*GetUploadFileUrlResponse) Parse ¶
func (r *GetUploadFileUrlResponse) Parse()
type LoadPageChunkResponse ¶
type LoadPageChunkResponse struct { RecordMap *RecordMap `json:"recordMap"` Cursor cursor `json:"cursor"` RawJSON map[string]any `json:"-"` }
LoadPageChunkResponse is a response to /api/v3/loadPageChunk api
type PageDataRequest ¶
type PageDataResponse ¶
type PageDataResponse struct { Pageid string Cursor *Block Spacename string `json:"spaceName"` Spaceid string `json:"spaceId"` Canjoinspace bool `json:"canJoinSpace"` Icon string `json:"icon"` Userhasexplicitaccess bool `json:"userHasExplicitAccess"` Haspublicaccess bool `json:"hasPublicAccess"` Owneruserid string `json:"ownerUserId"` Betaenabled bool `json:"betaEnabled"` Canrequestaccess bool `json:"canRequestAccess"` }
type Record ¶
type Record struct { // fields returned by the server Role string `json:"role"` // polymorphic value of the record, which we decode into Block, Space etc. Value json.RawMessage `json:"value"` // fields set from Value based on type ID string `json:"-"` Table string `json:"-"` Block *Block `json:"-"` }
Record represents a polymorphic record
type RecordMap ¶
type RecordMap struct { Activities map[string]*Record `json:"activity"` Blocks map[string]*Record `json:"block"` Spaces map[string]*Record `json:"space"` Users map[string]*Record `json:"notion_user"` Collections map[string]*Record `json:"collection"` CollectionViews map[string]*Record `json:"collection_view"` Comments map[string]*Record `json:"comment"` Discussions map[string]*Record `json:"discussion"` }
RecordMap contains a collections of blocks, a space, users, and collections.
type Transaction ¶
Click to show internal directories.
Click to hide internal directories.