api

package
v3.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func WithURLParams added in v3.2.0

func WithURLParams(params map[string]any) dictOption

WithURLParams returns an option that applies the provided key-value pairs as URL query parameters. It can be passed to any API method that accepts options.

Types

type Client

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

func NewDemoApiClient(apiKey string, c *http.Client) *Client

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

func NewDemoApiRateLimitedClient(apiKey string, c *http.Client, reqPerMinute int) *Client

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

func NewProApiClient(apiKey string, c *http.Client) *Client

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL