From a65ceb2c41800aa85aa837fa56c80ef66ad8b820 Mon Sep 17 00:00:00 2001 From: Joel Speed Date: Thu, 20 Dec 2018 09:37:02 +0000 Subject: [PATCH] Add comments to exported methods for api package --- api/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/api.go b/api/api.go index 8b02934..56f36e6 100644 --- a/api/api.go +++ b/api/api.go @@ -10,6 +10,7 @@ import ( "github.com/bitly/go-simplejson" ) +// Request parses the request body into a simplejson.Json object func Request(req *http.Request) (*simplejson.Json, error) { resp, err := http.DefaultClient.Do(req) if err != nil { @@ -32,6 +33,7 @@ func Request(req *http.Request) (*simplejson.Json, error) { return data, nil } +// RequestJSON parses the request body into the given interface func RequestJSON(req *http.Request, v interface{}) error { resp, err := http.DefaultClient.Do(req) if err != nil { @@ -50,6 +52,7 @@ func RequestJSON(req *http.Request, v interface{}) error { return json.Unmarshal(body, v) } +// RequestUnparsedResponse performs a GET and returns the raw response object func RequestUnparsedResponse(url string, header http.Header) (resp *http.Response, err error) { req, err := http.NewRequest("GET", url, nil) if err != nil {