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.
|
||||
func (cw *ConnectwiseSite) GetCompanyByName(companyName string) *[]Company {
|
||||
|
||||
companies := []Company{}
|
||||
|
||||
cwurl := cw.BuildURL("/company/companies")
|
||||
parameters := url.Values{}
|
||||
parameters.Add("conditions", "name=\""+companyName+"\"")
|
||||
cwurl.RawQuery = parameters.Encode()
|
||||
|
||||
body := cw.GetRequest(cwurl)
|
||||
companies := []Company{}
|
||||
check(json.Unmarshal(body, &companies))
|
||||
|
||||
return &companies
|
||||
|
@ -3,6 +3,7 @@ package connectwise
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
//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
|
||||
//TBD: Finish this.
|
||||
func (cw *ConnectwiseSite) GetBillingCycles() {
|
||||
|
@ -172,11 +172,8 @@ type Ticket struct {
|
||||
ContactPhoneExtension string `json:"contactPhoneExtension,omitempty"`
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
//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
|
||||
=======
|
||||
>>>>>>> ab8a24800f1f1789b3aca8e12cc3f8ccfc1ba415
|
||||
type TimeEntryReference struct {
|
||||
ID int
|
||||
Info struct {
|
||||
@ -220,9 +217,9 @@ func (cw *ConnectwiseSite) GetTicketTimeEntriesByID(ticketID int) *[]TimeEntryRe
|
||||
|
||||
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{}
|
||||
check(json.Unmarshal(body, &configurationReference))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user