1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-15 00:05:04 +02:00

Add "Update database" endpoint

This commit is contained in:
David Stotijn
2021-12-20 11:11:03 +01:00
parent 2ebac2e1b2
commit f62677ef09
3 changed files with 282 additions and 0 deletions

View File

@ -436,3 +436,17 @@ func (p CreateDatabaseParams) MarshalJSON() ([]byte, error) {
return json.Marshal(dto)
}
// UpdateDatabaseParams are the params used for updating a database.
type UpdateDatabaseParams struct {
Title []RichText `json:"title,omitempty"`
Properties map[string]*DatabaseProperty `json:"properties,omitempty"`
}
// Validate validates params for updating a database.
func (p UpdateDatabaseParams) Validate() error {
if len(p.Title) == 0 && len(p.Properties) == 0 {
return errors.New("either title or properties are required")
}
return nil
}