-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcities-filter.go
64 lines (45 loc) · 2.29 KB
/
cities-filter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package cdekapi
type CitiesFilterParamName string
const (
// CitiesFilterCountryCodes Array of country codes in the format ISO_3166-1_alpha-2
CitiesFilterCountryCodes CitiesFilterParamName = "country_codes"
// CitiesFilterRegionCode Region code in the CDEK IS
CitiesFilterRegionCode CitiesFilterParamName = "region_code"
// CitiesFilterKladrRegionCode Region code according to the Russian Classifier of Countries of the World
CitiesFilterKladrRegionCode CitiesFilterParamName = "kladr_region_code"
// CitiesFilterFiasRegionCode Region code according to the Federal Information Address System
CitiesFilterFiasRegionCode CitiesFilterParamName = "fias_region_guid"
// CitiesFilterKladrCityCode City code according to the Russian Classifier of Countries of the World
CitiesFilterKladrCityCode CitiesFilterParamName = "kladr_code"
// CitiesFilterFiasCityCode City code according to the Federal Information Address System
CitiesFilterFiasCityCode CitiesFilterParamName = "fias_guid"
// City code according to the Federal Information Address System, UUID
CitiesFilterPostalCode CitiesFilterParamName = "postal_code"
// CitiesFilterCode City code from the CDEK IS
CitiesFilterCode CitiesFilterParamName = "code"
// CitiesFilterCity City name
CitiesFilterCity CitiesFilterParamName = "city"
// CitiesFilterSize Limitation on the number of results displayed. Required, if "page" is specified. Default value: 1,000
CitiesFilterSize CitiesFilterParamName = "size"
// CitiesFilterPage Number of the results page. Default value: 0
CitiesFilterPage CitiesFilterParamName = "page"
// CitiesFilterLang Localization. Default: “rus”
CitiesFilterLang CitiesFilterParamName = "lang"
// CitiesFilterPaymentLimit Cash-on-delivery amount limit, possible values: 1 – no limit; 0 – cash on delivery is not accepted;
// positive value – the cash-on-delivery amount does not exceed this value.
CitiesFilterPaymentLimit CitiesFilterParamName = "payment_limit"
)
type CitiesFilter struct {
params map[string]string
}
func (f *CitiesFilter) AddParam(name CitiesFilterParamName, value string) *CitiesFilter {
if f.params == nil {
f.params = map[string]string{}
}
paramName := string(name)
f.params[paramName] = value
return f
}
func (f CitiesFilter) BuildQueryParams() map[string]string {
return f.params
}