driver

package
v0.0.0-...-69f7ccb Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 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/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      int    `json:"buy"`
		Sale     int    `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.

Jump to

Keyboard shortcuts

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