A client for Fortnox's REST api.
import (
"github.com/byrnedo/go-fortnox"
"context"
)
client := fortnox.NewClient(fortnox.WithAuthOpts("token", "secret"))
order, err := client.GetOrder(context.Background(), 1)
if err != nil {
return errors.Wrap(err, "Error getting order")
}
There are quite a few endpoints that aren't implemented yet. Feel free to make an issue or pull request.
For some reason the fortnox api ocassionally gives back a float but sometimes a string for certain fields. I made these two types for dealing with those situations for unmarshalling.
You need to set the FORTNOX_AUTH_CODE
, FORTNOX_ACCESS_TOKEN
and FORTNOX_CLIENT_SECRET
envs when running the tests.