driver

package
v0.0.0-...-f732412 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Freedom

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

func NewFreedom

func NewFreedom(addr string, httpClient HTTPClient) *Freedom

NewFreedom creates a new Freedom driver.

func (*Freedom) FetchRates

func (f *Freedom) FetchRates(ctx context.Context) ([]*entity.ExchangeRate, error)

FetchRates fetches cash exchange rates for supported currencies.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface that defines the methods that an HTTP client must implement.

type Halyk

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

func NewHalyk

func NewHalyk(addr string, httpClient HTTPClient) *Halyk

func (*Halyk) FetchRates

func (h *Halyk) FetchRates(ctx context.Context) ([]*entity.ExchangeRate, error)

FetchRates returns latest (index 0) private persons rates for supported currencies.

type Home

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

func NewHome

func NewHome(addr string, httpClient HTTPClient) *Home

NewHome creates driver for home.kz.

func (*Home) FetchRates

func (h *Home) FetchRates(ctx context.Context) ([]*entity.ExchangeRate, error)

type Kaspi

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

func NewKaspi

func NewKaspi(addr string, httpClient HTTPClient) *Kaspi

NewKaspi creates a new Kaspi driver. Default addr is "https://guide.kaspi.kz/client/api/v2/intgr/currency/rate/aggregate". Seems that addr works only from KZ location.

func (*Kaspi) FetchRates

func (k *Kaspi) FetchRates(ctx context.Context) ([]*entity.ExchangeRate, error)

FetchRates fetches exchange rates from the Kaspi API.

type KaspiResponse

type KaspiResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Body    []struct {
		Currency string  `json:"currency"`
		Buy      float64 `json:"buy"`
		Sale     float64 `json:"sale"`
	} `json:"body"`
}

type NBRK

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

func NewNBRK

func NewNBRK(addr string, client HTTPClient) *NBRK

NewNBRK creates a new NBRK driver. default address is "https://nationalbank.kz/rss/rates_all.xml" but you can pass your own address.

func (*NBRK) FetchRates

func (n *NBRK) FetchRates(ctx context.Context) ([]*entity.ExchangeRate, error)

FetchRates fetches exchange rates from the NBRK API.

type RBK

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

func NewRBK

func NewRBK(addr string, httpClient HTTPClient) *RBK

NewRBK creates RBK driver.

func (*RBK) FetchRates

func (r *RBK) FetchRates(ctx context.Context) ([]*entity.ExchangeRate, error)

FetchRates returns latest online rates for supported currencies.

Jump to

Keyboard shortcuts

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