From 6f921c2bf5722d05bc554515269fb2973ef8f15f Mon Sep 17 00:00:00 2001 From: Alexander Zhuravlev Date: Sun, 12 May 2024 17:56:24 +0300 Subject: [PATCH] Fix geolocate params types. --- api/suggest/geolocate.go | 4 ++-- dadata_test.go | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/api/suggest/geolocate.go b/api/suggest/geolocate.go index 8fffa8b..404c4bd 100644 --- a/api/suggest/geolocate.go +++ b/api/suggest/geolocate.go @@ -10,8 +10,8 @@ type ( GeolocateParams struct { Lat string `json:"lat"` // geographic latitude Lon string `json:"lon"` // geographic longitude - Count string `json:"count,omitempty"` // number of results (max 20) - RadiusMeters string `json:"radius_meters,omitempty"` // search radius in metres (max. 1000) + Count int `json:"count,omitempty"` // number of results (max 20) + RadiusMeters int `json:"radius_meters,omitempty"` // search radius in metres (max. 1000) Language string `json:"language,omitempty"` // in which language to return the result (ru / en) } diff --git a/dadata_test.go b/dadata_test.go index 4307cda..5c08a94 100644 --- a/dadata_test.go +++ b/dadata_test.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "os" - "strconv" "testing" "github.com/stretchr/testify/suite" @@ -364,13 +363,13 @@ func (s *ApiSuggestIntegrationTest) TestGeoLocateWithCountTwo() { Lat: "55.878", Lon: "37.653", Language: "EN", - Count: strconv.Itoa(reqElementCount), + Count: reqElementCount, } res, err := api.GeoLocate(context.Background(), ¶ms) s.NoError(err) - s.Len(res, 2) + s.Len(res, reqElementCount) } func (s *ApiSuggestIntegrationTest) TestGeoLocateWithRadius() { @@ -380,7 +379,7 @@ func (s *ApiSuggestIntegrationTest) TestGeoLocateWithRadius() { Lat: "55.878", Lon: "37.653", Language: "EN", - RadiusMeters: "100", + RadiusMeters: 100, } res, err := api.GeoLocate(context.Background(), ¶ms)