mirror of
https://github.com/dstotijn/go-notion.git
synced 2025-06-08 23:46:12 +02:00
Rename UpdatePageProps
to UpdatePage
This commit is contained in:
parent
a14508d7c8
commit
57876f99e3
@ -262,9 +262,9 @@ func (c *Client) CreatePage(ctx context.Context, params CreatePageParams) (page
|
|||||||
return page, nil
|
return page, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePageProps updates page property values for a page.
|
// UpdatePage updates a page.
|
||||||
// See: https://developers.notion.com/reference/patch-page
|
// See: https://developers.notion.com/reference/patch-page
|
||||||
func (c *Client) UpdatePageProps(ctx context.Context, pageID string, params UpdatePageParams) (page Page, err error) {
|
func (c *Client) UpdatePage(ctx context.Context, pageID string, params UpdatePageParams) (page Page, err error) {
|
||||||
if err := params.Validate(); err != nil {
|
if err := params.Validate(); err != nil {
|
||||||
return Page{}, fmt.Errorf("notion: invalid page params: %w", err)
|
return Page{}, fmt.Errorf("notion: invalid page params: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -2101,7 +2101,7 @@ func TestCreatePage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdatePageProps(t *testing.T) {
|
func TestUpdatePage(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -2583,7 +2583,7 @@ func TestUpdatePageProps(t *testing.T) {
|
|||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
client := notion.NewClient("secret-api-key", notion.WithHTTPClient(httpClient))
|
client := notion.NewClient("secret-api-key", notion.WithHTTPClient(httpClient))
|
||||||
page, err := client.UpdatePageProps(context.Background(), "00000000-0000-0000-0000-000000000000", tt.params)
|
page, err := client.UpdatePage(context.Background(), "00000000-0000-0000-0000-000000000000", tt.params)
|
||||||
|
|
||||||
if tt.expError == nil && err != nil {
|
if tt.expError == nil && err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
3
page.go
3
page.go
@ -79,8 +79,9 @@ type CreatePageParams struct {
|
|||||||
Cover *Cover
|
Cover *Cover
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdatePageParams is used for updating a page. At least one field should have
|
||||||
|
// a non-empty value.
|
||||||
type UpdatePageParams struct {
|
type UpdatePageParams struct {
|
||||||
// Either DatabasePageProperties, Title or Icon must be not nil.
|
|
||||||
DatabasePageProperties *DatabasePageProperties
|
DatabasePageProperties *DatabasePageProperties
|
||||||
Title []RichText
|
Title []RichText
|
||||||
Icon *Icon
|
Icon *Icon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user