Documentation ¶
Index ¶
- Constants
- type AddressResponse
- type AddressSuggestion
- type Api
- func (a *Api) Address(ctx context.Context, params *RequestParams) (ret []*AddressSuggestion, err error)
- func (a *Api) AddressByID(ctx context.Context, id string) (addresses []*AddressSuggestion, err error)
- func (a *Api) Bank(ctx context.Context, params *RequestParams) (ret []*BankSuggestion, err error)
- func (a *Api) Country(ctx context.Context, params *RequestParams) (ret []*CountrySuggestion, err error)
- func (a *Api) CountryByID(ctx context.Context, id string) (addresses []*CountrySuggestion, err error)
- func (a *Api) Email(ctx context.Context, params *RequestParams) (ret []*EmailSuggestion, err error)
- func (a *Api) FMSUnit(ctx context.Context, params *RequestParams) (ret []*FMSUnitSuggestion, err error)
- func (a *Api) GeoIP(ctx context.Context, ip string) (result *GeoIPResponse, err error)
- func (a *Api) GeoLocate(ctx context.Context, params *GeolocateParams) (ret []*GeolocateSuggestion, err error)
- func (a *Api) Name(ctx context.Context, requestParams *RequestParams, opts ...NameOption) (ret []*NameSuggestion, err error)
- func (a *Api) Party(ctx context.Context, params *RequestParams) (ret []*PartySuggestion, err error)
- func (a *Api) PartyByID(ctx context.Context, params *PartyByIDParams) (ret []*PartySuggestion, err error)
- type BankResponse
- type BankSuggestion
- type Bound
- type CountryResponse
- type CountrySuggestion
- type EmailResponse
- type EmailSuggestion
- type FMSUnitResponse
- type FMSUnitSuggestion
- type GeoIPResponse
- type GeolocateParams
- type GeolocateResponse
- type GeolocateSuggestion
- type NameOption
- type NameParams
- type NameResponse
- type NameSuggestion
- type PartyBranchType
- type PartyByIDParams
- func (o *PartyByIDParams) SetBranchType(t PartyBranchType) *PartyByIDParams
- func (o *PartyByIDParams) SetCount(count int) *PartyByIDParams
- func (o *PartyByIDParams) SetKPP(kpp string) *PartyByIDParams
- func (o *PartyByIDParams) SetQuery(query string) *PartyByIDParams
- func (o *PartyByIDParams) SetType(t PartyType) *PartyByIDParams
- type PartyResponse
- type PartySuggestion
- type PartyType
- type RequestParams
- type RequestParamsLocation
- type Requester
Constants ¶
const ( NameGenderUnknown = "UNKNOWN" // не удалось однозначно определить NameGenderMale = "MALE" NameGenderFemale = "FEMALE" )
Name gender values https://confluence.hflabs.ru/pages/viewpage.action?pageId=204669115
const ( NamePartSurname = "SURNAME" NamePartName = "NAME" NamePartPatronymic = "PATRONYMIC" )
Name parts https://dadata.ru/api/suggest/name/ https://confluence.hflabs.ru/pages/viewpage.action?pageId=204669115
const ( PartyTypeLegal PartyType = "LEGAL" PartyTypeIndividual PartyType = "INDIVIDUAL" PartyBranchTypeMain PartyBranchType = "MAIN" PartyBranchTypeBranch PartyBranchType = "BRANCH" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressResponse ¶
type AddressResponse struct {
Suggestions []*AddressSuggestion `json:"suggestions"`
}
AddressResponse result slice for address suggestions
type AddressSuggestion ¶
type AddressSuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.Address `json:"data"` }
AddressSuggestion api response for address
type Api ¶
type Api struct {
Client Requester
}
Api provides suggestion API.
func (*Api) Address ¶
func (a *Api) Address(ctx context.Context, params *RequestParams) (ret []*AddressSuggestion, err error)
Address try to return suggest addresses by params
func (*Api) AddressByID ¶
func (a *Api) AddressByID(ctx context.Context, id string) (addresses []*AddressSuggestion, err error)
AddressByID find addresses by Fias or Kladr see full documentation https://confluence.hflabs.ru/pages/viewpage.action?pageId=312016944
func (*Api) Bank ¶
func (a *Api) Bank(ctx context.Context, params *RequestParams) (ret []*BankSuggestion, err error)
Bank try to return suggest banks by params
func (*Api) Country ¶
func (a *Api) Country(ctx context.Context, params *RequestParams) (ret []*CountrySuggestion, err error)
Country try to return suggest countries by params
func (*Api) CountryByID ¶
func (a *Api) CountryByID(ctx context.Context, id string) (addresses []*CountrySuggestion, err error)
CountryByID find countries by ID
func (*Api) Email ¶
func (a *Api) Email(ctx context.Context, params *RequestParams) (ret []*EmailSuggestion, err error)
Email try to return suggest emails by params
func (*Api) FMSUnit ¶
func (a *Api) FMSUnit(ctx context.Context, params *RequestParams) (ret []*FMSUnitSuggestion, err error)
FMSUnit try to return suggest FMS unit by params
func (*Api) GeoIP ¶
GeoIP try to find address by IP see documentation on: https://dadata.ru/api/detect_address_by_ip/ ip string representation of ip-address (example 10.12.44.23) if ip=="" then dadata try to get ip-address from X-Forwarded-For header
func (*Api) GeoLocate ¶
func (a *Api) GeoLocate(ctx context.Context, params *GeolocateParams) (ret []*GeolocateSuggestion, err error)
GeoLocate try to return suggest addresses by params see documentation on:https://dadata.ru/api/geolocate/
func (*Api) Name ¶
func (a *Api) Name(ctx context.Context, requestParams *RequestParams, opts ...NameOption) (ret []*NameSuggestion, err error)
Name try to return suggest names by params
func (*Api) Party ¶
func (a *Api) Party(ctx context.Context, params *RequestParams) (ret []*PartySuggestion, err error)
Party try to return suggest parties by params
func (*Api) PartyByID ¶
func (a *Api) PartyByID(ctx context.Context, params *PartyByIDParams) (ret []*PartySuggestion, err error)
Party find parties by ID https://dadata.ru/api/find-party/
type BankResponse ¶
type BankResponse struct {
Suggestions []*BankSuggestion `json:"suggestions"`
}
BankResponse result slice for bank suggestions
type BankSuggestion ¶
type BankSuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.Bank `json:"data"` }
BankSuggestion api response for bank
type Bound ¶
type Bound struct {
Value model.BoundValue `json:"value"`
}
Bound for granular sugestion full documentation https://confluence.hflabs.ru/pages/viewpage.action?pageId=222888017
type CountryResponse ¶
type CountryResponse struct {
Suggestions []*CountrySuggestion `json:"suggestions"`
}
CountryResponse result slice for country suggestions
type CountrySuggestion ¶
CountrySuggestion api response for country
type EmailResponse ¶
type EmailResponse struct {
Suggestions []*EmailSuggestion `json:"suggestions"`
}
EmailResponse result slice for email suggestions
type EmailSuggestion ¶
type EmailSuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.Email `json:"data"` }
EmailSuggestion api response for email
type FMSUnitResponse ¶
type FMSUnitResponse struct {
Suggestions []*FMSUnitSuggestion `json:"suggestions"`
}
FMSUnitResponse result slice for FMS unit suggestions
type FMSUnitSuggestion ¶
type FMSUnitSuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.FMSUnit `json:"data"` }
FMSUnitSuggestion is a FMS unit suggestion https://dadata.ru/api/suggest/fms_unit/
type GeoIPResponse ¶
type GeoIPResponse struct {
Location *AddressSuggestion `json:"location"`
}
GeoIPResponse response for GeoIP
type GeolocateParams ¶
type GeolocateParams struct { Lat string `json:"lat"` // geographic latitude Lon string `json:"lon"` // geographic longitude 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) }
GeolocateParams Request struct full documentation https://confluence.hflabs.ru/pages/viewpage.action?pageId=808583277
type GeolocateResponse ¶
type GeolocateResponse struct {
Suggestions []*GeolocateSuggestion `json:"suggestions"`
}
GeolocateResponse result slice for address suggestions
type GeolocateSuggestion ¶
type GeolocateSuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.Address `json:"data"` }
GeolocateSuggestion api response for address
type NameOption ¶
type NameOption func(params *NameParams)
func WithNameGender ¶
func WithNameGender(gender string) NameOption
WithNameGender adds `gender` parameter to suggest/fio request https://dadata.ru/api/suggest/name/ https://confluence.hflabs.ru/pages/viewpage.action?pageId=204669115
func WithNameParts ¶
func WithNameParts(parts ...string) NameOption
WithNameParts adds `parts` parameter to suggest/fio request https://dadata.ru/api/suggest/name/ https://confluence.hflabs.ru/pages/viewpage.action?pageId=204669115
type NameParams ¶
type NameResponse ¶
type NameResponse struct {
Suggestions []*NameSuggestion `json:"suggestions"`
}
NameResponse result slice for name suggestions
type NameSuggestion ¶
type NameSuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.Name `json:"data"` }
NameSuggestion api response for name
type PartyBranchType ¶
type PartyBranchType string
type PartyByIDParams ¶
type PartyByIDParams struct { Query string `json:"query"` Count *int `json:"count,omitempty"` KPP *string `json:"kpp,omitempty"` Type *PartyType `json:"type,omitempty"` BranchType *PartyBranchType `json:"branch_type,omitempty"` }
func NewPartyByIDParams ¶
func NewPartyByIDParams(query string) *PartyByIDParams
func (*PartyByIDParams) SetBranchType ¶
func (o *PartyByIDParams) SetBranchType(t PartyBranchType) *PartyByIDParams
func (*PartyByIDParams) SetCount ¶
func (o *PartyByIDParams) SetCount(count int) *PartyByIDParams
func (*PartyByIDParams) SetKPP ¶
func (o *PartyByIDParams) SetKPP(kpp string) *PartyByIDParams
func (*PartyByIDParams) SetQuery ¶
func (o *PartyByIDParams) SetQuery(query string) *PartyByIDParams
func (*PartyByIDParams) SetType ¶
func (o *PartyByIDParams) SetType(t PartyType) *PartyByIDParams
type PartyResponse ¶
type PartyResponse struct {
Suggestions []*PartySuggestion `json:"suggestions"`
}
PartyResponse result slice for party suggestions
type PartySuggestion ¶
type PartySuggestion struct { Value string `json:"value"` UnrestrictedValue string `json:"unrestricted_value"` Data *model.Party `json:"data"` }
PartySuggestion api response for party https://confluence.hflabs.ru/pages/viewpage.action?pageId=204669122
type RequestParams ¶
type 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,omitempty"` // ligmit for results Language string `json:"language,omitempty"` Locations []*RequestParamsLocation `json:"locations,omitempty"` RestrictValue bool `json:"restrict_value,omitempty"` // don't show restricts (region) on results FromBound *Bound `json:"from_bound,omitempty"` ToBound *Bound `json:"to_bound,omitempty"` }
RequestParams Request struct
type RequestParamsLocation ¶
type RequestParamsLocation struct { FiasID string `json:"fias_id,omitempty"` KladrID string `json:"kladr_id,omitempty"` Region string `json:"region,omitempty"` RegionFiasID string `json:"region_fias_id,omitempty"` RegionKladrID string `json:"region_kladr_id,omitempty"` RegionTypeFull string `json:"region_type_full,omitempty"` City string `json:"city,omitempty"` CityFiasID string `json:"city_fias_id,omitempty"` // search only in this area CityKladrID string `json:"city_kladr_id,omitempty"` CityTypeFull string `json:"city_type_full,omitempty"` CityDistrictTypeFull string `json:"city_district_type_full,omitempty"` Settlement string `json:"settlement,omitempty"` SettlementFiasID string `json:"settlement_fias_id,omitempty"` SettlementKladrID string `json:"settlement_kladr_id,omitempty"` SettlementTypeFull string `json:"settlement_type_full,omitempty"` Street string `json:"street,omitempty"` StreetFiasID string `json:"street_fias_id,omitempty"` StreetKladrID string `json:"street_kladr_id,omitempty"` StreetTypeFull string `json:"street_type_full,omitempty"` AreaTypeFull string `json:"area_type_full,omitempty"` Country string `json:"country,omitempty"` CountryISOCode string `json:"country_iso_code,omitempty"` }
RequestParamsLocation constraints for suggestion full documentation https://confluence.hflabs.ru/pages/viewpage.action?pageId=204669108
type Requester ¶
type Requester interface { // Get makes a GET API call. Assumes sending params in a request query string. Get(ctx context.Context, apiMethod string, params url.Values, result interface{}) error // Post makes a POST API call. Assumes sending json-encoded params in a request body. Post(ctx context.Context, apiMethod string, params, result interface{}) error }
Requester provides transport level API calls.