lib

package
v0.0.0-...-284a013 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Config *Config
	// contains filtered or unexported fields
}

API declared data types.

func NewAPI

func NewAPI(config *Config, endpointName string) *API

NewAPI creates a new service instance.

func (*API) Parse

func (api *API) Parse(body []byte) interface{}

Parse returns API response body data.

func (*API) URL

func (api *API) URL() string

URL returns as constructed location.

type Config

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

Config declared data types.

func NewConfig

func NewConfig(serviceName string) *Config

NewConfig create a new config instance.

func (*Config) APIKey

func (config *Config) APIKey(v ...string) string

APIKey sets/returns the option value.

func (*Config) Currency

func (config *Config) Currency(v ...string) string

Currency sets/returns the option value.

func (*Config) IsValid

func (config *Config) IsValid() bool

IsValid checks config values exist.

func (*Config) Language

func (config *Config) Language(v ...string) string

Language sets/returns the option value.

func (*Config) Options

func (config *Config) Options() ConfigOpts

Options returns ConfigOpts name/value(s).

func (*Config) RefreshRate

func (config *Config) RefreshRate(v ...string) int64

RefreshRate sets/returns the option value.

func (*Config) Save

func (config *Config) Save()

Save the config field values.

func (*Config) ServiceName

func (config *Config) ServiceName(v ...string) string

ServiceName sets/returns the option value.

func (*Config) Symbols

func (config *Config) Symbols(v ...ConfigSymbol) ConfigSymbol

Symbols sets/returns the option value.

type ConfigHolding

type ConfigHolding struct {
	Units float64 `yaml:"units"`
	Price float64 `yaml:"price"`
}

ConfigHolding declared data types.

type ConfigOpts

type ConfigOpts struct {
	ServiceName string       `yaml:"service"`
	APIKey      string       `yaml:"apiKey"`
	Currency    string       `yaml:"currency"`
	Language    string       `yaml:"language"`
	RefreshRate int64        `yaml:"refreshRate"`
	Symbols     ConfigSymbol `yaml:"symbols"`
}

ConfigOpts declared data types.

type ConfigSymbol

type ConfigSymbol map[string]symbol

ConfigSymbol declared data types.

type Request

type Request struct {
	API   *API
	Error interface{}
	// contains filtered or unexported fields
}

Request declared data types.

func NewRequest

func NewRequest(api *API) *Request

NewRequest creates a new request instance.

func (*Request) Get

func (request *Request) Get() interface{}

Get data from a remote resource or cached response.

Jump to

Keyboard shortcuts

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