Fix URL in system.go

This commit is contained in:
Steven Polley 2018-07-05 19:57:24 -06:00
parent 1576a16d65
commit f2e6e33a53

View File

@ -9,7 +9,7 @@ import (
type Callback struct { type Callback struct {
ID int ID int
Description string Description string
Url string URL string
ObjectId int ObjectId int
Type string Type string
Level string Level string
@ -19,8 +19,8 @@ type Callback struct {
func (cw *ConnectwiseSite) GetCallbacks() *[]Callback { func (cw *ConnectwiseSite) GetCallbacks() *[]Callback {
Url := cw.BuildURL("/system/callbacks") URL := cw.BuildURL("/system/callbacks")
body := cw.GetRequest(Url) body := cw.GetRequest(URL)
callbacks := []Callback{} callbacks := []Callback{}
check(json.Unmarshal(body, &callbacks)) check(json.Unmarshal(body, &callbacks))
@ -32,20 +32,20 @@ func (cw *ConnectwiseSite) GetCallbacks() *[]Callback {
//TBD: This should return something? //TBD: This should return something?
func (cw *ConnectwiseSite) NewCallback(callback Callback) { func (cw *ConnectwiseSite) NewCallback(callback Callback) {
Url := cw.BuildURL("/system/callbacks") URL := cw.BuildURL("/system/callbacks")
jsonCallback, err := json.Marshal(callback) jsonCallback, err := json.Marshal(callback)
check(err) check(err)
jsonBuffer := bytes.NewReader(jsonCallback) jsonBuffer := bytes.NewReader(jsonCallback)
cw.PostRequest(Url, jsonBuffer) cw.PostRequest(URL, jsonBuffer)
} }
func (cw *ConnectwiseSite) DeleteCallback(callback int) { func (cw *ConnectwiseSite) DeleteCallback(callback int) {
Url := cw.BuildURL(fmt.Sprintf("/system/callbacks/%d", callback)) URL := cw.BuildURL(fmt.Sprintf("/system/callbacks/%d", callback))
body := cw.DeleteRequest(Url) body := cw.DeleteRequest(URL)
fmt.Print(string(body)) fmt.Print(string(body))
} }