|
6 | 6 | "errors" |
7 | 7 | "fmt" |
8 | 8 | "io/ioutil" |
| 9 | + "net/url" |
9 | 10 | ) |
10 | 11 |
|
11 | 12 | // Annotation represents a Grafana API Annotation |
@@ -37,9 +38,8 @@ type GraphiteAnnotation struct { |
37 | 38 | } |
38 | 39 |
|
39 | 40 | // Annotations fetches the annotations queried with the params it's passed |
40 | | -func (c *Client) Annotations(params map[string]string) ([]Annotation, error) { |
41 | | - pathAndQuery := buildPathAndQuery("/api/annotations", params) |
42 | | - req, err := c.newRequest("GET", pathAndQuery, nil) |
| 41 | +func (c *Client) Annotations(params url.Values) ([]Annotation, error) { |
| 42 | + req, err := c.newRequest("GET", "/api/annotation", params, nil) |
43 | 43 | if err != nil { |
44 | 44 | return nil, err |
45 | 45 | } |
@@ -68,7 +68,7 @@ func (c *Client) NewAnnotation(a *Annotation) (int64, error) { |
68 | 68 | if err != nil { |
69 | 69 | return 0, err |
70 | 70 | } |
71 | | - req, err := c.newRequest("POST", "/api/annotations", bytes.NewBuffer(data)) |
| 71 | + req, err := c.newRequest("POST", "/api/annotations", nil, bytes.NewBuffer(data)) |
72 | 72 | if err != nil { |
73 | 73 | return 0, err |
74 | 74 | } |
@@ -99,7 +99,7 @@ func (c *Client) NewGraphiteAnnotation(gfa *GraphiteAnnotation) (int64, error) { |
99 | 99 | if err != nil { |
100 | 100 | return 0, err |
101 | 101 | } |
102 | | - req, err := c.newRequest("POST", "/api/annotations/graphite", bytes.NewBuffer(data)) |
| 102 | + req, err := c.newRequest("POST", "/api/annotations/graphite", nil, bytes.NewBuffer(data)) |
103 | 103 | if err != nil { |
104 | 104 | return 0, err |
105 | 105 | } |
@@ -131,7 +131,7 @@ func (c *Client) UpdateAnnotation(a *Annotation) (int64, error) { |
131 | 131 | if err != nil { |
132 | 132 | return 0, err |
133 | 133 | } |
134 | | - req, err := c.newRequest("PUT", path, bytes.NewBuffer(data)) |
| 134 | + req, err := c.newRequest("PUT", path, nil, bytes.NewBuffer(data)) |
135 | 135 | if err != nil { |
136 | 136 | return 0, err |
137 | 137 | } |
@@ -159,7 +159,7 @@ func (c *Client) UpdateAnnotation(a *Annotation) (int64, error) { |
159 | 159 | // DeleteAnnotation deletes the annotation of the ID it is passed |
160 | 160 | func (c *Client) DeleteAnnotation(id int64) (string, error) { |
161 | 161 | path := fmt.Sprintf("/api/annotations/%d", id) |
162 | | - req, err := c.newRequest("DELETE", path, bytes.NewBuffer(nil)) |
| 162 | + req, err := c.newRequest("DELETE", path, nil, bytes.NewBuffer(nil)) |
163 | 163 | if err != nil { |
164 | 164 | return "", err |
165 | 165 | } |
@@ -187,7 +187,7 @@ func (c *Client) DeleteAnnotation(id int64) (string, error) { |
187 | 187 | // DeleteAnnotationByRegionID deletes the annotation corresponding to the region ID it is passed |
188 | 188 | func (c *Client) DeleteAnnotationByRegionID(id int64) (string, error) { |
189 | 189 | path := fmt.Sprintf("/api/annotations/region/%d", id) |
190 | | - req, err := c.newRequest("DELETE", path, bytes.NewBuffer(nil)) |
| 190 | + req, err := c.newRequest("DELETE", path, nil, bytes.NewBuffer(nil)) |
191 | 191 | if err != nil { |
192 | 192 | return "", err |
193 | 193 | } |
|
0 commit comments