Big Gommerce
This is a library for consuming the Big Commerce API in go. Handles things like auth and [un]marshalling to hopefully make things easier.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
-
About The Project
-
Getting Started
- Usage
- Roadmap
- Contributing
- License
- Contact
- Acknowledgements
About The Project
If you want to interact with the BigCommerce rest API in a golang project, this library should
help you out. The plan is to eventually build it out for all endpoints/resources but for now most of
the orders endpoint is addressed.
Module is still considered "unstable" (v0.x.x) until I have a chance to use this in a production app.
Built With
Getting Started
To use the module in your project follow these simple steps.
Prerequisites
Go >= 1.15 - Most versions should work, but was tested on 1.15.
Installation
- Go get the module
go get github.com/dan-collins/biggommerce
- Import the relevant packages
package main
import "github.com/dan-collins/biggommerce/order"
Usage
package main
import (
"fmt"
// Make sure you import the package you want to access
bgOrder "github.com/dan-collins/biggommerce/order"
"time"
)
func main() {
orders := GetOrders()
fmt.Println(orders)
}
func GetOrders() []bgOrder.Order {
// Fill in your BigCommerce details here
bcToken := "{YOUR-TOKEN}"
bgClient := "{YOUR-CLIENT-ID}"
bcStoreKey := "{YOUR-STORE-KEY}"
// Create the client
client := bgOrder.NewClient(bcToken, bgClient, bcStoreKey)
// Set up your query criteria
// (see https://pkg.go.dev/github.com/dan-collins/biggommerce/order#Query for details)
ny, err := time.LoadLocation("America/New_York")
if err != nil {
panic(err)
}
// Just getting a date range for beginning and end of a day
sDate := time.Date(2021, 3, 3, 0, 0, 0, 0, ny)
eDate := time.Date(2021, 3, 3, 23, 59, 59, 0, ny)
// I only want orders with status id of 8
status := 8
// Setup the query to use based on the criteria
orderQuery := bgOrder.Query{StatusID: status, MinDateModified: sDate, MaxDateModified: eDate}
// Get back the data you care about, Hydrated will include all resource linked objects on each order returned
orders, err := client.GetHydratedOrders(orderQuery)
if err != nil {
fmt.Println(err.Error())
panic(err)
}
return *orders
}
For method documentation, please refer to the GoDoc
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Project Link: https://github.com/dan-collins/biggommerce
Contact Me Directly
Acknowledgements