From 6723418785011c914e6a0686abd5145c0d35e4b9 Mon Sep 17 00:00:00 2001 From: Lukasz Szczesny Date: Mon, 24 Feb 2020 15:40:21 +0100 Subject: [PATCH] Rename UpdateFolder and DeleteFolder arguments names to match Grafana API --- folder.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/folder.go b/folder.go index 55613c6..7c3059b 100644 --- a/folder.go +++ b/folder.go @@ -86,12 +86,13 @@ func (c *Client) NewFolder(title string) (Folder, error) { return folder, err } -func (c *Client) UpdateFolder(id string, name string) error { - dataMap := map[string]string{ - "name": name, +func (c *Client) UpdateFolder(uid string, title string) error { + dataMap := map[string]interface{}{ + "title": title, + "overwrite": true, } data, err := json.Marshal(dataMap) - req, err := c.newRequest("PUT", fmt.Sprintf("/api/folders/%s", id), nil, bytes.NewBuffer(data)) + req, err := c.newRequest("PUT", fmt.Sprintf("/api/folders/%s", uid), nil, bytes.NewBuffer(data)) if err != nil { return err } @@ -105,8 +106,8 @@ func (c *Client) UpdateFolder(id string, name string) error { return err } -func (c *Client) DeleteFolder(id string) error { - req, err := c.newRequest("DELETE", fmt.Sprintf("/api/folders/%s", id), nil, nil) +func (c *Client) DeleteFolder(uid string) error { + req, err := c.newRequest("DELETE", fmt.Sprintf("/api/folders/%s", uid), nil, nil) if err != nil { return err }