biggommerce

package module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 0 Imported by: 0

README

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

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

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. 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

  1. Go get the module
    go get github.com/dan-collins/biggommerce
    
  2. 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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project Link: https://github.com/dan-collins/biggommerce

Contact Me Directly

Acknowledgements

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL