Skip to content

Commit

Permalink
ParamCurrency is no more
Browse files Browse the repository at this point in the history
  • Loading branch information
Noctember committed Jan 30, 2020
1 parent 4924182 commit f8db534
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions ksoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down
12 changes: 3 additions & 9 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f8db534

Please sign in to comment.