Documentation
¶
Index ¶
- Variables
- func GeckoApiVersion() string
- type Client
- func NewClient(c geckohttp.HttpClient, url string) *Client
- func NewDefaultClient() *Client
- func NewDefaultRateLimitedClient() *Client
- func NewDemoApiClient(apiKey string, c *http.Client) *Client
- func NewDemoApiRateLimitedClient(apiKey string, c *http.Client, reqPerMinute int) *Client
- func NewProApiClient(apiKey string, c *http.Client) *Client
- func NewProApiRateLimitedClient(apiKey string, c *http.Client, reqPerMinute, maxRetries int, ...) *Client
Constants ¶
This section is empty.
Variables ¶
var ( // Version represents the CoinGecko API version used by this client Version = internal.Version // BaseURL is the base URL for the CoinGecko public API BaseURL = internal.BaseURL // ProBaseURL is the base URL for the CoinGecko Pro API which requires authentication ProBaseURL = internal.ProBaseURL )
Functions ¶
func GeckoApiVersion ¶
func GeckoApiVersion() string
GeckoApiVersion returns the version of the CoinGecko API client library
Types ¶
type Client ¶
type Client struct {
*ping.PingClient
*simple.SimpleClient
*coins.CoinsClient
*contract.ContractClient
*assetPlatforms.AssetPlatformsClient
*categories.CategoriesClient
*exchanges.ExchangesClient
*derivatives.DerivativesClient
*nfts.NftsClient
*exchangeRates.ExchangeRatesClient
*search.SearchClient
*trending.TrendingClient
*global.GlobalClient
*companies.CompaniesClient
}
Client wraps the CoinGecko API client functionality
func NewClient ¶ added in v3.1.0
func NewClient(c geckohttp.HttpClient, url string) *Client
NewClient creates a new Client with the given gecko HTTP client and base URL.
func NewDefaultClient ¶
func NewDefaultClient() *Client
NewDefaultClient creates a new Client using the default HTTP client and base URL
func NewDefaultRateLimitedClient ¶ added in v3.1.0
func NewDefaultRateLimitedClient() *Client
NewDefaultRateLimitedClient creates a new Client using the default HTTP client and base URL
func NewDemoApiClient ¶
NewDemoApiClient creates a new Client configured for the Demo API with the provided API key and HTTP client
func NewDemoApiRateLimitedClient ¶ added in v3.1.0
NewDemoApiRateLimitedClient creates a new Client configured for the Demo API with rate limiting. It takes an API key, HTTP client, and rate limiting configuration:
- apiKey: The API key for authentication
- c: The HTTP client to use for requests
- reqPerMinute: Maximum number of requests allowed per minute
The client is configured with 5 retry attempts and a base delay of 2 seconds between retries.
func NewProApiClient ¶
NewProApiClient creates a new Client configured for the Pro API with the provided API key and HTTP client
func NewProApiRateLimitedClient ¶ added in v3.1.0
func NewProApiRateLimitedClient(apiKey string, c *http.Client, reqPerMinute, maxRetries int, baseDelay time.Duration) *Client
NewProApiRateLimitedClient creates a new Client configured for the Pro API with rate limiting. It takes an API key, HTTP client, and rate limiting configuration parameters:
- reqPerMinute: Maximum number of requests allowed per minute
- maxRetries: Maximum number of retry attempts for failed requests
- baseDelay: Initial delay between retries, which will be exponentially increased