11package gapi
22
33import (
4- "bytes"
54 "encoding/json"
65 "fmt"
76 "net/url"
@@ -58,7 +57,7 @@ func (c *Client) NewAnnotation(a *Annotation) (int64, error) {
5857 ID int64 `json:"id"`
5958 }{}
6059
61- err = c .request ("POST" , "/api/annotations" , nil , bytes . NewBuffer ( data ) , & result )
60+ err = c .request ("POST" , "/api/annotations" , nil , data , & result )
6261 if err != nil {
6362 return 0 , err
6463 }
@@ -77,7 +76,7 @@ func (c *Client) NewGraphiteAnnotation(gfa *GraphiteAnnotation) (int64, error) {
7776 ID int64 `json:"id"`
7877 }{}
7978
80- err = c .request ("POST" , "/api/annotations/graphite" , nil , bytes . NewBuffer ( data ) , & result )
79+ err = c .request ("POST" , "/api/annotations/graphite" , nil , data , & result )
8180 if err != nil {
8281 return 0 , err
8382 }
@@ -97,7 +96,7 @@ func (c *Client) UpdateAnnotation(id int64, a *Annotation) (string, error) {
9796 Message string `json:"message"`
9897 }{}
9998
100- err = c .request ("PUT" , path , nil , bytes . NewBuffer ( data ) , & result )
99+ err = c .request ("PUT" , path , nil , data , & result )
101100 if err != nil {
102101 return "" , err
103102 }
@@ -117,7 +116,7 @@ func (c *Client) PatchAnnotation(id int64, a *Annotation) (string, error) {
117116 Message string `json:"message"`
118117 }{}
119118
120- err = c .request ("PATCH" , path , nil , bytes . NewBuffer ( data ) , & result )
119+ err = c .request ("PATCH" , path , nil , data , & result )
121120 if err != nil {
122121 return "" , err
123122 }
@@ -132,7 +131,7 @@ func (c *Client) DeleteAnnotation(id int64) (string, error) {
132131 Message string `json:"message"`
133132 }{}
134133
135- err := c .request ("DELETE" , path , nil , bytes . NewBuffer ( nil ) , & result )
134+ err := c .request ("DELETE" , path , nil , nil , & result )
136135 if err != nil {
137136 return "" , err
138137 }
@@ -147,7 +146,7 @@ func (c *Client) DeleteAnnotationByRegionID(id int64) (string, error) {
147146 Message string `json:"message"`
148147 }{}
149148
150- err := c .request ("DELETE" , path , nil , bytes . NewBuffer ( nil ) , & result )
149+ err := c .request ("DELETE" , path , nil , nil , & result )
151150 if err != nil {
152151 return "" , err
153152 }
0 commit comments