diff --git a/README.md b/README.md
index 413352c..0b01274 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,5 @@
# Goingecko
-Coingecko API client for golang.
-
diff --git a/api/coins/types/markets.go b/api/coins/types/markets.go
index a7d338f..ec117cb 100644
--- a/api/coins/types/markets.go
+++ b/api/coins/types/markets.go
@@ -9,7 +9,7 @@ type Market struct {
Image string `json:"image"`
CurrentPrice float64 `json:"current_price"`
MarketCap float64 `json:"market_cap"`
- MarkeCcapRank int64 `json:"market_cap_rank"`
+ MarketCapRank int64 `json:"market_cap_rank"`
FullyDilutedValuation float64 `json:"fully_diluted_valuation"`
TotalVolume float64 `json:"total_volume"`
HighDay float64 `json:"high_24h"`
diff --git a/http/client.go b/http/client.go
index 2d29f13..0512590 100644
--- a/http/client.go
+++ b/http/client.go
@@ -65,10 +65,7 @@ func (c *Client) MakeReq(ctx context.Context, url string) ([]byte, error) {
}
if code != http.StatusOK {
- return nil, &APIError{
- StatusCode: code,
- Body: resp,
- }
+ return nil, NewAPIError(code, resp)
}
return resp, nil
diff --git a/http/error.go b/http/error.go
index 5553ed3..7db6b55 100644
--- a/http/error.go
+++ b/http/error.go
@@ -11,3 +11,11 @@ type APIError struct {
func (e *APIError) Error() string {
return fmt.Sprintf("api returned status code %d", e.StatusCode)
}
+
+// NewAPIError returns a new APIError
+func NewAPIError(status int, body []byte) *APIError {
+ return &APIError{
+ StatusCode: status,
+ Body: body,
+ }
+}
diff --git a/http/rateLimitedClient.go b/http/rateLimitedClient.go
index 7e00f4f..5dd6853 100644
--- a/http/rateLimitedClient.go
+++ b/http/rateLimitedClient.go
@@ -98,7 +98,7 @@ func (c *RateLimitedClient) MakeReq(ctx context.Context, url string) ([]byte, er
}
// Check if this is a 429 error (rate limit exceeded)
var apiErr *APIError
- if errors.As(err, &apiErr) && apiErr.StatusCode == 429 {
+ if errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusTooManyRequests {
if attempt < c.retryPolicy.maxRetries {
// Calculate exponential backoff delay
delay := c.retryPolicy.baseDelay * time.Duration(1<