-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmodels.go
219 lines (197 loc) · 9.29 KB
/
models.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
package lalamove
import "time"
// ServiceType is the range of vehicles that Lalamove provides to cater to different needs at different cities.
type ServiceType string
// ServiceType enum
const (
ServiceTypeCar ServiceType = "CAR"
ServiceTypeLalago ServiceType = "LALAGO"
ServiceTypeLalapro ServiceType = "LALAPRO"
ServiceTypeMinivan ServiceType = "MINIVAN"
ServiceTypeMotorcycle ServiceType = "MOTORCYCLE"
ServiceTypeMPV ServiceType = "MPV"
ServiceTypeTataAce7 ServiceType = "TATA7FT"
ServiceTypeTataAce8 ServiceType = "TATA8FT"
ServiceTypeThreeWheeler ServiceType = "THREE_WHEELER"
ServiceTypeTruck175 ServiceType = "TRUCK175"
ServiceTypeTruck330 ServiceType = "TRUCK330"
ServiceTypeTruck550 ServiceType = "TRUCK550"
ServiceTypeUV ServiceType = "UV_FIORINO"
ServiceTypeVan ServiceType = "VAN"
ServiceType4x4 ServiceType = "4X4"
)
// SpecialRequest ...
type SpecialRequest string
// SpecialRequest enum
const (
SpecialRequest1HelperTier1 SpecialRequest = "1HELPER_TIER1"
SpecialRequest1HelperTier2 SpecialRequest = "1HELPER_TIER3"
SpecialRequest1HelperTier3 SpecialRequest = "1HELPER_TIER2"
SpecialRequestAddAssistantTier1 SpecialRequest = "ADDITIONAL_ASSISTANT_TIER1"
SpecialRequestAddAssistantTier2 SpecialRequest = "ADDITIONAL_ASSISTANT_TIER2"
SpecialRequestAddAssistantTier3 SpecialRequest = "ADDITIONAL_ASSISTANT_TIER3"
SpecialRequestInsulatedBag SpecialRequest = "INSULATED_BAG"
SpecialRequestUVVan SpecialRequest = "UV_VAN"
SpecialRequestLalabag SpecialRequest = "LALABAG"
SpecialRequestLalabagBig SpecialRequest = "LALABAG_BIG"
SpecialRequestDoor2Door SpecialRequest = "DOOR2DOOR"
SpecialRequestDoor2DoorDriver SpecialRequest = "DOOR2DOOR_DRIVER"
SpecialRequestDoor2DoorTruck330 SpecialRequest = "DOOR2DOOR_TRUCK330"
SpecialRequestDoor2DoorTruck550 SpecialRequest = "DOOR2DOOR_TRUCK550"
SpecialRequestDoor2Door1HelperTruck175 SpecialRequest = "DOOR2DOOR_1HELPER_TRUCK175"
SpecialRequestDoor2Door1HelperTruck330 SpecialRequest = "DOOR2DOOR_1HELPER_TRUCK330"
SpecialRequestDoor2Door1HelperTruck550 SpecialRequest = "DOOR2DOOR_1HELPER_TRUCK550"
SpecialRequestDoor2Door2HelperTruck330 SpecialRequest = "DOOR2DOOR_2HELPER_TRUCK330"
SpecialRequestDoor2Door2HelperTruck550 SpecialRequest = "DOOR2DOOR_2HELPER_TRUCK550"
SpecialRequestCOD SpecialRequest = "COD"
SpecialRequestPurchaseService SpecialRequest = "PURCHASE_SERVICE"
SpecialRequestPurchaseServiceTier2 SpecialRequest = "PURCHASE_SERVICE_TIER_2"
SpecialRequestExtraHelper SpecialRequest = "EXTRA_HELPER"
SpecialRequestExtraHelperTruck175 SpecialRequest = "EXTRA_HELPER_TRUCK175"
SpecialRequestRoundtripMotorcycle SpecialRequest = "ROUNDTRIP_MOTORYCYCLE"
SpecialRequestRoundtripTruck175 SpecialRequest = "ROUNDTRIP_TRUCK175"
SpecialRequestRoundtripTruck330 SpecialRequest = "ROUNDTRIP_TRUCK330"
SpecialRequestQueueingMotorcycle SpecialRequest = "QUEUEING_MOTORCYCLE"
SpecialRequestReturnTrip SpecialRequest = "RETURNTRIP"
SpecialRequestReturnTripLorry SpecialRequest = "RETURNTRIP_LORRY"
SpecialRequestLoadingService SpecialRequest = "LOADING_SERVICE"
SpecialRequestFoodService SpecialRequest = "FOOD_SERVICE"
SpecialRequestDriverCarries SpecialRequest = "DRIVER_CARRIES"
SpecialRequest1Assistant1To2Drops SpecialRequest = "1ASSISTANT_1_MINUS_2DROPS"
SpecialRequest1Assistant3To4Drops SpecialRequest = "1ASSISTANT_3_MINUS_4DROPS"
SpecialRequest1AssistantPlusDrops SpecialRequest = "1ASSISTANT_5_PLUS_DROPS"
SpecialRequestRestricted SpecialRequest = "RESTRICTED"
SpecialRequestMovingDriver SpecialRequest = "MOVING_DRIVER"
SpecialRequestMovingDriver1Helper SpecialRequest = "MOVING_DRIVER_1HELPER"
SpecialRequestMovingDriver2Helper SpecialRequest = "MOVING_DRIVER_2HELPER"
SpecialRequestMovingDriver1HelperVan SpecialRequest = "MOVING_DRIVER_1HELPER_VAN"
SpecialRequestMovingDriver2HelperVan SpecialRequest = "MOVING_DRIVER_2HELPER_VAN"
SpecialRequestTailgate SpecialRequest = "TAILGATE"
SpecialRequestCovered SpecialRequest = "COVERED"
SpecialRequestHelpBuy SpecialRequest = "HELP_BUY"
SpecialRequestGroundFloor1Way SpecialRequest = "GROUND_FLOOR_ONE_WAY"
SpecialRequestGroundFloor1Way2 SpecialRequest = "GROUND_FLOOR_ONE_WAY_2"
SpecialRequestUpstairDownstair1Way SpecialRequest = "UPSTAIR_DOWNSTAIR_ONE_WAY"
SpecialRequestUpstairDownstair1Way2 SpecialRequest = "UPSTAIR_DOWNSTAIR_ONE_WAY_2"
)
// OrderStatus ...
type OrderStatus string
// OrderStatus enum
const (
// OrderStatusAssigningDriver - Trying to match shipment with a driver.
OrderStatusAssigningDriver OrderStatus = "ASSIGNING_DRIVER"
// OrderStatusOngoing - A driver has accepted the order.
OrderStatusOngoing OrderStatus = "ON_GOING"
// OrderStatusPickedUp - The driver has picked up the order.
OrderStatusPickedUp OrderStatus = "PICKED_UP"
// OrderStatusCompleted - The order has been delivered successfully and transaction has concluded.
OrderStatusCompleted OrderStatus = "COMPLETED"
// OrderStatusCanceled - User has canceled the order.
OrderStatusCanceled OrderStatus = "CANCELED"
// OrderStatusRejected - The order was matched and rejected twice by two drivers in a row.
OrderStatusRejected OrderStatus = "REJECTED"
// OrderStatusExpired - The order expired as no drivers accepted the order.
OrderStatusExpired OrderStatus = "EXPIRED"
)
// Address ...
type Address struct {
// DisplayString is the street address in plain text. Use remarks in DeliveryInfo for building, floor and flat.
DisplayString string `json:"displayString"`
// Country is the country code of the address and must match with X-LLM-Country in the request headers.
Country LLMCountry `json:"country"`
}
// Location ...
type Location struct {
// Lat is the latitude
Lat string `json:"lat"`
// Lng is the longitude
Lng string `json:"lng"`
}
// AddressTranslations ...
type AddressTranslations map[Locale]Address
// Waypoint ...
type Waypoint struct {
Location Location `json:"location"`
Addresses AddressTranslations `json:"addresses"`
}
// DeliveryInfo ...
type DeliveryInfo struct {
// ToStop is the index of waypoint in stops this information associates with, has to be >= 1
// since the first stop's Delivery Info is tided to requesterContact.
ToStop int64 `json:"toStop"`
// Contact is the contact person at the stop specified in ToStop. You can provide placeholders to GetQuotation
// if the user information is not available and correct it before calling PlaceOrder.
Contact Contact `json:"toContact"`
// Remarks gives additional info about the delivery. eg. building, floor and flat.
// Use newline \r\n for better readability.
Remarks *string `json:"remarks,omitempty"`
}
// Contact ...
type Contact struct {
// Name is the name of the contact person
Name string `json:"name"`
// Phone must be a valid phone number, validation varies for each country/region.
Phone string `json:"phone"`
}
// GetQuotationRequest ...
type GetQuotationRequest struct {
// ServiceType is the type of vehicle, availability varies for each country/region.
ServiceType ServiceType `json:"serviceType"`
// Stops is an array of Waypoints (minimum 2, maximum 10)
Stops []Waypoint `json:"stops"`
// Deliveries is an array of DeliveryInfos
Deliveries []DeliveryInfo `json:"deliveries"`
// RequesterContact is the contact person at pick up point aka stop[0].
RequesterContact Contact `json:"requesterContact"`
// ScheduleAt is the pick up time in UTC timezone and ISO 8601 format.
// Omit this field if you are placing an immediate order.
ScheduleAt *string `json:"scheduleAt,omitempty"`
// SpecialRequests are special requests for the order, availability varies for each country/region.
SpecialRequests *[]SpecialRequest `json:"specialRequests,omitempty"`
}
// GetQuotationResponse ...
type GetQuotationResponse struct {
Amount string `json:"totalFee"`
Currency string `json:"totalFeeCurrency"`
}
// Price ...
type Price struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
}
// PlaceOrderRequest ...
type PlaceOrderRequest struct {
QuotedPrice Price `json:"quotedTotalFee"`
// SendSms is set to end delivery updates via SMS to the recipient,
// or the recipient of the LAST STOP for multi-stop orders. Defaults to true.
SendSms *bool `json:"sms"`
GetQuotationRequest
}
// PlaceOrderResponse ...
type PlaceOrderResponse struct {
// OrderID is the order id
OrderID string `json:"orderRef"`
// CustomerOrderID is a UUID order id (deprecated)
CustomerOrderID string `json:"customerOrderId"`
}
// OrderDetailsResponse ...
type OrderDetailsResponse struct {
Status OrderStatus `json:"status"`
Price Price `json:"price"`
DriverID string `json:"driverId"`
}
// DriverDetailsResponse ...
type DriverDetailsResponse struct {
Contact
PlateNumber string `json:"plateNumber"`
PhotoURL string `json:"photo"`
}
// DriverLocationResponse ...
type DriverLocationResponse struct {
Location Location `json:"location"`
UpdatedAt time.Time `json:"updatedAt"`
}
// ErrorResponse ...
type ErrorResponse struct {
Error string `json:"message"`
}