Add GetAgreementsByCompanyName
This commit is contained in:
parent
4616997d47
commit
8d6312bff5
@ -150,14 +150,13 @@ type Company struct {
|
|||||||
//Will return a pointer to a slice of Company's.
|
//Will return a pointer to a slice of Company's.
|
||||||
func (cw *ConnectwiseSite) GetCompanyByName(companyName string) *[]Company {
|
func (cw *ConnectwiseSite) GetCompanyByName(companyName string) *[]Company {
|
||||||
|
|
||||||
companies := []Company{}
|
|
||||||
|
|
||||||
cwurl := cw.BuildURL("/company/companies")
|
cwurl := cw.BuildURL("/company/companies")
|
||||||
parameters := url.Values{}
|
parameters := url.Values{}
|
||||||
parameters.Add("conditions", "name=\""+companyName+"\"")
|
parameters.Add("conditions", "name=\""+companyName+"\"")
|
||||||
cwurl.RawQuery = parameters.Encode()
|
cwurl.RawQuery = parameters.Encode()
|
||||||
|
|
||||||
body := cw.GetRequest(cwurl)
|
body := cw.GetRequest(cwurl)
|
||||||
|
companies := []Company{}
|
||||||
check(json.Unmarshal(body, &companies))
|
check(json.Unmarshal(body, &companies))
|
||||||
|
|
||||||
return &companies
|
return &companies
|
||||||
|
@ -3,6 +3,7 @@ package connectwise
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
//Agreement is a struct to hold the unmarshaled JSON data when making a call to the Finance API
|
//Agreement is a struct to hold the unmarshaled JSON data when making a call to the Finance API
|
||||||
@ -129,6 +130,20 @@ func (cw *ConnectwiseSite) GetAgreements() *[]Agreement {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cw *ConnectwiseSite) GetAgreementsByCompanyName(companyName string) *[]Agreement {
|
||||||
|
|
||||||
|
cwurl := cw.BuildURL("/finance/agreements")
|
||||||
|
parameters := url.Values{}
|
||||||
|
parameters.Add("conditions", "company/name=\""+companyName+"\"")
|
||||||
|
cwurl.RawQuery = parameters.Encode()
|
||||||
|
|
||||||
|
body := cw.GetRequest(cwurl)
|
||||||
|
agreements := []Agreement{}
|
||||||
|
check(json.Unmarshal(body, &agreements))
|
||||||
|
|
||||||
|
return &agreements
|
||||||
|
}
|
||||||
|
|
||||||
//GetBillingCycles is not complete
|
//GetBillingCycles is not complete
|
||||||
//TBD: Finish this.
|
//TBD: Finish this.
|
||||||
func (cw *ConnectwiseSite) GetBillingCycles() {
|
func (cw *ConnectwiseSite) GetBillingCycles() {
|
||||||
|
@ -172,11 +172,8 @@ type Ticket struct {
|
|||||||
ContactPhoneExtension string `json:"contactPhoneExtension,omitempty"`
|
ContactPhoneExtension string `json:"contactPhoneExtension,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
//TimeEntryReference is a struct to hold the unmarshaled JSON data when making a call to the Service API
|
//TimeEntryReference is a struct to hold the unmarshaled JSON data when making a call to the Service API
|
||||||
//TBD: For some reason the Info struct contained in TimeEntryReference does get data when the JSON is unmarshaled into this struct. The ID works fine
|
//TBD: For some reason the Info struct contained in TimeEntryReference does get data when the JSON is unmarshaled into this struct. The ID works fine
|
||||||
=======
|
|
||||||
>>>>>>> ab8a24800f1f1789b3aca8e12cc3f8ccfc1ba415
|
|
||||||
type TimeEntryReference struct {
|
type TimeEntryReference struct {
|
||||||
ID int
|
ID int
|
||||||
Info struct {
|
Info struct {
|
||||||
@ -220,9 +217,9 @@ func (cw *ConnectwiseSite) GetTicketTimeEntriesByID(ticketID int) *[]TimeEntryRe
|
|||||||
|
|
||||||
func (cw *ConnectwiseSite) GetTicketConfigurationsByID(ticketID int) *[]ConfigurationReference {
|
func (cw *ConnectwiseSite) GetTicketConfigurationsByID(ticketID int) *[]ConfigurationReference {
|
||||||
|
|
||||||
Url := cw.BuildUrl(fmt.Sprintf("/service/tickets/%d/configurations", ticketID))
|
cwurl := cw.BuildURL(fmt.Sprintf("/service/tickets/%d/configurations", ticketID))
|
||||||
|
|
||||||
body := cw.GetRequest(Url)
|
body := cw.GetRequest(cwurl)
|
||||||
configurationReference := []ConfigurationReference{}
|
configurationReference := []ConfigurationReference{}
|
||||||
check(json.Unmarshal(body, &configurationReference))
|
check(json.Unmarshal(body, &configurationReference))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user