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