dnscontrol/vendor/github.com/namedotcom/go/namecom/hello.go
Pat Moroney 716cc0843a Namecom v4 api (#298)
* new Name.com api version and go client library
* vendor github.com/namedotcom/go/namecom
2018-01-10 16:49:20 -05:00

31 lines
502 B
Go

package namecom
import (
"bytes"
"encoding/json"
"fmt"
"net/url"
)
var _ = bytes.MinRead
// HelloFunc returns some information about the API server.
func (n *NameCom) HelloFunc(request *HelloRequest) (*HelloResponse, error) {
endpoint := fmt.Sprintf("/v4/hello")
values := url.Values{}
body, err := n.get(endpoint, values)
if err != nil {
return nil, err
}
resp := &HelloResponse{}
err = json.NewDecoder(body).Decode(resp)
if err != nil {
return nil, err
}
return resp, nil
}