-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.go
177 lines (157 loc) · 8.98 KB
/
common.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
package novapost
type (
TimeIntervalRequest struct {
RecipientCityRef string
DateTime string
}
TimeInterval struct {
Number string
Start string
End string
}
)
// GetTimeIntervals Види часових інтервалів
//
// Метод «getTimeIntervals», працює в моделі «Common», цей метод необхідний для отримання списку часових інтервалів (для
// замовлення послуги «Часові інтервали»). Для оновлення даних, довідник потрібно завантажувати один раз на місяць.
func (c *Client) GetTimeIntervals(req TimeIntervalRequest) (*Response[TimeInterval], error) {
return RawRequest[TimeInterval](c, CommonModel, "getTimeIntervals", req)
}
// GetCargoTypes Види вантажу
//
// Метод «getCargoTypes», працює в моделі «Common», цей метод необхідний для завантаження списку типів вантажу
// українською мовою. Для оновлення даних, довідник потрібно завантажувати один раз на місяць.
func (c *Client) GetCargoTypes() (*Response[RefDescription], error) {
return RawRequest[RefDescription](c, CommonModel, "getCargoTypes", nil)
}
// GetBackwardDeliveryCargoTypes Види зворотної доставки вантажу
//
// Метод «getBackwardDeliveryCargoTypes», працює в моделі «Common», цей метод необхідний для відображення списку видів
// зворотної доставки вантажу українською та російською мовами. Для оновлення даних, довідник потрібно завантажувати
// один раз на місяць.
func (c *Client) GetBackwardDeliveryCargoTypes() (*Response[RefDescription], error) {
return RawRequest[RefDescription](c, CommonModel, "getBackwardDeliveryCargoTypes", nil)
}
type Pallet struct {
Ref string
Description string
Weight float64
}
// GetPalletsList Види палет
//
// Метод «getPalletsList», працює в моделі «Common», цей метод необхідний для отримання списку видів палет. Для
// оновлення даних, довідник потрібно завантажувати один раз на місяць.
func (c *Client) GetPalletsList() (*Response[Pallet], error) {
return RawRequest[Pallet](c, CommonModel, "getPalletsList", nil)
}
// GetTypesOfPayersForRedelivery Види платників зворотної доставки
//
// Метод «getTypesOfPayersForRedelivery», працює в моделі «Common», цей метод необхідний для завантаження списку видів
// платників послуги зворотної доставки українською та англійською мовами: Sender, Recipient.
//
// Для оновлення даних, довідник потрібно завантажувати один раз на місяць.
func (c *Client) GetTypesOfPayersForRedelivery() (*Response[RefDescription], error) {
return RawRequest[RefDescription](c, CommonModel, "getTypesOfPayersForRedelivery", nil)
}
type (
PackRequest struct {
Length float64 `xml:"Lengthstring" json:"Lengthstring"`
Width float64 `xml:"Widthstring" json:"Widthstring"`
Height float64 `xml:"Heightstring" json:"Heightstring"`
VolumetricWeight float64 `xml:"VolumetricWeightstring" json:"VolumetricWeightstring"`
TypeOfPacking string `xml:"TypeOfPackingstring" json:"TypeOfPackingstring"`
}
Pack struct {
Ref string
Description string
Length float64
Width float64
Height float64
VolumetricWeight float64
TypeOfPacking string
PackagingForPlace bool
}
)
// GetPackList Види упаковки
//
// Метод «getPackList», працює в моделі «Common», цей метод необхідний для завантаження видів упаковки вантажу
// українською або російською мовами. Для оновлення даних, довідник потрібно завантажувати один раз на місяць.
func (c *Client) GetPackList(req PackRequest) (*Response[Pack], error) {
return RawRequest[Pack](c, CommonModel, "getPackList", req)
}
type TireWheel struct {
Ref string
Description string
Weight float64
DescriptionType string
}
// GetTiresWheelsList Види шин і дисків
//
// Метод «getTiresWheelsList», працює в моделі «Common», цей метод дозволяє завантажити список шин і дисків
// (використовується, якщо вид вантажу шини-диски) українською та російською мовами.
//
// Необхідно зберігати копію довідників на стороні клієнта та підтримувати її в актуальному стані.
//
// Рекомендується проводити оновлення довідників раз на місяць.
func (c *Client) GetTiresWheelsList() (*Response[TireWheel], error) {
return RawRequest[TireWheel](c, CommonModel, "getTiresWheelsList", nil)
}
type CargoDescriptionRequest struct {
FindByString string
Page int
Limit int
}
// GetCargoDescriptionList Описи вантажу
//
// Метод «getCargoDescriptionList», працює в моделі «Common», цей метод дозволяє віддати опис вантажу українською та
// російською мовами. "FindByString": "абажур", - також доступний пошук по рядках, не обов'язковий параметр.
//
// Необхідно зберігати копію довідників на стороні клієнта та підтримувати її в актуальному стані.
//
// Рекомендується проводити оновлення довідників раз на місяць.
func (c *Client) GetCargoDescriptionList(req CargoDescriptionRequest) (*Response[RefDescription], error) {
return RawRequest[RefDescription](c, CommonModel, "getCargoDescriptionList", req)
}
type MessageCodeText struct {
MessageCode string
MessageText string
MessageDescription string `xml:"MessageDescriptionUA" json:"MessageDescriptionUA"`
}
// GetMessageCodeText Перелік помилок
//
// Метод «getMessageCodeText», працює в моделі «CommonGeneral», цей метод необхідний для завантаження довідника з описом
// переліку помилок.
//
// Метод постійно поповнюється новим описом трьома мовами.
//
// Для оновлення даних, довідник потрібно завантажувати один раз на місяць.
func (c *Client) GetMessageCodeText() (*Response[MessageCodeText], error) {
return RawRequest[MessageCodeText](c, CommonGeneralModel, "getMessageCodeText", nil)
}
// GetServiceTypes Технології доставки
//
// Метод «getServiceTypes», працює в моделі «Common», цей метод дозволяє завантажити список типів технологій доставки:
// «склад-склад», «двері-двері», «склад-двері», «двері-склад» українською та російською мовами.
//
// Необхідно зберігати копію довідників на стороні клієнта та підтримувати її в актуальному стані.
//
// Рекомендується проводити оновлення довідників раз на місяць.
func (c *Client) GetServiceTypes() (*Response[RefDescription], error) {
return RawRequest[RefDescription](c, CommonModel, "getServiceTypes", nil)
}
type OwnershipForm struct {
Ref string
Description string
FullName string
}
// GetOwnershipFormsList Форми власності
//
// Метод «getOwnershipFormsList», працює в моделі «Common», цей метод дозволяє завантажити список форм власності
// українською мовою.
//
// Необхідно зберігати копію довідників на стороні клієнта та підтримувати її в актуальному стані.
//
// Рекомендується проводити оновлення довідників раз на місяць.
func (c *Client) GetOwnershipFormsList() (*Response[OwnershipForm], error) {
return RawRequest[OwnershipForm](c, CommonModel, "getOwnershipFormsList", nil)
}