Documentation ¶
Index ¶
- Variables
- type Address
- type AddressTranslations
- type CityCode
- type Client
- func (c *Client) CancelOrder(ctx context.Context, city CityCode, orderID string) error
- func (c *Client) DriverDetails(ctx context.Context, city CityCode, orderID, driverID string) (*DriverDetailsResponse, error)
- func (c *Client) DriverLocation(ctx context.Context, city CityCode, orderID, driverID string) (*DriverLocationResponse, error)
- func (c *Client) GetQuotation(ctx context.Context, city CityCode, req *GetQuotationRequest) (*GetQuotationResponse, error)
- func (c *Client) OrderDetails(ctx context.Context, city CityCode, orderID string) (*OrderDetailsResponse, error)
- func (c *Client) PlaceOrder(ctx context.Context, city CityCode, req *PlaceOrderRequest) (*PlaceOrderResponse, error)
- type ClientOption
- type Contact
- type Country
- type CountryCode
- type DeliveryInfo
- type DriverDetailsResponse
- type DriverLocationResponse
- type ErrorResponse
- type GetQuotationRequest
- type GetQuotationResponse
- type LLMCountry
- type Locale
- type Location
- type OrderDetailsResponse
- type OrderStatus
- type PlaceOrderRequest
- type PlaceOrderResponse
- type Price
- type ServiceType
- type SpecialRequest
- type Waypoint
Constants ¶
This section is empty.
Variables ¶
var ( CountryUnknown = Country{ Name: "Unknown", } CountryBrasil = Country{ Name: "Brasil", Code: CountryCodeBrasil, Cities: []CityCode{CityCodeBrasilSaoPaulo, CityCodeBrasilRioDeJaneiro}, PhoneRegex: "^[0-9]{2}[9]{1}[0-9]{8}$", Locales: []Locale{LocaleBrasilEN, LocaleBrasilPT}, } CountryHongKong = Country{ Name: "Hong Kong", Code: CountryCodeHongKong, Cities: []CityCode{CityCodeHongKongHongKong}, PhoneRegex: "^((?!999)([2-9][0-9]{7}))$", Locales: []Locale{LocaleHongKongEN, LocaleHongKongZH}, } CountryIndia = Country{ Name: "India", Code: CountryCodeIndia, Cities: []CityCode{CityCodeIndiaBengaluru, CityCodeIndiaMumbai, CityCodeIndiaDelhi}, PhoneRegex: "^([6-9][0-9]{9}|22[0-9]{8})$", Locales: []Locale{LocaleIndiaEN, LocaleIndiaHI, LocaleIndiaKN, LocaleIndiaMR}, } CountryIndonesia = Country{ Name: "Indonesia", Code: CountryCodeIndonesia, Cities: []CityCode{CityCodeIndonesiaJakarata}, PhoneRegex: "^0(8\\d{8,11}|21\\d{7,8})$", Locales: []Locale{LocaleIndonesiaEN, LocaleIndonesiaID}, } CountryMalaysia = Country{ Name: "Malaysia", Code: CountryCodeMalaysia, Cities: []CityCode{CityCodeMalaysiaKualaLumpur}, PhoneRegex: "^0(1[1,5]?\\d{8}|[4-7,9]\\d{7}|8[2-9]\\d{6}|3\\d{8})$", Locales: []Locale{LocaleMalaysiaEN, LocaleMalaysiaMS}, } CountryMexico = Country{ Name: "Mexico", Code: CountryCodeMexico, Cities: []CityCode{CityCodeMexicoMexico}, PhoneRegex: "^([+]+52?)?(\\d{3}?){2}\\d{4}$", Locales: []Locale{LocaleMexicoEN, LocaleMexicoMX}, } CountryPhilippines = Country{ Name: "Philippines", Code: CountryCodePhilippines, Cities: []CityCode{CityCodePhilippinesManila, CityCodePhilippinesCebu}, PhoneRegex: "^09[0-9]{9}$|^0?2[0-9]{7}$|^0?32[0-9]{7}$", Locales: []Locale{LocalePhilippinesEN}, } CountrySingapore = Country{ Name: "Singapore", Code: CountryCodeSingapore, Cities: []CityCode{CityCodeSingaporeSingapore}, PhoneRegex: "^[689]{1}[0-9]{7}$", Locales: []Locale{LocaleSingaporeEN}, } CountryTaiwan = Country{ Name: "Taiwan", Code: CountryCodeTaiwan, Cities: []CityCode{CityCodeTaiwanTaipei}, PhoneRegex: "^0([1-8]{1}[0-9]{7,8}|9[0-9]{8})$", Locales: []Locale{LocaleTaiwanZH}, } CountryThailand = Country{ Name: "Thailand", Code: CountryCodeThailand, Cities: []CityCode{CityCodeThailandBangkok, CityCodeThailandPattaya}, PhoneRegex: "^(0[0-9]{8,9}|[0-9]{4})$", Locales: []Locale{LocaleThailandEN, LocaleThailandTH}, } CountryVietnam = Country{ Name: "Vietnam", Code: CountryCodeVietnam, Cities: []CityCode{CityCodeVietnamHoChiMinh, CityCodeVietnamHanoi}, PhoneRegex: "^0?(2|[35789])[0-9]{8}$|^02[48][0-9]{8}$", Locales: []Locale{LocaleVietnamEN, LocaleVietnamVI}, } )
Country enum
var AllCountriesByISOCode = map[CountryCode]Country{ CountryCodeBrasil: CountryBrasil, CountryCodeHongKong: CountryHongKong, CountryCodeIndia: CountryIndia, CountryCodeIndonesia: CountryIndonesia, CountryCodeMalaysia: CountryMalaysia, CountryCodeMexico: CountryMexico, CountryCodePhilippines: CountryPhilippines, CountryCodeSingapore: CountrySingapore, CountryCodeTaiwan: CountryTaiwan, CountryCodeThailand: CountryThailand, CountryCodeVietnam: CountryVietnam, }
AllCountriesByISOCode list all the countries and regions supported by Lalamove by ISO 3166-1 alpha-2 code
Functions ¶
This section is empty.
Types ¶
type 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"` }
Address ...
type CityCode ¶
type CityCode string
CityCode is the UN/LOCODE of supported cities.
const ( CityCodeBrasilSaoPaulo CityCode = "BR_SAO" CityCodeBrasilRioDeJaneiro CityCode = "BR_RIO" CityCodeHongKongHongKong CityCode = "HK_HKG" CityCodeIndiaBengaluru CityCode = "IN_BLR" CityCodeIndiaMumbai CityCode = "IN_BOM" CityCodeIndiaDelhi CityCode = "IN_DEL" CityCodeIndonesiaJakarata CityCode = "ID_JKT" CityCodeMalaysiaKualaLumpur CityCode = "MY_KUL" CityCodeMexicoMexico CityCode = "MX_MEX" CityCodePhilippinesManila CityCode = "PH_MNL" CityCodePhilippinesCebu CityCode = "PH_CEB" CityCodeSingaporeSingapore CityCode = "SG_SIN" CityCodeTaiwanTaipei CityCode = "TW_TPE" CityCodeThailandBangkok CityCode = "TH_BKK" CityCodeThailandPattaya CityCode = "TH_PYX" CityCodeVietnamHoChiMinh CityCode = "VN_SGN" CityCodeVietnamHanoi CityCode = "VN_HAN" )
CityCode enum
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client may be used to make requests to the Lalamove APIs
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
NewClient constructs a new Client which can make requests to the Lalamove APIs.
func (*Client) CancelOrder ¶
CancelOrder cancels the order based on the Lalamove cancellation policy. Attempts to cancel an order that does not comply with the cancellation policy will get ERR_CANCELLATION_FORBIDDEN as response.
func (*Client) DriverDetails ¶
func (c *Client) DriverDetails(ctx context.Context, city CityCode, orderID, driverID string) (*DriverDetailsResponse, error)
DriverDetails retrieves the driver's information.
func (*Client) DriverLocation ¶
func (c *Client) DriverLocation(ctx context.Context, city CityCode, orderID, driverID string) (*DriverLocationResponse, error)
DriverLocation retrieves driver's latest location in latitude and longitude. This information is available starting 1 hour prior to datetime specified in scheduleAt datetime and remain accessible until the order is completed. Attempts made outside of this time window will get 403 Forbidden response.
func (*Client) GetQuotation ¶
func (c *Client) GetQuotation(ctx context.Context, city CityCode, req *GetQuotationRequest) (*GetQuotationResponse, error)
GetQuotation requests a quotation.
func (*Client) OrderDetails ¶
func (c *Client) OrderDetails(ctx context.Context, city CityCode, orderID string) (*OrderDetailsResponse, error)
OrderDetails retrieves the shipment order information.
func (*Client) PlaceOrder ¶
func (c *Client) PlaceOrder(ctx context.Context, city CityCode, req *PlaceOrderRequest) (*PlaceOrderResponse, error)
PlaceOrder creates a shipment order. The quotation received from GetQuotation and the same body used to get the quotation request should be merged in the request body.
type ClientOption ¶
ClientOption is the type of constructor options for NewClient(...).
func WithAPIKey ¶
func WithAPIKey(apiKey string) ClientOption
WithAPIKey configures a Lalamove API client with an API Key
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL configures a Lalamove API client with a custom base url
func WithHTTPClient ¶
func WithHTTPClient(c *http.Client) ClientOption
WithHTTPClient configures a Lalamove API client with a http.Client to make requests over.
func WithSecret ¶
func WithSecret(secret string) ClientOption
WithSecret configures a Lalamove API client with a secret
type 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"` }
Contact ...
type Country ¶
type Country struct { Name string Code CountryCode Cities []CityCode Locales []Locale PhoneRegex string }
Country ...
type CountryCode ¶
type CountryCode string
CountryCode is the ISO 3166-1 alpha-2 of supported countries and regions.
const ( CountryCodeBrasil CountryCode = "BR" CountryCodeHongKong CountryCode = "HK" CountryCodeIndia CountryCode = "IN" CountryCodeIndonesia CountryCode = "ID" CountryCodeMalaysia CountryCode = "MY" CountryCodeMexico CountryCode = "MX" CountryCodePhilippines CountryCode = "PH" CountryCodeSingapore CountryCode = "SG" CountryCodeTaiwan CountryCode = "TW" CountryCodeThailand CountryCode = "TH" CountryCodeVietnam CountryCode = "VN" )
CountryCode enum
type 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"` }
DeliveryInfo ...
type DriverDetailsResponse ¶
type DriverDetailsResponse struct { Contact PlateNumber string `json:"plateNumber"` PhotoURL string `json:"photo"` }
DriverDetailsResponse ...
type DriverLocationResponse ¶
type DriverLocationResponse struct { Location Location `json:"location"` UpdatedAt time.Time `json:"updatedAt"` }
DriverLocationResponse ...
type 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"` }
GetQuotationRequest ...
type GetQuotationResponse ¶
type GetQuotationResponse struct { Amount string `json:"totalFee"` Currency string `json:"totalFeeCurrency"` }
GetQuotationResponse ...
type LLMCountry ¶
type LLMCountry string
LLMCountry is the country/region/city where the order is being placed. 1. Hong Kong, Indonesia, Malaysia, Singapore & Taipei should be in ISO 3166-1 alpha-2 format. 2. Countries/regions/cities shou lbe in UN/LOCODE format.
type Locale ¶
type Locale string
Locale ...
const ( LocaleBrasilEN Locale = "en_BR" LocaleBrasilPT Locale = "pt_BR" LocaleHongKongEN Locale = "en_HK" LocaleHongKongZH Locale = "zh_HK" LocaleIndiaEN Locale = "en_IN" LocaleIndiaHI Locale = "hi_IN" LocaleIndiaKN Locale = "kn_IN" LocaleIndiaMR Locale = "mr_IN" LocaleIndonesiaEN Locale = "en_ID" LocaleIndonesiaID Locale = "id_ID" LocaleMalaysiaEN Locale = "en_MY" LocaleMalaysiaMS Locale = "ms_MY" LocaleMexicoEN Locale = "en_MX" LocaleMexicoMX Locale = "es_MX" LocalePhilippinesEN Locale = "en_PH" LocaleSingaporeEN Locale = "en_SG" LocaleTaiwanZH Locale = "zh_TW" LocaleThailandEN Locale = "en_TH" LocaleThailandTH Locale = "th_TH" LocaleVietnamEN Locale = "en_VN" LocaleVietnamVI Locale = "vi_VN" )
Locale enum
type Location ¶
type Location struct { // Lat is the latitude Lat string `json:"lat"` // Lng is the longitude Lng string `json:"lng"` }
Location ...
type OrderDetailsResponse ¶
type OrderDetailsResponse struct { Status OrderStatus `json:"status"` Price Price `json:"price"` DriverID string `json:"driverId"` }
OrderDetailsResponse ...
type OrderStatus ¶
type OrderStatus string
OrderStatus ...
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" )
OrderStatus enum
type 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 }
PlaceOrderRequest ...
type PlaceOrderResponse ¶
type PlaceOrderResponse struct { // OrderID is the order id OrderID string `json:"orderRef"` // CustomerOrderID is a UUID order id (deprecated) CustomerOrderID string `json:"customerOrderId"` }
PlaceOrderResponse ...
type ServiceType ¶
type ServiceType string
ServiceType is the range of vehicles that Lalamove provides to cater to different needs at different cities.
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" )
ServiceType enum
type SpecialRequest ¶
type SpecialRequest string
SpecialRequest ...
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" )
SpecialRequest enum
type Waypoint ¶
type Waypoint struct { Location Location `json:"location"` Addresses AddressTranslations `json:"addresses"` }
Waypoint ...