Omit empty suggest params.
This commit is contained in:
parent
d693536866
commit
ab7e9437f3
|
@ -40,15 +40,15 @@ type (
|
||||||
|
|
||||||
// RequestParams Request struct
|
// RequestParams Request struct
|
||||||
RequestParams struct {
|
RequestParams struct {
|
||||||
Type *PartyType `json:"type,omitempty"` // party type for the suggestion (user input)
|
Type PartyType `json:"type,omitempty"` // party type for the suggestion (user input)
|
||||||
Query string `json:"query"` // user input for suggestion
|
Query string `json:"query"` // user input for suggestion
|
||||||
Count int `json:"count"` // ligmit for results
|
Count int `json:"count,omitempty"` // ligmit for results
|
||||||
Language string `json:"language,omitempty"`
|
Language string `json:"language,omitempty"`
|
||||||
Locations []*RequestParamsLocation `json:"locations"`
|
Locations []*RequestParamsLocation `json:"locations,omitempty"`
|
||||||
RestrictValue bool `json:"restrict_value"` // don't show restricts (region) on results
|
RestrictValue bool `json:"restrict_value,omitempty"` // don't show restricts (region) on results
|
||||||
|
|
||||||
FromBound *Bound `json:"from_bound"`
|
FromBound *Bound `json:"from_bound,omitempty"`
|
||||||
ToBound *Bound `json:"to_bound"`
|
ToBound *Bound `json:"to_bound,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddressResponse result slice for address suggestions
|
// AddressResponse result slice for address suggestions
|
||||||
|
|
|
@ -105,10 +105,9 @@ func (s *ApiSuggestIntegrationTest) TestPartyWithTypePositive() {
|
||||||
api := NewSuggestApi()
|
api := NewSuggestApi()
|
||||||
|
|
||||||
// positive: there are some legal entities "сбербанк"
|
// positive: there are some legal entities "сбербанк"
|
||||||
legalParty := suggest.PartyTypeLegal
|
|
||||||
res, err := api.Party(context.Background(), &suggest.RequestParams{
|
res, err := api.Party(context.Background(), &suggest.RequestParams{
|
||||||
Query: "сбербанк",
|
Query: "сбербанк",
|
||||||
Type: &legalParty,
|
Type: suggest.PartyTypeLegal,
|
||||||
})
|
})
|
||||||
|
|
||||||
s.NoError(err)
|
s.NoError(err)
|
||||||
|
@ -119,10 +118,9 @@ func (s *ApiSuggestIntegrationTest) TestPartyWithTypeNegative() {
|
||||||
api := NewSuggestApi()
|
api := NewSuggestApi()
|
||||||
|
|
||||||
// there are no one individual entrepreneur "сбербанк"
|
// there are no one individual entrepreneur "сбербанк"
|
||||||
individualParty := suggest.PartyTypeIndividual
|
|
||||||
res, err := api.Party(context.Background(), &suggest.RequestParams{
|
res, err := api.Party(context.Background(), &suggest.RequestParams{
|
||||||
Query: "сбербанк",
|
Query: "сбербанк",
|
||||||
Type: &individualParty,
|
Type: suggest.PartyTypeIndividual,
|
||||||
})
|
})
|
||||||
|
|
||||||
s.NoError(err)
|
s.NoError(err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user