Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Rename folder functions' arguments names to match Grafana API #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down