blob: ec3dfeeff0cb87526f188ca24760e32c8b387f4b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
}
|