Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporting MakeAPIGetRequest #17

Merged
merged 1 commit into from
Oct 13, 2016
Merged
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
10 changes: 5 additions & 5 deletions govt.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ func (client *Client) checkApiKey() (err error) {
}
}

// makeApiGetRequest fetches a URL with querystring via HTTP GET and
// MakeAPIGetRequest fetches a URL with querystring via HTTP GET and
// returns the response if the status code is HTTP 200
// `parameters` should not include the apikey.
// The caller must call `resp.Body.Close()`.
func (client *Client) makeApiGetRequest(fullurl string, parameters map[string]string) (resp *http.Response, err error) {
func (client *Client) MakeAPIGetRequest(fullurl string, parameters map[string]string) (resp *http.Response, err error) {
if err = client.checkApiKey(); err != nil {
return resp, err
}
Expand Down Expand Up @@ -464,7 +464,7 @@ func (client *Client) fetchApiJson(method string, actionurl string, parameters P
var resp *http.Response
switch method {
case "GET":
resp, err = client.makeApiGetRequest(theurl, parameters)
resp, err = client.MakeAPIGetRequest(theurl, parameters)
case "POST":
resp, err = client.makeApiPostRequest(theurl, parameters)
case "FILE":
Expand All @@ -490,7 +490,7 @@ func (client *Client) fetchApiJson(method string, actionurl string, parameters P
func (client *Client) fetchApiFile(actionurl string, parameters Parameters) (data []byte, err error) {
theurl := client.Url + actionurl
var resp *http.Response
resp, err = client.makeApiGetRequest(theurl, parameters)
resp, err = client.MakeAPIGetRequest(theurl, parameters)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -607,7 +607,7 @@ func readData(br *bufio.Reader) (line []byte, err error) {
func (client *Client) GetFileFeed(packageRange string) ([]FileFeed, error) {
var resp *http.Response
feedElements := []FileFeed{}
resp, err := client.makeApiGetRequest(client.Url+"file/feed", Parameters{"package": packageRange})
resp, err := client.MakeAPIGetRequest(client.Url+"file/feed", Parameters{"package": packageRange})
if err != nil {
return feedElements, err
}
Expand Down