Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
refactor: minor adjustments
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Jun 9, 2022
1 parent d2796d1 commit 3bdb516
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func NewClient(baseURL string, options ...ClientOption) (*Client, error) {
}

for _, option := range options {
if err := option(&client); err != nil {
return nil, err
if optionErr := option(&client); optionErr != nil {
return nil, optionErr
}
}

Expand Down Expand Up @@ -174,8 +174,8 @@ func withBody(body interface{}) requestOption {
}

type Page[T any] struct {
Items []T
TotalCount int
Items []T // Items on this page
TotalCount int // Total number of items
}

type PageOptions struct {
Expand Down Expand Up @@ -221,7 +221,7 @@ func (c Client) doRequest(req *http.Request, v interface{}) (a apiResponse, err
log.Printf("received response:\n<<<<<<\n%s\n<<<<<<\n", string(resDump))
}

err = checkResponse(res)
err = checkResponseForError(res)
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (e APIError) Error() string {
return fmt.Sprintf("%s (status: %d)", e.Message, e.StatusCode)
}

func checkResponse(res *http.Response) error {
func checkResponseForError(res *http.Response) error {
if res.StatusCode >= 200 && res.StatusCode < 300 {
return nil
}
Expand Down

0 comments on commit 3bdb516

Please sign in to comment.