client

package
v0.0.0-...-9d5c328 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base interface {
	GetConfig() *Config
}

Base client basic interface

type Client

type Client struct {
	CryptocurrencyV1 CryptocurrencyV1API
	CryptocurrencyV2 CryptocurrencyV2API
	ExchangeV1       ExchangeV1API
	FiatV1           FiatV1API
	GlobalMetricsV1  GlobalMetricsV1API
	// contains filtered or unexported fields
}

func New

func New(options ...OptionHandler) (*Client, error)

New create a new coinmarket instance

func (*Client) GetConfig

func (c *Client) GetConfig() *Config

GetConfig get instance configuration

type Config

type Config struct {
	BaseApi          string // coinmarketcap OpenAPI Server Domain
	RestyClient      *resty.Client
	ApiKey           string // coinmarketcap ApiKey
	IsDebug          bool   // debug mode
	IsSandBox        bool
	Timeout          time.Duration // resty client request timeout
	ProxyUrl         string        // 国内访问不了设置下代理
	RequestPerMinute int
}

Config coinmarketcap client configuration

type CryptocurrencyV1API

type CryptocurrencyV1API interface {
	GetMap(ctx context.Context, req *types.GetCryptocurrencyMapReq) (*types.GetCryptocurrencyMapResp, error)
}

币种接口

type ExchangeV1API

交易所接口

type FiatV1API

type FiatV1API interface {
	GetMap(ctx context.Context, req *types.GetFiatMapReq) (*types.GetFiatResp, error)
}

type GlobalMetricsV1API

type GlobalMetricsV1API interface {
	GetQuotesLatest(ctx context.Context, req *types.GetGlobalMetricsQuotesReq) (*types.GetGlobalMetricsQuotesResp, error)
}

type OptionHandler

type OptionHandler func(*Config) error

func WithApiKey

func WithApiKey(apiKey string) OptionHandler

WithApiKey Customize DoDoBot Api base host

func WithBaseApi

func WithBaseApi(baseApi string) OptionHandler

WithBaseApi Customize DoDoBot Api base host

func WithDebugMode

func WithDebugMode(flag bool) OptionHandler

WithDebugMode Toggle debug mode

func WithProxyUrl

func WithProxyUrl(proxyUrl string) OptionHandler

func WithRequestPerMinute

func WithRequestPerMinute(m int) OptionHandler

WithDebugMode Toggle debug mode

func WithRestyClient

func WithRestyClient(client *resty.Client) OptionHandler

func WithSandBox

func WithSandBox(flag bool) OptionHandler

WithSandBox Toggle sandbox mode

func WithTimeout

func WithTimeout(duration time.Duration) OptionHandler

WithTimeout Customize RestyClient request timeout

Jump to

Keyboard shortcuts

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