exchange_rates

package
v0.0.0-...-5b29fed Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetExchangeRatesRequestPoint = "/exchange_rates"
	GetExchangeRateEndpoint      = "/exchange_rates/{id}"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetExchangeRates() (*GetExchangeRatesResponse, error)
	GetExchangeRate(request *GetExchangeRateRequest) (*GetExchangeRateResponse, error)
}

func NewClient

func NewClient(baseClient *base.BaseClient) Client

type ClientImpl

type ClientImpl struct {
	// contains filtered or unexported fields
}

func (*ClientImpl) GetExchangeRate

func (c *ClientImpl) GetExchangeRate(request *GetExchangeRateRequest) (*GetExchangeRateResponse, error)

func (*ClientImpl) GetExchangeRates

func (c *ClientImpl) GetExchangeRates() (*GetExchangeRatesResponse, error)

type ExchangeRate

type ExchangeRate struct {
	// Name is the name of the currency
	Name string `json:"name"`
	// Unit is the unit of the currency
	Unit string `json:"unit"`
	// Value is the value of the currency in BTC
	Value float64 `json:"value"`
	// Type is the type of the currency
	Type string `json:"type"`
}

ExchangeRate represents a single exchange rate

type GetExchangeRateRequest

type GetExchangeRateRequest struct {
	// ID is the unique identifier of the currency
	ID string `json:"id" validate:"required"`
}

GetExchangeRateRequest represents the request parameters for getting a specific exchange rate

func (*GetExchangeRateRequest) Validate

func (r *GetExchangeRateRequest) Validate() error

Validate validates the GetExchangeRateRequest

type GetExchangeRateResponse

type GetExchangeRateResponse struct {
	// Name is the name of the currency
	Name string `json:"name"`
	// Unit is the unit of the currency
	Unit string `json:"unit"`
	// Value is the exchange rate value
	Value float64 `json:"value"`
	// Type is the type of the currency
	Type string `json:"type"`
}

GetExchangeRateResponse represents the response from the Exchange Rate API

type GetExchangeRatesResponse

type GetExchangeRatesResponse struct {
	// Rates contains exchange rates for different currencies
	Rates map[string]ExchangeRate `json:"rates"`
}

GetExchangeRatesResponse represents the response from the Exchange Rates API

Jump to

Keyboard shortcuts

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