coingecko

package
v0.0.0-...-4ca6365 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Handles HTTP requests logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
	RetryDelay time.Duration
	MaxRetries int
}

func NewClient

func NewClient() *Client

Create a new Client object

func (*Client) RequestWithRetries

func (c *Client) RequestWithRetries(endpoint string, parameters map[string]string) ([]byte, error)

Retry mechanism for HTTP requests

type CoinList

type CoinList struct {
	Coins []struct {
		ID     string `json:"id"`
		Symbol string `json:"symbol"`
		Name   string `json:"name"`
	}
}

func GetCoinList

func GetCoinList() (*CoinList, error)

type CoinPrice

type CoinPrice struct {
	ID         string `json:"id"`
	Symbol     string `json:"symbol"`
	Name       string `json:"name"`
	MarketData struct {
		CurrentPrice struct {
			EUR float64 `json:"eur"`
			USD float64 `json:"usd"`
		} `json:"current_price"`
	} `json:"market_data"`
}

func GetCoinPrice

func GetCoinPrice(id string) (*CoinPrice, error)

Jump to

Keyboard shortcuts

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