Documentation ¶
Index ¶
- Constants
- Variables
- type Annotations
- type Block
- type BlockParent
- type BlockParentType
- type BlockType
- type BookmarkBlock
- type Bot
- type BotOwner
- type BreadCrumbBlock
- type CalloutBlock
- type CheckboxCondition
- type ChildBlock
- type CodeBlock
- type Color
- type ColumnBlock
- type ColumnListBlock
- type CreateDBRq
- type CreatePageRq
- type DB
- type DBDefaultProperty
- type DBFormulatProperty
- type DBNumberProperty
- type DBParent
- type DBParentType
- type DBProperties
- type DBProperty
- type DBPropertyType
- type DBRelationProperty
- type DBRollupProperty
- type DBSelectProperties
- type DBSelectProperty
- type DateCondition
- type DatePageProperty
- type DateTimeEmptyWrap
- type DateTimeWrap
- type DividerBlock
- type EmbedBlock
- type Emoji
- type Equation
- type EquationBlock
- type ExternalFile
- type FileBlock
- type FileCondition
- type FileDescriptor
- type FileDescriptorType
- type Filter
- type FormulaCondition
- type FormulaPageProperty
- type HeadingBlock
- type IDWrap
- type IconDescriptor
- type IconType
- type ImageBlock
- type Language
- type Link
- type LinkPreviewBlock
- type LinkToPageBlock
- type Mention
- type MentionType
- type MultiSelectCondition
- type NotionClient
- type NotionFile
- type NumberCondition
- type NumberPropertyFormat
- type PDFBlock
- type Page
- type PageParent
- type PageParentType
- type PageProperties
- type PageProperty
- type PagePropertyFormulaType
- type PeopleCondition
- type Person
- type QueryDBRq
- type QueryDBRs
- type RelationCondition
- type RichText
- type RichTextType
- type RollupArrayValue
- type RollupCondition
- type RollupFunction
- type RollupPageProperty
- type RollupProperty
- type RollupPropertyType
- type SelectCondition
- type SelectPageProperty
- type Sort
- type SortDirection
- type SyncedBlock
- type SyncedFrom
- type TableBlock
- type TableOfContentsBlock
- type TableRowBlock
- type Template
- type TemplateBlock
- type Text
- type TextBlock
- type TextCondition
- type TimestampConditionType
- type TodoBlock
- type UpdateDBRq
- type UpdatePageRq
- type User
- type UserType
- type VideoBlock
Constants ¶
const ( NoBlockParentType = iota PageBlockParentType DatabaseBlockParentType BlockBlockParentType )
const ( NoBlockType = iota ParagraphBlockType H1BlockType H2BlockType H3BlockType BulletedListBlockType NumberedListBlockType ToDoBlockType ToggleBlockType CodeBlockType ChildPageBlockType ChildDatabaseBlockType EmbedBlockType ImageBlockType VideoBlockType FileBlockType PDFBlockType BookmarkBlockType CalloutBlockType QuoteBlockType EquationBlockType DividerBlockType TableOfContentsBlockType BreadCrumbBlockType ColumnBlockType ColumnListBlockType LinkPreviewBlockType SuncedBlockBlockType TemplateBlockType LinkToPageBlockType TableBlockType TableRowBlockType UnsupportedBlockType )
const BaseUrl = "https://api.notion.com"
const V1 = "v1"
Variables ¶
var BlockParentTypeToString = map[BlockParentType]string{ PageBlockParentType: "page_id", DatabaseBlockParentType: "database_id", BlockBlockParentType: "block_id", }
var BlockTypeToString = map[BlockType]string{ ParagraphBlockType: "paragraph", H1BlockType: "heading_1", H2BlockType: "heading_2", H3BlockType: "heading_3", BulletedListBlockType: "bulleted_list_item", NumberedListBlockType: "numbered_list_item", ToDoBlockType: "to_do", ToggleBlockType: "toggle", CodeBlockType: "code", ChildPageBlockType: "child_page", ChildDatabaseBlockType: "child_database", EmbedBlockType: "embed", ImageBlockType: "image", VideoBlockType: "video", FileBlockType: "file", PDFBlockType: "pdf", BookmarkBlockType: "bookmark", CalloutBlockType: "callout", QuoteBlockType: "quote", EquationBlockType: "equation", DividerBlockType: "divider", TableOfContentsBlockType: "table_of_contents", BreadCrumbBlockType: "breadcrumb", ColumnBlockType: "column", ColumnListBlockType: "column_list", LinkPreviewBlockType: "link_preview", SuncedBlockBlockType: "synced_block", TemplateBlockType: "template", LinkToPageBlockType: "link_to_page", TableBlockType: "table", TableRowBlockType: "table_row", UnsupportedBlockType: "unsupported", }
var ColorToString = map[Color]string{ DefaultColor: "default", Gray: "gray", Brown: "brown", Orange: "orange", Yellow: "yellow", Green: "green", Blue: "blue", Purple: "purple", Pink: "pink", Red: "red", GrayBackground: "gray_background", BrownBackground: "brown_background", OrangeBackground: "orange_background", YellowBackground: "yellow_background", GreenBackground: "green_background", BlueBackground: "blue_background", PurpleBackground: "purple_background", PinkBackground: "pink_background", RedBackground: "red_background", }
var DBParentTypeToString = map[DBParentType]string{ PageDBParentType: "page_id", WorksapceDBParentType: "workspace", }
var FileDescriptorTypeToString = map[FileDescriptorType]string{ NotionFileDescriptorType: "file", ExternalFileDescriptorType: "external", }
var IconTypeToString = map[IconType]string{ EmojiIconType: "emoji", FileIconType: "file", ExternalIconType: "external", }
var LanguageToString = map[Language]string{ ABAP: "abap", Arduino: "arduino", Bash: "bash", Basic: "basic", C: "c", Clojure: "clojure", CoffeeScript: "coffeescript", CPlusPlus: "c++", CSharp: "c#", CSS: "css", Dart: "dart", Diff: "diff", Docker: "docker", Elixir: "elixir", Elm: "elm", Erlang: "erlang", Flow: "flow", Fortran: "fortran", FSharp: "f#", Gherkin: "gherkin", Glsl: "glsl", Go: "go", GraphQL: "graphql", Groovy: "groovy", Haskell: "haskell", HTML: "html", Java: "java", JavaScript: "javascript", JSON: "json", Julia: "julia", Kotlin: "kotlin", LaTeX: "latex", LESS: "less", Lisp: "lisp", LiveScript: "livescript", Lua: "lua", Makefile: "makefile", Markdown: "markdown", Markup: "markup", Matlab: "matlab", Mermaid: "mermaid", ObjectiveC: "objective-c", OCaml: "ocaml", Pascal: "pascal", Perl: "perl", PHP: "php", PlainText: "plain text", PowerShell: "powershell", Prolog: "prolog", Protobuf: "protobuf", Python: "python", R: "r", Reason: "reason", Ruby: "ruby", Rust: "rust", SASS: "sass", Scala: "scala", Scheme: "scheme", SCSS: "scss", Shell: "shell", SQL: "sql", Swift: "swift", TypeScript: "typescript", VBNet: "vb.net", Verilog: "verilog", VHDL: "vhdl", VisualBasic: "visual basic", Webassembly: "webassembly", XML: "xml", YAML: "yaml", // contains filtered or unexported fields }
var MentionTypeToString = map[MentionType]string{ UserMentionType: "user", PageMentionType: "page", DatabaseMentionType: "database", DateMentionType: "date", LinkPriviewMentionType: "link_preview", }
var NumberFormatToString = map[NumberPropertyFormat]string{ Number: "number", NumberWithCommas: "number_with_commas", Percent: "percent", Dollar: "dollar", CanadianDollar: "canadian_dollar", Euro: "euro", Pound: "pound", Yen: "yen", Ruble: "ruble", Rupee: "rupee", Won: "won", Yuan: "yuan", Real: "real", Lira: "lira", Rupiah: "rupiah", Franc: "franc", HongKondDollar: "hong_kong_dollar", NewZellanDollar: "new_zealand_dollar", Krona: "krona", NorwegianKrone: "norwegian_krone", MexicanPeso: "mexican_peso", Rand: "rand", NewTaiwanDollar: "new_taiwan_dollar", DanishKrone: "danish_krone", Zloty: "zloty", Baht: "baht", Forint: "forint", Koruna: "koruna", Shekel: "shekel", ChileanPeso: "chilean_peso", PhilippinePeso: "philippine_peso", Dirham: "dirham", ColumbianPeso: "colombian_peso", Riyal: "riyal", Ringgit: "ringgit", Leu: "leu", ArgentinePeso: "argentine_peso", UruguayanPeso: "uruguayan_peso", }
var PageParentToString = map[PageParentType]string{ PageParentDB: "database_id", PageParentWorkspace: "workspace", PageParentPage: "page_id", }
var PagePropertyFormulaTypeToString = map[PagePropertyFormulaType]string{ StringFormulaType: "string", NumberFormulaType: "number", BoolFormulaType: "boolean", DateFormuleType: "date", }
var PropTypeToString = map[DBPropertyType]string{ DBPropTypeTitle: "title", DBPropTypeRichText: "rich_text", DBPropTypeNumber: "number", DBPropTypeSelect: "select", DBPropTypeMultiSelect: "multi_select", DBPropTypeDate: "date", DBPropTypePeople: "people", DBPropTypeFiles: "files", DBPropTypeCheckbox: "checkbox", DBPropTypeURL: "url", DBPropTypeEmail: "email", DBPropTypePhoneNumber: "phone_number", DBPropTypeFormula: "formula", DBPropTypeRelation: "relation", DBPropTypeRollup: "rollup", DBPropTypeCreatedTime: "created_time", DBPropTypeCreatedBy: "created_by", DBPropTypeLastEditedTime: "last_edited_time", DBPropTypeLastEditedBy: "last_edited_by", }
var RichTextTypeToString = map[RichTextType]string{ TextRichTextType: "text", MentionRichTextType: "mention", EquationRichTextType: "equation", }
var RollupFunctionToString = map[RollupFunction]string{ Count: "count", CountAll: "count_all", CountValues: "count_values", CountUniqueValues: "count_unique_values", CountEmpty: "count_empty", CountNotEmpty: "count_not_empty", PercentEmpty: "percent_empty", PercentNotEmpty: "percent_not_empty", Sum: "sum", Average: "average", Median: "median", Min: "min", Max: "max", Range: "range", ShowOriginal: "show_original", EarliestDate: "earliest_date", LatestDate: "latest_date", DateRange: "date_range", }
var RollupPropertyTypeToString = map[RollupPropertyType]string{ NumberRollupPropertyType: "number", DateRollupPropertyType: "date", ArrayRollupPropertyType: "array", UnsupportedRollupPropertyType: "unsupported", IncompleteRollupPropertyType: "incomplete", }
var SortDirectionToString = map[SortDirection]string{ Ascending: "ascending", Descending: "descending", }
var StringToBlockParentType = map[string]BlockParentType{ "page_id": PageBlockParentType, "database_id": DatabaseBlockParentType, "block_id": BlockBlockParentType, }
var StringToBlockType = map[string]BlockType{ "paragraph": ParagraphBlockType, "heading_1": H1BlockType, "heading_2": H2BlockType, "heading_3": H3BlockType, "bulleted_list_item": BulletedListBlockType, "numbered_list_item": NumberedListBlockType, "to_do": ToDoBlockType, "toggle": ToggleBlockType, "code": CodeBlockType, "child_page": ChildPageBlockType, "child_database": ChildDatabaseBlockType, "embed": EmbedBlockType, "image": ImageBlockType, "video": VideoBlockType, "file": FileBlockType, "pdf": PDFBlockType, "bookmark": BookmarkBlockType, "callout": CalloutBlockType, "quote": QuoteBlockType, "equation": EquationBlockType, "divider": DividerBlockType, "table_of_contents": TableOfContentsBlockType, "breadcrumb": BreadCrumbBlockType, "column": ColumnBlockType, "column_list": ColumnListBlockType, "link_preview": LinkPreviewBlockType, "synced_block": SuncedBlockBlockType, "template": TemplateBlockType, "link_to_page": LinkToPageBlockType, "table": TableBlockType, "table_row": TableRowBlockType, "unsupported": UnsupportedBlockType, }
var StringToColor = map[string]Color{ "default": DefaultColor, "gray": Gray, "brown": Brown, "orange": Orange, "yellow": Yellow, "green": Green, "blue": Blue, "purple": Purple, "pink": Pink, "red": Red, "gray_background": GrayBackground, "brown_background": BrownBackground, "orange_background": OrangeBackground, "yellow_background": YellowBackground, "green_background": GreenBackground, "blue_background": BlueBackground, "purple_background": PurpleBackground, "pink_background": PinkBackground, "red_background": RedBackground, }
var StringToDBParentType = map[string]DBParentType{ "page_id": PageDBParentType, "workspace": WorksapceDBParentType, }
var StringToFileDescriptorType = map[string]FileDescriptorType{ "file": NotionFileDescriptorType, "external": ExternalFileDescriptorType, }
var StringToIconType = map[string]IconType{ "emoji": EmojiIconType, "file": FileIconType, "external": ExternalIconType, }
var StringToLanguage = map[string]Language{ "abap": ABAP, "arduino": Arduino, "bash": Bash, "basic": Basic, "c": C, "clojure": Clojure, "coffeescript": CoffeeScript, "c++": CPlusPlus, "c#": CSharp, "css": CSS, "dart": Dart, "diff": Diff, "docker": Docker, "elixir": Elixir, "elm": Elm, "erlang": Erlang, "flow": Flow, "fortran": Fortran, "f#": FSharp, "gherkin": Gherkin, "glsl": Glsl, "go": Go, "graphql": GraphQL, "groovy": Groovy, "haskell": Haskell, "html": HTML, "java": Java, "javascript": JavaScript, "json": JSON, "julia": Julia, "kotlin": Kotlin, "latex": LaTeX, "less": LESS, "lisp": Lisp, "livescript": LiveScript, "lua": Lua, "makefile": Makefile, "markdown": Markdown, "markup": Markup, "matlab": Matlab, "mermaid": Mermaid, "nix": nix, "objective-c": ObjectiveC, "ocaml": OCaml, "pascal": Pascal, "perl": Perl, "php": PHP, "plain text": PlainText, "powershell": PowerShell, "prolog": Prolog, "protobuf": Protobuf, "python": Python, "r": R, "reason": Reason, "ruby": Ruby, "rust": Rust, "sass": SASS, "scala": Scala, "scheme": Scheme, "scss": SCSS, "shell": Shell, "sql": SQL, "swift": Swift, "typescript": TypeScript, "vb.net": VBNet, "verilog": Verilog, "vhdl": VHDL, "visual basic": VisualBasic, "webassembly": Webassembly, "xml": XML, "yaml": YAML, }
var StringToMentionType = map[string]MentionType{ "user": UserMentionType, "page": PageMentionType, "database": DatabaseMentionType, "date": DateMentionType, "link_privew": LinkPriviewMentionType, }
var StringToNumberFormat = map[string]NumberPropertyFormat{ "number": Number, "number_with_commas": NumberWithCommas, "percent": Percent, "dollar": Dollar, "canadian_dollar": CanadianDollar, "euro": Euro, "pound": Pound, "yen": Yen, "ruble": Ruble, "rupee": Rupee, "won": Won, "yuan": Yuan, "real": Real, "lira": Lira, "rupiah": Rupiah, "franc": Franc, "hong_kong_dollar": HongKondDollar, "new_zealand_dollar": NewZellanDollar, "krona": Krona, "norwegian_krone": NorwegianKrone, "mexican_peso": MexicanPeso, "rand": Rand, "new_taiwan_dollar": NewTaiwanDollar, "danish_krone": DanishKrone, "zloty": Zloty, "baht": Baht, "forint": Forint, "koruna": Koruna, "shekel": Shekel, "chilean_peso": ChileanPeso, "philippine_peso": PhilippinePeso, "dirham": Dirham, "colombian_peso": ColumbianPeso, "riyal": Riyal, "ringgit": Ringgit, "leu": Leu, "argentine_peso": ArgentinePeso, "uruguayan_peso": UruguayanPeso, }
var StringToPageParent = map[string]PageParentType{ "database_id": PageParentDB, "workspace": PageParentWorkspace, "page_id": PageParentPage, }
var StringToPagePropertyFormulaType = map[string]PagePropertyFormulaType{ "string": StringFormulaType, "number": NumberFormulaType, "boolean": BoolFormulaType, "date": DateFormuleType, }
var StringToPropType = map[string]DBPropertyType{ "title": DBPropTypeTitle, "rich_text": DBPropTypeRichText, "number": DBPropTypeNumber, "select": DBPropTypeSelect, "multi_select": DBPropTypeMultiSelect, "date": DBPropTypeDate, "people": DBPropTypePeople, "files": DBPropTypeFiles, "checkbox": DBPropTypeCheckbox, "url": DBPropTypeURL, "email": DBPropTypeEmail, "phone_number": DBPropTypePhoneNumber, "formula": DBPropTypeFormula, "relation": DBPropTypeRelation, "rollup": DBPropTypeRollup, "created_time": DBPropTypeCreatedTime, "created_by": DBPropTypeCreatedBy, "last_edited_time": DBPropTypeLastEditedTime, "last_edited_by": DBPropTypeLastEditedBy, }
var StringToRichTextType = map[string]RichTextType{ "text": TextRichTextType, "mention": MentionRichTextType, "equation": EquationRichTextType, }
var StringToRollupFunction = map[string]RollupFunction{ "count": Count, "count_all": CountAll, "count_values": CountValues, "count_unique_values": CountUniqueValues, "count_empty": CountEmpty, "count_not_empty": CountNotEmpty, "percent_empty": PercentEmpty, "percent_not_empty": PercentNotEmpty, "sum": Sum, "average": Average, "median": Median, "min": Min, "max": Max, "range": Range, "show_original": ShowOriginal, "earliest_date": EarliestDate, "latest_date": LatestDate, "date_range": DateRange, }
var StringToRollupPropertyType = map[string]RollupPropertyType{ "number": NumberRollupPropertyType, "date": DateRollupPropertyType, "array": ArrayRollupPropertyType, "unsupported": UnsupportedRollupPropertyType, "incomplete": IncompleteRollupPropertyType, }
var StringToSortDirection = map[string]SortDirection{ "ascending": Ascending, "descending": Descending, }
var StringToTimestampFilterType = map[string]TimestampConditionType{ "created_time": CreatedTime, "last_edited_time": LastEditedTime, }
var StringToUserType = map[string]UserType{ "person": PersonType, "bot": BotType, }
var TimestampFilterTypeToString = map[TimestampConditionType]string{ CreatedTime: "created_time", LastEditedTime: "last_edited_time", }
var UserTypeToString = map[UserType]string{ PersonType: "person", BotType: "bot", }
Functions ¶
This section is empty.
Types ¶
type Annotations ¶
type Block ¶
type Block struct { Object string `json:"object,omitempty"` ID string `json:"id"` Parent BlockParent `json:"parent"` Type BlockType `json:"type"` CreatedTime DateTimeWrap `json:"created_time"` CreatedBy User `json:"created_by"` LastEditedTime DateTimeWrap `json:"last_edited_time"` LastEditedBy User `json:"last_edited_by"` Archived *bool `json:"archived,omitempty"` //TODO value instead pointer? HasChildren *bool `json:"has_children,omitempty"` //TODO value instead pointer? Paragraph *TextBlock `json:"paragraph,omitempty"` Heading_1 *HeadingBlock `json:"heading_1,omitempty"` Heading_2 *HeadingBlock `json:"heading_2,omitempty"` Heading_3 *HeadingBlock `json:"heading_3,omitempty"` Callout *CalloutBlock `json:"callout,omitempty"` Quote *TextBlock `json:"quote,omitempty"` BulletedListItem *TextBlock `json:"bulleted_list_item,omitempty"` NumberedListItem *TextBlock `json:"numbered_list_item,omitempty"` ToDo *TodoBlock `json:"to_do,omitempty"` Toggle *TextBlock `json:"toggle,omitempty"` Code *CodeBlock `json:"code,omitempty"` //WTF ChildPage *ChildBlock `json:"child_page,omitempty"` ChildDatabase *ChildBlock `json:"child_database,omitempty"` Embed *EmbedBlock `json:"embed,omitempty"` Image *FileDescriptor `json:"image,omitempty"` Video *FileDescriptor `json:"video,omitempty"` File *FileDescriptor `json:"file,omitempty"` PDF *FileDescriptor `json:"pdf,omitempty"` Bookmark *BookmarkBlock `json:"bookmark,omitempty"` Equation *EquationBlock `json:"equation,omitempty"` Divider *DividerBlock `json:"divider,omitempty"` TableOfContents *TableOfContentsBlock `json:"table_of_contents,omitempty"` // Table of contents block? BreadCrumb *BreadCrumbBlock `json:"breadcrumb,omitempty"` ColumnList *ColumnListBlock `json:"column_list,omitempty"` //Column Block? Column *ColumnBlock `json:"column,omitempty"` //row? LinkPreview *LinkPreviewBlock `json:"link_preview,omitempty"` //Link Privew blocks? Template *TemplateBlock `json:"template,omitempty"` //Tempalte Blocks? LinkToPage *LinkToPageBlock `json:"link_to_page,omitempty"` //Link To page BlocK? SyncedBlock *SyncedBlock `json:"synced_block,omitempty"` Table *TableBlock `json:"table,omitempty"` TableRow *TableRowBlock `json:"table_row,omitempty"` }
type BlockParent ¶
type BlockParentType ¶
type BlockParentType int
func (BlockParentType) MarshalJSON ¶
func (p BlockParentType) MarshalJSON() ([]byte, error)
func (*BlockParentType) UnmarshalJSON ¶
func (p *BlockParentType) UnmarshalJSON(b []byte) error
type BlockType ¶
type BlockType int
func (BlockType) MarshalJSON ¶
func (*BlockType) UnmarshalJSON ¶
type BookmarkBlock ¶
type BreadCrumbBlock ¶
type BreadCrumbBlock struct{}
type CalloutBlock ¶
type CalloutBlock struct { RichText []RichText `json:"rich_text"` Icon *IconDescriptor `json:"icon,omitempty"` Color Color `json:"color,omitempty"` Children []Block `json:"children,omitempty"` }
type CheckboxCondition ¶
type CheckboxCondition struct { Equals *bool `json:"equals,omitempty"` DoesntEqual *bool `json:"does_not_equal,omitempty"` }
by default go treats bool_field=false as empty and if tag omitempty is present, bool_field=false will be erased from result json that's why I use *bool hre, instead bool. https://github.com/golang/go/issues/13284
type ChildBlock ¶
type ChildBlock struct {
Title string `json:"title"`
}
type ColumnBlock ¶
type ColumnBlock struct {
Children []Block `json:"children"`
}
Can contains any block type itself "column", need validation
type ColumnListBlock ¶
type ColumnListBlock struct {
Children []ColumnBlock `json:"children"`
}
TODO need to test ColumnListBlock and ColumnBlock carefuly https://developers.notion.com/reference/block#column-list-and-column-blocks
type CreateDBRq ¶
type CreateDBRq struct { PageId string Title []RichText Properties DBProperties Icon *IconDescriptor Cover *FileDescriptor }
func (CreateDBRq) MarshalJSON ¶
func (cdb CreateDBRq) MarshalJSON() ([]byte, error)
func (CreateDBRq) ValidateRequest ¶
func (cdb CreateDBRq) ValidateRequest() error
type CreatePageRq ¶
type CreatePageRq struct { ID string // You can create page only with database as parent. Looks like bug, might need to be fixed later Properties PageProperties // TODO children Icon *IconDescriptor Cover *FileDescriptor }
If pass empty value for text, like
gotion.CreatePageRq{ ID: "7fb5f8a059eb45a585fa71ba40fd7a0f", Properties: gotion.PageProperties{ "Name": gotion.PageProperty{ Title: []gotion.RichText{ }, }, }, }
title will be omitted and error will be returned from notion need fix this
func (CreatePageRq) MarshalJSON ¶
func (rq CreatePageRq) MarshalJSON() ([]byte, error)
func (CreatePageRq) ValidateRequest ¶
func (rq CreatePageRq) ValidateRequest() error
type DB ¶
type DB struct { Object string `json:"object"` ID string `json:"id"` CreatedTime DateTimeWrap `json:"created_time"` CreatedBy User `json:"created_by"` LastEditedTime DateTimeWrap `json:"last_edited_time"` LastEditedBy User `json:"last_edited_by"` Title []RichText `json:"title"` //Doesn't exist in doc, but exists in response Description []RichText `json:"description"` Icon *IconDescriptor `json:"icon,omitempty"` Cover *FileDescriptor `json:"cover,omitempty"` Properties DBProperties `json:"properties"` Parent DBParent `json:"parent"` URL string `json:"url"` Archived bool `json:"archived"` }
type DBDefaultProperty ¶
type DBDefaultProperty struct{}
type DBFormulatProperty ¶
type DBFormulatProperty struct {
Expression string `json:"expression"`
}
type DBNumberProperty ¶
type DBNumberProperty struct {
Format NumberPropertyFormat `json:"format"`
}
type DBParent ¶
type DBParent struct { Type DBParentType `json:"type"` PageID string `json:"page_id,omitempty"` Workspace bool `json:"workspace,omitempty"` }
func (DBParent) ValidateRequest ¶
type DBParentType ¶
type DBParentType int
const ( NoDBParentType DBParentType = iota PageDBParentType WorksapceDBParentType )
func (DBParentType) MarshalJSON ¶
func (p DBParentType) MarshalJSON() ([]byte, error)
func (*DBParentType) UnmarshalJSON ¶
func (p *DBParentType) UnmarshalJSON(b []byte) error
type DBProperties ¶
type DBProperties map[string]DBProperty
type DBProperty ¶
type DBProperty struct { ID string `json:"id,omitempty"` Type DBPropertyType `json:"type,omitempty"` Name string `json:"name,omitempty"` Title *DBDefaultProperty `json:"title,omitempty"` RichText *DBDefaultProperty `json:"rich_text,omitempty"` Number *DBNumberProperty `json:"number,omitempty"` Select *DBSelectProperties `json:"select,omitempty"` MultiSelect *DBSelectProperties `json:"multi_select,omitempty"` Date *DBDefaultProperty `json:"date,omitempty"` People *DBDefaultProperty `json:"people,omitempty"` Files *DBDefaultProperty `json:"files,omitempty"` Checkbox *DBDefaultProperty `json:"checkbox,omitempty"` URL *DBDefaultProperty `json:"url,omitempty"` Email *DBDefaultProperty `json:"email,omitempty"` PhoneNumber *DBDefaultProperty `json:"phone_number,omitempty"` Formula *DBFormulatProperty `json:"formula,omitempty"` Relation *DBRelationProperty `json:"relation,omitempty"` Rollup *RollupProperty `json:"rollup,omitempty"` // TODO need fix this CreatedTime *DBDefaultProperty `json:"created_time,omitempty"` CreatedBy *DBDefaultProperty `json:"created_by,omitempty"` LastEditedTime *DBDefaultProperty `json:"last_edited_time,omitempty"` LastEditedBy *DBDefaultProperty `json:"last_edited_by,omitempty"` }
type DBPropertyType ¶
type DBPropertyType int
const ( NoDBPropType DBPropertyType = iota DBPropTypeTitle DBPropTypeRichText DBPropTypeNumber DBPropTypeSelect DBPropTypeMultiSelect DBPropTypeDate DBPropTypePeople DBPropTypeFiles DBPropTypeCheckbox DBPropTypeURL DBPropTypeEmail DBPropTypePhoneNumber DBPropTypeFormula DBPropTypeRelation DBPropTypeRollup DBPropTypeCreatedTime DBPropTypeCreatedBy DBPropTypeLastEditedTime DBPropTypeLastEditedBy )
func (DBPropertyType) MarshalJSON ¶
func (p DBPropertyType) MarshalJSON() ([]byte, error)
func (*DBPropertyType) UnmarshalJSON ¶
func (p *DBPropertyType) UnmarshalJSON(b []byte) error
type DBRelationProperty ¶
type DBRollupProperty ¶
type DBSelectProperties ¶
type DBSelectProperties struct {
Options []DBSelectProperty `json:"options"`
}
type DBSelectProperty ¶
type DateCondition ¶
type DateCondition struct { Equals *DateTimeWrap `json:"equals,omitempty"` Before *DateTimeWrap `json:"before,omitempty"` After *DateTimeWrap `json:"after,omitempty"` OnOrBefore *DateTimeWrap `json:"on_or_before,omitempty"` OnOrAfter *DateTimeWrap `json:"on_or_after,omitempty"` PastWeek *DateTimeEmptyWrap `json:"past_week,omitempty"` PastMonth *DateTimeEmptyWrap `json:"past_month,omitempty"` PastYear *DateTimeEmptyWrap `json:"past_year,omitempty"` NextWeek *DateTimeEmptyWrap `json:"next_week,omitempty"` NextMonth *DateTimeEmptyWrap `json:"next_month,omitempty"` NextYear *DateTimeEmptyWrap `json:"next_year,omitempty"` IsEmpty bool `json:"is_empty,omitempty"` IsNotEmpty bool `json:"is_not_empty,omitempty"` }
type DatePageProperty ¶
type DatePageProperty struct { Start DateTimeWrap `json:"start"` End *DateTimeWrap `json:"end,omitempty"` TimeZone *string `json:"time_zone,omitempty"` }
type DateTimeEmptyWrap ¶
type DateTimeEmptyWrap struct{}
type DateTimeWrap ¶
func (DateTimeWrap) MarshalJSON ¶
func (dt DateTimeWrap) MarshalJSON() ([]byte, error)
func (*DateTimeWrap) UnmarshalJSON ¶
func (dt *DateTimeWrap) UnmarshalJSON(b []byte) error
type DividerBlock ¶
type DividerBlock struct{}
type EmbedBlock ¶
type EmbedBlock struct {
Url string `json:"url"`
}
Embed blocks created via Notion API may differ of embed blocks created via UI Details: https://developers.notion.com/reference/block#embed-blocks Can it be returned in request? Because after inserting embed link into page its type transforming to another For isntace to bookmark. Example: https://{{notion-host}}/v1/blocks/74552d4f1c01447a8c7edd560e161520
type EquationBlock ¶
type EquationBlock struct {
Expression string `json:"expression"`
}
type ExternalFile ¶
type ExternalFile struct {
URL string `json:"url"`
}
type FileBlock ¶
type FileBlock struct {
File FileDescriptor `json:"file"`
}
type FileCondition ¶
type FileDescriptor ¶
type FileDescriptor struct { Type FileDescriptorType `json:"type"` Name string `json:"name,omitempty"` ExternalFile *ExternalFile `json:"external,omitempty"` NotionFile *NotionFile `json:"file,omitempty"` //This field isn't documented, but it's appeared in blocks Caption []RichText `json:"caption,omitempty"` }
func (FileDescriptor) ValidateRequest ¶
func (fdt FileDescriptor) ValidateRequest() error
type FileDescriptorType ¶
type FileDescriptorType int
const ( NoFileDescriptorType FileDescriptorType = iota NotionFileDescriptorType ExternalFileDescriptorType )
func (FileDescriptorType) MarshalJSON ¶
func (p FileDescriptorType) MarshalJSON() ([]byte, error)
func (*FileDescriptorType) UnmarshalJSON ¶
func (p *FileDescriptorType) UnmarshalJSON(b []byte) error
type Filter ¶
type Filter struct { Property string `json:"property,omitempty"` Timestamp TimestampConditionType `json:"timestamp,omitempty"` RichText *TextCondition `json:"rich_text,omitempty"` Title *TextCondition `json:"title,omitempty"` URL *TextCondition `json:"url,omitempty"` Email *TextCondition `json:"email,omitempty"` PhoneNumber *TextCondition `json:"phone_number,omitempty"` Number *NumberCondition `json:"number,omitempty"` Checkbox *CheckboxCondition `json:"checkbox,omitempty"` Select *SelectCondition `json:"select,omitempty"` MultiSelect *MultiSelectCondition `json:"multi_select,omitempty"` File *FileCondition `json:"files,omitempty"` Relation *RelationCondition `json:"relation,omitempty"` Date *DateCondition `json:"date,omitempty"` People *PeopleCondition `json:"people,omitempty"` CreatedBy *PeopleCondition `json:"created_by,omitempty"` LastEditedBy *PeopleCondition `json:"last_edited_by,omitempty"` Formula *FormulaCondition `json:"formula,omitempty"` Rollup *RollupCondition `json:"rollup,omitempty"` And []Filter `json:"and,omitempty"` Or []Filter `json:"or,omitempty"` }
Add filter terst with timestamp
type FormulaCondition ¶
type FormulaCondition struct { String *TextCondition `json:"string,omitempty"` Checkbox *CheckboxCondition `json:"checkbox,omitempty"` Number *NumberCondition `json:"number,omitempty"` Date *DateCondition `json:"date,omitempty"` }
type FormulaPageProperty ¶
type FormulaPageProperty struct { Type PagePropertyFormulaType `json:"type"` StringFormula *string `json:"string,omitempty"` BooleanFormula *bool `json:"boolean,omitempty"` NumberFormula *float64 `json:"number,omitempty"` DateFormula *DatePageProperty `json:"date,omitempty"` }
type HeadingBlock ¶
type IconDescriptor ¶
type IconDescriptor struct { Type IconType `json:"type"` Emoji string `json:"emoji,omitempty"` External *ExternalFile `json:"external,omitempty"` File *NotionFile `json:"file,omitempty"` }
func (IconDescriptor) ValidateRequest ¶
func (id IconDescriptor) ValidateRequest() error
Notion supports icon as a notion file and this can be returned with response. But in request supports only emoji and external types
type ImageBlock ¶
type ImageBlock struct {
Image FileDescriptor `json:"image"`
}
type Language ¶
type Language int
const ( NoLanguage Language = iota ABAP Arduino Bash Basic C Clojure CoffeeScript CPlusPlus CSharp CSS Dart Diff Docker Elixir Elm Erlang Flow Fortran FSharp Gherkin Glsl Go GraphQL Groovy Haskell HTML Java JavaScript JSON Julia Kotlin LaTeX LESS Lisp LiveScript Lua Makefile Markdown Markup Matlab Mermaid ObjectiveC OCaml Pascal Perl PHP PlainText PowerShell Prolog Protobuf Python R Reason Ruby Rust SASS Scala Scheme SCSS Shell SQL Swift TypeScript VBNet Verilog VHDL VisualBasic Webassembly XML YAML )
func (Language) MarshalJSON ¶
func (*Language) UnmarshalJSON ¶
type LinkPreviewBlock ¶
type LinkPreviewBlock struct {
URL string `json:"link_preview"`
}
Link Preview block objects return the originally pasted url. NOTE: The link_preview block will only be returned as part of a response. It cannot be created via the API. https://developers.notion.com/reference/block#link-preview-blocks
type LinkToPageBlock ¶
type Mention ¶
type Mention struct { Type MentionType `json:"type,omitempty"` User *User `json:"user,omitempty"` Page *IDWrap `json:"page,omitempty"` Database *IDWrap `json:"database,omitempty"` Date *DatePageProperty `json:"date,omitempty"` Template *Template `json:"template_mention,omitempty"` }
type MentionType ¶
type MentionType int
const ( NoMentionType MentionType = iota UserMentionType PageMentionType DatabaseMentionType DateMentionType LinkPriviewMentionType )
func (MentionType) MarshalJSON ¶
func (p MentionType) MarshalJSON() ([]byte, error)
func (*MentionType) UnmarshalJSON ¶
func (p *MentionType) UnmarshalJSON(b []byte) error
type MultiSelectCondition ¶
type NotionClient ¶
type NotionClient struct { BaseURL string ApiVersion string NotionVersion string HttpClient *http.Client // contains filtered or unexported fields }
func CreateNotionClient ¶
func CreateNotionClient(apiKey string) NotionClient
func (*NotionClient) QueryDatabase ¶
func (*NotionClient) UpdatePage ¶
type NotionFile ¶
type NotionFile struct { URL string `json:"url"` ExpiryTime *DateTimeWrap `json:"expiry_time,omitempty"` }
type NumberCondition ¶
type NumberCondition struct { Equals float64 `json:"equals,omitempty"` DoesntEqual 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"` }
If we pass 0 as value, fields will be erased completely from result json.
type NumberPropertyFormat ¶
type NumberPropertyFormat int
const ( NoNumberFormat NumberPropertyFormat = iota Number NumberWithCommas Percent Dollar CanadianDollar Euro Pound Yen Ruble Rupee Won Yuan Real Lira Rupiah Franc HongKondDollar NewZellanDollar Krona NorwegianKrone MexicanPeso Rand NewTaiwanDollar DanishKrone Zloty Baht Forint Koruna Shekel ChileanPeso PhilippinePeso Dirham ColumbianPeso Riyal Ringgit Leu ArgentinePeso UruguayanPeso )
func (NumberPropertyFormat) MarshalJSON ¶
func (p NumberPropertyFormat) MarshalJSON() ([]byte, error)
func (*NumberPropertyFormat) UnmarshalJSON ¶
func (p *NumberPropertyFormat) UnmarshalJSON(b []byte) error
type PDFBlock ¶
type PDFBlock struct {
PDF FileDescriptor `json:"pdf"`
}
type Page ¶
type Page struct { Object string ID string `json:"id"` CreatedTime DateTimeWrap `json:"created_time"` CreatedBy User `json:"created_by"` LastEditedTime DateTimeWrap `json:"last_edited_time"` LastEditedBy User `json:"last_edited_by"` Parent PageParent `json:"parent"` Icon *IconDescriptor `json:"icon,omitempty"` Cover *FileDescriptor `json:"cover,omitempty"` Archived bool `json:"archived"` Properties PageProperties `json:"properties"` URL string `json:"url"` }
type PageParent ¶
type PageParent struct { Type PageParentType `json:"type"` DatabaseID string `json:"database_id,omitempty"` PageID string `json:"page_id,omitempty"` Workspace bool `json:"workspace,omitempty"` }
type PageParentType ¶
type PageParentType int
const ( NoPageParentType PageParentType = iota PageParentDB PageParentWorkspace PageParentPage )
func (PageParentType) MarshalJSON ¶
func (pt PageParentType) MarshalJSON() ([]byte, error)
func (*PageParentType) UnmarshalJSON ¶
func (pt *PageParentType) UnmarshalJSON(b []byte) error
type PageProperties ¶
type PageProperties map[string]PageProperty
type PageProperty ¶
type PageProperty struct { ID string `json:"id,omitempty"` Type DBPropertyType `json:"type,omitempty"` Title []RichText `json:"title,omitempty"` RichText []RichText `json:"rich_text,omitempty"` Number *float64 `json:"number,omitempty"` Select *SelectPageProperty `json:"select,omitempty"` MultiSelect []SelectPageProperty `json:"multi_select,omitempty"` Date *DatePageProperty `json:"date,omitempty"` People []User `json:"people,omitempty"` Files []FileDescriptor `json:"files,omitempty"` Checkbox *bool `json:"checkbox,omitempty"` URL *string `json:"url,omitempty"` Email *string `json:"email,omitempty"` PhoneNumber *string `json:"phone_number,omitempty"` Formula *FormulaPageProperty `json:"formula,omitempty"` Relation []IDWrap `json:"relation,omitempty"` Rollup *RollupPageProperty `json:"rollup,omitempty"` CreatedTime *DateTimeWrap `json:"created_time,omitempty"` CreatedBy *User `json:"created_by,omitempty"` LastEditedTime *DateTimeWrap `json:"last_edited_time,omitempty"` LastEditedBy *User `json:"last_edited_by,omitempty"` }
type PagePropertyFormulaType ¶
type PagePropertyFormulaType int
const ( NoFormulaType PagePropertyFormulaType = iota StringFormulaType NumberFormulaType BoolFormulaType DateFormuleType )
func (PagePropertyFormulaType) MarshalJSON ¶
func (p PagePropertyFormulaType) MarshalJSON() ([]byte, error)
func (*PagePropertyFormulaType) UnmarshalJSON ¶
func (p *PagePropertyFormulaType) UnmarshalJSON(b []byte) error
type PeopleCondition ¶
type RelationCondition ¶
type RichText ¶
type RichText struct { Type RichTextType `json:"type,omitempty"` PlainText string `json:"plain_text,omitempty"` Href string `json:"href,omitempty"` Annotations *Annotations `json:"annotations,omitempty"` //One of followings should be define Text *Text `json:"text,omitempty"` Mention *Mention `json:"mention,omitempty"` Equation *Equation `json:"equation,omitempty"` }
type RichTextType ¶
type RichTextType int
const ( NoRichTextType RichTextType = iota TextRichTextType MentionRichTextType EquationRichTextType )
func (RichTextType) MarshalJSON ¶
func (p RichTextType) MarshalJSON() ([]byte, error)
func (*RichTextType) UnmarshalJSON ¶
func (p *RichTextType) UnmarshalJSON(b []byte) error
type RollupArrayValue ¶
type RollupArrayValue struct { Type DBPropertyType `json:"type"` Title []RichText `json:"title,omitempty"` RichText []RichText `json:"rich_text,omitempty"` Number *float64 `json:"number,omitempty"` Select *SelectPageProperty `json:"select,omitempty"` MultiSelect []SelectPageProperty `json:"multi_select,omitempty"` Date *DatePageProperty `json:"date,omitempty"` People []User `json:"people,omitempty"` Files []FileDescriptor `json:"files,omitempty"` Checkbox *bool `json:"checkbox,omitempty"` URL *string `json:"url,omitempty"` Email *string `json:"email,omitempty"` PhoneNumber *string `json:"phone_number,omitempty"` Formula *FormulaPageProperty `json:"formula,omitempty"` Relation []IDWrap `json:"relation,omitempty"` CreatedTime *DateTimeWrap `json:"created_time,omitempty"` CreatedBy *User `json:"created_by,omitempty"` LastEditedTime *DateTimeWrap `json:"last_edited_time,omitempty"` LastEditedBy *User `json:"last_edited_by,omitempty"` }
type RollupCondition ¶
type RollupCondition struct { Any *RollupProperty `json:"any,omitempty"` Every *RollupProperty `json:"every,omitempty"` None *RollupProperty `json:"none,omitempty"` Number *NumberCondition `json:"number,omitempty"` Date *DateCondition `json:"date,omitempty"` }
type RollupFunction ¶
type RollupFunction int
const ( NoRollupFunc RollupFunction = iota Count CountAll CountValues CountUniqueValues CountEmpty CountNotEmpty PercentEmpty PercentNotEmpty Sum Average Median Min Max Range ShowOriginal EarliestDate LatestDate DateRange )
func (RollupFunction) MarshalJSON ¶
func (p RollupFunction) MarshalJSON() ([]byte, error)
func (*RollupFunction) UnmarshalJSON ¶
func (p *RollupFunction) UnmarshalJSON(b []byte) error
type RollupPageProperty ¶
type RollupPageProperty struct { Type RollupPropertyType `json:"type"` Number *float64 `json:"number,omitempty"` Date *DatePageProperty `json:"date,omitempty"` String *string `json:"string,omitempty"` Array []RollupArrayValue `json:"array,omitempty"` Function RollupFunction `json:"function"` }
type RollupProperty ¶
type RollupProperty struct { RichText *TextCondition `json:"rich_text,omitempty"` Title *TextCondition `json:"title,omitempty"` URL *TextCondition `json:"url,omitempty"` Email *TextCondition `json:"email,omitempty"` PhoneNumber *TextCondition `json:"phone_number,omitempty"` Number *NumberCondition `json:"number,omitempty"` CheckBox *CheckboxCondition `json:"checkbox,omitempty"` Select *SelectCondition `json:"select,omitempty"` MultiSelect *MultiSelectCondition `json:"multi_select,omitempty"` File *FileCondition `json:"files,omitempty"` Relation *RelationCondition `json:"relation,omitempty"` Date *DateCondition `json:"date,omitempty"` }
type RollupPropertyType ¶
type RollupPropertyType int
const ( NoRollupPropertyType RollupPropertyType = iota NumberRollupPropertyType DateRollupPropertyType ArrayRollupPropertyType UnsupportedRollupPropertyType IncompleteRollupPropertyType )
func (RollupPropertyType) MarshalJSON ¶
func (p RollupPropertyType) MarshalJSON() ([]byte, error)
func (*RollupPropertyType) UnmarshalJSON ¶
func (p *RollupPropertyType) UnmarshalJSON(b []byte) error
type SelectCondition ¶
type SelectPageProperty ¶
type SelectPageProperty struct { Name string `json:"name"` ID *string `json:"id,omitempty"` //Color works strange while creating pages. Looks like it doesn't have any effect on creating tag. Need test more. //https://developers.notion.com/reference/property-value-object#multi-select-property-values Color *Color `json:"color,omitempty"` }
type Sort ¶
type Sort struct { Property string `json:"property,omitempty"` /* If you will pass both timestamp and property in one sort object like this: { "sorts": [ { "timestamp": "created_time", "property": "title", "direction": "ascending" } ] } Notiion will accept it, but behaviour unpredictable(need to test) TODO Think about validtion on exactly one of this */ Timestamp TimestampConditionType `json:"timestamp,omitempty"` Direction SortDirection `json:"direction"` }
type SortDirection ¶
type SortDirection int
const ( Ascending SortDirection = iota Descending )
func (SortDirection) MarshalJSON ¶
func (p SortDirection) MarshalJSON() ([]byte, error)
func (*SortDirection) UnmarshalJSON ¶
func (p *SortDirection) UnmarshalJSON(b []byte) error
type SyncedBlock ¶
type SyncedBlock struct { SyncedFrom *SyncedFrom `json:"synced_from,omitempty"` Children []Block `json:"children"` }
Need validations to prevent creating original synced block with filled SyncedFrom and visa verse Details: https://developers.notion.com/reference/block#synced-block-blocks
type SyncedFrom ¶
type TableBlock ¶
type TableBlock struct { //Note that this cannot be changed via the public API once a table is created. TableWidth int `json:"table_width"` HasColumnHeader bool `json:"has_column_header"` HasRowHeader bool `json:"has_row_header"` Children []TableRowBlock `json:"children"` }
type TableOfContentsBlock ¶
type TableOfContentsBlock struct {
Color Color `json:"color,omitempty"`
}
type TableRowBlock ¶
type TableRowBlock struct {
Cells []RichText `json:"cells"`
}
type TemplateBlock ¶
type TextCondition ¶
type TextCondition struct { Equals string `json:"equals,omitempty"` DoesntEqual string `json:"does_not_equal,omitempty"` Contains string `json:"contains,omitempty"` DoesntContain string `json:"does_not_contain,omitempty"` StartsWith string `json:"starts_with,omitempty"` EndsWith string `json:"ends_with,omitempty"` IsEmpty bool `json:"is_empty,omitempty"` //In doc written "only true", test what happened if false will be passed here IsNotEmpty bool `json:"is_not_empty,omitempty"` //In doc written "only true", test what happened if false will be passed here }
type TimestampConditionType ¶
type TimestampConditionType int
const ( NoTimestampFilterType TimestampConditionType = iota CreatedTime LastEditedTime )
func (TimestampConditionType) MarshalJSON ¶
func (p TimestampConditionType) MarshalJSON() ([]byte, error)
func (*TimestampConditionType) UnmarshalJSON ¶
func (p *TimestampConditionType) UnmarshalJSON(b []byte) error
type UpdateDBRq ¶
type UpdateDBRq struct { Title []RichText `json:"title,omitempty"` Properties DBProperties `json:"properties,omitempty"` Icon *IconDescriptor `json:"icon,omitempty"` Cover *FileDescriptor `json:"cover,omitempty"` }
type UpdatePageRq ¶
type UpdatePageRq struct { Archived *bool `json:"archived,omitempty"` Properties PageProperties `json:"properties,omitempty"` Icon *IconDescriptor `json:"icon,omitempty"` Cover *FileDescriptor `json:"cover,omitempty"` }
type User ¶
type User struct { Object string `json:"object,omitempty"` ID string `json:"id"` Type UserType `json:"type,omitempty"` Name string `json:"name,omitempty"` AvatarUrl *string `json:"avatar_url,omitempty"` Person *Person `json:"person,omitempty"` Bot *Bot `json:"bot,omitempty"` }
* https://developers.notion.com/reference/user#where-user-objects-appear-in-the-api
User objects will always contain object and id keys, as described below. The remaining properties may appear if the user is being rendered in a rich text or page property context, and the bot has the correct capabilities to access those properties. *
type VideoBlock ¶
type VideoBlock struct {
Video FileDescriptor `json:"image"`
}