diff --git a/endpoints.go b/endpoints.go index ba94a74..d229b33 100644 --- a/endpoints.go +++ b/endpoints.go @@ -37,8 +37,8 @@ var ( return EndpointRest + "kumo/weather/" + strconv.FormatFloat(param.Latitude, 'f', -1, 64) + "," + strconv.FormatFloat(param.Longitude, 'f', -1, 64) + "/" + param.ReportType } EndpointKumoGeoip = func(ip string) string { return EndpointRest + "kumo/geoip?ip=" + ip } - EndpointKumoCurrency = func(param ParamCurrency) string { - return EndpointRest + "kumo/currency?from=" + param.From + "&to=" + param.To + "&value=" + string(param.Value) + EndpointKumoCurrency = func(value float64, from, to string) string { + return EndpointRest + "kumo/currency?from=" + from + "&to=" + to + "&value=" + strconv.FormatFloat(value, 'f', -1, 64) } EndpointLyricsSearch = func(param ParamSearchLyrics) string { diff --git a/ksoft.go b/ksoft.go index 172d437..7258a09 100644 --- a/ksoft.go +++ b/ksoft.go @@ -12,7 +12,7 @@ import ( ) // Following https://semver.org/ -const VERSION string = "1.1.3" +const VERSION string = "1.1.4" // New creates a new KSoft instance. func New(token string) (s *KSession, err error) { @@ -297,10 +297,10 @@ func (s *KSession) GeoIP(ip string) (geoip GeoIP, err error) { // Currency conversion // Example: -// currency, err := ksession.CurrenyConversion(ksoftgo.ParamCurrency{From: "CAD", To "USD", Value: "1000"}) -func (s *KSession) CurrencyConversion(param ParamCurrency) (curr Currency, err error) { +// currency, err := ksession.CurrenyConversion(694.20, "USD", "CAD") +func (s *KSession) CurrencyConversion(value float64, from, to string) (curr Currency, err error) { curr = Currency{} - res, err := s.request("GET", EndpointKumoCurrency(param), nil) + res, err := s.request("GET", EndpointKumoCurrency(value, from, to), nil) if err != nil { return } diff --git a/structs.go b/structs.go index 57d7fc6..66c64e8 100644 --- a/structs.go +++ b/structs.go @@ -61,9 +61,9 @@ type Image struct { } type WikiHowImage struct { - URL string `json:"url"` - Title string `json:"title"` - NSFW bool `json:"nsfw"` + URL string `json:"url"` + Title string `json:"title"` + NSFW bool `json:"nsfw"` ArticleURL string `json:"article_url"` } @@ -269,12 +269,6 @@ type ParamAdvWeather struct { Icons string } -type ParamCurrency struct { - From string - To string - Value string -} - type ParamDeleteBan struct { User int64 Force bool