roadie-go-sdk is a client library for accessing the Roadie API
go get github.com/markwunsch/roadie-go-sdk/roadie
The roadie
package provides a Client
for accessing the Roadie API. Authentication is handled by including your access token in the WithAccessToken
function, as shown below.
client, err := roadie.NewClient(roadie.WithAccessToken(context.Background(), "YOUR-ACCESS-TOKEN"))
// Get shipment by ID
shipment, err := client.Shipments.Get(context.Background(), 413042)
// Create an estimate and get the response from the roadie API
response, err := client.Estimates.Create(context.Background(), roadie.CreateEstimateRequest{
Items: []roadie.Item{
roadie.Item{
Length: 4.3,
Width: 1.0,
Height: 4.2,
Weight: 1.1,
Quantity: 1,
Value: 25.00,
Description: "Item description",
ReferenceId: "UUID",
},
},
PickupLocation: roadie.Location{
Address: roadie.Address{
Street1: "7778 McGinnis Ferry Rd #270",
City: "Suwanee",
State: "GA",
Zip: "30024",
},
},
DeliveryLocation: roadie.Location{
Address: roadie.Address{
Street1: "100 North Ave",
City: "Atlanta",
State: "GA",
Zip: "30332",
},
},
PickupAfter: time.Now(),
DeliverBetween: roadie.TimeWindow{
Start: time.Now(),
End: time.Now().Add(time.Hour * 4),
},
})
Method | HTTP request | Description |
---|---|---|
Create Estimate | POST /estimate | Create an estimate |
Create Shipment | POST /shipments | Create a shipment |
Retrieve Shipment | GET /shipments/{shipment-id} | Retrieve a shipment |
Retrieve List of Shipments | GET /shipments/reference_ids={reference-ids} | Retrieve a list of shipments |
Update Shipment | PATCH /shipments/{shipment-id} | Update a shipment |
Cancel Shipment | DELETE /shipments/{shipment-id} | Cancel a shipment |
Tip the driver | POST /shipments/{shipment-id}/tips | Leave a tip for the driver |
Rate the driver | POST /shipments/{shipment-id}/ratings | Rate the driver |