Go to file
Steven Polley 947924bd6d Merge branch 'master' of https://deadbeef.codes:/steven/go-cw 2019-04-06 14:36:40 -06:00
3.0/connectwise Merge branch 'master' of https://deadbeef.codes:/steven/go-cw 2019-04-06 14:36:40 -06:00
cwautomate Add Clients.go 2018-11-27 16:03:45 -07:00
LICENSE Initial commit 2018-06-20 08:39:46 -06:00
README.md Fix README.md 2018-07-06 12:57:51 -06:00

README.md

go-cw

Go structs and methods for the ConnectWise REST API

Note: This is far from complete, I'm simply adding structs and methods as I have an actual requirement for them. If you add to this, please feel free to send a pull request.

Installation

go get deadbeef.codes/steven/go-cw

Usage

package main

import (
	"fmt"
	"log"
	"os"

	"deadbeef.codes/steven/go-cw/3.0/connectwise"
)

var cw *connectwise.ConnectwiseSite

func init() {
	publicKey := os.Getenv("gocwpublickey")
	privateKey := os.Getenv("gocwprivatekey")
	site := os.Getenv("gocwsite")
	company := os.Getenv("gocwcompany")

	cw = connectwise.NewSite(site, publicKey, privateKey, company)
}

func main() {

	co, err := cw.GetCompanyByID(2)
	if err != nil {
		log.Fatal("could not get company 2: %g", err)
	}

	//Refer to the Connectwise API documentation to see what fields are available
	fmt.Println(co.Name)
	fmt.Println(co.DefaultContact.Name)
}