At Groundfog we value employee recognition, which is why we love using Bonus.ly. To help us automate a few things we wanted to create a Go package that we can use to create reports or give our employees automated bonuses.
Since we also love sharing with the community and giving back, we decided to build our SDK in the open and allow others to also build something awesome with it as well.
go get github.com/groundfoghub/bonusly-sdk-go
To update the SDK run the following command:
go get -u github.com/groundfoghub/bonusly-sdk-go
Before you start with the examples, you need to get a valid access token. To get a token login to Bonus.ly and go to https://bonus.ly/api to create a new access token.
Get all users
config := bonusly.Configuration{Token: "<your-access-token>"}
client := bonusly.New(config)
var users []bonusly.User
paginator := bonusly.NewListUsersPaginator(client, nil)
for paginator.HasMorePages() {
output, err := paginator.NextPage(context.TODO())
if err != nil {
return
}
users = append(users, output.Users...)
}
fmt.Printf("Found %d users\n", len(users))
Create a bonus
You need a token that allows write access for this example to work.
config := bonusly.Configuration{Token: "<your-access-token>"}
client := bonusly.New(config)
params := bonusly.CreateBonusInput{
GiverEmail: "leia@examplecorp.com",
Receivers: []string{"luke@examplecorp.com"},
Reason: "For destroying the Death Star",
Amount: 25,
}
_, err := client.CreateBonus(context.TODO(), ¶ms)
if err != nil {
fmt.Println("create bonus: ", err)
}
The SDK does not yet cover all of the Bonus.ly API yet. Based on the official API documentation, the following list provides an overview of all the features and their current implementation status.
At the moment we are working on implementing all the features except SCIM, which will follow later. Current progress can be tracked using the All Non-SCIM Features Implemented milestone.
Legend:
- ✅ Implemented.
⚠️ Partially implemented or can not be exactly fully implemented.- ⛔ Not implemented yet.
Achievements
- ⛔ List Achievements (Issue: #6)
Analytics
API Keys
Bonuses
- ⛔ List Bonuses (Issue: #12)
- ✅ Create a Bonus
⚠️ Create a Bonus with separate fields fo reason, hashtag, receiver and amount- ⛔ Retrieve a Bonus (Issue: #13)
- ⛔ Update a Bonus (Issue: #14)
- ⛔ Delete a Bonus (Issue: #15)
Company
Redemptions
- ✅ List Redemptions
- ✅ Retrieve a Redemption
Rewards
- ✅ List Rewards
- ✅ Retrieve a Reward
SCIM
- ⛔ List users
- ⛔ Retrieve a user
- ⛔ Create a user
- ⛔ Update an existing user
- ⛔ Activate or deactivate a user
- ⛔ Get metadata about the Bonusly SCIM API
- ⛔ List the SCIM resource types supported by Bonusly
- ⛔ List the SCIM schemas supported by Bonusly
Users
- ✅ List Users
- ✅ Retrieve a User
- ⛔ Me (Issue: #18)
- ⛔ Autocomplete (Issue: #19)
- ⛔ Bonuses (Issue: #20)
- ⛔ Achievements (Issue: #21)
- ⛔ Redemptions (Issue: #22)
- ⛔ Create a Redemption (Issue: #23)
- ⛔ [ADMIN] Create a User (Issue: #24)
- ⛔ [ADMIN] Update a User (Issue: #25)
- ⛔ [ADMIN] Deactivate a User(Issue: #26)
Webhooks
- ✅ List Webhooks
- ✅ Create Webhook
- ✅ Update Webhook
- ✅ Remove Webhook
The official Go package documentation can be found at pkg.go.dev.
If you found a bug, have a feature suggestion or just want to help us build the SDK, feel free to file an issue or create a pull requests. Contributions are welcome.