go-cw/README.md

47 lines
934 B
Markdown
Raw Permalink Normal View History

2018-06-20 14:39:46 +00:00
# go-cw
2018-06-20 15:16:40 +00:00
Go structs and methods for the ConnectWise REST API
2018-06-20 23:56:50 +00:00
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.
2018-07-06 18:57:51 +00:00
# Installation
2018-06-20 23:56:50 +00:00
```
2018-07-02 22:17:26 +00:00
go get deadbeef.codes/steven/go-cw
2018-06-20 23:56:50 +00:00
```
2018-07-06 18:57:51 +00:00
# Usage
2018-06-20 23:56:50 +00:00
```
package main
import (
"fmt"
"log"
"os"
2018-06-20 23:56:50 +00:00
"deadbeef.codes/steven/go-cw/3.0/connectwise"
2018-06-20 23:56:50 +00:00
)
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)
}
2018-06-20 23:56:50 +00:00
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)
2018-06-20 23:56:50 +00:00
}
2018-06-20 23:56:50 +00:00
```