Skip to content

Commit

Permalink
Updating comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Dowling committed Jan 24, 2016
1 parent 0d9dae4 commit bfb5a94
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
6 changes: 4 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ func Do(request *http.Request) (*jsh.Document, *http.Response, error) {
return doc, response, parseErr
}

// ParseResponse handles parsing an HTTP response into a JSON Document if
// possible
/*
ParseResponse handles parsing an HTTP response into a JSON Document if
possible.
*/
func ParseResponse(response *http.Response) (*jsh.Document, error) {

skipCodes := []int{
Expand Down
17 changes: 10 additions & 7 deletions client/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"github.com/derekdowling/go-json-spec-handler"
)

// Delete allows a user to make an outbound "DELETE /resource/:id" request.
//
// resp, err := jsh.Delete("http://apiserver", "user", "2")
//
/*
Delete allows a user to make an outbound "DELETE /resource/:id" request.
resp, err := jsh.Delete("http://apiserver", "user", "2")
*/
func Delete(urlStr string, resourceType string, id string) (*http.Response, error) {
request, err := DeleteRequest(urlStr, resourceType, id)
if err != nil {
Expand All @@ -26,9 +27,11 @@ func Delete(urlStr string, resourceType string, id string) (*http.Response, erro
return response, nil
}

// DeleteRequest returns a fully formatted request for performing a JSON API DELETE.
// This is useful for if you need to set custom headers on the request. Otherwise
// just use "jsc.Delete".
/*
DeleteRequest returns a fully formatted request for performing a JSON API DELETE.
This is useful for if you need to set custom headers on the request. Otherwise
just use "jsc.Delete".
*/
func DeleteRequest(urlStr string, resourceType string, id string) (*http.Request, error) {
u, err := url.Parse(urlStr)
if err != nil {
Expand Down
12 changes: 8 additions & 4 deletions client/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ func Fetch(baseURL string, resourceType string, id string) (*jsh.Document, *http
return Do(request)
}

// FetchRequest returns a fully formatted JSONAPI Fetch request. Useful if you need to
// set custom headers before proceeding. Otherwise just use "jsh.Fetch".
/*
FetchRequest returns a fully formatted JSONAPI Fetch request. Useful if you need to
set custom headers before proceeding. Otherwise just use "jsh.Fetch".
*/
func FetchRequest(baseURL string, resourceType, id string) (*http.Request, error) {
if id == "" {
return nil, jsh.SpecificationError("ID cannot be empty for GetObject request type")
Expand All @@ -45,8 +47,10 @@ func List(baseURL string, resourceType string) (*jsh.Document, *http.Response, e
return Do(request)
}

// ListRequest returns a fully formatted JSONAPI List request. Useful if you need to
// set custom headers before proceeding. Otherwise just use "jsh.List".
/*
ListRequest returns a fully formatted JSONAPI List request. Useful if you need to
set custom headers before proceeding. Otherwise just use "jsh.List".
*/
func ListRequest(baseURL string, resourceType string) (*http.Request, error) {
u, urlErr := url.Parse(baseURL)
if urlErr != nil {
Expand Down

0 comments on commit bfb5a94

Please sign in to comment.