Skip to content

Generated go library to interact with the raw bol.com v3 retailer API

Notifications You must be signed in to change notification settings

tcorp-bv/bol-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bol-api-go

Generated golang API for bol.com v3 using the swagger spec.

We do not hold copyright over the API specification and types.json is from bol.com.

Using the API

Add github.com/tcorp-bv/bol-api-go v1.6.0 to go.mod.

import (
    bolapi "github.com/tcorp-bv/bol-api-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)
}

Regenerating the API

Go-swagger was used for the client generation. Make sure it is accessible as swagger.

swagger generate client -f types.json

In the current version we had to change get-process-status to get-process-status-list due to the duplicate.

Notes on rate limiting

Rate limits of the bol.com api are shared between all your clientIds and are extremely low. Because of this, we recommend having a single service that consumes your bol.com api and indexes all resources.

This library is opinionated in the way it handles rate limiting. Requests that fail due to rate limiting will be tried again a certain amount of time. Because of this, requests could take a very long time.

The default behavior is to retry 10 times.

About

Generated go library to interact with the raw bol.com v3 retailer API

Resources

Stars

Watchers

Forks

Packages