Golang API client generated from the bol.com v4 api swagger specification.
TCorp does not hold copyright over the API specification and types.json is from bol.com.
Add github.com/tcorp-bv/bol-api-v4-go v1.0.0
to go.mod.
import (
bolapi "github.com/tcorp-bv/bol-api-v4-go"
)
// Setup the authentication
api, err := bolapi.New(&auth.EnvironmentProvider{ClientIdKey: "CLIENT_ID", ClientSecretKey: "CLIENT_SECRET"})
if err != nil {
//handle error
}
// Get the client (you should do this once)
client := api.GetClient()
// Use the API
res, err := client.Shipments.GetShipments(&shipments.GetShipmentsParams{Context:context.Background()})
if err != nil {
// handle error
}
for _, s := range res.Payload.Shipments {
println(s.ShipmentID)
}
make generate
Bol.com shares your rate limits over all of your OAuth2.0 keys. The limits are extremely low. You should have a single service that consumes and caches the API for your other services.
This library has retry-logic build in. When a request fails due to rate-limiting , the api sends the request again. A request could thus take multiple minutes to complete. The default behavior is to retry 10 times.