From 4853cad7499a953deb4a18bae2c14c1482007e42 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 9 Jul 2026 15:36:08 -0230 Subject: rate --- schema.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 schema.go (limited to 'schema.go') diff --git a/schema.go b/schema.go new file mode 100644 index 0000000..ec3dfee --- /dev/null +++ b/schema.go @@ -0,0 +1,39 @@ +package exchange + +import ( + "fmt" + + "github.com/shopspring/decimal" +) + +type response[T any] struct { + Data T + Status status +} + +type status struct { + Error string `json:"error_message"` +} + +type apiError struct { + Status status +} + +func (e apiError) Error() string { + return fmt.Sprintf("currency exchange api error: %v", e.Status.Error) +} + +type priceConversionQuery struct { + Amount uint `url:"amount"` + From string `url:"symbol"` + To string `url:"convert"` +} + +type priceConversion struct { + Id uint + Quote map[string]price +} + +type price struct { + Price decimal.Decimal +} -- cgit v1.2.3