1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-17 00:07:45 +02:00

Enumerate rollup function values

This commit is contained in:
David Stotijn
2021-12-17 18:12:14 +01:00
parent 52e133b4e8
commit 74663ed1b6
2 changed files with 26 additions and 7 deletions

View File

@ -191,7 +191,7 @@ func TestFindDatabaseByID(t *testing.T) {
"relation_property_name": "Meals",
"rollup_property_id": "title",
"relation_property_id": "mxp^",
"function": "count"
"function": "count_all"
}
},
"Store availability": {
@ -322,7 +322,7 @@ func TestFindDatabaseByID(t *testing.T) {
RelationPropName: "Meals",
RollupPropID: "title",
RelationPropID: "mxp^",
Function: "count",
Function: notion.RollupFunctionCountAll,
},
},
"Store availability": notion.DatabaseProperty{

View File

@ -43,10 +43,29 @@ type (
RelationPropID string `json:"relation_property_id,omitempty"`
RollupPropName string `json:"rollup_property_name,omitempty"`
RollupPropID string `json:"rollup_property_id,omitempty"`
Function string `json:"function,omitempty"`
Function RollupFunction `json:"function,omitempty"`
}
)
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"
RollupFunctionShowOriginal RollupFunction = "show_original"
)
type SelectOptions struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`