diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-07-09 15:36:08 -0230 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-07-09 15:36:08 -0230 |
| commit | 4853cad7499a953deb4a18bae2c14c1482007e42 (patch) | |
| tree | b6a7eaf332d4c89ba585f88e1a345d716df59ae1 /schema.go | |
| download | exchange-4853cad7499a953deb4a18bae2c14c1482007e42.zip | |
rate
Diffstat (limited to 'schema.go')
| -rw-r--r-- | schema.go | 39 |
1 files changed, 39 insertions, 0 deletions
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 +} |